yading@10: /* yading@10: * Musepack decoder yading@10: * Copyright (c) 2006 Konstantin Shishkov yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: /** yading@10: * @file yading@10: * Musepack decoder yading@10: * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples yading@10: * divided into 32 subbands. yading@10: */ yading@10: yading@10: #ifndef AVCODEC_MPC_H yading@10: #define AVCODEC_MPC_H yading@10: yading@10: #include "libavutil/lfg.h" yading@10: #include "avcodec.h" yading@10: #include "get_bits.h" yading@10: #include "dsputil.h" yading@10: #include "mpegaudio.h" yading@10: #include "mpegaudiodsp.h" yading@10: yading@10: #define BANDS 32 yading@10: #define SAMPLES_PER_BAND 36 yading@10: #define MPC_FRAME_SIZE (BANDS * SAMPLES_PER_BAND) yading@10: yading@10: /** Subband structure - hold all variables for each subband */ yading@10: typedef struct Band { yading@10: int msf; ///< mid-stereo flag yading@10: int res[2]; yading@10: int scfi[2]; yading@10: int scf_idx[2][3]; yading@10: int Q[2]; yading@10: }Band; yading@10: yading@10: typedef struct MPCContext { yading@10: DSPContext dsp; yading@10: MPADSPContext mpadsp; yading@10: GetBitContext gb; yading@10: int IS, MSS, gapless; yading@10: int lastframelen; yading@10: int maxbands, last_max_band; yading@10: int last_bits_used; yading@10: int oldDSCF[2][BANDS]; yading@10: Band bands[BANDS]; yading@10: int Q[2][MPC_FRAME_SIZE]; yading@10: int cur_frame, frames; yading@10: uint8_t *bits; yading@10: int buf_size; yading@10: AVLFG rnd; yading@10: int frames_to_skip; yading@10: /* for synthesis */ yading@10: DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2]; yading@10: int synth_buf_offset[MPA_MAX_CHANNELS]; yading@10: DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; yading@10: } MPCContext; yading@10: yading@10: void ff_mpc_init(void); yading@10: void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels); yading@10: yading@10: #endif /* AVCODEC_MPC_H */