[FFmpeg-cvslog] r23800 - in branches/0.6-aac-he-v2: . libavcodec/Makefile libavcodec/aac.c libavcodec/aac.h libavcodec/aac_tablegen.c libavcodec/aac_tablegen.h libavcodec/aac_tablegen_decl.h libavcodec/aacdec.c li...

siretart subversion
Sat Jun 26 17:29:53 CEST 2010


Author: siretart
Date: Sat Jun 26 17:29:53 2010
New Revision: 23800

Log:
merge all revision that are related for aac encoder and decoder from trunk

Added:
   branches/0.6-aac-he-v2/libavcodec/aac_tablegen.c
      - copied unchanged from r23798, trunk/libavcodec/aac_tablegen.c
   branches/0.6-aac-he-v2/libavcodec/aac_tablegen.h
      - copied unchanged from r23798, trunk/libavcodec/aac_tablegen.h
   branches/0.6-aac-he-v2/libavcodec/aac_tablegen_decl.h
      - copied unchanged from r23798, trunk/libavcodec/aac_tablegen_decl.h
   branches/0.6-aac-he-v2/libavcodec/aacdec.c   (contents, props changed)
      - copied, changed from r23489, trunk/libavcodec/aacdec.c
   branches/0.6-aac-he-v2/libavcodec/aacps.c
      - copied unchanged from r23798, trunk/libavcodec/aacps.c
   branches/0.6-aac-he-v2/libavcodec/aacps.h
      - copied unchanged from r23798, trunk/libavcodec/aacps.h
   branches/0.6-aac-he-v2/libavcodec/aacps_tablegen.c
      - copied unchanged from r23798, trunk/libavcodec/aacps_tablegen.c
   branches/0.6-aac-he-v2/libavcodec/aacps_tablegen.h
      - copied unchanged from r23798, trunk/libavcodec/aacps_tablegen.h
   branches/0.6-aac-he-v2/libavcodec/aacpsdata.c
      - copied unchanged from r23798, trunk/libavcodec/aacpsdata.c
Deleted:
   branches/0.6-aac-he-v2/libavcodec/aac.c
Modified:
   branches/0.6-aac-he-v2/   (props changed)
   branches/0.6-aac-he-v2/libavcodec/Makefile
   branches/0.6-aac-he-v2/libavcodec/aac.h   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/aacenc.c   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/aacenc.h   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/aacsbr.c   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/aactab.c   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/aactab.h   (contents, props changed)
   branches/0.6-aac-he-v2/libavcodec/sbr.h   (contents, props changed)

Modified: branches/0.6-aac-he-v2/libavcodec/Makefile
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/Makefile	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/Makefile	Sat Jun 26 17:29:53 2010	(r23800)
@@ -43,7 +43,7 @@ OBJS-$(CONFIG_VAAPI)                   +
 OBJS-$(CONFIG_VDPAU)                   += vdpau.o
 
 # decoders/encoders/hardware accelerators
-OBJS-$(CONFIG_AAC_DECODER)             += aac.o aactab.o aacsbr.o
+OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aactab.o aacsbr.o aacps.o
 OBJS-$(CONFIG_AAC_ENCODER)             += aacenc.o aaccoder.o    \
                                           aacpsy.o aactab.o      \
                                           psymodel.o iirfilter.o \

Modified: branches/0.6-aac-he-v2/libavcodec/aac.h
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aac.h	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aac.h	Sat Jun 26 17:29:53 2010	(r23800)
@@ -38,12 +38,6 @@
 
 #include <stdint.h>
 
-#define AAC_INIT_VLC_STATIC(num, size) \
-    INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
-         ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
-        ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
-        size);
-
 #define MAX_CHANNELS 64
 #define MAX_ELEM_ID 16
 
