]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/eac3dec.c
Alpha: move dsputil prototypes to a header file
[ffmpeg] / libavcodec / eac3dec.c
index 62f6d792cf56aeba7054b051961932a7a41dbaac..3784ccfb1db960eb51e9cca9414eb47f97115c96 100644 (file)
@@ -55,6 +55,7 @@
 #include "ac3_parser.h"
 #include "ac3dec.h"
 #include "ac3dec_data.h"
+#include "eac3dec_data.h"
 
 /** gain adaptive quantization mode */
 typedef enum {
@@ -175,7 +176,7 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
 
             for (blk = 0; blk < 6; blk++) {
                 int mant = get_sbits(gbc, gbits);
-                if (mant == -(1 << (gbits-1))) {
+                if (log_gain && mant == -(1 << (gbits-1))) {
                     /* large mantissa */
                     int b;
                     int mbits = bits - (2 - log_gain);
@@ -183,16 +184,16 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
                     mant <<= (23 - (mbits - 1));
                     /* remap mantissa value to correct for asymmetric quantization */
                     if (mant >= 0)
-                        b = 1 << (23 - (mbits - 1));
+                        b = 1 << (23 - log_gain);
                     else
                         b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;
-                    mant += (((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] << 8) * (int64_t)mant) >> 23) + b;
+                    mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;
                 } else {
                     /* small mantissa, no GAQ, or Gk=1 */
                     mant <<= 24 - bits;
                     if (!log_gain) {
                         /* remap mantissa value for no GAQ or Gk=1 */
-                        mant += ((ff_eac3_gaq_remap_1[hebap-8] << 8) * (int64_t)mant) >> 23;
+                        mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;
                     }
                 }
                 s->pre_mantissa[ch][bin][blk] = mant;
@@ -214,7 +215,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
        application can select from. each independent stream can also contain
        dependent streams which are used to add or replace channels. */
     if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
-        ff_log_missing_feature(s->avctx, "Dependent substream decoding", 1);
+        av_log_missing_feature(s->avctx, "Dependent substream decoding", 1);
         return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
     } else if (s->frame_type == EAC3_FRAME_TYPE_RESERVED) {
         av_log(s->avctx, AV_LOG_ERROR, "Reserved frame type\n");
@@ -226,7 +227,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
        associated to an independent stream have matching substream id's. */
     if (s->substreamid) {
         /* only decode substream with id=0. skip any additional substreams. */
-        ff_log_missing_feature(s->avctx, "Additional substreams", 1);
+        av_log_missing_feature(s->avctx, "Additional substreams", 1);
         return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
     }
 
@@ -235,7 +236,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
            rates in bit allocation.  The best assumption would be that it is
            handled like AC-3 DolbyNet, but we cannot be sure until we have a
            sample which utilizes this feature. */
-        ff_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
+        av_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
         return -1;
     }
     skip_bits(gbc, 5); // skip bitstream id
@@ -492,7 +493,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
 
     /* spectral extension attenuation data */
     if (parse_spx_atten_data) {
-        ff_log_missing_feature(s->avctx, "Spectral extension attenuation", 1);
+        av_log_missing_feature(s->avctx, "Spectral extension attenuation", 1);
         for (ch = 1; ch <= s->fbw_channels; ch++) {
             if (get_bits1(gbc)) { // channel has spx attenuation
                 skip_bits(gbc, 5); // skip spx attenuation code
@@ -508,7 +509,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
            It is likely the offset of each block within the frame. */
         int block_start_bits = (s->num_blocks-1) * (4 + av_log2(s->frame_size-2));
         skip_bits_long(gbc, block_start_bits);
-        ff_log_missing_feature(s->avctx, "Block start info", 1);
+        av_log_missing_feature(s->avctx, "Block start info", 1);
     }
 
     /* syntax state initialization */