[Ffmpeg-devel] fix ac3 parser with realaudio

Michael Niedermayer michaelni
Fri Feb 9 02:50:21 CET 2007


Hi

On Thu, Feb 08, 2007 at 08:40:37PM -0500, Justin Ruggles wrote:
> Justin Ruggles wrote:
> > Justin Ruggles wrote:
> > 
> >>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 ?
> > 
> > 
> > but I forgot about what halfratecod would be...
> > 
> > should be:
> > 
> > halfratecod = FFMAX(0, bsid - 8);
> > 
> > -Justin
> 
> geez, maybe I should stop coding for the day. :)  Since bsid is
> unsigned, the above wouldn't work.  Here is a new patch...

looks ok now, except a minor nitpick

[...]
> +        halfratecod = 0;
> +        if(bsid > 8) {
> +            halfratecod = bsid - 8;
> +        }

halfratecod= FFMAX(bsid, 8) - 8;


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070209/faac2327/attachment.pgp>



More information about the ffmpeg-devel mailing list