00001 /* 00002 * Musepack decoder 00003 * Copyright (c) 2006 Konstantin Shishkov 00004 * 00005 * This file is part of FFmpeg. 00006 * 00007 * FFmpeg is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * FFmpeg is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with FFmpeg; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00028 #ifndef FFMPEG_MPC_H 00029 #define FFMPEG_MPC_H 00030 00031 #include "avcodec.h" 00032 #include "bitstream.h" 00033 #include "dsputil.h" 00034 #include "random.h" 00035 00036 #ifdef CONFIG_MPEGAUDIO_HP 00037 #define USE_HIGHPRECISION 00038 #endif 00039 #include "mpegaudio.h" 00040 00041 #include "mpcdata.h" 00042 00043 #define BANDS 32 00044 #define SAMPLES_PER_BAND 36 00045 #define MPC_FRAME_SIZE (BANDS * SAMPLES_PER_BAND) 00046 00048 typedef struct { 00049 int msf; 00050 int res[2]; 00051 int scfi[2]; 00052 int scf_idx[2][3]; 00053 int Q[2]; 00054 }Band; 00055 00056 typedef struct { 00057 DSPContext dsp; 00058 GetBitContext gb; 00059 int IS, MSS, gapless; 00060 int lastframelen; 00061 int maxbands, last_max_band; 00062 int last_bits_used; 00063 int oldDSCF[2][BANDS]; 00064 Band bands[BANDS]; 00065 int Q[2][MPC_FRAME_SIZE]; 00066 int cur_frame, frames; 00067 uint8_t *bits; 00068 int buf_size; 00069 AVRandomState rnd; 00070 int frames_to_skip; 00071 /* for synthesis */ 00072 DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512*2]); 00073 int synth_buf_offset[MPA_MAX_CHANNELS]; 00074 DECLARE_ALIGNED_16(int32_t, sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]); 00075 } MPCContext; 00076 00077 extern void ff_mpc_init(); 00078 extern void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst); 00079 00080 #endif /* FFMPEG_MPC_H */