Go to the documentation of this file.
60 for (
int j = 0; j < 2; j++) {
64 &raw_quant_table[1], 2,
65 &raw_quant_table[0], 2, 1,
92 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
96 c->bdsp.bswap_buf((uint32_t *) buf, (
const uint32_t *) avctx->
extradata, 4);
110 c->IS,
c->MSS,
c->gapless,
c->lastframelen,
c->maxbands);
111 c->frames_to_skip = 0;
151 case 3:
case 4:
case 5:
case 6:
case 7:
156 case 8:
case 9:
case 10:
case 11:
case 12:
157 case 13:
case 14:
case 15:
case 16:
case 17:
158 t = (1 << (idx - 2)) - 1;
176 int *got_frame_ptr,
AVPacket *avpkt)
178 const uint8_t *buf = avpkt->
data;
185 int off,
ret, last_frame,
skip;
186 int bits_used, bits_avail;
188 memset(
bands, 0,
sizeof(*
bands) * (
c->maxbands + 1));
190 buf_size = avpkt->
size & ~3;
196 if (buf_size != avpkt->
size) {
198 "extra bytes at the end will be skipped.\n");
214 c->bdsp.bswap_buf((uint32_t *)
c->bits, (
const uint32_t *) buf,
221 for(
i = 0;
i <=
c->maxbands;
i++){
222 for(ch = 0; ch < 2; ch++){
238 for(
i = 0;
i <=
mb;
i++)
239 for(ch = 0; ch < 2; ch++)
242 for(
i = 0;
i <=
mb;
i++){
243 for(ch = 0; ch < 2; ch++){
245 bands[
i].scf_idx[ch][2] =
c->oldDSCF[ch][
i];
247 switch(
bands[
i].scfi[ch]){
264 c->oldDSCF[ch][
i] =
bands[
i].scf_idx[ch][2];
269 memset(
c->Q, 0,
sizeof(
c->Q));
272 for(ch = 0; ch < 2; ch++)
280 bits_avail = buf_size * 8;
281 if (!last_frame && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))) {
282 av_log(avctx,
AV_LOG_ERROR,
"Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
285 if(
c->frames_to_skip){
300 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
301 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.
int ff_vlc_init_from_lengths(VLC *vlc, 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()
static int mpc7_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
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
const FFCodec ff_mpc7_decoder
#define AV_CHANNEL_LAYOUT_STEREO
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
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]
static const uint16_t table[]
static av_cold int mpc7_decode_close(AVCodecContext *avctx)
int nb_channels
Number of channels in this layout.
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.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define FF_CODEC_DECODE_CB(func)
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[]
int(* init)(AVBSFContext *ctx)
#define LOCAL_ALIGNED_16(t, v,...)
static void mpc7_decode_flush(AVCodecContext *avctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const float bands[]
#define CODEC_LONG_NAME(str)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void ff_mpa_synth_init_fixed(void)
static const int8_t mpc7_idx51[]
static const uint8_t mpc7_quant_vlcs[177 *2 *2]
static unsigned int get_bits1(GetBitContext *s)
static av_cold void mpc7_init_static(void)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
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() or get_encode_buffer() for allocating buffers and supports custom allocators.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVSampleFormat sample_fmt
audio sample format
static const uint8_t mpc7_quant_vlc_sizes[MPC7_QUANT_VLC_TABLES]
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
static int get_scale_idx(GetBitContext *gb, int ref)
int nb_samples
number of audio samples (per channel) described by this frame
#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.
uint8_t ** extended_data
pointers to the data planes/channels.
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[]
static const uint8_t mpc7_dscf[MPC7_DSCF_SIZE *2]
main external API structure.
#define VLC_INIT_STATIC_OVERLONG
static const int8_t mpc7_idx50[]
Subband structure - hold all variables for each subband.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
static int ref[MAX_W *MAX_W]
#define VLC_INIT_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, symbols, symbols_wrap, symbols_size, offset, flags, static_size)
#define avpriv_request_sample(...)
This structure stores compressed data.
static const uint8_t quant_tables[]
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 void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static const int8_t mpc7_quant_vlc_off[MPC7_QUANT_VLC_TABLES]