changeset 6005:7d9dddd54817 libavcodec

cosmetics: rename common ac3 variables
author jbr
date Sun, 09 Dec 2007 03:27:14 +0000
parents 713d66164428
children ed7a232d570a
files ac3.h ac3_parser.c ac3dec.c ac3enc.c
diffstat 4 files changed, 111 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/ac3.h	Sun Dec 09 03:25:42 2007 +0000
+++ b/ac3.h	Sun Dec 09 03:27:14 2007 +0000
@@ -53,14 +53,14 @@
 
 /** Channel mode (audio coding mode) */
 typedef enum {
-    AC3_ACMOD_DUALMONO = 0,
-    AC3_ACMOD_MONO,
-    AC3_ACMOD_STEREO,
-    AC3_ACMOD_3F,
-    AC3_ACMOD_2F1R,
-    AC3_ACMOD_3F1R,
-    AC3_ACMOD_2F2R,
-    AC3_ACMOD_3F2R
+    AC3_CHMODE_DUALMONO = 0,
+    AC3_CHMODE_MONO,
+    AC3_CHMODE_STEREO,
+    AC3_CHMODE_3F,
+    AC3_CHMODE_2F1R,
+    AC3_CHMODE_3F1R,
+    AC3_CHMODE_2F2R,
+    AC3_CHMODE_3F2R
 } AC3ChannelMode;
 
 typedef struct AC3BitAllocParameters {
@@ -81,14 +81,14 @@
     uint16_t sync_word;
     uint16_t crc1;
     uint8_t sr_code;
-    uint8_t frmsizecod;
-    uint8_t bsid;
-    uint8_t bsmod;
-    uint8_t acmod;
-    uint8_t cmixlev;
-    uint8_t surmixlev;
-    uint8_t dsurmod;
-    uint8_t lfeon;
+    uint8_t frame_size_code;
+    uint8_t bitstream_id;
+    uint8_t bitstream_mode;
+    uint8_t channel_mode;
+    uint8_t center_mix_level;
+    uint8_t surround_mix_level;
+    uint8_t dolby_surround_mode;
+    uint8_t lfe_on;
     /** @} */
 
     /** @defgroup derived Derived values
--- a/ac3_parser.c	Sun Dec 09 03:25:42 2007 +0000
+++ b/ac3_parser.c	Sun Dec 09 03:27:14 2007 +0000
@@ -47,8 +47,8 @@
         return AC3_PARSE_ERROR_SYNC;
 
     /* read ahead to bsid to make sure this is AC-3, not E-AC-3 */
-    hdr->bsid = show_bits_long(&gbc, 29) & 0x1F;
-    if(hdr->bsid > 10)
+    hdr->bitstream_id = show_bits_long(&gbc, 29) & 0x1F;
+    if(hdr->bitstream_id > 10)
         return AC3_PARSE_ERROR_BSID;
 
     hdr->crc1 = get_bits(&gbc, 16);
@@ -56,30 +56,30 @@
     if(hdr->sr_code == 3)
         return AC3_PARSE_ERROR_SAMPLE_RATE;
 
-    hdr->frmsizecod = get_bits(&gbc, 6);
-    if(hdr->frmsizecod > 37)
+    hdr->frame_size_code = get_bits(&gbc, 6);
+    if(hdr->frame_size_code > 37)
         return AC3_PARSE_ERROR_FRAME_SIZE;
 
     skip_bits(&gbc, 5); // skip bsid, already got it
 
-    hdr->bsmod = get_bits(&gbc, 3);
-    hdr->acmod = get_bits(&gbc, 3);
-    if((hdr->acmod & 1) && hdr->acmod != AC3_ACMOD_MONO) {
-        hdr->cmixlev = get_bits(&gbc, 2);
+    hdr->bitstream_mode = get_bits(&gbc, 3);
+    hdr->channel_mode = get_bits(&gbc, 3);
+    if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) {
+        hdr->center_mix_level = get_bits(&gbc, 2);
     }
-    if(hdr->acmod & 4) {
-        hdr->surmixlev = get_bits(&gbc, 2);
+    if(hdr->channel_mode & 4) {
+        hdr->surround_mix_level = get_bits(&gbc, 2);
     }
-    if(hdr->acmod == AC3_ACMOD_STEREO) {
-        hdr->dsurmod = get_bits(&gbc, 2);
+    if(hdr->channel_mode == AC3_CHMODE_STEREO) {
+        hdr->dolby_surround_mode = get_bits(&gbc, 2);
     }
-    hdr->lfeon = get_bits1(&gbc);
+    hdr->lfe_on = get_bits1(&gbc);
 
-    hdr->sr_shift = FFMAX(hdr->bsid, 8) - 8;
+    hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
     hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
-    hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frmsizecod>>1] * 1000) >> hdr->sr_shift;
-    hdr->channels = ff_ac3_channels_tab[hdr->acmod] + hdr->lfeon;
-    hdr->frame_size = ff_ac3_frame_size_tab[hdr->frmsizecod][hdr->sr_code] * 2;
+    hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frame_size_code>>1] * 1000) >> hdr->sr_shift;
+    hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
+    hdr->frame_size = ff_ac3_frame_size_tab[hdr->frame_size_code][hdr->sr_code] * 2;
 
     return 0;
 }
