diff options
author | Benjamin Larsson <banan@ludd.ltu.se> | 2009-09-19 01:45:00 +0000 |
---|---|---|
committer | Benjamin Larsson <banan@ludd.ltu.se> | 2009-09-19 01:45:00 +0000 |
commit | 0105f49792f675ecdca76b59979a70e1e21872dd (patch) | |
tree | 34f2f22d08d89b552610c0661d7f7eb72eee7f56 /libavcodec/atrac1.c | |
parent | 0ae2ccff560cb23dc0a30c02234b25b9cd958975 (diff) | |
download | ffmpeg-0105f49792f675ecdca76b59979a70e1e21872dd.tar.gz |
Fix the short block transform for atrac1.
Originally committed as revision 19917 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/atrac1.c')
-rw-r--r-- | libavcodec/atrac1.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 42c4801fb6..17f90b164d 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -73,7 +73,6 @@ typedef struct { typedef struct { AT1SUCtx SUs[AT1_MAX_CHANNELS]; ///< channel sound unit DECLARE_ALIGNED_16(float,spec[AT1_SU_SAMPLES]); ///< the mdct spectrum buffer - DECLARE_ALIGNED_16(float,short_buf[512]); ///< buffer for the short mode DECLARE_ALIGNED_16(float, low[256]); DECLARE_ALIGNED_16(float, mid[256]); @@ -133,6 +132,7 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q) return -1; if (num_blocks == 1) { + /* long blocks */ at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos], nbits, band_num); pos += block_size; // move to the next mdct block in the spectrum @@ -142,29 +142,21 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q) memcpy(q->bands[band_num]+32, &su->spectrum[0][ref_pos+16], 240 * sizeof(float)); } else { - /* calc start position for the 1st short block: 96(128) or 112(256) */ - int short_pos = 32; + /* short blocks */ float *prev_buf; - start_pos = (band_samples * (num_blocks - 1)) >> (log2_block_count + 1); - memset(&su->spectrum[0][ref_pos], 0, sizeof(float) * (band_samples * 2)); - + start_pos = 0; prev_buf = &su->spectrum[1][ref_pos+band_samples-16]; for (; num_blocks!=0 ; num_blocks--) { - /* use hardcoded nbits for the short mode */ - at1_imdct(q, &q->spec[pos], &q->short_buf[short_pos], 5, band_num); + at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos+start_pos], 5, band_num); /* overlap and window between short blocks */ - q->dsp.vector_fmul_window(&su->spectrum[0][ref_pos+start_pos], - &q->short_buf[short_pos-16], - &q->short_buf[short_pos],short_window, 0, 16); - - prev_buf = &q->short_buf[short_pos+16]; + q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf, + &su->spectrum[0][ref_pos+start_pos], short_window, 0, 16); + prev_buf = &su->spectrum[0][ref_pos+start_pos+16]; start_pos += 32; // use hardcoded block_size pos += 32; - short_pos +=32; } - memcpy(q->bands[band_num], &su->spectrum[0][ref_pos], band_samples*sizeof(float)); } ref_pos += band_samples; } |