101 for (
int i = 16;
i > 0;
i--)
102 for (
unsigned tmp = num + codes_counts[
i - 1]; num <
tmp; num++)
123 for (
int i = 0;
i < 2;
i++){
132 &q_syms, -48 - 16 *
i);
133 for (
int j = 0; j < 4; j++)
135 &q_syms, -((8 << j) - 1));
151 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
159 if (
c->maxbands >=
BANDS) {
181 int *got_frame_ptr,
AVPacket *avpkt)
185 int buf_size = avpkt->
size;
188 int i, j, k, ch, cnt, res, t;
191 int maxband, keyframe;
194 keyframe =
c->cur_frame == 0;
197 memset(
c->Q, 0,
sizeof(
c->Q));
198 c->last_bits_used = 0;
209 if(maxband > 32) maxband -= 33;
217 if(maxband >
c->maxbands + 1) {
221 c->last_max_band = maxband;
225 last[0] = last[1] = 0;
226 for(
i = maxband - 1;
i >= 0;
i--){
227 for(ch = 0; ch < 2; ch++){
229 if(last[ch] > 15) last[ch] -= 17;
230 bands[
i].res[ch] = last[ch];
237 for(
i = 0;
i < maxband;
i++)
242 for(
i = maxband - 1;
i >= 0;
i--)
249 for(
i = maxband;
i <
c->maxbands;
i++)
253 for(
i = 0;
i < 32;
i++)
254 c->oldDSCF[0][
i] =
c->oldDSCF[1][
i] = 1;
257 for(
i = 0;
i < maxband;
i++){
268 for(
i = 0;
i < maxband;
i++){
269 for(ch = 0; ch < 2; ch++){
270 if(!
bands[
i].res[ch])
continue;
272 if(
c->oldDSCF[ch][
i]){
274 c->oldDSCF[ch][
i] = 0;
279 bands[
i].scf_idx[ch][0] = ((
bands[
i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
281 for(j = 0; j < 2; j++){
282 if((
bands[
i].scfi[ch] << j) & 2)
288 bands[
i].scf_idx[ch][j + 1] = ((
bands[
i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
295 for(ch = 0; ch < 2; ch++){
300 c->Q[ch][off + j] = (
av_lfg_get(&
c->rnd) & 0x3FC) - 510;
327 c->Q[ch][off + j + 1] = t >> 4;
339 cnt = (cnt >> 1) +
FFABS(
c->Q[ch][off + j]);
346 c->Q[ch][off + j] <<= res - 9;
347 c->Q[ch][off + j] |=
get_bits(gb, res - 9);
349 c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
366 if(
c->cur_frame >=
c->frames)
370 c->last_bits_used = buf_size << 3;
372 c->last_bits_used = buf_size << 3;
377 return c->cur_frame ?
c->last_bits_used >> 3 : buf_size;
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
static VLC_TYPE vlc_buf[16716][2]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
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 unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
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_MONO
#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.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#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.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
static av_cold void mpc8_init_static(void)
static av_cold int mpc8_decode_init(AVCodecContext *avctx)
static int mpc8_dec_enum(GetBitContext *gb, int k, int n)
static int mpc8_get_mask(GetBitContext *gb, int size, int t)
static VLC quant_vlc[4][2]
static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
static int mpc8_get_mod_golomb(GetBitContext *gb, int m)
static int mpc8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset, const uint8_t codes_counts[16], const uint8_t **syms, int offset)
static int mpc8_dec_base(GetBitContext *gb, int k, int n)
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))
static const uint16_t mask[17]
static av_const int sign_extend(int val, unsigned bits)
static const uint32_t mpc8_cnk_lost[16][33]
static const uint32_t mpc8_cnk[16][32]
static const int8_t mpc8_idx51[125]
static const int8_t mpc8_huffq2[5 *5 *5]
static const unsigned int mpc8_thres[]
static const uint8_t mpc8_cnk_len[16][33]
static const int8_t mpc8_idx50[125]
static const int8_t mpc8_idx52[125]
static const uint8_t mpc8_q5_8_len_counts[2][4][16]
static const uint8_t mpc8_dscf_syms[]
static const uint8_t mpc8_res_syms[]
static const uint8_t mpc8_res_len_counts[2][16]
static const uint8_t mpc8_scfi_syms[]
static const uint8_t mpc8_bands_syms[MPC8_BANDS_SIZE]
static const uint8_t mpc8_q2_len_counts[2][16]
static const uint8_t mpc8_q1_len_counts[16]
static const uint8_t mpc8_q_syms[]
#define MPC8_MAX_VLC_SIZE
static const uint8_t mpc8_q34_len_counts[2][16]
static const uint8_t mpc8_dscf_len_counts[2][16]
static const uint8_t mpc8_bands_len_counts[16]
static const uint8_t mpc8_q9up_len_counts[16]
static const uint8_t mpc8_scfi_len_counts[2][16]
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 const uint8_t offset[127][2]
#define INIT_VLC_STATIC_OVERLONG