MediaPortal Audio renderer - better video playback quality (7 Viewers)

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,257
    2,533
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Just tried this but got unable to play stream error (works with default direct sound device)

    error.log has
    Code:
    2010-07-28 19:40:23.021241 [ERROR][MPMain(1)]: TSReaderPlayer: Exception while creating DShow graph Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    2010-07-28 19:40:23.052243 [ERROR][MPMain(1)]: TSReaderPlayer:GetInterfaces() failed

    Setup on this machine is Win7 x64 using Nvidia 7600 GS GPU and onboard audio (is just called ADI® 8-channel High Definition Audio CODEC in specs)

    This is standard SD channel with MPEG2 audio. I have MPC Audio codec and I am guessing this is the issue? Just wanted to confirm before I download FFDShow
     

    Attachments

    • MediaPortal.zip
      5.8 KB

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Can I ask how you are using the SoundTouch library for multiple channels - are you using multiple mono/stereo instances, or modifying the SoundTouch code to handle multiple channels natively ?

    The reason for the question is explained quite well here - Tourist In Paradise: Phase-Coherent Pitch Shifter for ReClock (ReClock uses SoundTouch for pitch-shifting/time-stretching only, and a different, multi-channel capable resampling library for the basic resampling).

    First of all, currently we are only time-stretching, not resampling the audio. I do not know if we will need to resample, but so far I see no need.

    Regarding the phase coherency, I am quite aware of the problem and have examined the code of the above solution (in fact at first I was wondering why ReClock did such "weird" tricks with SoundTouch). Adapting SoundTouch for multichannel is pretty much out of the question for two reasons:

    1. It would take a lot of time/work to do it right, as it would have to be done using MMX/SSEx/3Now to be usable
    2. It would be too slow for most systems. The way soundtouch works is by calculating the auto-correlation of the samples. If we increase the number of channels we also increase the time it takes to calculate the auto-correlation and the increase is exponential.
    The solution I have used is similar to the above proposed, only it is a bit more flexible:

    1. the code will try to process related channels in pairs (i.e. a left/right pair for each Front, Side, Rear, Top, Bottom)
    2. the channels that are not related to each other, will be processed by pairing each of them with a composite channel
    3. the composite channel will be calculated based on the average of the dominant channel pair (in order of priority: Front left/right or Side left/right or Rear left/right etc). I have not yet decided what are the correct priorities for selecting dominant channel pair, but these will be easy to change within the code
    This solution will ensure that each left/right channel pair retains phase coherency, single channels will be coherent to the dominant channel pair (where most of the audio comes from), BUT channel pairs may be incoherent to each other. Fortunately our architecture allows us to switch to a different scheme, that processes each channel paired to the composite channel, so that each channel is coherent to the dominant channel pair or to the average of all channels and in essence coherent to each other. Unfortunately this will also increase CPU usage (by how much it remains to be seen).

    That all sounds good - thanks for the explanation :)

    Tony
     

    davidf

    Retired Team Member
  • Premium Supporter
  • April 3, 2006
    796
    348
    Scotland
    Home Country
    Scotland Scotland
    Had some issues with the earlier versions, lipsync mainly, and I have just tried v5 with no success.

    Using the renderer I tuned on TV and no picture is displayed, using the NVIDIA HDMI Out on it's own as the renderer works but the one here produces no picture and no sound.

    Logs are attached
     

    Attachments

    • Nothing Rendered.zip
      42.4 KB

    Airshark

    MP Donator
  • Premium Supporter
  • February 23, 2007
    378
    23
    Baden- Württemberg
    Home Country
    Germany Germany
    AW: MediaPortal Audio renderer - better video playback quality

    What Button do I need to press when I want to enable the statistics in the video?
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,367
    1,642
    Athens
    Home Country
    Greece Greece
    Thinking again my previous reply regarding SoundTouch, I realize some of my statements were wrong or at least inaccurate:

    Adapting SoundTouch for multichannel is pretty much out of the question for two reasons:

    1. It would take a lot of time/work to do it right, as it would have to be done using MMX/SSEx/3Now to be usable
    2. It would be too slow for most systems. The way soundtouch works is by calculating the auto-correlation of the samples. If we increase the number of channels we also increase the time it takes to calculate the auto-correlation and the increase is exponential.
    In fact the auto-correlation is computed on the average of the two channels, so in the multichannel case we would need compute it on the average of all the channels. This means that the amount of data the the auto-correlation works on does not change and as a result it will not be any slower than it already is. It is not however clear to me if the subsequent segmentation and stitching of the sample data is done separately for each channel or as channel pair. If the former is true then expanding to multiple channels should be relatively easy and would not require additional SSEx code. Otherwise it would probably need to re-implement existing SSEx code once for each channel count above 2 (i.e for 2.1/3, 4, 4.1/5, 5.1/6, 7 and 7.1/8).

    So, adapting SoundTouch for multichannel may not be out of the question after all. It will certainly require more work than the current implementation but it might be doable.

    Also the above means that instead of using the dominant channels for coherency we should use a carefully selected mix of all channels. If Ci is channel i (1 to N), we want SoundTouch to compute the auto-correlation on

    Q(t) = Sum(Ci(t), i=1..N)/N

    SoundTouch uses Q(t) = (L(t)+R(t))/2

    So in order to time-stretch channel j we want:

    L(t) = Cj(t)

    and

    R(t) = 2*Sum(Ci(t), i=1..N)/N - Cj(t)

    The latter could be a problem when SoundTouch is working on integer samples. Floating point samples OTOH are no problem, so in this case we might need to switch to floating point samples. After all there is no point processing 24bit audio using 16 bit integer intermediate results.
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    In fact the auto-correlation is computed on the average of the two channels, so in the multichannel case we would need compute it on the average of all the channels. This means that the amount of data the the auto-correlation works on does not change and as a result it will not be any slower than it already is. It is not however clear to me if the subsequent segmentation and stitching of the sample data is done separately for each channel or as channel pair. If the former is true then expanding to multiple channels should be relatively easy and would not require additional SSEx code. Otherwise it would probably need to re-implement existing SSEx code once for each channel count above 2 (i.e for 2.1/3, 4, 4.1/5, 5.1/6, 7 and 7.1/8).

    So, adapting SoundTouch for multichannel may not be out of the question after all. It will certainly require more work than the current implementation but it might be doable.

    Also the above means that instead of using the dominant channels for coherency we should use a carefully selected mix of all channels. If Ci is channel i (1 to N), we want SoundTouch to compute the auto-correlation on

    Q(t) = Sum(Ci(t), i=1..N)/N

    SoundTouch uses Q(t) = (L(t)+R(t))/2

    So in order to time-stretch channel j we want:

    L(t) = Cj(t)

    and

    R(t) = 2*Sum(Ci(t), i=1..N)/N - Cj(t)

    The latter could be a problem when SoundTouch is working on integer samples. Floating point samples OTOH are no problem, so in this case we might need to switch to floating point samples. After all there is no point processing 24bit audio using 16 bit integer intermediate results.

    All looks good, but why is there a '2*' in the last equation - it's presumably meant to be the average of all channels minus the target (j) channel ? (is it to make sure it becomes the 'dominant' channel ?)

    Tony
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Had some issues with the earlier versions, lipsync mainly, and I have just tried v5 with no success.

    Using the renderer I tuned on TV and no picture is displayed, using the NVIDIA HDMI Out on it's own as the renderer works but the one here produces no picture and no sound.

    Logs are attached

    Please check if using {0.0.0.00000000}.{4616abfc-985b-40be-9f77-129cab1183f3} as the WASAPIPreferredDevice setting in registry helps at all,
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Re: AW: MediaPortal Audio renderer - better video playback quality

    I am having problems to register the renderer :(

    I'm quite helpless when it comes to such error. Basicly there is no code on the filter side when the registration is done (if I remember correctly). I guess we would need to have a call stack at lest to be able to get more info (even better would be to be able to attach a debigger to the crashing process to see if it is some sysem component or audio renderer.)
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    I'm using the latest V5 of your mod Tourettes and while playing my 720p Topgear episodes I don't have sound anymore. Nothing gets send to my receiver anymore. Using MPC-HC I do get this file played with audio.
    Here are the details, I hope I provide you with enough information. THanks in advance!

    Log looks ok. could you please upload a short sample of such file that produces no sound?

    Address: ftp.team-mediaportal.com
    Login: tsdump@team-mediaportal.com
    Password: mpuser88
     

    Users who are viewing this thread

    Top Bottom