FFmpeg  4.4.7
mpc8.c
Go to the documentation of this file.
1 /*
2  * Musepack SV8 decoder
3  * Copyright (c) 2007 Konstantin Shishkov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
25  * divided into 32 subbands.
26  */
27 
29 #include "libavutil/lfg.h"
30 #include "libavutil/thread.h"
31 #include "avcodec.h"
32 #include "get_bits.h"
33 #include "internal.h"
34 #include "mpegaudiodsp.h"
35 
36 #include "mpc.h"
37 #include "mpc8data.h"
38 #include "mpc8huff.h"
39 
40 static VLC band_vlc, scfi_vlc[2], dscf_vlc[2], res_vlc[2];
41 static VLC q1_vlc, q2_vlc[2], q3_vlc[2], quant_vlc[4][2], q9up_vlc;
42 
43 static inline int mpc8_dec_base(GetBitContext *gb, int k, int n)
44 {
45  int len = mpc8_cnk_len[k-1][n-1] - 1;
46  int code = len ? get_bits_long(gb, len) : 0;
47 
48  if (code >= mpc8_cnk_lost[k-1][n-1])
49  code = ((code << 1) | get_bits1(gb)) - mpc8_cnk_lost[k-1][n-1];
50 
51  return code;
52 }
53 
54 static inline int mpc8_dec_enum(GetBitContext *gb, int k, int n)
55 {
56  int bits = 0;
57  const uint32_t * C = mpc8_cnk[k-1];
58  int code = mpc8_dec_base(gb, k, n);
59 
60  do {
61  n--;
62  if (code >= C[n]) {
63  bits |= 1U << n;
64  code -= C[n];
65  C -= 32;
66  k--;
67  }
68  } while(k > 0);
69 
70  return bits;
71 }
72 
73 static inline int mpc8_get_mod_golomb(GetBitContext *gb, int m)
74 {
75  if(mpc8_cnk_len[0][m] < 1) return 0;
76  return mpc8_dec_base(gb, 1, m+1);
77 }
78 
79 static int mpc8_get_mask(GetBitContext *gb, int size, int t)
80 {
81  int mask = 0;
82 
83  if(t && t != size)
84  mask = mpc8_dec_enum(gb, FFMIN(t, size - t), size);
85  if((t << 1) > size) mask = ~mask;
86 
87  return mask;
88 }
89 
90 static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset,
91  const uint8_t codes_counts[16],
92  const uint8_t **syms, int offset)
93 {
94  static VLC_TYPE vlc_buf[9296][2];
96  unsigned num = 0;
97 
98  vlc->table = &vlc_buf[*buf_offset];
99  vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *buf_offset;
100 
101  for (int i = 16; i > 0; i--)
102  for (unsigned tmp = num + codes_counts[i - 1]; num < tmp; num++)
103  len[num] = i;
104 
105  ff_init_vlc_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1,
106  *syms, 1, 1, offset, INIT_VLC_STATIC_OVERLONG, NULL);
107  *buf_offset += vlc->table_size;
108  *syms += num;
109 }
110 
111 static av_cold void mpc8_init_static(void)
112 {
113  const uint8_t *q_syms = mpc8_q_syms, *bands_syms = mpc8_bands_syms;
114  const uint8_t *res_syms = mpc8_res_syms, *scfi_syms = mpc8_scfi_syms;
115  const uint8_t *dscf_syms = mpc8_dscf_syms;
116  unsigned offset = 0;
117 
118  build_vlc(&band_vlc, &offset, mpc8_bands_len_counts, &bands_syms, 0);
119 
120  build_vlc(&q1_vlc, &offset, mpc8_q1_len_counts, &q_syms, 0);
122 
123  for (int i = 0; i < 2; i++){
124  build_vlc(&scfi_vlc[i], &offset, mpc8_scfi_len_counts[i], &scfi_syms, 0);
125 
126  build_vlc(&dscf_vlc[i], &offset, mpc8_dscf_len_counts[i], &dscf_syms, 0);
127 
128  build_vlc(&res_vlc[i], &offset, mpc8_res_len_counts[i], &res_syms, 0);
129 
130  build_vlc(&q2_vlc[i], &offset, mpc8_q2_len_counts[i], &q_syms, 0);
132  &q_syms, -48 - 16 * i);
133  for (int j = 0; j < 4; j++)
135  &q_syms, -((8 << j) - 1));
136  }
138 }
139 
141 {
142  static AVOnce init_static_once = AV_ONCE_INIT;
143  MPCContext *c = avctx->priv_data;
144  GetBitContext gb;
145  int channels;
146 
147  if(avctx->extradata_size < 2){
148  av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
149  return -1;
150  }
151  memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
152  av_lfg_init(&c->rnd, 0xDEADBEEF);
153  ff_mpadsp_init(&c->mpadsp);
154 
155  init_get_bits(&gb, avctx->extradata, 16);
156 
157  uint8_t sample_rate_idx = get_bits(&gb, 3);
158  static const int sample_rates[] = { 44100, 48000, 37800, 32000 };
160  av_log(avctx, AV_LOG_ERROR, "invalid sample rate index (%u)\n", sample_rate_idx);
161  return AVERROR_INVALIDDATA;
162  }
164  c->maxbands = get_bits(&gb, 5) + 1;
165  if (c->maxbands >= BANDS) {
166  av_log(avctx,AV_LOG_ERROR, "maxbands %d too high\n", c->maxbands);
167  return AVERROR_INVALIDDATA;
168  }
169  channels = get_bits(&gb, 4) + 1;
170  if (channels > 2) {
171  avpriv_request_sample(avctx, "Multichannel MPC SV8");
172  return AVERROR_PATCHWELCOME;
173  }
174  c->MSS = get_bits1(&gb);
175  c->frames = 1 << (get_bits(&gb, 3) * 2);
176 
179  avctx->channels = channels;
180 
181  ff_thread_once(&init_static_once, mpc8_init_static);
182 
183  return 0;
184 }
185 
186 static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
187  int *got_frame_ptr, AVPacket *avpkt)
188 {
189  AVFrame *frame = data;
190  const uint8_t *buf = avpkt->data;
191  int buf_size = avpkt->size;
192  MPCContext *c = avctx->priv_data;
193  GetBitContext gb2, *gb = &gb2;
194  int i, j, k, ch, cnt, res, t;
195  Band *bands = c->bands;
196  int off;
197  int maxband, keyframe;
198  int last[2];
199 
200  keyframe = c->cur_frame == 0;
201 
202  if(keyframe){
203  memset(c->Q, 0, sizeof(c->Q));
204  c->last_bits_used = 0;
205  }
206  if ((res = init_get_bits8(gb, buf, buf_size)) < 0)
207  return res;
208 
209  skip_bits(gb, c->last_bits_used & 7);
210 
211  if(keyframe)
212  maxband = mpc8_get_mod_golomb(gb, c->maxbands + 1);
213  else{
214  maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
215  if(maxband > 32) maxband -= 33;
216  }
217 
218  if (get_bits_left(gb) < 0) {
219  *got_frame_ptr = 0;
220  return buf_size;
221  }
222 
223  if(maxband > c->maxbands + 1) {
224  av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband);
225  return AVERROR_INVALIDDATA;
226  }
227  c->last_max_band = maxband;
228 
229  /* read subband indexes */
230  if(maxband){
231  last[0] = last[1] = 0;
232  for(i = maxband - 1; i >= 0; i--){
233  for(ch = 0; ch < 2; ch++){
234  last[ch] = get_vlc2(gb, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];
235  if(last[ch] > 15) last[ch] -= 17;
236  bands[i].res[ch] = last[ch];
237  }
238  }
239  if(c->MSS){
240  int mask;
241 
242  cnt = 0;
243  for(i = 0; i < maxband; i++)
244  if(bands[i].res[0] || bands[i].res[1])
245  cnt++;
246  t = mpc8_get_mod_golomb(gb, cnt);
247  mask = mpc8_get_mask(gb, cnt, t);
248  for(i = maxband - 1; i >= 0; i--)
249  if(bands[i].res[0] || bands[i].res[1]){
250  bands[i].msf = mask & 1;
251  mask >>= 1;
252  }
253  }
254  }
255  for(i = maxband; i < c->maxbands; i++)
256  bands[i].res[0] = bands[i].res[1] = 0;
257 
258  if(keyframe){
259  for(i = 0; i < 32; i++)
260  c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;
261  }
262 
263  for(i = 0; i < maxband; i++){
264  if(bands[i].res[0] || bands[i].res[1]){
265  cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;
266  if(cnt >= 0){
267  t = get_vlc2(gb, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);
268  if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);
269  if(bands[i].res[1]) bands[i].scfi[1] = t & 3;
270  }
271  }
272  }
273 
274  for(i = 0; i < maxband; i++){
275  for(ch = 0; ch < 2; ch++){
276  if(!bands[i].res[ch]) continue;
277 
278  if(c->oldDSCF[ch][i]){
279  bands[i].scf_idx[ch][0] = get_bits(gb, 7) - 6;
280  c->oldDSCF[ch][i] = 0;
281  }else{
282  t = get_vlc2(gb, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);
283  if(t == 64)
284  t += get_bits(gb, 6);
285  bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
286  }
287  for(j = 0; j < 2; j++){
288  if((bands[i].scfi[ch] << j) & 2)
289  bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
290  else{
291  t = get_vlc2(gb, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);
292  if(t == 31)
293  t = 64 + get_bits(gb, 6);
294  bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
295  }
296  }
297  }
298  }
299 
300  for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){
301  for(ch = 0; ch < 2; ch++){
302  res = bands[i].res[ch];
303  switch(res){
304  case -1:
305  for(j = 0; j < SAMPLES_PER_BAND; j++)
306  c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
307  break;
308  case 0:
309  break;
310  case 1:
311  for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
312  cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
313  t = mpc8_get_mask(gb, 18, cnt);
314  for(k = 0; k < SAMPLES_PER_BAND / 2; k++)
315  c->Q[ch][off + j + k] = t & (1 << (SAMPLES_PER_BAND / 2 - k - 1))
316  ? (get_bits1(gb) << 1) - 1 : 0;
317  }
318  break;
319  case 2:
320  cnt = 6;//2*mpc8_thres[res]
321  for(j = 0; j < SAMPLES_PER_BAND; j += 3){
322  t = get_vlc2(gb, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);
323  c->Q[ch][off + j + 0] = mpc8_idx50[t];
324  c->Q[ch][off + j + 1] = mpc8_idx51[t];
325  c->Q[ch][off + j + 2] = mpc8_idx52[t];
326  cnt = (cnt >> 1) + mpc8_huffq2[t];
327  }
328  break;
329  case 3:
330  case 4:
331  for(j = 0; j < SAMPLES_PER_BAND; j += 2){
332  t = get_vlc2(gb, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2);
333  c->Q[ch][off + j + 1] = t >> 4;
334  c->Q[ch][off + j + 0] = sign_extend(t, 4);
335  }
336  break;
337  case 5:
338  case 6:
339  case 7:
340  case 8:
341  cnt = 2 * mpc8_thres[res];
342  for(j = 0; j < SAMPLES_PER_BAND; j++){
343  const VLC *vlc = &quant_vlc[res - 5][cnt > mpc8_thres[res]];
344  c->Q[ch][off + j] = get_vlc2(gb, vlc->table, vlc->bits, 2);
345  cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);
346  }
347  break;
348  default:
349  for(j = 0; j < SAMPLES_PER_BAND; j++){
350  c->Q[ch][off + j] = get_vlc2(gb, q9up_vlc.table, MPC8_Q9UP_BITS, 2);
351  if(res != 9){
352  c->Q[ch][off + j] <<= res - 9;
353  c->Q[ch][off + j] |= get_bits(gb, res - 9);
354  }
355  c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
356  }
357  }
358  }
359  }
360 
362  if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
363  return res;
364 
365  ff_mpc_dequantize_and_synth(c, maxband - 1,
366  (int16_t **)frame->extended_data,
367  avctx->channels);
368 
369  c->cur_frame++;
370 
371  c->last_bits_used = get_bits_count(gb);
372  if(c->cur_frame >= c->frames)
373  c->cur_frame = 0;
374  if (get_bits_left(gb) < 0) {
375  av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -get_bits_left(gb));
376  c->last_bits_used = buf_size << 3;
377  } else if (c->cur_frame == 0 && get_bits_left(gb) < 8) {// we have only padding left
378  c->last_bits_used = buf_size << 3;
379  }
380 
381  *got_frame_ptr = 1;
382 
383  return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
384 }
385 
387 {
388  MPCContext *c = avctx->priv_data;
389  c->cur_frame = 0;
390 }
391 
393  .name = "mpc8",
394  .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
395  .type = AVMEDIA_TYPE_AUDIO,
396  .id = AV_CODEC_ID_MUSEPACK8,
397  .priv_data_size = sizeof(MPCContext),
402  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
404  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
405 };
static int sample_rate_idx(int rate)
static void flush(AVCodecContext *avctx)
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:925
static const float bands[]
channels
Definition: aptx.h:33
#define av_cold
Definition: attributes.h:88
uint8_t
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
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()
Definition: bitstream.c:381
audio channel layout utility functions
static VLC_TYPE vlc_buf[16716][2]
Definition: clearvideo.c:86
#define FFMIN(a, b)
Definition: common.h:105
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
#define NULL
Definition: coverity.c:32
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1900
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
static AVFrame * frame
sample_rates
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:797
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:659
#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.
Definition: codec.h:52
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:104
@ AV_CODEC_ID_MUSEPACK8
Definition: codec_id.h:458
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
#define BANDS
Definition: imc.c:55
int i
Definition: input.c:407
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
Definition: lfg.c:32
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
Definition: lfg.h:53
#define 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...
Definition: internal.h:41
static av_cold void mpc8_init_static(void)
Definition: mpc8.c:111
static av_cold int mpc8_decode_init(AVCodecContext *avctx)
Definition: mpc8.c:140
static VLC res_vlc[2]
Definition: mpc8.c:40
static VLC scfi_vlc[2]
Definition: mpc8.c:40
static int mpc8_dec_enum(GetBitContext *gb, int k, int n)
Definition: mpc8.c:54
static int mpc8_get_mask(GetBitContext *gb, int size, int t)
Definition: mpc8.c:79
static VLC q2_vlc[2]
Definition: mpc8.c:41
static VLC q9up_vlc
Definition: mpc8.c:41
static VLC quant_vlc[4][2]
Definition: mpc8.c:41
static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
Definition: mpc8.c:386
static int mpc8_get_mod_golomb(GetBitContext *gb, int m)
Definition: mpc8.c:73
static VLC q1_vlc
Definition: mpc8.c:41
static VLC q3_vlc[2]
Definition: mpc8.c:41
static int mpc8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: mpc8.c:186
static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset, const uint8_t codes_counts[16], const uint8_t **syms, int offset)
Definition: mpc8.c:90
AVCodec ff_mpc8_decoder
Definition: mpc8.c:392
static VLC dscf_vlc[2]
Definition: mpc8.c:40
static VLC band_vlc
Definition: mpc8.c:40
static int mpc8_dec_base(GetBitContext *gb, int k, int n)
Definition: mpc8.c:43
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
Definition: mpc.c:56
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
#define AVOnce
Definition: thread.h:172
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:175
#define AV_ONCE_INIT
Definition: thread.h:173
static const uint16_t mask[17]
Definition: lzw.c:38
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:130
static const uint32_t mpc8_cnk_lost[16][33]
Definition: mpc8data.h:101
static const uint32_t mpc8_cnk[16][32]
Definition: mpc8data.h:60
static const int8_t mpc8_idx51[125]
Definition: mpc8data.h:34
static const int8_t mpc8_huffq2[5 *5 *5]
Definition: mpc8data.h:50
static const unsigned int mpc8_thres[]
Definition: mpc8data.h:49
static const uint8_t mpc8_cnk_len[16][33]
Definition: mpc8data.h:80
static const int8_t mpc8_idx50[125]
Definition: mpc8data.h:27
static const int8_t mpc8_idx52[125]
Definition: mpc8data.h:41
static const uint8_t mpc8_q5_8_len_counts[2][4][16]
Definition: mpc8huff.h:114
static const uint8_t mpc8_dscf_syms[]
Definition: mpc8huff.h:55
#define MPC8_BANDS_BITS
Definition: mpc8huff.h:30
static const uint8_t mpc8_res_syms[]
Definition: mpc8huff.h:75
#define MPC8_Q1_BITS
Definition: mpc8huff.h:87
static const uint8_t mpc8_res_len_counts[2][16]
Definition: mpc8huff.h:82
static const uint8_t mpc8_scfi_syms[]
Definition: mpc8huff.h:40
#define MPC8_Q9UP_BITS
Definition: mpc8huff.h:93
static const uint8_t mpc8_bands_syms[MPC8_BANDS_SIZE]
Definition: mpc8huff.h:32
static const uint8_t mpc8_q2_len_counts[2][16]
Definition: mpc8huff.h:101
#define MPC8_DSCF1_BITS
Definition: mpc8huff.h:53
static const uint8_t mpc8_q1_len_counts[16]
Definition: mpc8huff.h:89
#define MPC8_DSCF0_BITS
Definition: mpc8huff.h:52
#define MPC8_Q2_BITS
Definition: mpc8huff.h:99
static const uint8_t mpc8_q_syms[]
Definition: mpc8huff.h:129
#define MPC8_MAX_VLC_SIZE
Definition: mpc8huff.h:27
static const uint8_t mpc8_q34_len_counts[2][16]
Definition: mpc8huff.h:109
#define MPC8_RES_BITS
Definition: mpc8huff.h:73
static const uint8_t mpc8_dscf_len_counts[2][16]
Definition: mpc8huff.h:68
static const uint8_t mpc8_bands_len_counts[16]
Definition: mpc8huff.h:36
static const uint8_t mpc8_q9up_len_counts[16]
Definition: mpc8huff.h:95
static const uint8_t mpc8_scfi_len_counts[2][16]
Definition: mpc8huff.h:47
#define MPC8_Q3_BITS
Definition: mpc8huff.h:106
Musepack decoder MPEG Audio Layer 1/2 -like codec with frames of 1152 samples divided into 32 subband...
#define SAMPLES_PER_BAND
Definition: mpc.h:41
#define MPC_FRAME_SIZE
Definition: mpc.h:42
av_cold void ff_mpadsp_init(MPADSPContext *s)
Definition: mpegaudiodsp.c:81
void ff_mpa_synth_init_fixed(void)
const char data[16]
Definition: mxf.c:142
static const uint16_t table[]
Definition: prosumer.c:206
#define FF_ARRAY_ELEMS(a)
const uint8_t * code
Definition: spdifenc.c:413
main external API structure.
Definition: avcodec.h:536
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1204
int sample_rate
samples per second
Definition: avcodec.h:1196
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:637
int channels
number of audio channels
Definition: avcodec.h:1197
int extradata_size
Definition: avcodec.h:638
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1247
void * priv_data
Definition: avcodec.h:563
AVCodec.
Definition: codec.h:197
const char * name
Name of the codec implementation.
Definition: codec.h:204
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:384
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:365
This structure stores compressed data.
Definition: packet.h:346
int size
Definition: packet.h:370
uint8_t * data
Definition: packet.h:369
Subband structure - hold all variables for each subband.
Definition: mpc.h:45
Definition: mpc.h:53
Definition: vlc.h:26
int table_size
Definition: vlc.h:29
int table_allocated
Definition: vlc.h:29
int bits
Definition: vlc.h:27
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
#define avpriv_request_sample(...)
#define av_log(a,...)
static uint8_t tmp[11]
Definition: aes_ctr.c:27
int size
static const uint8_t offset[127][2]
Definition: vf_spp.c:107
#define INIT_VLC_STATIC_OVERLONG
Definition: vlc.h:96
#define VLC_TYPE
Definition: vlc.h:24
int len
uint8_t bits
Definition: vp3data.h:141
static double c[64]