@@ -88,8 +88,8 @@
                     int *bit_rate, int *samples)
 {
     int err;
-    unsigned int sr_code, acmod, bsid, lfeon;
-    unsigned int strmtyp, substreamid, frmsiz, sr_code2, numblkscod;
+    unsigned int sr_code, channel_mode, bitstream_id, lfe_on;
+    unsigned int stream_type, substream_id, frame_size, sr_code2, num_blocks_code;
     GetBitContext bits;
     AC3HeaderInfo hdr;
 
@@ -98,48 +98,48 @@
     if(err < 0 && err != -2)
         return 0;
 
-    bsid = hdr.bsid;
-    if(bsid <= 10) {             /* Normal AC-3 */
+    bitstream_id = hdr.bitstream_id;
+    if(bitstream_id <= 10) {             /* Normal AC-3 */
         *sample_rate = hdr.sample_rate;
         *bit_rate = hdr.bit_rate;
         *channels = hdr.channels;
         *samples = AC3_FRAME_SIZE;
         return hdr.frame_size;
-    } else if (bsid > 10 && bsid <= 16) { /* Enhanced AC-3 */
+    } else if (bitstream_id > 10 && bitstream_id <= 16) { /* Enhanced AC-3 */
         init_get_bits(&bits, &buf[2], (AC3_HEADER_SIZE-2) * 8);
-        strmtyp = get_bits(&bits, 2);
-        substreamid = get_bits(&bits, 3);
+        stream_type = get_bits(&bits, 2);
+        substream_id = get_bits(&bits, 3);
 
-        if (strmtyp != 0 || substreamid != 0)
+        if (stream_type != 0 || substream_id != 0)
             return 0;   /* Currently don't support additional streams */
 
-        frmsiz = get_bits(&bits, 11) + 1;
-        if(frmsiz*2 < AC3_HEADER_SIZE)
+        frame_size = get_bits(&bits, 11) + 1;
+        if(frame_size*2 < AC3_HEADER_SIZE)
             return 0;
 
         sr_code = get_bits(&bits, 2);
         if (sr_code == 3) {
             sr_code2 = get_bits(&bits, 2);
-            numblkscod = 3;
+            num_blocks_code = 3;
 
             if(sr_code2 == 3)
                 return 0;
 
             *sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
         } else {
-            numblkscod = get_bits(&bits, 2);
+            num_blocks_code = get_bits(&bits, 2);
 
             *sample_rate = ff_ac3_sample_rate_tab[sr_code];
         }
 
-        acmod = get_bits(&bits, 3);
-        lfeon = get_bits1(&bits);
+        channel_mode = get_bits(&bits, 3);
+        lfe_on = get_bits1(&bits);
 
-        *samples = eac3_blocks[numblkscod] * 256;
-        *bit_rate = frmsiz * (*sample_rate) * 16 / (*samples);
-        *channels = ff_ac3_channels_tab[acmod] + lfeon;
+        *samples = eac3_blocks[num_blocks_code] * 256;
+        *bit_rate = frame_size * (*sample_rate) * 16 / (*samples);
+        *channels = ff_ac3_channels_tab[channel_mode] + lfe_on;
 
-        return frmsiz * 2;
+        return frame_size * 2;
     }
 
     /* Unsupported bitstream version */
--- a/ac3dec.c	Sun Dec 09 03:25:42 2007 +0000
+++ b/ac3dec.c	Sun Dec 09 03:27:14 2007 +0000
@@ -97,13 +97,13 @@
  * Table for center mix levels
  * reference: Section 5.4.2.4 cmixlev
  */
-static const uint8_t clevs[4] = { 2, 3, 4, 3 };
+static const uint8_t center_levels[4] = { 2, 3, 4, 3 };
 
 /**
  * Table for surround mix levels
  * reference: Section 5.4.2.5 surmixlev
  */
-static const uint8_t slevs[4] = { 2, 4, 0, 4 };
+static const uint8_t surround_levels[4] = { 2, 4, 0, 4 };
 
 /**
  * Table for default stereo downmixing coefficients
@@ -128,8 +128,8 @@
 #define AC3_OUTPUT_LFEON  8
 
 typedef struct {
-    int acmod;                              ///< audio coding mode
-    int dsurmod;                            ///< dolby surround mode
+    int channel_mode;                       ///< channel mode (acmod)
+    int dolby_surround_mode;                ///< dolby surround mode
     int blksw[AC3_MAX_CHANNELS];            ///< block switch flags
     int dithflag[AC3_MAX_CHANNELS];         ///< dither flags
     int dither_all;                         ///< true if all channels are dithered
@@ -155,7 +155,7 @@
 
     int nchans;                             ///< number of total channels
     int nfchans;                            ///< number of full-bandwidth channels
-    int lfeon;                              ///< lfe channel in use
+    int lfe_on;                             ///< lfe channel in use
     int lfe_ch;                             ///< index of LFE channel
     int output_mode;                        ///< output channel configuration
     int out_channels;                       ///< number of output channels
@@ -336,7 +336,7 @@
 {
     AC3HeaderInfo hdr;
     GetBitContext *gb = &ctx->gb;
-    float cmixlev, surmixlev;
+    float center_mix_level, surround_mix_level;
     int err, i;
 
     err = ff_ac3_parse_header(gb->buffer, &hdr);
@@ -345,23 +345,23 @@
 
     /* get decoding parameters from header info */
     ctx->bit_alloc_params.sr_code     = hdr.sr_code;
-    ctx->acmod                        = hdr.acmod;
-    cmixlev                           = gain_levels[clevs[hdr.cmixlev]];
-    surmixlev                         = gain_levels[slevs[hdr.surmixlev]];
-    ctx->dsurmod                      = hdr.dsurmod;
-    ctx->lfeon                        = hdr.lfeon;
+    ctx->channel_mode                 = hdr.channel_mode;
+    center_mix_level                  = gain_levels[center_levels[hdr.center_mix_level]];
+    surround_mix_level                = gain_levels[surround_levels[hdr.surround_mix_level]];
+    ctx->dolby_surround_mode          = hdr.dolby_surround_mode;
+    ctx->lfe_on                        = hdr.lfe_on;
     ctx->bit_alloc_params.sr_shift    = hdr.sr_shift;
     ctx->sampling_rate                = hdr.sample_rate;
     ctx->bit_rate                     = hdr.bit_rate;
     ctx->nchans                       = hdr.channels;
-    ctx->nfchans                      = ctx->nchans - ctx->lfeon;
+    ctx->nfchans                      = ctx->nchans - ctx->lfe_on;
     ctx->lfe_ch                       = ctx->nfchans + 1;
     ctx->frame_size                   = hdr.frame_size;
 
     /* set default output to all source channels */
     ctx->out_channels = ctx->nchans;
-    ctx->output_mode = ctx->acmod;
-    if(ctx->lfeon)
+    ctx->output_mode = ctx->channel_mode;
+    if(ctx->lfe_on)
         ctx->output_mode |= AC3_OUTPUT_LFEON;
 
     /* skip over portion of header which has already been read */
@@ -369,18 +369,18 @@
     skip_bits(gb, 16); // skip crc1
     skip_bits(gb, 8);  // skip fscod and frmsizecod
     skip_bits(gb, 11); // skip bsid, bsmod, and acmod
-    if(ctx->acmod == AC3_ACMOD_STEREO) {
+    if(ctx->channel_mode == AC3_CHMODE_STEREO) {
         skip_bits(gb, 2); // skip dsurmod
     } else {
-        if((ctx->acmod & 1) && ctx->acmod != AC3_ACMOD_MONO)
+        if((ctx->channel_mode & 1) && ctx->channel_mode != AC3_CHMODE_MONO)
             skip_bits(gb, 2); // skip cmixlev
-        if(ctx->acmod & 4)
+        if(ctx->channel_mode & 4)
             skip_bits(gb, 2); // skip surmixlev
     }
     skip_bits1(gb); // skip lfeon
 
     /* read the rest of the bsi. read twice for dual mono mode. */
-    i = !(ctx->acmod);
+    i = !(ctx->channel_mode);
     do {
         ctx->dialnorm[i] = dialnorm_tab[get_bits(gb, 5)]; // dialog normalization
         if (get_bits1(gb))
@@ -411,19 +411,19 @@
     /* set stereo downmixing coefficients
        reference: Section 7.8.2 Downmixing Into Two Channels */
     for(i=0; i<ctx->nfchans; i++) {
-        ctx->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[ctx->acmod][i][0]];
-        ctx->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[ctx->acmod][i][1]];
+        ctx->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[ctx->channel_mode][i][0]];
+        ctx->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[ctx->channel_mode][i][1]];
     }
