[FFmpeg-soc] [soc]: r1741 - in eac3: ac3dec.c ac3dec.h eac3dec.c

Bill Crowley bc at wlca.com
Tue Jan 1 21:31:15 CET 2008


jbr,

FYI,

I just tried to run "ffplay" using your latest eac3 changes
and EAC3 Audio is no longer recognized.

Earlier versions of your eac3 code worked.

Cheers,

Bill.


jbr wrote:
> Author: jbr
> Date: Tue Jan  1 20:31:18 2008
> New Revision: 1741
>
> Log:
> use a common function to decode transform coefficients
>
> Modified:
>    eac3/ac3dec.c
>    eac3/ac3dec.h
>    eac3/eac3dec.c
>
> Modified: eac3/ac3dec.c
> ==============================================================================
> --- eac3/ac3dec.c	(original)
> +++ eac3/ac3dec.c	Tue Jan  1 20:31:18 2008
> @@ -424,7 +424,8 @@ void ff_ac3_uncouple_channels(AC3DecodeC
>   * Get the transform coefficients for a particular channel
>   * reference: Section 7.3 Quantization and Decoding of Mantissas
>   */
> -int ff_ac3_get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)
> +static int ac3_get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index,
> +                                       mant_groups *m)
>  {
>      GetBitContext *gbc = &s->gbc;
>      int i, gcode, tbap, start, end;
> @@ -529,10 +530,26 @@ void ff_ac3_remove_dithering(AC3DecodeCo
>      }
>  }
>  
> +static int get_transform_coeffs_ch(AC3DecodeContext *s, int blk, int ch,
> +                                   mant_groups *m)
> +{
> +    if (!s->eac3 || !s->channel_uses_aht[ch]) {
> +        if(ac3_get_transform_coeffs_ch(s, ch, m))
> +            return -1;
> +    } else if (s->channel_uses_aht[ch] == 1) {
> +        ff_eac3_get_transform_coeffs_aht_ch(s, ch);
> +        s->channel_uses_aht[ch] = -1; /* AHT info for this frame has been read - do not read again */
> +    }
> +    if (s->eac3 && s->channel_uses_aht[ch]) {
> +        ff_eac3_idct_transform_coeffs_ch(s, ch, blk);
> +    }
> +    return 0;
> +}
> +
>  /**
>   * Get the transform coefficients.
>   */
> -static int get_transform_coeffs(AC3DecodeContext *s)
> +int ff_ac3_get_transform_coeffs(AC3DecodeContext *s, int blk)
>  {
>      int ch, end;
>      int got_cplchan = 0;
> @@ -542,17 +559,15 @@ static int get_transform_coeffs(AC3Decod
>  
>      for (ch = 1; ch <= s->channels; ch++) {
>          /* transform coefficients for full-bandwidth channel */
> -        if(ff_ac3_get_transform_coeffs_ch(s, ch, &m))
> +        if(get_transform_coeffs_ch(s, blk, ch, &m))
>              return -1;
>          /* tranform coefficients for coupling channel come right after the
>             coefficients for the first coupled channel*/
>          if (s->channel_in_cpl[ch])  {
>              if (!got_cplchan) {
> -                if (ff_ac3_get_transform_coeffs_ch(s, CPL_CH, &m)) {
> -                    av_log(s->avctx, AV_LOG_ERROR, "error in decoupling channels\n");
> +                if (get_transform_coeffs_ch(s, blk, CPL_CH, &m)) {
>                      return -1;
>                  }
> -                ff_ac3_uncouple_channels(s);
>                  got_cplchan = 1;
>              }
>              end = s->end_freq[CPL_CH];
> @@ -564,6 +579,10 @@ static int get_transform_coeffs(AC3Decod
>          while(++end < 256);
>      }
>  
> +    /* calculate transform coefficients for coupling range */
> +    if(s->cpl_in_use[blk])
> +        ff_ac3_uncouple_channels(s);
> +
>      /* if any channel doesn't use dithering, zero appropriate coefficients */
>      if(!s->dither_all)
>          ff_ac3_remove_dithering(s);
> @@ -962,8 +981,8 @@ static int ac3_parse_audio_block(AC3Deco
>  
>      /* unpack the transform coefficients
>         this also uncouples channels if coupling is in use. */
> -    if (get_transform_coeffs(s)) {
> -        av_log(s->avctx, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n");
> +    if (ff_ac3_get_transform_coeffs(s, blk)) {
> +        av_log(s->avctx, AV_LOG_ERROR, "Error decoding transform coefficients\n");
>          return -1;
>      }
>  
>
> Modified: eac3/ac3dec.h
> ==============================================================================
> --- eac3/ac3dec.h	(original)
> +++ eac3/ac3dec.h	Tue Jan  1 20:31:18 2008
> @@ -251,9 +251,11 @@ int ff_ac3_parse_frame_header(AC3DecodeC
>  /* TEMPORARY SOLUTION */
>  int ff_eac3_parse_header(AC3DecodeContext *s);
>  int ff_eac3_parse_audio_block(AC3DecodeContext *s, int blk);
> +void ff_eac3_get_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
> +void ff_eac3_idct_transform_coeffs_ch(AC3DecodeContext *s, int ch, int blk);
>  void ff_eac3_tables_init(void);
>  
> -int ff_ac3_get_transform_coeffs_ch(AC3DecodeContext *s, int ch, mant_groups *m);
> +int ff_ac3_get_transform_coeffs(AC3DecodeContext *s, int blk);
>  
>  void ff_ac3_uncouple_channels(AC3DecodeContext *s);
>  
>
> Modified: eac3/eac3dec.c
> ==============================================================================
> --- eac3/eac3dec.c	(original)
> +++ eac3/eac3dec.c	Tue Jan  1 20:31:18 2008
> @@ -169,7 +169,7 @@ static void spectral_extension(AC3Decode
>  }
>  #endif
>  
> -static void get_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch){
> +void ff_eac3_get_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch){
>      int bin, blk, gs;
>      int hebap, end_bap, gaq_mode, bits, pre_mantissa, remap, log_gain;
>      float mant;
> @@ -261,7 +261,7 @@ static void get_transform_coeffs_aht_ch(
>      }
>  }
>  
> -static void idct_transform_coeffs_ch(AC3DecodeContext *s, int ch, int blk){
> +void ff_eac3_idct_transform_coeffs_ch(AC3DecodeContext *s, int ch, int blk){
>      // TODO fast IDCT
>      int bin, i;
>      float tmp;
> @@ -274,23 +274,6 @@ static void idct_transform_coeffs_ch(AC3
>      }
>  }
>  
> -static void get_eac3_transform_coeffs_ch(AC3DecodeContext *s, int blk,
> -        int ch, mant_groups *m){
> -    if (!s->channel_uses_aht[ch]) {
> -        ff_ac3_get_transform_coeffs_ch(s, ch, m);
> -    } else if (s->channel_uses_aht[ch] == 1) {
> -        get_transform_coeffs_aht_ch(s, ch);
> -        s->channel_uses_aht[ch] = -1; /* AHT info for this frame has been read - do not read again */
> -    }
> -    if (s->channel_uses_aht[ch]) {
> -        idct_transform_coeffs_ch(s, ch, blk);
> -    }
> -
> -    memset(s->transform_coeffs[ch]+s->end_freq[ch], 0,
> -           sizeof(s->transform_coeffs[ch]) -
> -           s->end_freq[ch] * sizeof(*s->transform_coeffs[ch]));
> -}
> -
>  static int parse_bsi(AC3DecodeContext *s){
>      int i, blk;
>      GetBitContext *gbc = &s->gbc;
> @@ -1122,21 +1105,11 @@ int ff_eac3_parse_audio_block(AC3DecodeC
>      got_cplchan = 0;
>  
>      /* Quantized mantissa values */
> -    for (ch = 1; ch <= s->channels; ch++) {
> -        get_eac3_transform_coeffs_ch(s, blk, ch, &m);
> -        if (s->cpl_in_use[blk] && s->channel_in_cpl[ch] && !got_cplchan) {
> -            get_eac3_transform_coeffs_ch(s, blk, CPL_CH, &m);
> -            got_cplchan = 1;
> -        }
> -    }
> -
> -    if (s->cpl_in_use[blk]) {
> -        ff_ac3_uncouple_channels(s);
> +    if(ff_ac3_get_transform_coeffs(s, blk)) {
> +        av_log(s->avctx, AV_LOG_ERROR, "error decoding transform coefficients\n");
> +        return -1;
>      }
>  
> -    if(!s->dither_all)
> -        ff_ac3_remove_dithering(s);
> -
>  #if 0
>      //apply spectral extension
>      if (s->spxinu)
> _______________________________________________
> FFmpeg-soc mailing list
> FFmpeg-soc at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc
>
>   




More information about the FFmpeg-soc mailing list