46 static VLC_TYPE quant_tables[7224][2];
59 for (
int j = 0; j < 2; j++) {
63 &raw_quant_table[1], 2,
64 &raw_quant_table[0], 2, 1,
91 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
95 c->bdsp.bswap_buf((uint32_t *) buf, (
const uint32_t *) avctx->
extradata, 4);
109 c->IS,
c->MSS,
c->gapless,
c->lastframelen,
c->maxbands);
110 c->frames_to_skip = 0;
149 case 3:
case 4:
case 5:
case 6:
case 7:
154 case 8:
case 9:
case 10:
case 11:
case 12:
155 case 13:
case 14:
case 15:
case 16:
case 17:
156 t = (1 << (idx - 2)) - 1;
174 int *got_frame_ptr,
AVPacket *avpkt)
184 int off, ret, last_frame, skip;
185 int bits_used, bits_avail;
187 memset(
bands, 0,
sizeof(*
bands) * (
c->maxbands + 1));
189 buf_size = avpkt->
size & ~3;
195 if (buf_size != avpkt->
size) {
197 "extra bytes at the end will be skipped.\n");
213 c->bdsp.bswap_buf((uint32_t *)
c->bits, (
const uint32_t *) buf,
220 for(
i = 0;
i <=
c->maxbands;
i++){
221 for(ch = 0; ch < 2; ch++){
237 for(
i = 0;
i <=
mb;
i++)
238 for(ch = 0; ch < 2; ch++)
241 for(
i = 0;
i <=
mb;
i++){
242 for(ch = 0; ch < 2; ch++){
244 bands[
i].scf_idx[ch][2] =
c->oldDSCF[ch][
i];
246 switch(
bands[
i].scfi[ch]){
263 c->oldDSCF[ch][
i] =
bands[
i].scf_idx[ch][2];
268 memset(
c->Q, 0,
sizeof(
c->Q));
271 for(ch = 0; ch < 2; ch++)
279 bits_avail = buf_size * 8;
280 if (!last_frame && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))) {
281 av_log(avctx,
AV_LOG_ERROR,
"Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
284 if(
c->frames_to_skip){
299 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
300 c->frames_to_skip = 32;
static void flush(AVCodecContext *avctx)
static enum AVSampleFormat sample_fmts[]
static const float bands[]
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
audio channel layout utility functions
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
bitstream reader API header.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CH_LAYOUT_STEREO
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int ff_thread_once(char *control, void(*routine)(void))
#define LOCAL_ALIGNED_16(t, v,...)
static int mpc7_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static av_cold int mpc7_decode_close(AVCodecContext *avctx)
static int get_scale_idx(GetBitContext *gb, int ref)
static av_cold int mpc7_decode_init(AVCodecContext *avctx)
static VLC quant_vlc[MPC7_QUANT_VLC_TABLES][2]
static void mpc7_decode_flush(AVCodecContext *avctx)
static void idx_to_quant(MPCContext *c, GetBitContext *gb, int idx, int *dst)
Fill samples for given subband.
static av_cold void mpc7_init_static(void)
static const uint8_t mpc7_scfi[MPC7_SCFI_SIZE *2]
static const int8_t mpc7_idx32[]
static const uint8_t mpc7_hdr[MPC7_HDR_SIZE *2]
static const uint8_t mpc7_dscf[MPC7_DSCF_SIZE *2]
static const uint8_t mpc7_quant_vlc_sizes[MPC7_QUANT_VLC_TABLES]
#define MPC7_QUANT_VLC_TABLES
static const uint8_t mpc7_quant_vlcs[177 *2 *2]
static const int8_t mpc7_idx51[]
static const int8_t mpc7_idx30[]
static const int8_t mpc7_quant_vlc_off[MPC7_QUANT_VLC_TABLES]
static const int8_t mpc7_idx50[]
static const int8_t mpc7_idx31[]
Musepack decoder MPEG Audio Layer 1/2 -like codec with frames of 1152 samples divided into 32 subband...
av_cold void ff_mpadsp_init(MPADSPContext *s)
void ff_mpa_synth_init_fixed(void)
static const uint16_t table[]
#define FF_ARRAY_ELEMS(a)
main external API structure.
enum AVSampleFormat sample_fmt
audio sample format
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int channels
number of audio channels
uint64_t channel_layout
Audio channel layout.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.
This structure stores compressed data.
Subband structure - hold all variables for each subband.
VLC_TYPE(* table)[2]
code, bits
#define avpriv_request_sample(...)
static int ref[MAX_W *MAX_W]
static const uint8_t offset[127][2]
#define INIT_VLC_STATIC_OVERLONG
#define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, symbols, symbols_wrap, symbols_size, offset, flags, static_size)