FFmpeg
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 "codec_internal.h"
33 #include "decode.h"
34 #include "get_bits.h"
35 #include "mpegaudiodsp.h"
36 
37 #include "mpc.h"
38 #include "mpc8data.h"
39 #include "mpc8huff.h"
40 
41 static VLC band_vlc, scfi_vlc[2], dscf_vlc[2], res_vlc[2];
42 static VLC q1_vlc, q2_vlc[2], q3_vlc[2], quant_vlc[4][2], q9up_vlc;
43 
44 static inline int mpc8_dec_base(GetBitContext *gb, int k, int n)
45 {
46  int len = mpc8_cnk_len[k-1][n-1] - 1;
47  int code = len ? get_bits_long(gb, len) : 0;
48 
49  if (code >= mpc8_cnk_lost[k-1][n-1])
50  code = ((code << 1) | get_bits1(gb)) - mpc8_cnk_lost[k-1][n-1];
51 
52  return code;
53 }
54 
55 static inline int mpc8_dec_enum(GetBitContext *gb, int k, int n)
56 {
57  int bits = 0;
58  const uint32_t * C = mpc8_cnk[k-1];
59  int code = mpc8_dec_base(gb, k, n);
60 
61  do {
62  n--;
63  if (code >= C[n]) {
64  bits |= 1U << n;
65  code -= C[n];
66  C -= 32;
67  k--;
68  }
69  } while(k > 0);
70 
71  return bits;
72 }
73 
74 static inline int mpc8_get_mod_golomb(GetBitContext *gb, int m)
75 {
76  if(mpc8_cnk_len[0][m] < 1) return 0;
77  return mpc8_dec_base(gb, 1, m+1);
78 }
79 
80 static int mpc8_get_mask(GetBitContext *gb, int size, int t)
81 {
82  int mask = 0;
83 
84  if(t && t != size)
85  mask = mpc8_dec_enum(gb, FFMIN(t, size - t), size);
86  if((t << 1) > size) mask = ~mask;
87 
88  return mask;
89 }
90 
91 static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset,
92  const uint8_t codes_counts[16],
93  const uint8_t **syms, int offset)
94 {
95  static VLCElem vlc_buf[9296];
96  uint8_t len[MPC8_MAX_VLC_SIZE];
97  unsigned num = 0;
98 
99  vlc->table = &vlc_buf[*buf_offset];
100  vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *buf_offset;
101 
102  for (int i = 16; i > 0; i--)
103  for (unsigned tmp = num + codes_counts[i - 1]; num < tmp; num++)
104  len[num] = i;
105 
106  ff_init_vlc_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1,
107  *syms, 1, 1, offset, INIT_VLC_STATIC_OVERLONG, NULL);
108  *buf_offset += vlc->table_size;
109  *syms += num;
110 }
111 
112 static av_cold void mpc8_init_static(void)
113 {
114  const uint8_t *q_syms = mpc8_q_syms, *bands_syms = mpc8_bands_syms;
115  const uint8_t *res_syms = mpc8_res_syms, *scfi_syms = mpc8_scfi_syms;
116  const uint8_t *dscf_syms = mpc8_dscf_syms;
117  unsigned offset = 0;
118 
119  build_vlc(&band_vlc, &offset, mpc8_bands_len_counts, &bands_syms, 0);
120 
121  build_vlc(&q1_vlc, &offset, mpc8_q1_len_counts, &q_syms, 0);
123 
124  for (int i = 0; i < 2; i++){
125  build_vlc(&scfi_vlc[i], &offset, mpc8_scfi_len_counts[i], &scfi_syms, 0);
126 
127  build_vlc(&dscf_vlc[i], &offset, mpc8_dscf_len_counts[i], &dscf_syms, 0);
128 
129  build_vlc(&res_vlc[i], &offset, mpc8_res_len_counts[i], &res_syms, 0);
130 
131  build_vlc(&q2_vlc[i], &offset, mpc8_q2_len_counts[i], &q_syms, 0);
133  &q_syms, -48 - 16 * i);
134  for (int j = 0; j < 4; j++)
136  &q_syms, -((8 << j) - 1));
137  }
139 }
140 
142 {
143  static AVOnce init_static_once = AV_ONCE_INIT;
144  MPCContext *c = avctx->priv_data;
145  GetBitContext gb;
146  int channels;
147 
148  if(avctx->extradata_size < 2){
149  av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
150  return -1;
151  }
152  memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
153  av_lfg_init(&c->rnd, 0xDEADBEEF);
154  ff_mpadsp_init(&c->mpadsp);
155 
156  init_get_bits(&gb, avctx->extradata, 16);
157 
158  skip_bits(&gb, 3);//sample rate
159  c->maxbands = get_bits(&gb, 5) + 1;
160  if (c->maxbands >= BANDS) {
161  av_log(avctx,AV_LOG_ERROR, "maxbands %d too high\n", c->maxbands);
162  return AVERROR_INVALIDDATA;
163  }
164  channels = get_bits(&gb, 4) + 1;
165  if (channels > 2) {
166  avpriv_request_sample(avctx, "Multichannel MPC SV8");
167  return AVERROR_PATCHWELCOME;
168  }
169  c->MSS = get_bits1(&gb);
170  c->frames = 1 << (get_bits(&gb, 3) * 2);
171 
175 
176  ff_thread_once(&init_static_once, mpc8_init_static);
177 
178  return 0;
179 }
180 
182  int *got_frame_ptr, AVPacket *avpkt)
183 {
184  const uint8_t *buf = avpkt->data;
185  int buf_size = avpkt->size;
186  MPCContext *c = avctx->priv_data;
187  GetBitContext gb2, *gb = &gb2;
188  int i, j, k, ch, cnt, res, t;
189  Band *bands = c->bands;
190  int off;
191  int maxband, keyframe;
192  int last[2];
193 
194  keyframe = c->cur_frame == 0;
195 
196  if(keyframe){
197  memset(c->Q, 0, sizeof(c->Q));
198  c->last_bits_used = 0;
199  }
200  if ((res = init_get_bits8(gb, buf, buf_size)) < 0)
201  return res;
202 
203  skip_bits(gb, c->last_bits_used & 7);
204 
205  if(keyframe)
206  maxband = mpc8_get_mod_golomb(gb, c->maxbands + 1);
207  else{
208  maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
209  if(maxband > 32) maxband -= 33;
210  }
211 
212  if (get_bits_left(gb) < 0) {
213  *got_frame_ptr = 0;
214  return buf_size;
215  }
216 
217  if(maxband > c->maxbands + 1) {
218  av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband);
219  return AVERROR_INVALIDDATA;
220  }
221  c->last_max_band = maxband;
222 
223  /* read subband indexes */
224  if(maxband){
225  last[0] = last[1] = 0;
226  for(i = maxband - 1; i >= 0; i--){
227  for(ch = 0; ch < 2; ch++){
228  last[ch] = get_vlc2(gb, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];
229  if(last[ch] > 15) last[ch] -= 17;
230  bands[i].res[ch] = last[ch];
231  }
232  }
233  if(c->MSS){
234  int mask;
235 
236  cnt = 0;
237  for(i = 0; i < maxband; i++)
238  if(bands[i].res[0] || bands[i].res[1])
239  cnt++;
240  t = mpc8_get_mod_golomb(gb, cnt);
241  mask = mpc8_get_mask(gb, cnt, t);
242  for(i = maxband - 1; i >= 0; i--)
243  if(bands[i].res[0] || bands[i].res[1]){
244  bands[i].msf = mask & 1;
245  mask >>= 1;
246  }
247  }
248  }
249  for(i = maxband; i < c->maxbands; i++)
250  bands[i].res[0] = bands[i].res[1] = 0;
251 
252  if(keyframe){
253  for(i = 0; i < 32; i++)
254  c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;
255  }
256 
257  for(i = 0; i < maxband; i++){
258  if(bands[i].res[0] || bands[i].res[1]){
259  cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;
260  if(cnt >= 0){
261  t = get_vlc2(gb, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);
262  if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);
263  if(bands[i].res[1]) bands[i].scfi[1] = t & 3;
264  }
265  }
266  }
267 
268  for(i = 0; i < maxband; i++){
269  for(ch = 0; ch < 2; ch++){
270  if(!bands[i].res[ch]) continue;
271 
272  if(c->oldDSCF[ch][i]){
273  bands[i].scf_idx[ch][0] = get_bits(gb, 7) - 6;
274  c->oldDSCF[ch][i] = 0;
275  }else{
276  t = get_vlc2(gb, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);
277  if(t == 64)
278  t += get_bits(gb, 6);
279  bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
280  }
281  for(j = 0; j < 2; j++){
282  if((bands[i].scfi[ch] << j) & 2)
283  bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
284  else{
285  t = get_vlc2(gb, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);
286  if(t == 31)
287  t = 64 + get_bits(gb, 6);
288  bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
289  }
290  }
291  }
292  }
293 
294  for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){
295  for(ch = 0; ch < 2; ch++){
296  res = bands[i].res[ch];
297  switch(res){
298  case -1:
299  for(j = 0; j < SAMPLES_PER_BAND; j++)
300  c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
301  break;
302  case 0:
303  break;
304  case 1:
305  for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
306  cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
307  t = mpc8_get_mask(gb, 18, cnt);
308  for(k = 0; k < SAMPLES_PER_BAND / 2; k++)
309  c->Q[ch][off + j + k] = t & (1 << (SAMPLES_PER_BAND / 2 - k - 1))
310  ? (get_bits1(gb) << 1) - 1 : 0;
311  }
312  break;
313  case 2:
314  cnt = 6;//2*mpc8_thres[res]
315  for(j = 0; j < SAMPLES_PER_BAND; j += 3){
316  t = get_vlc2(gb, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);
317  c->Q[ch][off + j + 0] = mpc8_idx50[t];
318  c->Q[ch][off + j + 1] = mpc8_idx51[t];
319  c->Q[ch][off + j + 2] = mpc8_idx52[t];
320  cnt = (cnt >> 1) + mpc8_huffq2[t];
321  }
322  break;
323  case 3:
324  case 4:
325  for(j = 0; j < SAMPLES_PER_BAND; j += 2){
326  t = get_vlc2(gb, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2);
327  c->Q[ch][off + j + 1] = t >> 4;
328  c->Q[ch][off + j + 0] = sign_extend(t, 4);
329  }
330  break;
331  case 5:
332  case 6:
333  case 7:
334  case 8:
335  cnt = 2 * mpc8_thres[res];
336  for(j = 0; j < SAMPLES_PER_BAND; j++){
337  const VLC *vlc = &quant_vlc[res - 5][cnt > mpc8_thres[res]];
338  c->Q[ch][off + j] = get_vlc2(gb, vlc->table, vlc->bits, 2);
339  cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);
340  }
341  break;
342  default:
343  for(j = 0; j < SAMPLES_PER_BAND; j++){
344  c->Q[ch][off + j] = get_vlc2(gb, q9up_vlc.table, MPC8_Q9UP_BITS, 2);
345  if(res != 9){
346  c->Q[ch][off + j] <<= res - 9;
347  c->Q[ch][off + j] |= get_bits(gb, res - 9);
348  }
349  c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
350  }
351  }
352  }
353  }
354 
355  frame->nb_samples = MPC_FRAME_SIZE;
356  if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
357  return res;
358 
359  ff_mpc_dequantize_and_synth(c, maxband - 1,
360  (int16_t **)frame->extended_data,
361  avctx->ch_layout.nb_channels);
362 
363  c->cur_frame++;
364 
365  c->last_bits_used = get_bits_count(gb);
366  if(c->cur_frame >= c->frames)
367  c->cur_frame = 0;
368  if (get_bits_left(gb) < 0) {
369  av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -get_bits_left(gb));
370  c->last_bits_used = buf_size << 3;
371  } else if (c->cur_frame == 0 && get_bits_left(gb) < 8) {// we have only padding left
372  c->last_bits_used = buf_size << 3;
373  }
374 
375  *got_frame_ptr = 1;
376 
377  return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
378 }
379 
381 {
382  MPCContext *c = avctx->priv_data;
383  c->cur_frame = 0;
384 }
385 
387  .p.name = "mpc8",
388  CODEC_LONG_NAME("Musepack SV8"),
389  .p.type = AVMEDIA_TYPE_AUDIO,
390  .p.id = AV_CODEC_ID_MUSEPACK8,
391  .priv_data_size = sizeof(MPCContext),
394  .flush = mpc8_decode_flush,
395  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
396  .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
398 };
mpc8_init_static
static av_cold void mpc8_init_static(void)
Definition: mpc8.c:112
q1_vlc
static VLC q1_vlc
Definition: mpc8.c:42
MPC8_Q9UP_BITS
#define MPC8_Q9UP_BITS
Definition: mpc8huff.h:93
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:839
mpc8data.h
av_lfg_init
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
Definition: lfg.c:32
thread.h
mpc8_decode_flush
static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
Definition: mpc8.c:380
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
mpc8_dscf_len_counts
static const uint8_t mpc8_dscf_len_counts[2][16]
Definition: mpc8huff.h:68
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
ff_mpadsp_init
av_cold void ff_mpadsp_init(MPADSPContext *s)
Definition: mpegaudiodsp.c:82
mpc8_dec_base
static int mpc8_dec_base(GetBitContext *gb, int k, int n)
Definition: mpc8.c:44
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
AVPacket::data
uint8_t * data
Definition: packet.h:374
table
static const uint16_t table[]
Definition: prosumer.c:205
MPCContext
Definition: mpc.h:54
FFCodec
Definition: codec_internal.h:119
scfi_vlc
static VLC scfi_vlc[2]
Definition: mpc8.c:41
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:311
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:649
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
mpc8huff.h
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
build_vlc
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:91
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:123
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:2059
MPC8_RES_BITS
#define MPC8_RES_BITS
Definition: mpc8huff.h:73
mpc8_get_mod_golomb
static int mpc8_get_mod_golomb(GetBitContext *gb, int m)
Definition: mpc8.c:74
GetBitContext
Definition: get_bits.h:61
mpc8_get_mask
static int mpc8_get_mask(GetBitContext *gb, int size, int t)
Definition: mpc8.c:80
ff_mpc_dequantize_and_synth
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
Definition: mpc.c:55
mpc8_q2_len_counts
static const uint8_t mpc8_q2_len_counts[2][16]
Definition: mpc8huff.h:101
mpc8_scfi_len_counts
static const uint8_t mpc8_scfi_len_counts[2][16]
Definition: mpc8huff.h:47
mpc8_cnk_lost
static const uint32_t mpc8_cnk_lost[16][33]
Definition: mpc8data.h:101
mpc8_cnk_len
static const uint8_t mpc8_cnk_len[16][33]
Definition: mpc8data.h:80
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
mpc8_q5_8_len_counts
static const uint8_t mpc8_q5_8_len_counts[2][4][16]
Definition: mpc8huff.h:114
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:184
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:667
mask
static const uint16_t mask[17]
Definition: lzw.c:38
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:500
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:298
av_lfg_get
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
Definition: lfg.h:53
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
lfg.h
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:363
vlc_buf
static VLCElem vlc_buf[16716]
Definition: clearvideo.c:80
bits
uint8_t bits
Definition: vp3data.h:128
mpc8_idx52
static const int8_t mpc8_idx52[125]
Definition: mpc8data.h:41
channels
channels
Definition: aptx.h:31
decode.h
get_bits.h
bands
static const float bands[]
Definition: af_superequalizer.c:56
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:264
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:64
MPC8_Q1_BITS
#define MPC8_Q1_BITS
Definition: mpc8huff.h:87
mpc.h
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:182
mpc8_bands_len_counts
static const uint8_t mpc8_bands_len_counts[16]
Definition: mpc8huff.h:36
mpc8_q1_len_counts
static const uint8_t mpc8_q1_len_counts[16]
Definition: mpc8huff.h:89
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
ff_mpa_synth_init_fixed
void ff_mpa_synth_init_fixed(void)
MPC_FRAME_SIZE
#define MPC_FRAME_SIZE
Definition: mpc.h:43
ff_mpc8_decoder
const FFCodec ff_mpc8_decoder
Definition: mpc8.c:386
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
ff_init_vlc_from_lengths
int ff_init_vlc_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()
Definition: vlc.c:328
mpc8_huffq2
static const int8_t mpc8_huffq2[5 *5 *5]
Definition: mpc8data.h:50
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:787
quant_vlc
static VLC quant_vlc[4][2]
Definition: mpc8.c:42
AVOnce
#define AVOnce
Definition: thread.h:181
c
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
Definition: undefined.txt:32
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:109
VLC::table_allocated
int table_allocated
Definition: vlc.h:34
mpc8_q34_len_counts
static const uint8_t mpc8_q34_len_counts[2][16]
Definition: mpc8huff.h:109
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1450
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
MPC8_Q3_BITS
#define MPC8_Q3_BITS
Definition: mpc8huff.h:106
AVPacket::size
int size
Definition: packet.h:375
mpc8_thres
static const unsigned int mpc8_thres[]
Definition: mpc8data.h:49
mpc8_bands_syms
static const uint8_t mpc8_bands_syms[MPC8_BANDS_SIZE]
Definition: mpc8huff.h:32
codec_internal.h
mpc8_q_syms
static const uint8_t mpc8_q_syms[]
Definition: mpc8huff.h:129
band_vlc
static VLC band_vlc
Definition: mpc8.c:41
SAMPLES_PER_BAND
#define SAMPLES_PER_BAND
Definition: mpc.h:42
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1023
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
size
int size
Definition: twinvq_data.h:10344
VLCElem
Definition: vlc.h:27
MPC8_Q2_BITS
#define MPC8_Q2_BITS
Definition: mpc8huff.h:99
offset
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
Definition: writing_filters.txt:86
mpc8_cnk
static const uint32_t mpc8_cnk[16][32]
Definition: mpc8data.h:60
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:962
q9up_vlc
static VLC q9up_vlc
Definition: mpc8.c:42
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:499
BANDS
#define BANDS
Definition: imc.c:56
mpc8_res_syms
static const uint8_t mpc8_res_syms[]
Definition: mpc8huff.h:75
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
mpc8_dec_enum
static int mpc8_dec_enum(GetBitContext *gb, int k, int n)
Definition: mpc8.c:55
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
mpc8_dscf_syms
static const uint8_t mpc8_dscf_syms[]
Definition: mpc8huff.h:55
MPC8_DSCF1_BITS
#define MPC8_DSCF1_BITS
Definition: mpc8huff.h:53
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:211
len
int len
Definition: vorbis_enc_data.h:426
res_vlc
static VLC res_vlc[2]
Definition: mpc8.c:41
avcodec.h
q3_vlc
static VLC q3_vlc[2]
Definition: mpc8.c:42
VLC::bits
int bits
Definition: vlc.h:32
INIT_VLC_STATIC_OVERLONG
#define INIT_VLC_STATIC_OVERLONG
Definition: vlc.h:101
frame
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
Definition: filter_design.txt:264
AV_CODEC_ID_MUSEPACK8
@ AV_CODEC_ID_MUSEPACK8
Definition: codec_id.h:469
dscf_vlc
static VLC dscf_vlc[2]
Definition: mpc8.c:41
U
#define U(x)
Definition: vpx_arith.h:37
mpc8_decode_init
static av_cold int mpc8_decode_init(AVCodecContext *avctx)
Definition: mpc8.c:141
AVCodecContext
main external API structure.
Definition: avcodec.h:398
mpc8_res_len_counts
static const uint8_t mpc8_res_len_counts[2][16]
Definition: mpc8huff.h:82
channel_layout.h
Band
Subband structure - hold all variables for each subband.
Definition: mpc.h:46
mpc8_idx50
static const int8_t mpc8_idx50[125]
Definition: mpc8data.h:27
MPC8_DSCF0_BITS
#define MPC8_DSCF0_BITS
Definition: mpc8huff.h:52
VLC
Definition: vlc.h:31
MPC8_BANDS_BITS
#define MPC8_BANDS_BITS
Definition: mpc8huff.h:30
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:632
sign_extend
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:133
mpc8_q9up_len_counts
static const uint8_t mpc8_q9up_len_counts[16]
Definition: mpc8huff.h:95
VLC::table
VLCElem * table
Definition: vlc.h:33
VLC::table_size
int table_size
Definition: vlc.h:34
mpegaudiodsp.h
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:425
MPC8_MAX_VLC_SIZE
#define MPC8_MAX_VLC_SIZE
Definition: mpc8huff.h:27
mpc8_scfi_syms
static const uint8_t mpc8_scfi_syms[]
Definition: mpc8huff.h:40
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
mpc8_idx51
static const int8_t mpc8_idx51[125]
Definition: mpc8data.h:34
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
mpc8_decode_frame
static int mpc8_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: mpc8.c:181
q2_vlc
static VLC q2_vlc[2]
Definition: mpc8.c:42