@@ -241,7 +235,7 @@ typedef struct {
  * main AAC context
  */
 typedef struct {
-    AVCodecContext * avccontext;
+    AVCodecContext *avctx;
 
     MPEG4AudioConfig m4ac;
 
@@ -255,8 +249,9 @@ typedef struct {
     enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
                                                    *   first index as the first 4 raw data block types
                                                    */
-    ChannelElement * che[4][MAX_ELEM_ID];
-    ChannelElement * tag_che_map[4][MAX_ELEM_ID];
+    ChannelElement          *che[4][MAX_ELEM_ID];
+    ChannelElement  *tag_che_map[4][MAX_ELEM_ID];
+    uint8_t tags_seen_this_frame[4][MAX_ELEM_ID];
     int tags_mapped;
     /** @} */
 

Copied and modified: branches/0.6-aac-he-v2/libavcodec/aacdec.c (from r23489, trunk/libavcodec/aacdec.c)
==============================================================================
--- trunk/libavcodec/aacdec.c	Sat Jun  5 17:27:53 2010	(r23489, copy source)
+++ branches/0.6-aac-he-v2/libavcodec/aacdec.c	Sat Jun 26 17:29:53 2010	(r23800)
@@ -67,7 +67,7 @@
  * Y (not in this code) Layer-2
  * Y (not in this code) Layer-3
  * N                    SinuSoidal Coding (Transient, Sinusoid, Noise)
- * N (planned)          Parametric Stereo
+ * Y                    Parametric Stereo
  * N                    Direct Stream Transfer
  *
  * Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication.
@@ -200,7 +200,8 @@ static av_cold int che_configure(AACCont
         ff_aac_sbr_ctx_init(&ac->che[type][id]->sbr);
         if (type != TYPE_CCE) {
             ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret;
-            if (type == TYPE_CPE) {
+            if (type == TYPE_CPE ||
+                (type == TYPE_SCE && ac->m4ac.ps == 1)) {
                 ac->output_data[(*channels)++] = ac->che[type][id]->ch[1].ret;
             }
         }
@@ -228,6 +229,7 @@ static av_cold int output_configure(AACC
     AVCodecContext *avctx = ac->avctx;
     int i, type, channels = 0, ret;
 
+    if (new_che_pos != che_pos)
     memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
 
     if (channel_config) {
@@ -471,6 +473,8 @@ static int decode_audio_specific_config(
         av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
         return -1;
     }
+    if (ac->m4ac.sbr == 1 && ac->m4ac.ps == -1)
+        ac->m4ac.ps = 1;
 
     skip_bits_long(&gb, i);
 
@@ -524,10 +528,15 @@ static void reset_predictor_group(Predic
         reset_predict_state(&ps[i]);
 }
 
+#define AAC_INIT_VLC_STATIC(num, size) \
+    INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
+         ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
+        ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
+        size);
+
 static av_cold int aac_decode_init(AVCodecContext *avctx)
 {
     AACContext *ac = avctx->priv_data;
-    int i;
 
     ac->avctx = avctx;
     ac->m4ac.sample_rate = avctx->sample_rate;
@@ -571,10 +580,7 @@ static av_cold int aac_decode_init(AVCod
         ac->sf_offset = 60;
     }
 
-#if !CONFIG_HARDCODED_TABLES
-    for (i = 0; i < 428; i++)
-        ff_aac_pow2sf_tab[i] = pow(2, (i - 200) / 4.);
-#endif /* CONFIG_HARDCODED_TABLES */
+    ff_aac_tableinit();
 
     INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
                     ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
@@ -1661,6 +1667,10 @@ static int decode_extension_payload(AACC
             av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
             skip_bits_long(gb, 8 * cnt - 4);
             return res;
+        } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) {
+            ac->m4ac.sbr = 1;
+            ac->m4ac.ps = 1;
+            output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured);
         } else {
             ac->m4ac.sbr = 1;
         }
@@ -1940,8 +1950,10 @@ static int parse_adts_frame_header(AACCo
         } else if (ac->output_configured != OC_LOCKED) {
             ac->output_configured = OC_NONE;
         }
-        if (ac->output_configured != OC_LOCKED)
+        if (ac->output_configured != OC_LOCKED) {
             ac->m4ac.sbr = -1;
+            ac->m4ac.ps  = -1;
+        }
         ac->m4ac.sample_rate     = hdr_info.sample_rate;
         ac->m4ac.sampling_index  = hdr_info.sampling_index;
         ac->m4ac.object_type     = hdr_info.object_type;
@@ -1969,7 +1981,7 @@ static int aac_decode_frame(AVCodecConte
     enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
     int err, elem_id, data_size_tmp;
     int buf_consumed;
-    int samples = 1024, multiplier;
+    int samples = 0, multiplier;
     int buf_offset;
 
     init_get_bits(&gb, buf, buf_size * 8);
@@ -1990,9 +2002,13 @@ static int aac_decode_frame(AVCodecConte
     while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
         elem_id = get_bits(&gb, 4);
 
-        if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) {
-            av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id);
-            return -1;
+        if (elem_type < TYPE_DSE) {
+            if (!(che=get_che(ac, elem_type, elem_id))) {
+                av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
+                       elem_type, elem_id);
+                return -1;
+            }
+            samples = 1024;
         }
 
         switch (elem_type) {
@@ -2077,7 +2093,8 @@ static int aac_decode_frame(AVCodecConte
     }
     *data_size = data_size_tmp;
 
-    ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
+    if (samples)
+        ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
 
     if (ac->output_configured)
         ac->output_configured = OC_LOCKED;

Modified: branches/0.6-aac-he-v2/libavcodec/aacenc.c
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aacenc.c	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aacenc.c	Sat Jun 26 17:29:53 2010	(r23800)
@@ -201,13 +201,11 @@ static av_cold int aac_encode_init(AVCod
     lengths[1] = ff_aac_num_swb_128[i];
     ff_psy_init(&s->psy, avctx, 2, sizes, lengths);
     s->psypp = ff_psy_preprocess_init(avctx);
-    s->coder = &ff_aac_coders[0];
+    s->coder = &ff_aac_coders[2];
 
     s->lambda = avctx->global_quality ? avctx->global_quality : 120;
-#if !CONFIG_HARDCODED_TABLES
-    for (i = 0; i < 428; i++)
-        ff_aac_pow2sf_tab[i] = pow(2, (i - 200)/4.);
-#endif /* CONFIG_HARDCODED_TABLES */
+
+    ff_aac_tableinit();
 
     if (avctx->channels > 5)
         av_log(avctx, AV_LOG_ERROR, "This encoder does not yet enforce the restrictions on LFEs. "
@@ -234,25 +232,21 @@ static void apply_window_and_mdct(AVCode
                 s->output[i] = sce->saved[i];
         }
         if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) {
-            j = channel;
-            for (i = 0; i < 1024; i++, j += avctx->channels) {
+            for (i = 0, j = channel; i < 1024; i++, j += avctx->channels) {
                 s->output[i+1024]         = audio[j] * lwindow[1024 - i - 1];
                 sce->saved[i] = audio[j] * lwindow[i];
             }
         } else {
-            j = channel;
-            for (i = 0; i < 448; i++, j += avctx->channels)
+            for (i = 0, j = channel; i < 448; i++, j += avctx->channels)
                 s->output[i+1024]         = audio[j];
-            for (i = 448; i < 576; i++, j += avctx->channels)
+            for (; i < 576; i++, j += avctx->channels)
                 s->output[i+1024]         = audio[j] * swindow[576 - i - 1];
             memset(s->output+1024+576, 0, sizeof(s->output[0]) * 448);
-            j = channel;
-            for (i = 0; i < 1024; i++, j += avctx->channels)
+            for (i = 0, j = channel; i < 1024; i++, j += avctx->channels)
                 sce->saved[i] = audio[j];
         }
         ff_mdct_calc(&s->mdct1024, sce->coeffs, s->output);
     } else {
-        j = channel;
         for (k = 0; k < 1024; k += 128) {
             for (i = 448 + k; i < 448 + k + 256; i++)
                 s->output[i - 448 - k] = (i < 1024)
@@ -262,8 +256,7 @@ static void apply_window_and_mdct(AVCode
             s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128);
             ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output);
         }
-        j = channel;
-        for (i = 0; i < 1024; i++, j += avctx->channels)
+        for (i = 0, j = channel; i < 1024; i++, j += avctx->channels)
             sce->saved[i] = audio[j];
     }
 }
@@ -562,6 +555,7 @@ static int aac_encode_frame(AVCodecConte
             cpe      = &s->cpe[i];
             for (j = 0; j < chans; j++) {
                 s->cur_channel = start_ch + j;
+                ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
                 s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda);
             }
             cpe->common_window = 0;
@@ -592,7 +586,6 @@ static int aac_encode_frame(AVCodecConte
             }
             for (j = 0; j < chans; j++) {
                 s->cur_channel = start_ch + j;
-                ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
                 encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window);
             }
             start_ch += chans;

Modified: branches/0.6-aac-he-v2/libavcodec/aacenc.h
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aacenc.h	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aacenc.h	Sat Jun 26 17:29:53 2010	(r23800)
@@ -64,7 +64,7 @@ typedef struct AACEncContext {
     int cur_channel;
     int last_frame;
     float lambda;
-    DECLARE_ALIGNED(16, int,   qcoefs)[96][2];   ///< quantized coefficients
+    DECLARE_ALIGNED(16, int,   qcoefs)[96];      ///< quantized coefficients
     DECLARE_ALIGNED(16, float, scoefs)[1024];    ///< scaled coefficients
 } AACEncContext;
 

Modified: branches/0.6-aac-he-v2/libavcodec/aacsbr.c
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aacsbr.c	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aacsbr.c	Sat Jun 26 17:29:53 2010	(r23800)
@@ -31,6 +31,7 @@
 #include "aacsbr.h"
 #include "aacsbrdata.h"
 #include "fft.h"
+#include "aacps.h"
 
 #include <stdint.h>
 #include <float.h>
@@ -71,9 +72,6 @@ enum {
 static VLC vlc_sbr[10];
 static const int8_t vlc_sbr_lav[10] =
     { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-static DECLARE_ALIGNED(16, float, analysis_cos_pre)[64];
-static DECLARE_ALIGNED(16, float, analysis_sin_pre)[64];
-static DECLARE_ALIGNED(16, float, analysis_cossin_post)[32][2];
 static const DECLARE_ALIGNED(16, float, zero64)[64];
 
 #define SBR_INIT_VLC_STATIC(num, size) \
@@ -87,7 +85,7 @@ static const DECLARE_ALIGNED(16, float, 
 
 av_cold void ff_aac_sbr_init(void)
 {
-    int n, k;
+    int n;
     static const struct {
         const void *sbr_codes, *sbr_bits;
         const unsigned int table_size, elem_size;
@@ -116,16 +114,6 @@ av_cold void ff_aac_sbr_init(void)
     SBR_INIT_VLC_STATIC(8, 592);
     SBR_INIT_VLC_STATIC(9, 512);
 
-    for (n = 0; n < 64; n++) {
-        float pre = M_PI * n / 64;
-        analysis_cos_pre[n] = cosf(pre);
-        analysis_sin_pre[n] = sinf(pre);
-    }
-    for (k = 0; k < 32; k++) {
-        float post = M_PI * (k + 0.5) / 128;
-        analysis_cossin_post[k][0] =  4.0 * cosf(post);
-        analysis_cossin_post[k][1] = -4.0 * sinf(post);
-    }
     for (n = 1; n < 320; n++)
         sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
     sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
@@ -133,6 +121,8 @@ av_cold void ff_aac_sbr_init(void)
 
     for (n = 0; n < 320; n++)
         sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
+
+    ff_ps_init();
 }
 
 av_cold void ff_aac_sbr_ctx_init(SpectralBandReplication *sbr)
@@ -142,13 +132,14 @@ av_cold void ff_aac_sbr_ctx_init(Spectra
     sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
     sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
     ff_mdct_init(&sbr->mdct, 7, 1, 1.0/64);
-    ff_rdft_init(&sbr->rdft, 6, IDFT_R2C);
+    ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0);
+    ff_ps_ctx_init(&sbr->ps);
 }
 
 av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
 {
     ff_mdct_end(&sbr->mdct);
-    ff_rdft_end(&sbr->rdft);
+    ff_mdct_end(&sbr->mdct_ana);
 }
 
 static int qsort_comparison_function_int16(const void *a, const void *b)
@@ -293,15 +284,15 @@ static void make_bands(int16_t* bands, i
     bands[num_bands-1] = stop - previous;
 }
 
-static int check_n_master(AVCodecContext *avccontext, int n_master, int bs_xover_band)
+static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band)
 {
     // Requirements (14496-3 sp04 p205)
     if (n_master <= 0) {
-        av_log(avccontext, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
+        av_log(avctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
         return -1;
     }
     if (bs_xover_band >= n_master) {
-        av_log(avccontext, AV_LOG_ERROR,
+        av_log(avctx, AV_LOG_ERROR,
                "Invalid bitstream, crossover band index beyond array bounds: %d\n",
                bs_xover_band);
         return -1;
@@ -349,7 +340,7 @@ static int sbr_make_f_master(AACContext 
         sbr_offset_ptr = sbr_offset[5];
         break;
     default:
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
         return -1;
     }
@@ -367,7 +358,7 @@ static int sbr_make_f_master(AACContext 
     } else if (spectrum->bs_stop_freq == 15) {
         sbr->k[2] = 3*sbr->k[0];
     } else {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
         return -1;
     }
@@ -382,18 +373,17 @@ static int sbr_make_f_master(AACContext 
         max_qmf_subbands = 32;
 
     if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
         return -1;
     }
 
     if (!spectrum->bs_freq_scale) {
-        unsigned int dk;
-        int k2diff;
+        int dk, k2diff;
 
         dk = spectrum->bs_alter_scale + 1;
         sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
-        if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+        if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
             return -1;
 
         for (k = 1; k <= sbr->n_master; k++)
@@ -428,7 +418,7 @@ static int sbr_make_f_master(AACContext 
         num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2;
 
         if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205)
-            av_log(ac->avccontext, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
+            av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
             return -1;
         }
 
@@ -442,7 +432,7 @@ static int sbr_make_f_master(AACContext 
         vk0[0] = sbr->k[0];
         for (k = 1; k <= num_bands_0; k++) {
             if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205)
-                av_log(ac->avccontext, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
+                av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
                 return -1;
             }
             vk0[k] += vk0[k-1];
@@ -472,14 +462,14 @@ static int sbr_make_f_master(AACContext 
             vk1[0] = sbr->k[1];
             for (k = 1; k <= num_bands_1; k++) {
                 if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205)
-                    av_log(ac->avccontext, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
+                    av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
                     return -1;
                 }
                 vk1[k] += vk1[k-1];
             }
 
             sbr->n_master = num_bands_0 + num_bands_1;
-            if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+            if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
                 return -1;
             memcpy(&sbr->f_master[0],               vk0,
                    (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
@@ -488,7 +478,7 @@ static int sbr_make_f_master(AACContext 
 
         } else {
             sbr->n_master = num_bands_0;
-            if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
+            if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
                 return -1;
             memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
         }
@@ -524,7 +514,7 @@ static int sbr_hf_calc_npatches(AACConte
         // illegal however the Coding Technologies decoder check stream has a final
         // count of 6 patches
         if (sbr->num_patches > 5) {
-            av_log(ac->avccontext, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
+            av_log(ac->avctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
             return -1;
         }
 
@@ -563,12 +553,12 @@ static int sbr_make_f_derived(AACContext
 
     // Requirements (14496-3 sp04 p205)
     if (sbr->kx[1] + sbr->m[1] > 64) {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]);
         return -1;
     }
     if (sbr->kx[1] > 32) {
-        av_log(ac->avccontext, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
+        av_log(ac->avctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
         return -1;
     }
 
@@ -580,7 +570,7 @@ static int sbr_make_f_derived(AACContext
     sbr->n_q = FFMAX(1, lrintf(sbr->spectrum_params.bs_noise_bands *
                                log2f(sbr->k[2] / (float)sbr->kx[1]))); // 0 <= bs_noise_bands <= 3
     if (sbr->n_q > 5) {
-        av_log(ac->avccontext, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
+        av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
         return -1;
     }
 
@@ -638,7 +628,7 @@ static int read_sbr_grid(AACContext *ac,
             ch_data->bs_amp_res = 0;
 
         if (ch_data->bs_num_env > 4) {
-            av_log(ac->avccontext, AV_LOG_ERROR,
+            av_log(ac->avctx, AV_LOG_ERROR,
                    "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
                    ch_data->bs_num_env);
             return -1;
@@ -693,7 +683,7 @@ static int read_sbr_grid(AACContext *ac,
         ch_data->bs_num_env                 = num_rel_lead + num_rel_trail + 1;
 
         if (ch_data->bs_num_env > 5) {
-            av_log(ac->avccontext, AV_LOG_ERROR,
+            av_log(ac->avctx, AV_LOG_ERROR,
                    "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
                    ch_data->bs_num_env);
             return -1;
@@ -714,7 +704,7 @@ static int read_sbr_grid(AACContext *ac,
     }
 
     if (bs_pointer > ch_data->bs_num_env + 1) {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
                bs_pointer);
         return -1;
@@ -722,7 +712,7 @@ static int read_sbr_grid(AACContext *ac,
 
     for (i = 1; i <= ch_data->bs_num_env; i++) {
         if (ch_data->t_env[i-1] > ch_data->t_env[i]) {
-            av_log(ac->avccontext, AV_LOG_ERROR, "Non monotone time borders\n");
+            av_log(ac->avctx, AV_LOG_ERROR, "Non monotone time borders\n");
             return -1;
         }
     }
@@ -903,25 +893,24 @@ static void read_sbr_extension(AACContex
                                GetBitContext *gb,
                                int bs_extension_id, int *num_bits_left)
 {
-//TODO - implement ps_data for parametric stereo parsing
     switch (bs_extension_id) {
     case EXTENSION_ID_PS:
         if (!ac->m4ac.ps) {
-            av_log(ac->avccontext, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
+            av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
             skip_bits_long(gb, *num_bits_left); // bs_fill_bits
             *num_bits_left = 0;
         } else {
-#if 0
-            *num_bits_left -= ff_ps_data(gb, ps);
+#if 1
+            *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left);
 #else
-            av_log_missing_feature(ac->avccontext, "Parametric Stereo is", 0);
+            av_log_missing_feature(ac->avctx, "Parametric Stereo is", 0);
             skip_bits_long(gb, *num_bits_left); // bs_fill_bits
             *num_bits_left = 0;
 #endif
         }
         break;
     default:
-        av_log_missing_feature(ac->avccontext, "Reserved SBR extensions are", 1);
+        av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
         skip_bits_long(gb, *num_bits_left); // bs_fill_bits
         *num_bits_left = 0;
         break;
@@ -1006,7 +995,7 @@ static unsigned int read_sbr_data(AACCon
             return get_bits_count(gb) - cnt;
         }
     } else {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
             "Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
         sbr->start = 0;
         return get_bits_count(gb) - cnt;
@@ -1021,6 +1010,11 @@ static unsigned int read_sbr_data(AACCon
             num_bits_left -= 2;
             read_sbr_extension(ac, sbr, gb, get_bits(gb, 2), &num_bits_left); // bs_extension_id
         }
+        if (num_bits_left < 0) {
+            av_log(ac->avctx, AV_LOG_ERROR, "SBR Extension over read.\n");
+        }
+        if (num_bits_left > 0)
+            skip_bits(gb, num_bits_left);
     }
 
     return get_bits_count(gb) - cnt;
@@ -1033,7 +1027,7 @@ static void sbr_reset(AACContext *ac, Sp
     if (err >= 0)
         err = sbr_make_f_derived(ac, sbr);
     if (err < 0) {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "SBR reset failed. Switching SBR to pure upsampling mode.\n");
         sbr->start = 0;
     }
@@ -1085,7 +1079,7 @@ int ff_decode_sbr_extension(AACContext *
     bytes_read = ((num_sbr_bits + num_align_bits + 4) >> 3);
 
     if (bytes_read > cnt) {
-        av_log(ac->avccontext, AV_LOG_ERROR,
+        av_log(ac->avctx, AV_LOG_ERROR,
                "Expected to read %d SBR bytes actually read %d.\n", cnt, bytes_read);
     }
     return cnt;
@@ -1139,7 +1133,7 @@ static void sbr_dequant(SpectralBandRepl
  * @param   x       pointer to the beginning of the first sample window
  * @param   W       array of complex-valued samples split into subbands
  */
-static void sbr_qmf_analysis(DSPContext *dsp, RDFTContext *rdft, const float *in, float *x,
+static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x,
                              float z[320], float W[2][32][32][2],
                              float scale)
 {
@@ -1152,23 +1146,23 @@ static void sbr_qmf_analysis(DSPContext 
         memcpy(x+288, in, 1024*sizeof(*x));
     for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames
                                // are not supported
-        float re, im;
         dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320);
         for (k = 0; k < 64; k++) {
             float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
-            z[k] = f * analysis_cos_pre[k];
-            z[k+64] = f;
+            z[k] = f;
         }
-        ff_rdft_calc(rdft, z);
-        re = z[0] * 0.5f;
-        im = 0.5f * dsp->scalarproduct_float(z+64, analysis_sin_pre, 64);
-        W[1][i][0][0] = re * analysis_cossin_post[0][0] - im * analysis_cossin_post[0][1];
-        W[1][i][0][1] = re * analysis_cossin_post[0][1] + im * analysis_cossin_post[0][0];
+        //Shuffle to IMDCT
+        z[64] = z[0];
         for (k = 1; k < 32; k++) {
-            re = z[2*k  ] - re;
-            im = z[2*k+1] - im;
-            W[1][i][k][0] = re * analysis_cossin_post[k][0] - im * analysis_cossin_post[k][1];
-            W[1][i][k][1] = re * analysis_cossin_post[k][1] + im * analysis_cossin_post[k][0];
+            z[64+2*k-1] =  z[   k];
+            z[64+2*k  ] = -z[64-k];
+        }
+        z[64+63] = z[32];
+
+        ff_imdct_half(mdct, z, z+64);
+        for (k = 0; k < 32; k++) {
+            W[1][i][k][0] = -z[63-k];
+            W[1][i][k][1] = z[k];
         }
         x += 32;
     }
@@ -1179,7 +1173,7 @@ static void sbr_qmf_analysis(DSPContext 
  * (14496-3 sp04 p206)
  */
 static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
-                              float *out, float X[2][32][64],
+                              float *out, float X[2][38][64],
                               float mdct_buf[2][64],
                               float *v0, int *v_off, const unsigned int div,
                               float bias, float scale)
@@ -1197,21 +1191,22 @@ static void sbr_qmf_synthesis(DSPContext
             *v_off -= 128 >> div;
         }
         v = v0 + *v_off;
-        for (n = 1; n < 64 >> div; n+=2) {
-            X[1][i][n] = -X[1][i][n];
-        }
-        if (div) {
-            memset(X[0][i]+32, 0, 32*sizeof(float));
-            memset(X[1][i]+32, 0, 32*sizeof(float));
-        }
-        ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
-        ff_imdct_half(mdct, mdct_buf[1], X[1][i]);
         if (div) {
             for (n = 0; n < 32; n++) {
-                v[      n] = -mdct_buf[0][63 - 2*n] + mdct_buf[1][2*n    ];
-                v[ 63 - n] =  mdct_buf[0][62 - 2*n] + mdct_buf[1][2*n + 1];
+                X[0][i][   n] = -X[0][i][n];
+                X[0][i][32+n] =  X[1][i][31-n];
+            }
+            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
+            for (n = 0; n < 32; n++) {
+                v[     n] =  mdct_buf[0][63 - 2*n];
+                v[63 - n] = -mdct_buf[0][62 - 2*n];
             }
         } else {
+            for (n = 1; n < 64; n+=2) {
+                X[1][i][n] = -X[1][i][n];
+            }
+            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
+            ff_imdct_half(mdct, mdct_buf[1], X[1][i]);
             for (n = 0; n < 64; n++) {
                 v[      n] = -mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
                 v[127 - n] =  mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
@@ -1380,7 +1375,7 @@ static int sbr_hf_gen(AACContext *ac, Sp
             g--;
 
             if (g < 0) {
-                av_log(ac->avccontext, AV_LOG_ERROR,
+                av_log(ac->avctx, AV_LOG_ERROR,
                        "ERROR : no subband found for frequency %d\n", k);
                 return -1;
             }
@@ -1414,7 +1409,7 @@ static int sbr_hf_gen(AACContext *ac, Sp
 }
 
 /// Generate the subband filtered lowband
-static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][32][64],
+static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
                      const float X_low[32][40][2], const float Y[2][38][64][2],
                      int ch)
 {
@@ -1436,7 +1431,7 @@ static int sbr_x_gen(SpectralBandReplica
     }
 
     for (k = 0; k < sbr->kx[1]; k++) {
-        for (i = i_Temp; i < i_f; i++) {
+        for (i = i_Temp; i < 38; i++) {
             X[0][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][0];
             X[1][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][1];
         }
@@ -1730,7 +1725,7 @@ void ff_sbr_apply(AACContext *ac, Spectr
     }
     for (ch = 0; ch < nch; ch++) {
         /* decode channel */
-        sbr_qmf_analysis(&ac->dsp, &sbr->rdft, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
+        sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
                          (float*)sbr->qmf_filter_scratch,
                          sbr->data[ch].W, 1/(-1024 * ac->sf_scale));
         sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
@@ -1752,6 +1747,16 @@ void ff_sbr_apply(AACContext *ac, Spectr
         /* synthesis */
         sbr_x_gen(sbr, sbr->X[ch], sbr->X_low, sbr->data[ch].Y, ch);
     }
+
+    if (ac->m4ac.ps == 1) {
+        if (sbr->ps.start) {
+            ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
+        } else {
+            memcpy(sbr->X[1], sbr->X[0], sizeof(sbr->X[0]));
+        }
+        nch = 2;
+    }
+
     sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch,
                       sbr->data[0].synthesis_filterbank_samples,
                       &sbr->data[0].synthesis_filterbank_samples_offset,

Modified: branches/0.6-aac-he-v2/libavcodec/aactab.c
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aactab.c	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aactab.c	Sat Jun 26 17:29:53 2010	(r23800)
@@ -29,6 +29,7 @@
 
 #include "libavutil/mem.h"
 #include "aac.h"
+#include "aac_tablegen.h"
 
 #include <stdint.h>
 
@@ -1204,129 +1205,3 @@ const uint8_t ff_tns_max_bands_128[] = {
     9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
 };
 // @}
-
-
-#if CONFIG_HARDCODED_TABLES
-
-/**
- * Table of pow(2, (i - 200)/4.) used for different purposes depending on the
- * range of indices to the table:
- * [ 0, 255] scale factor decoding when using C dsp.float_to_int16
- * [60, 315] scale factor decoding when using SIMD dsp.float_to_int16
- * [45, 300] intensity stereo position decoding mapped in reverse order i.e. 0->300, 1->299, ..., 254->46, 255->45
- */
-const float ff_aac_pow2sf_tab[428] = {
-    8.88178420e-16, 1.05622810e-15, 1.25607397e-15, 1.49373210e-15,
-    1.77635684e-15, 2.11245619e-15, 2.51214793e-15, 2.98746420e-15,
-    3.55271368e-15, 4.22491238e-15, 5.02429587e-15, 5.97492839e-15,
-    7.10542736e-15, 8.44982477e-15, 1.00485917e-14, 1.19498568e-14,
-    1.42108547e-14, 1.68996495e-14, 2.00971835e-14, 2.38997136e-14,
-    2.84217094e-14, 3.37992991e-14, 4.01943669e-14, 4.77994272e-14,
-    5.68434189e-14, 6.75985982e-14, 8.03887339e-14, 9.55988543e-14,
-    1.13686838e-13, 1.35197196e-13, 1.60777468e-13, 1.91197709e-13,
-    2.27373675e-13, 2.70394393e-13, 3.21554936e-13, 3.82395417e-13,
-    4.54747351e-13, 5.40788785e-13, 6.43109871e-13, 7.64790834e-13,
-    9.09494702e-13, 1.08157757e-12, 1.28621974e-12, 1.52958167e-12,
-    1.81898940e-12, 2.16315514e-12, 2.57243948e-12, 3.05916334e-12,
-    3.63797881e-12, 4.32631028e-12, 5.14487897e-12, 6.11832668e-12,
-    7.27595761e-12, 8.65262056e-12, 1.02897579e-11, 1.22366534e-11,
-    1.45519152e-11, 1.73052411e-11, 2.05795159e-11, 2.44733067e-11,
-    2.91038305e-11, 3.46104823e-11, 4.11590317e-11, 4.89466134e-11,
-    5.82076609e-11, 6.92209645e-11, 8.23180635e-11, 9.78932268e-11,
-    1.16415322e-10, 1.38441929e-10, 1.64636127e-10, 1.95786454e-10,
-    2.32830644e-10, 2.76883858e-10, 3.29272254e-10, 3.91572907e-10,
-    4.65661287e-10, 5.53767716e-10, 6.58544508e-10, 7.83145814e-10,
-    9.31322575e-10, 1.10753543e-09, 1.31708902e-09, 1.56629163e-09,
-    1.86264515e-09, 2.21507086e-09, 2.63417803e-09, 3.13258326e-09,
-    3.72529030e-09, 4.43014173e-09, 5.26835606e-09, 6.26516652e-09,
-    7.45058060e-09, 8.86028346e-09, 1.05367121e-08, 1.25303330e-08,
-    1.49011612e-08, 1.77205669e-08, 2.10734243e-08, 2.50606661e-08,
-    2.98023224e-08, 3.54411338e-08, 4.21468485e-08, 5.01213321e-08,
-    5.96046448e-08, 7.08822677e-08, 8.42936970e-08, 1.00242664e-07,
-    1.19209290e-07, 1.41764535e-07, 1.68587394e-07, 2.00485328e-07,
-    2.38418579e-07, 2.83529071e-07, 3.37174788e-07, 4.00970657e-07,
-    4.76837158e-07, 5.67058141e-07, 6.74349576e-07, 8.01941314e-07,
-    9.53674316e-07, 1.13411628e-06, 1.34869915e-06, 1.60388263e-06,
-    1.90734863e-06, 2.26823256e-06, 2.69739830e-06, 3.20776526e-06,
-    3.81469727e-06, 4.53646513e-06, 5.39479661e-06, 6.41553051e-06,
-    7.62939453e-06, 9.07293026e-06, 1.07895932e-05, 1.28310610e-05,
-    1.52587891e-05, 1.81458605e-05, 2.15791864e-05, 2.56621220e-05,
-    3.05175781e-05, 3.62917210e-05, 4.31583729e-05, 5.13242441e-05,
-    6.10351562e-05, 7.25834421e-05, 8.63167458e-05, 1.02648488e-04,
-    1.22070312e-04, 1.45166884e-04, 1.72633492e-04, 2.05296976e-04,
-    2.44140625e-04, 2.90333768e-04, 3.45266983e-04, 4.10593953e-04,
-    4.88281250e-04, 5.80667537e-04, 6.90533966e-04, 8.21187906e-04,
-    9.76562500e-04, 1.16133507e-03, 1.38106793e-03, 1.64237581e-03,
-    1.95312500e-03, 2.32267015e-03, 2.76213586e-03, 3.28475162e-03,
-    3.90625000e-03, 4.64534029e-03, 5.52427173e-03, 6.56950324e-03,
-    7.81250000e-03, 9.29068059e-03, 1.10485435e-02, 1.31390065e-02,
-    1.56250000e-02, 1.85813612e-02, 2.20970869e-02, 2.62780130e-02,
-    3.12500000e-02, 3.71627223e-02, 4.41941738e-02, 5.25560260e-02,
-    6.25000000e-02, 7.43254447e-02, 8.83883476e-02, 1.05112052e-01,
-    1.25000000e-01, 1.48650889e-01, 1.76776695e-01, 2.10224104e-01,
-    2.50000000e-01, 2.97301779e-01, 3.53553391e-01, 4.20448208e-01,
-    5.00000000e-01, 5.94603558e-01, 7.07106781e-01, 8.40896415e-01,
-    1.00000000e+00, 1.18920712e+00, 1.41421356e+00, 1.68179283e+00,
-    2.00000000e+00, 2.37841423e+00, 2.82842712e+00, 3.36358566e+00,
-    4.00000000e+00, 4.75682846e+00, 5.65685425e+00, 6.72717132e+00,
-    8.00000000e+00, 9.51365692e+00, 1.13137085e+01, 1.34543426e+01,
-    1.60000000e+01, 1.90273138e+01, 2.26274170e+01, 2.69086853e+01,
-    3.20000000e+01, 3.80546277e+01, 4.52548340e+01, 5.38173706e+01,
-    6.40000000e+01, 7.61092554e+01, 9.05096680e+01, 1.07634741e+02,
-    1.28000000e+02, 1.52218511e+02, 1.81019336e+02, 2.15269482e+02,
-    2.56000000e+02, 3.04437021e+02, 3.62038672e+02, 4.30538965e+02,
-    5.12000000e+02, 6.08874043e+02, 7.24077344e+02, 8.61077929e+02,
-    1.02400000e+03, 1.21774809e+03, 1.44815469e+03, 1.72215586e+03,
-    2.04800000e+03, 2.43549617e+03, 2.89630938e+03, 3.44431172e+03,
-    4.09600000e+03, 4.87099234e+03, 5.79261875e+03, 6.88862343e+03,
-    8.19200000e+03, 9.74198469e+03, 1.15852375e+04, 1.37772469e+04,
-    1.63840000e+04, 1.94839694e+04, 2.31704750e+04, 2.75544937e+04,
-    3.27680000e+04, 3.89679387e+04, 4.63409500e+04, 5.51089875e+04,
-    6.55360000e+04, 7.79358775e+04, 9.26819000e+04, 1.10217975e+05,
-    1.31072000e+05, 1.55871755e+05, 1.85363800e+05, 2.20435950e+05,
-    2.62144000e+05, 3.11743510e+05, 3.70727600e+05, 4.40871900e+05,
-    5.24288000e+05, 6.23487020e+05, 7.41455200e+05, 8.81743800e+05,
-    1.04857600e+06, 1.24697404e+06, 1.48291040e+06, 1.76348760e+06,
-    2.09715200e+06, 2.49394808e+06, 2.96582080e+06, 3.52697520e+06,
-    4.19430400e+06, 4.98789616e+06, 5.93164160e+06, 7.05395040e+06,
-    8.38860800e+06, 9.97579232e+06, 1.18632832e+07, 1.41079008e+07,
-    1.67772160e+07, 1.99515846e+07, 2.37265664e+07, 2.82158016e+07,
-    3.35544320e+07, 3.99031693e+07, 4.74531328e+07, 5.64316032e+07,
-    6.71088640e+07, 7.98063385e+07, 9.49062656e+07, 1.12863206e+08,
-    1.34217728e+08, 1.59612677e+08, 1.89812531e+08, 2.25726413e+08,
-    2.68435456e+08, 3.19225354e+08, 3.79625062e+08, 4.51452825e+08,
-    5.36870912e+08, 6.38450708e+08, 7.59250125e+08, 9.02905651e+08,
-    1.07374182e+09, 1.27690142e+09, 1.51850025e+09, 1.80581130e+09,
-    2.14748365e+09, 2.55380283e+09, 3.03700050e+09, 3.61162260e+09,
-    4.29496730e+09, 5.10760567e+09, 6.07400100e+09, 7.22324521e+09,
-    8.58993459e+09, 1.02152113e+10, 1.21480020e+10, 1.44464904e+10,
-    1.71798692e+10, 2.04304227e+10, 2.42960040e+10, 2.88929808e+10,
-    3.43597384e+10, 4.08608453e+10, 4.85920080e+10, 5.77859616e+10,
-    6.87194767e+10, 8.17216907e+10, 9.71840160e+10, 1.15571923e+11,
-    1.37438953e+11, 1.63443381e+11, 1.94368032e+11, 2.31143847e+11,
-    2.74877907e+11, 3.26886763e+11, 3.88736064e+11, 4.62287693e+11,
-    5.49755814e+11, 6.53773525e+11, 7.77472128e+11, 9.24575386e+11,
-    1.09951163e+12, 1.30754705e+12, 1.55494426e+12, 1.84915077e+12,
-    2.19902326e+12, 2.61509410e+12, 3.10988851e+12, 3.69830155e+12,
-    4.39804651e+12, 5.23018820e+12, 6.21977702e+12, 7.39660309e+12,
-    8.79609302e+12, 1.04603764e+13, 1.24395540e+13, 1.47932062e+13,
-    1.75921860e+13, 2.09207528e+13, 2.48791081e+13, 2.95864124e+13,
-    3.51843721e+13, 4.18415056e+13, 4.97582162e+13, 5.91728247e+13,
-    7.03687442e+13, 8.36830112e+13, 9.95164324e+13, 1.18345649e+14,
-    1.40737488e+14, 1.67366022e+14, 1.99032865e+14, 2.36691299e+14,
-    2.81474977e+14, 3.34732045e+14, 3.98065730e+14, 4.73382598e+14,
-    5.62949953e+14, 6.69464090e+14, 7.96131459e+14, 9.46765196e+14,
-    1.12589991e+15, 1.33892818e+15, 1.59226292e+15, 1.89353039e+15,
-    2.25179981e+15, 2.67785636e+15, 3.18452584e+15, 3.78706078e+15,
-    4.50359963e+15, 5.35571272e+15, 6.36905167e+15, 7.57412156e+15,
-    9.00719925e+15, 1.07114254e+16, 1.27381033e+16, 1.51482431e+16,
-    1.80143985e+16, 2.14228509e+16, 2.54762067e+16, 3.02964863e+16,
-    3.60287970e+16, 4.28457018e+16, 5.09524134e+16, 6.05929725e+16,
-    7.20575940e+16, 8.56914035e+16, 1.01904827e+17, 1.21185945e+17,
-};
-
-#else
-
-float ff_aac_pow2sf_tab[428];
-
-#endif /* CONFIG_HARDCODED_TABLES */

Modified: branches/0.6-aac-he-v2/libavcodec/aactab.h
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/aactab.h	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/aactab.h	Sat Jun 26 17:29:53 2010	(r23800)
@@ -32,6 +32,7 @@
 
 #include "libavutil/mem.h"
 #include "aac.h"
+#include "aac_tablegen_decl.h"
 
 #include <stdint.h>
 
@@ -73,10 +74,4 @@ extern const uint16_t * const ff_swb_off
 extern const uint8_t ff_tns_max_bands_1024[13];
 extern const uint8_t ff_tns_max_bands_128 [13];
 
-#if CONFIG_HARDCODED_TABLES
-extern const float ff_aac_pow2sf_tab[428];
-#else
-extern       float ff_aac_pow2sf_tab[428];
-#endif /* CONFIG_HARDCODED_TABLES */
-
 #endif /* AVCODEC_AACTAB_H */

Modified: branches/0.6-aac-he-v2/libavcodec/sbr.h
==============================================================================
--- branches/0.6-aac-he-v2/libavcodec/sbr.h	Sat Jun 26 17:26:35 2010	(r23799)
+++ branches/0.6-aac-he-v2/libavcodec/sbr.h	Sat Jun 26 17:29:53 2010	(r23800)
@@ -31,6 +31,7 @@
 
 #include <stdint.h>
 #include "fft.h"
+#include "aacps.h"
 
 /**
  * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
@@ -133,6 +134,7 @@ typedef struct {
     ///The number of frequency bands in f_master
     unsigned           n_master;
     SBRData            data[2];
+    PSContext          ps;
     ///N_Low and N_High respectively, the number of frequency bands for low and high resolution
     unsigned           n[2];
     ///Number of noise floor bands
@@ -157,7 +159,7 @@ typedef struct {
     ///QMF output of the HF generator
     float              X_high[64][40][2];
     ///QMF values of the reconstructed signal
-    DECLARE_ALIGNED(16, float, X)[2][2][32][64];
+    DECLARE_ALIGNED(16, float, X)[2][2][38][64];
     ///Zeroth coefficient used to filter the subband signals
     float              alpha0[64][2];
     ///First coefficient used to filter the subband signals
@@ -176,7 +178,7 @@ typedef struct {
     float              s_m[7][48];
     float              gain[7][48];
     DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64];
-    RDFTContext        rdft;
+    FFTContext         mdct_ana;
     FFTContext         mdct;
 } SpectralBandReplication;
 



More information about the ffmpeg-cvslog mailing list