Go to the documentation of this file.
43 0, 512, 1024, 1536, 2052, 2564, 3076, 3588, 4100, 4612, 5124,
44 5636, 6164, 6676, 7224
54 static int vlc_initialized = 0;
59 static VLC_TYPE quant_tables[7224][2];
71 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
75 c->bdsp.bswap_buf((uint32_t *) buf, (
const uint32_t *) avctx->
extradata, 4);
90 c->IS,
c->MSS,
c->gapless,
c->lastframelen,
c->maxbands);
91 c->frames_to_skip = 0;
96 if(vlc_initialized)
return 0;
123 for(j = 0; j < 2; j++){
168 case 3:
case 4:
case 5:
case 6:
case 7:
173 case 8:
case 9:
case 10:
case 11:
case 12:
174 case 13:
case 14:
case 15:
case 16:
case 17:
175 t = (1 << (idx - 2)) - 1;
193 int *got_frame_ptr,
AVPacket *avpkt)
203 int off,
ret, last_frame, skip;
204 int bits_used, bits_avail;
206 memset(
bands, 0,
sizeof(*
bands) * (
c->maxbands + 1));
208 buf_size = avpkt->
size & ~3;
214 if (buf_size != avpkt->
size) {
216 "extra bytes at the end will be skipped.\n");
232 c->bdsp.bswap_buf((uint32_t *)
c->bits, (
const uint32_t *) buf,
239 for(
i = 0;
i <=
c->maxbands;
i++){
240 for(ch = 0; ch < 2; ch++){
257 for(
i = 0;
i <=
mb;
i++)
258 for(ch = 0; ch < 2; ch++)
261 for(
i = 0;
i <=
mb;
i++){
262 for(ch = 0; ch < 2; ch++){
264 bands[
i].scf_idx[ch][2] =
c->oldDSCF[ch][
i];
266 switch(
bands[
i].scfi[ch]){
283 c->oldDSCF[ch][
i] =
bands[
i].scf_idx[ch][2];
288 memset(
c->Q, 0,
sizeof(
c->Q));
291 for(ch = 0; ch < 2; ch++)
296 frame->nb_samples =
c->lastframelen;
299 bits_avail = buf_size * 8;
300 if (!last_frame && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))) {
301 av_log(avctx,
AV_LOG_ERROR,
"Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
304 if(
c->frames_to_skip){
319 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
320 c->frames_to_skip = 32;
static const uint8_t mpc7_scfi[MPC7_SCFI_SIZE *2]
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint64_t channel_layout
Audio channel layout.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static enum AVSampleFormat sample_fmts[]
static int get_bits_count(const GetBitContext *s)
av_cold void ff_mpadsp_init(MPADSPContext *s)
This structure describes decoded (raw) audio or video data.
static VLC quant_vlc[MPC7_QUANT_VLC_TABLES][2]
#define init_vlc(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
static const uint16_t quant_offsets[MPC7_QUANT_VLC_TABLES *2+1]
static const uint16_t table[]
static av_cold int mpc7_decode_close(AVCodecContext *avctx)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static const uint8_t mpc7_hdr[MPC7_HDR_SIZE *2]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
#define AV_CH_LAYOUT_STEREO
static const uint16_t mpc7_quant_vlc[MPC7_QUANT_VLC_TABLES][2][64 *2]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
static const int8_t mpc7_idx32[]
static void mpc7_decode_flush(AVCodecContext *avctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
av_cold void ff_mpc_init(void)
static const float bands[]
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
static void flush(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static const int8_t mpc7_idx51[]
static unsigned int get_bits1(GetBitContext *s)
static int mpc7_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
#define INIT_VLC_USE_NEW_STATIC
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define MPC7_QUANT_VLC_TABLES
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum AVSampleFormat sample_fmt
audio sample format
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
int channels
number of audio channels
static int get_scale_idx(GetBitContext *gb, int ref)
#define i(width, name, range_min, range_max)
static const int8_t mpc7_idx31[]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVSampleFormat
Audio sample formats.
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...
static av_cold int mpc7_decode_init(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
static const int8_t mpc7_idx30[]
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
static const uint8_t mpc7_dscf[MPC7_DSCF_SIZE *2]
static const uint8_t mpc7_quant_vlc_sizes[MPC7_QUANT_VLC_TABLES *2]
main external API structure.
static const int8_t mpc7_idx50[]
Subband structure - hold all variables for each subband.
static int ref[MAX_W *MAX_W]
#define avpriv_request_sample(...)
#define LOCAL_ALIGNED_16(t, v,...)
This structure stores compressed data.
static void idx_to_quant(MPCContext *c, GetBitContext *gb, int idx, int *dst)
Fill samples for given subband.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const uint8_t mpc7_quant_vlc_off[MPC7_QUANT_VLC_TABLES]
VLC_TYPE(* table)[2]
code, bits