-    if(ctx->acmod > 1 && ctx->acmod & 1) {
-        ctx->downmix_coeffs[1][0] = ctx->downmix_coeffs[1][1] = cmixlev;
+    if(ctx->channel_mode > 1 && ctx->channel_mode & 1) {
+        ctx->downmix_coeffs[1][0] = ctx->downmix_coeffs[1][1] = center_mix_level;
     }
-    if(ctx->acmod == AC3_ACMOD_2F1R || ctx->acmod == AC3_ACMOD_3F1R) {
-        int nf = ctx->acmod - 2;
-        ctx->downmix_coeffs[nf][0] = ctx->downmix_coeffs[nf][1] = surmixlev * LEVEL_MINUS_3DB;
+    if(ctx->channel_mode == AC3_CHMODE_2F1R || ctx->channel_mode == AC3_CHMODE_3F1R) {
+        int nf = ctx->channel_mode - 2;
+        ctx->downmix_coeffs[nf][0] = ctx->downmix_coeffs[nf][1] = surround_mix_level * LEVEL_MINUS_3DB;
     }
-    if(ctx->acmod == AC3_ACMOD_2F2R || ctx->acmod == AC3_ACMOD_3F2R) {
-        int nf = ctx->acmod - 4;
-        ctx->downmix_coeffs[nf][0] = ctx->downmix_coeffs[nf+1][1] = surmixlev;
+    if(ctx->channel_mode == AC3_CHMODE_2F2R || ctx->channel_mode == AC3_CHMODE_3F2R) {
+        int nf = ctx->channel_mode - 4;
+        ctx->downmix_coeffs[nf][0] = ctx->downmix_coeffs[nf+1][1] = surround_mix_level;
     }
 
     return 0;
@@ -766,9 +766,9 @@
         }
         v0 /= s0;
         v1 /= s1;
-        if(output_mode == AC3_ACMOD_MONO) {
+        if(output_mode == AC3_CHMODE_MONO) {
             samples[0][i] = (v0 + v1) * LEVEL_MINUS_3DB;
-        } else if(output_mode == AC3_ACMOD_STEREO) {
+        } else if(output_mode == AC3_CHMODE_STEREO) {
             samples[0][i] = v0;
             samples[1][i] = v1;
         }
@@ -781,7 +781,7 @@
 static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
 {
     int nfchans = ctx->nfchans;
-    int acmod = ctx->acmod;
+    int channel_mode = ctx->channel_mode;
     int i, bnd, seg, ch;
     GetBitContext *gb = &ctx->gb;
     uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
@@ -801,7 +801,7 @@
     }
 
     /* dynamic range */
-    i = !(ctx->acmod);
+    i = !(ctx->channel_mode);
     do {
         if(get_bits1(gb)) {
             ctx->dynrng[i] = dynrng_tab[get_bits(gb, 8)];
@@ -823,7 +823,7 @@
                 ctx->chincpl[ch] = get_bits1(gb);
 
             /* phase flags in use */
-            if (acmod == AC3_ACMOD_STEREO)
+            if (channel_mode == AC3_CHMODE_STEREO)
                 ctx->phsflginu = get_bits1(gb);
 
             /* coupling frequency range and band structure */
@@ -872,7 +872,7 @@
             }
         }
         /* phase flags */
-        if (acmod == AC3_ACMOD_STEREO && ctx->phsflginu && cplcoe) {
+        if (channel_mode == AC3_CHMODE_STEREO && ctx->phsflginu && cplcoe) {
             for (bnd = 0; bnd < ctx->ncplbnd; bnd++) {
                 if (get_bits1(gb))
                     ctx->cplco[2][bnd] = -ctx->cplco[2][bnd];
@@ -881,7 +881,7 @@
     }
 
     /* stereo rematrixing strategy and band structure */
-    if (acmod == AC3_ACMOD_STEREO) {
+    if (channel_mode == AC3_CHMODE_STEREO) {
         ctx->rematstr = get_bits1(gb);
         if (ctx->rematstr) {
             ctx->nrematbnd = 4;
@@ -1046,13 +1046,13 @@
     }
 
     /* recover coefficients if rematrixing is in use */
-    if(ctx->acmod == AC3_ACMOD_STEREO)
+    if(ctx->channel_mode == AC3_CHMODE_STEREO)
         do_rematrixing(ctx);
 
     /* apply scaling to coefficients (headroom, dialnorm, dynrng) */
     for(ch=1; ch<=ctx->nchans; ch++) {
         float gain = 2.0f * ctx->mul_bias;
-        if(ctx->acmod == AC3_ACMOD_DUALMONO) {
+        if(ctx->channel_mode == AC3_CHMODE_DUALMONO) {
             gain *= ctx->dialnorm[ch-1] * ctx->dynrng[ch-1];
         } else {
             gain *= ctx->dialnorm[0] * ctx->dynrng[0];
@@ -1136,9 +1136,9 @@
         return -1;
     }
     if(avctx->channels == 2) {
-        ctx->output_mode = AC3_ACMOD_STEREO;
+        ctx->output_mode = AC3_CHMODE_STEREO;
     } else if(avctx->channels == 1) {
-        ctx->output_mode = AC3_ACMOD_MONO;
+        ctx->output_mode = AC3_CHMODE_MONO;
     } else if(avctx->channels != ctx->out_channels) {
         av_log(avctx, AV_LOG_ERROR, "Cannot downmix AC3 from %d to %d channels.\n",
                ctx->out_channels, avctx->channels);
--- a/ac3enc.c	Sun Dec 09 03:25:42 2007 +0000
+++ b/ac3enc.c	Sun Dec 09 03:27:14 2007 +0000
@@ -37,17 +37,17 @@
     int lfe_channel;
     int bit_rate;
     unsigned int sample_rate;
-    unsigned int bsid;
+    unsigned int bitstream_id;
     unsigned int frame_size_min; /* minimum frame size in case rounding is necessary */
     unsigned int frame_size; /* current frame size in words */
     unsigned int bits_written;
     unsigned int samples_written;
     int sr_shift;
-    unsigned int frmsizecod;
+    unsigned int frame_size_code;
     unsigned int sr_code; /* frequency */
-    unsigned int acmod;
+    unsigned int channel_mode;
     int lfe;
-    unsigned int bsmod;
+    unsigned int bitstream_mode;
     short last_samples[AC3_MAX_CHANNELS][256];
     unsigned int chbwcod[AC3_MAX_CHANNELS];
     int nb_coefs[AC3_MAX_CHANNELS];
@@ -527,14 +527,14 @@
 
     /* header size */
     frame_bits += 65;
-    // if (s->acmod == 2)
+    // if (s->channel_mode == 2)
     //    frame_bits += 2;
-    frame_bits += frame_bits_inc[s->acmod];
+    frame_bits += frame_bits_inc[s->channel_mode];
 
     /* audio blocks */
     for(i=0;i<NB_BLOCKS;i++) {
         frame_bits += s->nb_channels * 2 + 2; /* blksw * c, dithflag * c, dynrnge, cplstre */
-        if (s->acmod == AC3_ACMOD_STEREO) {
+        if (s->channel_mode == AC3_CHMODE_STEREO) {
             frame_bits++; /* rematstr */
             if(i==0) frame_bits += 4;
         }
@@ -632,7 +632,7 @@
     AC3EncodeContext *s = avctx->priv_data;
     int i, j, ch;
     float alpha;
-    static const uint8_t acmod_defs[6] = {
+    static const uint8_t channel_mode_defs[6] = {
         0x01, /* C */
         0x02, /* L R */
         0x03, /* L C R */
@@ -648,7 +648,7 @@
     /* number of channels */
     if (channels < 1 || channels > 6)
         return -1;
-    s->acmod = acmod_defs[channels - 1];
+    s->channel_mode = channel_mode_defs[channels - 1];
     s->lfe = (channels == 6) ? 1 : 0;
     s->nb_all_channels = channels;
     s->nb_channels = channels > 5 ? 5 : channels;
@@ -665,8 +665,8 @@
     s->sample_rate = freq;
     s->sr_shift = i;
     s->sr_code = j;
-    s->bsid = 8 + s->sr_shift;
-    s->bsmod = 0; /* complete main audio service */
+    s->bitstream_id = 8 + s->sr_shift;
+    s->bitstream_mode = 0; /* complete main audio service */
 
     /* bitrate & frame size */
     bitrate /= 1000;
@@ -677,8 +677,8 @@
     if (i == 19)
         return -1;
     s->bit_rate = bitrate;
-    s->frmsizecod = i << 1;
-    s->frame_size_min = ff_ac3_frame_size_tab[s->frmsizecod][s->sr_code];
+    s->frame_size_code = i << 1;
+    s->frame_size_min = ff_ac3_frame_size_tab[s->frame_size_code][s->sr_code];
     s->bits_written = 0;
     s->samples_written = 0;
     s->frame_size = s->frame_size_min;
@@ -719,15 +719,15 @@
     put_bits(&s->pb, 16, 0x0b77); /* frame header */
     put_bits(&s->pb, 16, 0); /* crc1: will be filled later */
     put_bits(&s->pb, 2, s->sr_code);
-    put_bits(&s->pb, 6, s->frmsizecod + (s->frame_size - s->frame_size_min));
-    put_bits(&s->pb, 5, s->bsid);
-    put_bits(&s->pb, 3, s->bsmod);
-    put_bits(&s->pb, 3, s->acmod);
-    if ((s->acmod & 0x01) && s->acmod != AC3_ACMOD_MONO)
+    put_bits(&s->pb, 6, s->frame_size_code + (s->frame_size - s->frame_size_min));
+    put_bits(&s->pb, 5, s->bitstream_id);
+    put_bits(&s->pb, 3, s->bitstream_mode);
+    put_bits(&s->pb, 3, s->channel_mode);
+    if ((s->channel_mode & 0x01) && s->channel_mode != AC3_CHMODE_MONO)
         put_bits(&s->pb, 2, 1); /* XXX -4.5 dB */
-    if (s->acmod & 0x04)
+    if (s->channel_mode & 0x04)
         put_bits(&s->pb, 2, 1); /* XXX -6 dB */
-    if (s->acmod == AC3_ACMOD_STEREO)
+    if (s->channel_mode == AC3_CHMODE_STEREO)
         put_bits(&s->pb, 2, 0); /* surround not indicated */
     put_bits(&s->pb, 1, s->lfe); /* LFE */
     put_bits(&s->pb, 5, 31); /* dialog norm: -31 db */
@@ -810,7 +810,7 @@
         put_bits(&s->pb, 1, 0); /* no new coupling strategy */
     }
 
-    if (s->acmod == AC3_ACMOD_STEREO)
+    if (s->channel_mode == AC3_CHMODE_STEREO)
       {
         if(block_num==0)
           {