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

jbr subversion at mplayerhq.hu
Thu Dec 13 03:55:26 CET 2007


Author: jbr
Date: Thu Dec 13 03:55:26 2007
New Revision: 1555

Log:
rename sample rate code variable and use a macro definition to make code more
understandable

Modified:
   eac3/eac3.h
   eac3/eac3dec.c

Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h	(original)
+++ eac3/eac3.h	Thu Dec 13 03:55:26 2007
@@ -45,8 +45,8 @@ typedef struct EAC3Context{
     int stream_type;                 ///< Stream type
     int substreamid;                 ///< Substream identification
     int frame_size;                  ///< Frame size, in bytes
-    int fscod;                       ///< Sample rate code
-    int fscod2;                      ///< Sample rate code 2
+    int sr_code;                     ///< Sample rate code
+    int sr_code2;                    ///< Sample rate code 2
     int num_blocks;                  ///< Number of audio blocks
     int acmod;                       ///< Audio coding mode
     int lfeon;                       ///< Low frequency effect channel on
@@ -213,4 +213,6 @@ typedef enum {
     EAC3_STREAM_TYPE_RESERVED
 } EAC3StreamType;
 
+#define EAC3_SR_CODE_REDUCED  3
+
 #endif

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Thu Dec 13 03:55:26 2007
@@ -343,12 +343,12 @@ static int parse_bsi(GetBitContext *gbc,
     }
     s->substreamid = get_bits(gbc, 3);
     s->frame_size = (get_bits(gbc, 11) + 1) * 2;
-    s->fscod = get_bits(gbc, 2);
-    if (s->fscod == 3) {
+    s->sr_code = get_bits(gbc, 2);
+    if (s->sr_code == EAC3_SR_CODE_REDUCED) {
         log_missing_feature(s->avctx, "Reduced Sampling Rates");
         return -1;
 #if 0
-        s->fscod2 = get_bits(gbc, 2);
+        s->sr_code2 = get_bits(gbc, 2);
         s->num_blocks = 6;
 #endif
     } else {
@@ -498,8 +498,7 @@ static int parse_bsi(GetBitContext *gbc,
                 skip_bits(gbc, 8); //skip Mix level, Room type and A/D converter type
             }
         }
-        if (s->fscod < 3) {
-            /* if not half sample rate */
+        if (s->sr_code != EAC3_SR_CODE_REDUCED) {
             skip_bits1(gbc); //skip Source sample rate code
         }
     }
@@ -1166,7 +1165,7 @@ static int parse_audblk(GetBitContext *g
         ff_ac3_bit_alloc_calc_psd((int8_t *)s->dexps[ch], s->strtmant[ch],
                 s->endmant[ch], s->psd[ch], s->bndpsd[ch]);
 
-        s->bit_alloc_params.sr_code = s->fscod;
+        s->bit_alloc_params.sr_code = s->sr_code;
         s->bit_alloc_params.sr_shift = 0;
 
         ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params,
@@ -1253,10 +1252,10 @@ static int eac3_decode_frame(AVCodecCont
     if (parse_bsi(&gbc, c) || parse_audfrm(&gbc, c))
         return -1;
 
-    if (c->fscod == 3) {
-        avctx->sample_rate = ff_ac3_sample_rate_tab[c->fscod2] / 2;
+    if (c->sr_code == EAC3_SR_CODE_REDUCED) {
+        avctx->sample_rate = ff_ac3_sample_rate_tab[c->sr_code2] / 2;
     } else {
-        avctx->sample_rate = ff_ac3_sample_rate_tab[c->fscod];
+        avctx->sample_rate = ff_ac3_sample_rate_tab[c->sr_code];
     }
 
     avctx->bit_rate = (c->frame_size * avctx->sample_rate * 8 / (c->num_blocks * 256)) / 1000;



More information about the FFmpeg-soc mailing list