diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-20 05:42:04 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-20 05:48:22 +0200 |
commit | 80d156d7fdc44b09783ba242fe2681a6d4cc8df5 (patch) | |
tree | 7881b70297c87daa2f6d6f4790afaf438c53b3aa /libavcodec/qdm2.c | |
parent | 6efb29686fc9a7f76480405df8fe7eaa7a9dd4cf (diff) | |
parent | 984ece7503597d30e6f3bdeb67e337ea1616f880 (diff) | |
download | ffmpeg-80d156d7fdc44b09783ba242fe2681a6d4cc8df5.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
qdm2: Use floating point synthesis filter.
h264: correct border check.
h264: fix loopfilter with threading at slice boundaries.
Fix ff_mpa_synth_filter_fixed() prototype
Rename costablegen.c ---> cos_tablegen.c.
Collapse tableprint.c into tableprint.h.
Simplify trig table rules
Remove potentially unstable filenames from comments in generated files.
Ignore generated tables and generated table generator programs.
Simplify CLEANFILES make variable by using wildcards.
Remove silly insults from avformat_version() Doxygen documentation.
mpegaudiodsp: fix x86 and ppc makefiles
configure: Adjust AVX assembler check.
mpegaudio: remove unused version of SAME_HEADER_MASK
mpegaudio: remove useless #undef at end of file
asfdec: add missing #include for av_bswap32()
mpegaudio: merge two #if CONFIG_FLOAT blocks
mpegaudio: move some struct definitions from mpegaudio.h
Move some mpegaudio functions to new mpegaudiodsp subsystem
Conflicts:
libavcodec/h264.c
libavcodec/x86/Makefile
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r-- | libavcodec/qdm2.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index e1165074f7..b9252bab40 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -39,6 +39,7 @@ #include "get_bits.h" #include "dsputil.h" #include "rdft.h" +#include "mpegaudiodsp.h" #include "mpegaudio.h" #include "qdm2data.h" @@ -170,9 +171,10 @@ typedef struct { float output_buffer[1024]; /// Synthesis filter - DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2]; + MPADSPContext mpadsp; + DECLARE_ALIGNED(32, float, synth_buf)[MPA_MAX_CHANNELS][512*2]; int synth_buf_offset[MPA_MAX_CHANNELS]; - DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][128][SBLIMIT]; + DECLARE_ALIGNED(32, float, sb_samples)[MPA_MAX_CHANNELS][128][SBLIMIT]; /// Mixed temporary data used in decoding float tone_level[MPA_MAX_CHANNELS][30][64]; @@ -329,11 +331,6 @@ static av_cold void qdm2_init_vlc(void) } } - -/* for floating point to fixed point conversion */ -static const float f2i_scale = (float) (1 << (FRAC_BITS - 15)); - - static int qdm2_get_vlc (GetBitContext *gb, VLC *vlc, int flag, int depth) { int value; @@ -482,8 +479,8 @@ static void build_sb_samples_from_noise (QDM2Context *q, int sb) for (ch = 0; ch < q->nb_channels; ch++) for (j = 0; j < 64; j++) { - q->sb_samples[ch][j * 2][sb] = (int32_t)(f2i_scale * SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j] + .5); - q->sb_samples[ch][j * 2 + 1][sb] = (int32_t)(f2i_scale * SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j] + .5); + q->sb_samples[ch][j * 2][sb] = SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j]; + q->sb_samples[ch][j * 2 + 1][sb] = SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j]; } } @@ -923,11 +920,11 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l for (chs = 0; chs < q->nb_channels; chs++) for (k = 0; k < run; k++) if ((j + k) < 128) - q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5); + q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs]; } else { for (k = 0; k < run; k++) if ((j + k) < 128) - q->sb_samples[ch][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[ch][sb][(j + k)/2] * samples[k] + .5); + q->sb_samples[ch][j + k][sb] = q->tone_level[ch][sb][(j + k)/2] * samples[k]; } j += run; @@ -1601,7 +1598,7 @@ static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet) */ static void qdm2_synthesis_filter (QDM2Context *q, int index) { - OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE]; + float samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE]; int i, k, ch, sb_used, sub_sampling, dither_state = 0; /* copy sb_samples */ @@ -1613,11 +1610,12 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index) q->sb_samples[ch][(8 * index) + i][k] = 0; for (ch = 0; ch < q->nb_channels; ch++) { - OUT_INT *samples_ptr = samples + ch; + float *samples_ptr = samples + ch; for (i = 0; i < 8; i++) { - ff_mpa_synth_filter_fixed(q->synth_buf[ch], &(q->synth_buf_offset[ch]), - ff_mpa_synth_window_fixed, &dither_state, + ff_mpa_synth_filter_float(&q->mpadsp, + q->synth_buf[ch], &(q->synth_buf_offset[ch]), + ff_mpa_synth_window_float, &dither_state, samples_ptr, q->nb_channels, q->sb_samples[ch][(8 * index) + i]); samples_ptr += 32 * q->nb_channels; @@ -1629,7 +1627,7 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index) for (ch = 0; ch < q->channels; ch++) for (i = 0; i < q->frame_size; i++) - q->output_buffer[q->channels * i + ch] += (float)(samples[q->nb_channels * sub_sampling * i + ch] >> (sizeof(OUT_INT)*8-16)); + q->output_buffer[q->channels * i + ch] += (1 << 23) * samples[q->nb_channels * sub_sampling * i + ch]; } @@ -1646,7 +1644,7 @@ static av_cold void qdm2_init(QDM2Context *q) { initialized = 1; qdm2_init_vlc(); - ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed); + ff_mpa_synth_init_float(ff_mpa_synth_window_float); softclip_table_init(); rnd_table_init(); init_noise_samples(); @@ -1863,6 +1861,7 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx) } ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R); + ff_mpadsp_init(&s->mpadsp); qdm2_init(s); |