7
$\begingroup$

Is it possible for two different decoders to output two different sample results for the same MP3? I'm decoding an mp3 on Matlab and it produces two columns (presumably one for each channel). When I extract the sample data from the same file using AVAssetReader (iOS), I get different results. When I tried the same code with a WAV file, the two results matched, so I'm guessing the code is fine (although the Matlab result had a few extra blank frames).

If I, non-scientifically, choose random values from my AVAssetReader MP3 result, and search for them in the Matlab results, they tend to exist, but not always. I don't know if this is just coincidence, different rounding off errors or if they genuinely match. The problem is, when they match, the surrounding numbers differ from one another. For example, 0.0021 occurs in both results, but the surrounding numbers on Matlab are -0.0649,0.0147 etc.. (which don't appear near the 0.0021 in the AVAssetReader results).

What could cause this discrepancy, does it cause a serious lack of integrity in my app and how would I fix it? Thank you.

$\endgroup$
4
  • $\begingroup$ Although MPEG I/II Layer 3 specifies the decoding algorithm; I don't recall it specifying the exact numerical accuracy with which all the result values are calculated using that algorithm. Maybe only an error bound. You would have to check the document (ISO/IEC 13818). $\endgroup$
    – hotpaw2
    Sep 30, 2011 at 21:57
  • 3
    $\begingroup$ What is your application intending to do that requires bit-exact MP3 decoding? Unless one of the decoders is really messed up, you're not likely to tell an audible difference if you're just outputting the audio on an iOS device. $\endgroup$
    – Jason R
    Oct 1, 2011 at 3:02
  • 1
    $\begingroup$ dsp.stackexchange.com/questions/250/audio-output-quality/… $\endgroup$
    – endolith
    Oct 1, 2011 at 14:21
  • $\begingroup$ I don't necessarily require that much accuracy, but I wasn't sure if my MP3 decoding code was correct or was simply outputting nonsense. The WAV output matched precisely, which is why it threw me off when the MP3 output was completely different. @endolith - thanks for the link, I guess my code must be fine and that the internal processing is what's causing the difference. $\endgroup$
    – XSL
    Oct 1, 2011 at 15:11

1 Answer 1

10
$\begingroup$

It is possible that two decoders will have different results and be compliant with standard. The standard "ISO/IEC 11172-4 (part 4) compliance testing" specify two classes of decoders: "accurate" and with "limited accuracy" *).

The accuracy is measured by comparing decoded stream with reference stream (reference input and output is specified in standard). If the RMS of difference is below $2^{-15}/\sqrt{12}$ the decoder is classified as accurate and if below $2^{-11}/\sqrt{12}$ it is classified as "limited accuracy" one.

So if you are going to use different decoders or even the same decoder on different processor architectures you have to be prepared for this kind of discrepancy in output. Do not know your application or intend but maybe you can mimic the standard and work with RMS of error too?

*) I do not have text of the standard in English in front of me so actual name used in standard may be different.

$\endgroup$
1
  • $\begingroup$ Thanks very much for your help. I actually just want to perform various DSP functions on my signal, rather than play the MP3 itself. I just wasn't sure if I should be concerned about the integrity of the values I was getting because it was different from Matlab, which I considered the 'correct' results. But seeing that the standards dont require the two results to be exactly the same, but still compliant, makes me more confident in my code's results. $\endgroup$
    – XSL
    Oct 1, 2011 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.