Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.4
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by MohamedTarek - 2010-05-16
Last edited by MohamedTarek - 2010-07-27

FS#11281 - [New WMA Codecs] WMA Pro simulator playback

This patch enables the playback of WMA Pro streams in the simulator, but it’s still in an early phase. There’s also some random clicking noise along with the output,

Closed by  MohamedTarek
2010-07-27 09:49
Reason for closing:  Accepted
Additional comments about closing:  

last patch committed in r27402.

MohamedTarek commented on 2010-05-21 16:13

Regarding the noise in playback, it seems to be a simulator-specific problem.
I had test_codec produce a wav file from a wma pro sample. The output wav file played fine outside the simulator, but the noise was still there (in the wav file) in the simulator. I’ll just ignore that for now.

The previous patch produced 16-bit samples. The current one produces 32-bit samples, and adds seeking too.

Andree Buschmann commented on 2010-05-24 11:25

1) The patch doesn’t build against r26246 on cygwin.
2) Is it possible that the random clicking noise is caused by sample overflow? E.g. a float samples >1.0 or ←1.0 will cause overflow.
2a) You could easily spot this in the wav-file. A simple way to check for this is to not scale by INT32_MAX but by e.g. ((1«24)-1) to get a 8.24 representation. Additionally you’ll need to configure the dsp settings accordingly. This way the dsp routines take care of saturation.
2b) If even saturated samples result in clicking noise, then try to reduce the scale in general and check whether the the output is fine then.

MohamedTarek commented on 2010-05-24 12:21

Regarding the samples overflow, in wmaprodec.c the float samples are clipped to be in the range [-1.0, 1.0[ so there should be no overflows. (and just to be safe, I reduced the range to check but nothing changed).
Before sending the patch, I tried reducing the scale factor but still nothing changed.

The thing is, when I checked the plot in something like Audacity, I didn’t see saturated samples anywhere where I hear the noise.
I even applied a negative gain using audacity, and tried playing the file again in the sim, but again, nothing changed regarding that noise.

Here’s part of the file I edited in audacity : http://filebin.ca/fhrnph/test.wav

The original file is the first one here : http://samples.mplayerhq.hu/A-codecs/WMA9/wmapro/

As to why it doesn’t build, I sitll haven’t checked. I’m currently preparing for my finals which start in ~1 week from now :( , so not sure when I’ll be able to check it.

MohamedTarek commented on 2010-05-24 12:45

FWIW, I’ve also tried converting the same file in the previous post to wav with ffmpeg. Played the output wav file in the sim and got the same noise.

Andree Buschmann commented on 2010-05-24 13:08

Ok, sounds like another issue then. Good luck for your exam!

MohamedTarek commented on 2010-06-24 23:48

This patch convert the MDCT windowing step to fixed point math. It’s still very dirty with lots of experimental stuff, but functionally, it should be correct. There’s an error in the audio output however that I still can’t trace to something specific.

MohamedTarek commented on 2010-06-25 10:42

Ok, I figured out the problem.
The point in code where the floating point coefficients are converted to fixed point was wrong. Now the sound quality is very good and plots show that the max error between the current decoder (with fixed point windowing) and that of ffmpeg’s is 3.052*10^-5 which is good I think.

MohamedTarek commented on 2010-07-05 22:01

This patch converts imdct, windowing and inverse quantization and rescaling steps to fixed point maths.
With this patch, wmapro uses its own imdct not ours, because of different trig tables.

MohamedTarek commented on 2010-07-10 10:03

This patch converts the whole decoder to fixed point (no multichannel yet though).
There’s still some bug with it that I can’t track down. I think - but still not sure - something goes wrong in the imdct step.
Once this is fixed I could proceed on removing the unneeded code and start testing on hardware.
EDIT : The code in this patch isn’t pretty at all, it is still for testing purposes. You’ve been warned !

Dave Hooper commented on 2010-07-12 09:22

Do you need to clip >= 1.0 rather than > 1.0 ? The fixed-point representation cannot represent exactly 1.0 (even though it can represent exactly -1.0)

MohamedTarek commented on 2010-07-12 09:55

Thanks for helping Dave, but that’s not it. I discovered the source of the bug yesterday and fixed it, I’ll clean up tonight to prepare for committing.
The problem was with the mdct, I shifted the trig table values up by 16 which made some values overflow (stupid mistake), so I split the shifts between the trig values and the input coefficients and now everything is good. Fixed point step finally over ! or almost over, since it’s still not in svn.

Dave Hooper commented on 2010-07-13 11:55

So thinking about this some more – wouldn’t this now enable using the codeclib mdct? i.e. with the inputs shifted the ‘appropriate’ amount (and if necessary the outputs also shifted, although not certain about that), the codeclib imdct should be functionally *identically* to the wmapro mdct right? Is the challenge then to determine what is the correct shift to use for the inputs? It seems like the trig values are shifted by 14 bits so that they don’t overflow – which (I think) is the same as saying that the trig values now fall into the range of -1 ⇐ t < 1 in the s.31 representation, which (I think) is the same trig table as used by codeclib.

Dave Hooper commented on 2010-07-13 12:17

.. although the sincos wmap table seems to contain lots of tables all contatenated together, and it looks like wmapro is making use of the ‘scale’ argument when it did its mdct_init . So, I think, we just need to prescale the input by that same scale amount, rather than scale the trig table? Or something like that … ?

MohamedTarek commented on 2010-07-14 08:19

I tried that before my last commit. What I did was that I converted the scales in mdct_init to fixed point, and before passing the input buffer to the mdct (codeclib’s in that case), I would scale the coefficients based on the mdct size, like mdct_init does, to avoid overflows, but it still overflowed. I’ll look more into it later, I wanted to get the codec working first, so I consider this an optimisation/enhancement.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing