X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpc.c;h=88f722619be5f5e6f2fabd20211a9d775632d6c8;hb=f450cc7bc595155bacdb9f5d2414a076ccf81b4a;hp=ff010eb633ea0c0e3ce941a0e6ab346ceefaa26c;hpb=bad5537e2c2caeb5deb1ff9d771ea01058b8010c;p=ffmpeg diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c index ff010eb633e..88f722619be 100644 --- a/libavcodec/mpc.c +++ b/libavcodec/mpc.c @@ -2,69 +2,64 @@ * Musepack decoder core * Copyright (c) 2006 Konstantin Shishkov * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** - * @file libavcodec/mpc.c Musepack decoder core + * @file + * Musepack decoder core * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples * divided into 32 subbands. */ -#include "libavutil/random.h" +#include "libavutil/attributes.h" #include "avcodec.h" -#include "bitstream.h" -#include "dsputil.h" +#include "mpegaudiodsp.h" #include "mpegaudio.h" #include "mpc.h" #include "mpcdata.h" -static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]); - -void ff_mpc_init(void) +av_cold void ff_mpc_init(void) { - ff_mpa_synth_init(mpa_window); + ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed); } /** * Process decoded Musepack data and produce PCM */ -static void mpc_synth(MPCContext *c, int16_t *out) +static void mpc_synth(MPCContext *c, int16_t **out, int channels) { int dither_state = 0; int i, ch; - OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr; - for(ch = 0; ch < 2; ch++){ - samples_ptr = samples + ch; + for(ch = 0; ch < channels; ch++){ for(i = 0; i < SAMPLES_PER_BAND; i++) { - ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), - mpa_window, &dither_state, - samples_ptr, 2, + ff_mpa_synth_filter_fixed(&c->mpadsp, + c->synth_buf[ch], &(c->synth_buf_offset[ch]), + ff_mpa_synth_window_fixed, &dither_state, + out[ch] + 32 * i, 1, c->sb_samples[ch][i]); - samples_ptr += 64; } } - for(i = 0; i < MPC_FRAME_SIZE*2; i++) - *out++=samples[i]; } -void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data) +void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, int16_t **out, + int channels) { int i, j, ch; Band *bands = c->bands; @@ -78,13 +73,13 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data) for(ch = 0; ch < 2; ch++){ if(bands[i].res[ch]){ j = 0; - mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][0]]; + mul = mpc_CC[bands[i].res[ch] + 1] * mpc_SCF[bands[i].scf_idx[ch][0]+6]; for(; j < 12; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; - mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][1]]; + mul = mpc_CC[bands[i].res[ch] + 1] * mpc_SCF[bands[i].scf_idx[ch][1]+6]; for(; j < 24; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; - mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][2]]; + mul = mpc_CC[bands[i].res[ch] + 1] * mpc_SCF[bands[i].scf_idx[ch][2]+6]; for(; j < 36; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; } @@ -100,5 +95,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data) } } - mpc_synth(c, data); + mpc_synth(c, out, channels); }