[Ffmpeg-devel] fix ac3 parser with realaudio

Justin Ruggles justinruggles
Fri Feb 9 02:22:51 CET 2007


Michael Niedermayer wrote:
> Hi
> 
> On Thu, Feb 08, 2007 at 06:50:22PM -0500, Justin Ruggles wrote:
> 
>>Hi,
>>
>>It seems that when the AC-3 parser was modified to add E-AC-3 support,
>>it stopped working with RealAudio/DolbyNet.  Below is a patch to fix it.
> 
> [...]
> 
>>@@ -667,7 +667,7 @@
>>         return 0;
>> 
>>     bsid = show_bits_long(&bits, 29) & 0x1f;
>>-    if(bsid <= 8) {             /* Normal AC-3 */
>>+    if(bsid <= 10) {             /* Normal AC-3 */
>>         skip_bits(&bits, 16);       /* crc */
>>         fscod = get_bits(&bits, 2);
>>         frmsizecod = get_bits(&bits, 6);
>>@@ -686,13 +686,14 @@
>>             skip_bits(&bits, 2);    /* dsurmod */
>>         lfeon = get_bits1(&bits);
>> 
>>-        *sample_rate = ac3_sample_rates[fscod];
>>-        *bit_rate = ac3_bitrates[frmsizecod] * 1000;
>>+        halfratecod = bsid - 8;
>>+        *sample_rate = ac3_sample_rates[fscod] >> halfratecod;
>>+        *bit_rate = (ac3_bitrates[frmsizecod] * 1000) >> halfratecod;
> 
> 
> this doesnt look correct, what is with bsid<8 ?

from A/52A:
"Values of bsid smaller than 8 will be used for versions of AC-3 which
implement subsets of the version 8 syntax. Decoders which can decode
version 8 will thus be able to decode version numbers less than 8."

> 
> 
>>         *channels = ac3_channels[acmod] + lfeon;
>>         *samples = 6 * 256;
>> 
>>         return ac3_frame_sizes[frmsizecod][fscod] * 2;
>>-    } else if (bsid >= 10 && bsid <= 16) { /* Enhanced AC-3 */
>>+    } else if (bsid > 10 && bsid <= 16) { /* Enhanced AC-3 */
> 
> 
> is this correct for E-AC3?

from A/52B:
"Values of bsid smaller than 16 and greater than 10 will be used for
versions of E-AC-3 which are backwards compatible with version 16
decoders. Decoders which can decode version 16 will thus be able to
decode version numbers less than 16 and greater than 10."





More information about the ffmpeg-devel mailing list