[FFmpeg-devel] [PATCH] [RFC] E-AC-3 vs. AC-3 separation

Justin Ruggles justin.ruggles
Thu Jul 23 03:15:52 CEST 2009


Diego Biurrun wrote:
> On Thu, Jul 23, 2009 at 01:27:35AM +0200, Diego Biurrun wrote:
>> On Wed, Jul 22, 2009 at 06:37:19PM -0400, Justin Ruggles wrote:
>>> Diego Biurrun wrote:
>>>> On Tue, Jul 21, 2009 at 07:17:06PM -0400, Justin Ruggles wrote:
>>>>> Diego Biurrun wrote:
>>>>>> Here is a feeble attempt to separate the E-AC-3 and the AC-3 decoders.
>>>>>> I have the nagging feeling that it might not be quite so easy, but it
>>>>>> could be a start..
>>>>> If it compiles when E-AC-3 is disabled but AC-3 is enabled, then it
>>>>> actually looks ok.  They could be separated even more by splitting up
>>>>> ac3dec_data.c into 2 files.  For example, the VQ tables, which are
>>>>> pretty big, are not needed for regular AC-3 and are only used in eac3dec.c.
>>>> Your wish is my command, see the attached patch..
>>>>
>>>> --- libavcodec/ac3dec_data.h	(revision 19483)
>>>> +++ libavcodec/ac3dec_data.h	(working copy)
>>>> @@ -22,19 +22,9 @@
>>>>  #ifndef AVCODEC_AC3DEC_DATA_H
>>>>  #define AVCODEC_AC3DEC_DATA_H
>>>>  
>>>> -#include "libavutil/common.h"
>>>> +#include <stdint.h>
>>>>  
>>>>  extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
>>>> -extern const uint8_t ff_eac3_hebap_tab[64];
>>>> -extern const uint8_t ff_eac3_bits_vs_hebap[20];
>>>> -extern const int16_t ff_eac3_gaq_remap_1[12];
>>>> -extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2];
>>>> -extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2];
>>>> -
>>>> -extern const int16_t (* const ff_eac3_mantissa_vq[8])[6];
>>>> -extern const uint8_t ff_eac3_frm_expstr[32][6];
>>>> -extern const uint8_t ff_eac3_default_cpl_band_struct[18];
>>> ff_eac3_default_cpl_band_struct needs to stay with ac3dec_data.c because
>>> it is used in ac3dec.c by the shared AC-3/E-AC-3 code.
>>>
>>> Everything else in this patch looks ok if it works.
>> You were right of course, here is a new version that does all the fancy
>> stuff, like, say, compile... ;-)
> 
> Here is the current version that accomodates all recent changes.
> 
> Index: libavcodec/ac3dec.c
> ===================================================================
> --- libavcodec/ac3dec.c	(revision 19500)
> +++ libavcodec/ac3dec.c	(working copy)
> @@ -35,6 +35,7 @@
>  #include "ac3_parser.h"
>  #include "ac3dec.h"
>  #include "ac3dec_data.h"
> +#include "eac3dec_data.h"
>  
>  /** Large enough for maximum possible frame size when the specification limit is ignored */
>  #define AC3_FRAME_BUFFER_SIZE 32768
> @@ -314,9 +315,12 @@
>          s->skip_syntax           = 1;
>          memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
>          return ac3_parse_header(s);
> -    } else {
> +    } else if (CONFIG_EAC3_DECODER) {
>          s->eac3 = 1;
>          return ff_eac3_parse_header(s);
> +    } else {
> +        av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
> +        return -1;
>      }
>  }

That av_log() is not called when using FFmpeg with E-AC-3 disabled
because the parser will change the codec_id to EAC3, which will
correctly give an error before this point because the decoder is
disabled.  But if the parser is not used and the codec_id is set to AC3,
trying to decode E-AC-3 content will trigger that av_log().

patch is ok.

-Justin



More information about the ffmpeg-devel mailing list