[FFmpeg-cvslog] r9656 - trunk/libavcodec/ac3dec.c

Dominik 'Rathann' Mierzejewski dominik
Sat Jul 14 17:53:17 CEST 2007


On Saturday, 14 July 2007 at 17:51, jbr wrote:
> Author: jbr
> Date: Sat Jul 14 17:51:00 2007
> New Revision: 9656
> 
> Log:
> AC-3 decoder, soc revision 34, Jul 18 14:27:54 2006 UTC by cloud9
> working decoder
> imdct for block switching is to be implemented
> various other things to do
> 
> Modified:
>    trunk/libavcodec/ac3dec.c
> 
> Modified: trunk/libavcodec/ac3dec.c
> ==============================================================================
> --- trunk/libavcodec/ac3dec.c	(original)
> +++ trunk/libavcodec/ac3dec.c	Sat Jul 14 17:51:00 2007
> @@ -38,6 +38,7 @@
>  #define BLOCK_SIZE    256
>  #define AUDIO_BLOCKS    6
>  
> +
>  /* Synchronization information. */
>  typedef struct {
>      uint16_t sync_word;     //synchronization word = always 0x0b77

cosmetics

> @@ -891,6 +892,7 @@ static int get_transform_coeffs_ch(uint8
>                  }
>                  else {
>                      TRANSFORM_COEFF(coeffs[i], dither_int16(state), exps[i], factors);
> +                    coeffs[i] *= LEVEL_PLUS_3DB;
>                      continue;
>                  }
>  
> @@ -1482,39 +1484,13 @@ static void dump_floats(const char *name
>          av_log(NULL, AV_LOG_INFO, "\n");
>  }
>  
> -/*static void window_and_de_interleave(float *output)
> -{
> -    int n2, n4, n8;
> -    int k;
> -
> -    n2 = 512 >> 1;
> -    n4 = 512 >> 2;
> -    n8 = 512 >> 3;
> -
> -    for (k = 0; k < n8; k++) {
> -        output[2 * k] *= window[2 * k];
> -        output[n2 - 2 * k - 1] *= window[n2 - 2 * k - 1];
> -
> -        output[2 * k + 1] *= window[2 * k + 1];
> -        output[n2 - 2 * k - 2] *= window[n2 - 2 * k - 2];
> -
> -        output[n2 + 2 * k] *= window[n2 - 2 * k - 1];
> -        output[n - 2 * k - 1] *= window[n - 2 * k - 1];
> -
> -        output[n2 + 2 * k + 1] *= window[n2 - 2 * k - 2];
> -        output[n - 2 * k - 2] *= window[n - 2 * k - 2];
> -        output[3 * n4 + 2 * k + 1] *= window[n4 - 2 * k - 2];
> -    }
> -}*/
> -
>  static inline void overlap_and_add(float *tmp_output, float *delay, float *output)
>  {
>      int n;
>  
> -    for (n = 0; n < BLOCK_SIZE; n++) {
> -        output[n] = 2 * (tmp_output[n] * window[n] + delay[n] * window[255 - n]);
> -        delay[n] = tmp_output[BLOCK_SIZE + n];
> -    }
> +    for (n = 0; n < BLOCK_SIZE; n++)
> +        output[n] = (tmp_output[n] * window[n] + delay[n] * window[255 - n]);
> +    memcpy(delay, tmp_output + BLOCK_SIZE, BLOCK_SIZE * sizeof (float));
>  }
>  
>  
> @@ -1526,14 +1502,12 @@ static inline void do_imdct(AC3DecodeCon
>      if (ctx->output & AC3_OUTPUT_LFEON) {
>          av_log(NULL, AV_LOG_INFO, "imdct lfe\n");
>          ff_imdct_calc(&ctx->imdct_ctx_512, ab->tmp_output, ab->transform_coeffs[0], ab->tmp_imdct);
> -        //window_and_de_interleave(ab->tmp_output);
>          overlap_and_add(ab->tmp_output, ab->delay[0], ab->output[0]);
>      }
> -    for (i = 0; i < ctx->bsi.nfchans; i++) {
> +    for (i = 0; i < ctx->bsi.nfchans + 1; i++) {
>          if (!(((ab->blksw) >> i) & 1)) {
> -            av_log(NULL, AV_LOG_INFO, "imdct channel %d - block switching not enabled\n", i);
> +            //av_log(NULL, AV_LOG_INFO, "imdct channel %d - block switching not enabled\n", i);
>              ff_imdct_calc(&ctx->imdct_ctx_512, ab->tmp_output, ab->transform_coeffs[i + 1], ab->tmp_imdct);
> -            //window_and_de_interleave(ab->tmp_output);
>              overlap_and_add(ab->tmp_output, ab->delay[i + 1], ab->output[i + 1]);
>          } else {
>              av_log(NULL, AV_LOG_INFO, "imdct channel %d skipping - block switching enabled\n", i);
> @@ -1541,8 +1515,6 @@ static inline void do_imdct(AC3DecodeCon
>      }
>  }
>  
> -
> -
>  static int ac3_parse_audio_block(AC3DecodeContext * ctx, int index)
>  {
>      ac3_audio_block *ab = &ctx->audio_block;

cosmetics

I'd argue that removing commented out code could be considered cosmetics, too.

Either way, cosmetics must come in separate commits.

Regards,
R.

-- 
MPlayer developer and RPMs maintainer: http://mplayerhq.hu http://rpm.livna.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
	-- from "Collected Sayings of Muad'Dib" by the Princess Irulan




More information about the ffmpeg-cvslog mailing list