[FFmpeg-cvslog] r24209 - trunk/libavcodec/dca.c

benoit subversion
Mon Jul 12 11:00:18 CEST 2010


Author: benoit
Date: Mon Jul 12 11:00:17 2010
New Revision: 24209

Log:
Move XCH parameters into context structure.
Patch by Nick Brereton $name AT n$surname DOT net

Modified:
   trunk/libavcodec/dca.c

Modified: trunk/libavcodec/dca.c
==============================================================================
--- trunk/libavcodec/dca.c	Mon Jul 12 00:53:01 2010	(r24208)
+++ trunk/libavcodec/dca.c	Mon Jul 12 11:00:17 2010	(r24209)
@@ -288,6 +288,10 @@ typedef struct {
     int current_subframe;
     int current_subsubframe;
 
+    /* XCh extension information */
+    int xch_present;
+    int xch_base_channel;       ///< index of first (only) channel containing XCH data
+
     int debug_flag;             ///< used for suppressing repeated error messages output
     DSPContext dsp;
     FFTContext imdct;
@@ -1260,12 +1264,12 @@ static int dca_decode_frame(AVCodecConte
     int lfe_samples;
     int num_core_channels = 0;
     int i;
-    int xch_present = 0;
     int16_t *samples = data;
     DCAContext *s = avctx->priv_data;
     int channels;
 
 
+    s->xch_present = 0;
     s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE);
     if (s->dca_buffer_size == -1) {
         av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
@@ -1297,9 +1301,10 @@ static int dca_decode_frame(AVCodecConte
 
         switch(bits) {
         case 0x5a5a5a5a: {
-            int ext_base_ch = s->prim_channels;
             int ext_amode, xch_fsize;
 
+            s->xch_base_channel = s->prim_channels;
+
             /* validate sync word using XCHFSIZE field */
             xch_fsize = show_bits(&s->gb, 10);
             if((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) &&
@@ -1318,13 +1323,13 @@ static int dca_decode_frame(AVCodecConte
             }
 
             /* much like core primary audio coding header */
-            dca_parse_audio_coding_header(s, ext_base_ch);
+            dca_parse_audio_coding_header(s, s->xch_base_channel);
 
             for (i = 0; i < (s->sample_blocks / 8); i++) {
-                dca_decode_block(s, ext_base_ch, i);
+                dca_decode_block(s, s->xch_base_channel, i);
             }
 
-            xch_present = 1;
+            s->xch_present = 1;
             break;
         }
         case 0x1d95f262:
@@ -1342,7 +1347,7 @@ static int dca_decode_frame(AVCodecConte
     if (s->amode<16) {
         avctx->channel_layout = dca_core_channel_layout[s->amode];
 
-        if (xch_present && (!avctx->request_channels ||
+        if (s->xch_present && (!avctx->request_channels ||
                             avctx->request_channels > num_core_channels)) {
             avctx->channel_layout |= CH_BACK_CENTER;
             if (s->lfe) {



More information about the ffmpeg-cvslog mailing list