FFmpeg  4.4.9
interplayacm.c
Go to the documentation of this file.
1 /*
2  * Interplay ACM decoder
3  *
4  * Copyright (c) 2004-2008 Marko Kreen
5  * Copyright (c) 2008 Adam Gashlin
6  * Copyright (c) 2015 Paul B Mahol
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 #include "libavutil/intreadwrite.h"
22 
23 #define BITSTREAM_READER_LE
24 #include "avcodec.h"
25 #include "get_bits.h"
26 #include "internal.h"
27 
28 static const int8_t map_1bit[] = { -1, +1 };
29 static const int8_t map_2bit_near[] = { -2, -1, +1, +2 };
30 static const int8_t map_2bit_far[] = { -3, -2, +2, +3 };
31 static const int8_t map_3bit[] = { -4, -3, -2, -1, +1, +2, +3, +4 };
32 
33 static int mul_3x3 [3 * 3 * 3];
34 static int mul_3x5 [5 * 5 * 5];
35 static int mul_2x11[11 * 11];
36 
37 typedef struct InterplayACMContext {
41  uint64_t max_samples;
44 
45  int level;
46  int rows;
47  int cols;
49  int block_len;
50  int skip;
51 
52  int *block;
53  int *wrapbuf;
54  int *ampbuf;
55  int *midbuf;
57 
59 {
61  int x1, x2, x3;
62 
63  if (avctx->extradata_size < 14)
64  return AVERROR_INVALIDDATA;
65 
66  if (avctx->channels <= 0) {
67  av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels);
68  return AVERROR_INVALIDDATA;
69  }
70 
71  s->max_samples = AV_RL32(avctx->extradata + 4) / avctx->channels;
72  if (s->max_samples == 0)
73  s->max_samples = UINT64_MAX;
74  s->level = AV_RL16(avctx->extradata + 12) & 0xf;
75  s->rows = AV_RL16(avctx->extradata + 12) >> 4;
76  s->cols = 1 << s->level;
77  s->wrapbuf_len = 2 * s->cols - 2;
78  s->block_len = s->rows * s->cols;
79  if (s->block_len > 1024 * 1024) {
80  av_log(avctx, AV_LOG_ERROR, "Block of %d samples is too large\n", s->block_len);
81  return AVERROR_INVALIDDATA;
82  }
83  s->max_framesize = s->block_len;
84 
85  s->block = av_calloc(s->block_len, sizeof(int));
86  s->wrapbuf = av_calloc(s->wrapbuf_len, sizeof(int));
87  s->ampbuf = av_calloc(0x10000, sizeof(int));
88  s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*s->bitstream) + 1, sizeof(*s->bitstream));
89  if (!s->block || !s->wrapbuf || !s->ampbuf || !s->bitstream)
90  return AVERROR(ENOMEM);
91 
92  s->midbuf = s->ampbuf + 0x8000;
94 
95  for (x3 = 0; x3 < 3; x3++)
96  for (x2 = 0; x2 < 3; x2++)
97  for (x1 = 0; x1 < 3; x1++)
98  mul_3x3[x1 + x2 * 3 + x3* 3 * 3] = x1 + (x2 << 4) + (x3 << 8);
99  for (x3 = 0; x3 < 5; x3++)
100  for (x2 = 0; x2 < 5; x2++)
101  for (x1 = 0; x1 < 5; x1++)
102  mul_3x5[x1 + x2 * 5 + x3 * 5 * 5] = x1 + (x2 << 4) + (x3 << 8);
103  for (x2 = 0; x2 < 11; x2++)
104  for (x1 = 0; x1 < 11; x1++)
105  mul_2x11[x1 + x2 * 11] = x1 + (x2 << 4);
106 
107  return 0;
108 }
109 
110 #define set_pos(s, r, c, idx) do { \
111  unsigned pos = ((r) << s->level) + (c); \
112  s->block[pos] = s->midbuf[(idx)]; \
113  } while (0)
114 
115 static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
116 {
117  unsigned i;
118 
119  for (i = 0; i < s->rows; i++)
120  set_pos(s, i, col, 0);
121  return 0;
122 }
123 
124 static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
125 {
126  return AVERROR_INVALIDDATA;
127 }
128 
129 static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
130 {
131  GetBitContext *gb = &s->gb;
132  unsigned int i;
133  int b, middle = 1 << (ind - 1);
134 
135  for (i = 0; i < s->rows; i++) {
136  b = get_bits(gb, ind);
137  set_pos(s, i, col, b - middle);
138  }
139  return 0;
140 }
141 
142 static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
143 {
144  GetBitContext *gb = &s->gb;
145  unsigned i, b;
146 
147  for (i = 0; i < s->rows; i++) {
148  b = get_bits1(gb);
149  if (b == 0) {
150  set_pos(s, i++, col, 0);
151  if (i >= s->rows)
152  break;
153  set_pos(s, i, col, 0);
154  continue;
155  }
156  b = get_bits1(gb);
157  if (b == 0) {
158  set_pos(s, i, col, 0);
159  continue;
160  }
161  b = get_bits1(gb);
162  set_pos(s, i, col, map_1bit[b]);
163  }
164  return 0;
165 }
166 
167 static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
168 {
169  GetBitContext *gb = &s->gb;
170  unsigned i, b;
171 
172  for (i = 0; i < s->rows; i++) {
173  b = get_bits1(gb);
174  if (b == 0) {
175  set_pos(s, i, col, 0);
176  continue;
177  }
178 
179  b = get_bits1(gb);
180  set_pos(s, i, col, map_1bit[b]);
181  }
182  return 0;
183 }
184 
185 static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
186 {
187  GetBitContext *gb = &s->gb;
188  unsigned i, b;
189 
190  for (i = 0; i < s->rows; i++) {
191  b = get_bits1(gb);
192  if (b == 0) {
193  set_pos(s, i++, col, 0);
194  if (i >= s->rows) break;
195  set_pos(s, i, col, 0);
196  continue;
197  }
198 
199  b = get_bits1(gb);
200  if (b == 0) {
201  set_pos(s, i, col, 0);
202  continue;
203  }
204 
205  b = get_bits(gb, 2);
206  set_pos(s, i, col, map_2bit_near[b]);
207  }
208  return 0;
209 }
210 
211 static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
212 {
213  GetBitContext *gb = &s->gb;
214  unsigned i, b;
215 
216  for (i = 0; i < s->rows; i++) {
217  b = get_bits1(gb);
218  if (b == 0) {
219  set_pos(s, i, col, 0);
220  continue;
221  }
222 
223  b = get_bits(gb, 2);
224  set_pos(s, i, col, map_2bit_near[b]);
225  }
226  return 0;
227 }
228 
229 static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
230 {
231  GetBitContext *gb = &s->gb;
232  unsigned i, b;
233 
234  for (i = 0; i < s->rows; i++) {
235  b = get_bits1(gb);
236  if (b == 0) {
237  set_pos(s, i++, col, 0);
238  if (i >= s->rows)
239  break;
240  set_pos(s, i, col, 0);
241  continue;
242  }
243 
244  b = get_bits1(gb);
245  if (b == 0) {
246  set_pos(s, i, col, 0);
247  continue;
248  }
249 
250  b = get_bits1(gb);
251  if (b == 0) {
252  b = get_bits1(gb);
253  set_pos(s, i, col, map_1bit[b]);
254  continue;
255  }
256 
257  b = get_bits(gb, 2);
258  set_pos(s, i, col, map_2bit_far[b]);
259  }
260  return 0;
261 }
262 
263 static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
264 {
265  GetBitContext *gb = &s->gb;
266  unsigned i, b;
267 
268  for (i = 0; i < s->rows; i++) {
269  b = get_bits1(gb);
270  if (b == 0) {
271  set_pos(s, i, col, 0);
272  continue;
273  }
274 
275  b = get_bits1(gb);
276  if (b == 0) {
277  b = get_bits1(gb);
278  set_pos(s, i, col, map_1bit[b]);
279  continue;
280  }
281 
282  b = get_bits(gb, 2);
283  set_pos(s, i, col, map_2bit_far[b]);
284  }
285  return 0;
286 }
287 
288 static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
289 {
290  GetBitContext *gb = &s->gb;
291  unsigned i, b;
292 
293  for (i = 0; i < s->rows; i++) {
294  b = get_bits1(gb);
295  if (b == 0) {
296  set_pos(s, i, col, 0); i++;
297  if (i >= s->rows)
298  break;
299  set_pos(s, i, col, 0);
300  continue;
301  }
302 
303  b = get_bits1(gb);
304  if (b == 0) {
305  set_pos(s, i, col, 0);
306  continue;
307  }
308 
309  b = get_bits(gb, 3);
310  set_pos(s, i, col, map_3bit[b]);
311  }
312  return 0;
313 }
314 
315 static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
316 {
317  GetBitContext *gb = &s->gb;
318  unsigned i, b;
319 
320  for (i = 0; i < s->rows; i++) {
321  b = get_bits1(gb);
322  if (b == 0) {
323  set_pos(s, i, col, 0);
324  continue;
325  }
326 
327  b = get_bits(gb, 3);
328  set_pos(s, i, col, map_3bit[b]);
329  }
330  return 0;
331 }
332 
333 static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
334 {
335  GetBitContext *gb = &s->gb;
336  unsigned i, b;
337  int n1, n2, n3;
338 
339  for (i = 0; i < s->rows; i++) {
340  /* b = (x1) + (x2 * 3) + (x3 * 9) */
341  b = get_bits(gb, 5);
342  if (b > 26) {
343  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 26\n", b);
344  return AVERROR_INVALIDDATA;
345  }
346 
347  n1 = (mul_3x3[b] & 0x0F) - 1;
348  n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1;
349  n3 = ((mul_3x3[b] >> 8) & 0x0F) - 1;
350 
351  set_pos(s, i++, col, n1);
352  if (i >= s->rows)
353  break;
354  set_pos(s, i++, col, n2);
355  if (i >= s->rows)
356  break;
357  set_pos(s, i, col, n3);
358  }
359  return 0;
360 }
361 
362 static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
363 {
364  GetBitContext *gb = &s->gb;
365  unsigned i, b;
366  int n1, n2, n3;
367 
368  for (i = 0; i < s->rows; i++) {
369  /* b = (x1) + (x2 * 5) + (x3 * 25) */
370  b = get_bits(gb, 7);
371  if (b > 124) {
372  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 124\n", b);
373  return AVERROR_INVALIDDATA;
374  }
375 
376  n1 = (mul_3x5[b] & 0x0F) - 2;
377  n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2;
378  n3 = ((mul_3x5[b] >> 8) & 0x0F) - 2;
379 
380  set_pos(s, i++, col, n1);
381  if (i >= s->rows)
382  break;
383  set_pos(s, i++, col, n2);
384  if (i >= s->rows)
385  break;
386  set_pos(s, i, col, n3);
387  }
388  return 0;
389 }
390 
391 static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
392 {
393  GetBitContext *gb = &s->gb;
394  unsigned i, b;
395  int n1, n2;
396  for (i = 0; i < s->rows; i++) {
397  /* b = (x1) + (x2 * 11) */
398  b = get_bits(gb, 7);
399  if (b > 120) {
400  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 120\n", b);
401  return AVERROR_INVALIDDATA;
402  }
403 
404  n1 = (mul_2x11[b] & 0x0F) - 5;
405  n2 = ((mul_2x11[b] >> 4) & 0x0F) - 5;
406 
407  set_pos(s, i++, col, n1);
408  if (i >= s->rows)
409  break;
410  set_pos(s, i, col, n2);
411  }
412  return 0;
413 }
414 
415 typedef int (*filler)(InterplayACMContext *s, unsigned ind, unsigned col);
416 
417 static const filler filler_list[] = {
418  zero, bad, bad, linear,
422  linear, k13, k12, t15,
423  k24, k23, t27, k35,
424  k34, bad, k45, k44,
425  bad, t37, bad, bad,
426 };
427 
429 {
430  GetBitContext *gb = &s->gb;
431  unsigned i, ind;
432  int ret;
433 
434  if (get_bits_left(gb) < s->cols * 5)
435  return AVERROR_INVALIDDATA;
436 
437  for (i = 0; i < s->cols; i++) {
438  ind = get_bits(gb, 5);
439  ret = filler_list[ind](s, ind, i);
440  if (ret < 0)
441  return ret;
442  }
443  return 0;
444 }
445 
446 static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
447 {
448  unsigned i, j;
449  int *p;
450  unsigned int r0, r1, r2, r3;
451 
452  for (i = 0; i < sub_len; i++) {
453  p = block_p;
454  r0 = wrap_p[0];
455  r1 = wrap_p[1];
456  for (j = 0; j < sub_count/2; j++) {
457  r2 = *p;
458  *p = r1 * 2 + (r0 + r2);
459  p += sub_len;
460  r3 = *p;
461  *p = r2 * 2 - (r1 + r3);
462  p += sub_len;
463  r0 = r2;
464  r1 = r3;
465  }
466 
467  *wrap_p++ = r0;
468  *wrap_p++ = r1;
469  block_p++;
470  }
471 }
472 
474 {
475  unsigned sub_count, sub_len, todo_count, step_subcount, i;
476  int *wrap_p, *block_p, *p;
477 
478  /* juggle only if subblock_len > 1 */
479  if (s->level == 0)
480  return;
481 
482  /* 2048 / subblock_len */
483  if (s->level > 9)
484  step_subcount = 1;
485  else
486  step_subcount = (2048 >> s->level) - 2;
487 
488  /* Apply juggle() (rows)x(cols)
489  * from (step_subcount * 2) x (subblock_len/2)
490  * to (step_subcount * subblock_len) x (1)
491  */
492  todo_count = s->rows;
493  block_p = s->block;
494  while (1) {
495  wrap_p = s->wrapbuf;
496  sub_count = step_subcount;
497  if (sub_count > todo_count)
498  sub_count = todo_count;
499 
500  sub_len = s->cols / 2;
501  sub_count *= 2;
502 
503  juggle(wrap_p, block_p, sub_len, sub_count);
504  wrap_p += sub_len * 2;
505 
506  for (i = 0, p = block_p; i < sub_count; i++) {
507  p[0]++;
508  p += sub_len;
509  }
510 
511  while (sub_len > 1) {
512  sub_len /= 2;
513  sub_count *= 2;
514  juggle(wrap_p, block_p, sub_len, sub_count);
515  wrap_p += sub_len * 2;
516  }
517 
518  if (todo_count <= step_subcount)
519  break;
520 
521  todo_count -= step_subcount;
522  block_p += step_subcount << s->level;
523  }
524 }
525 
527 {
528  GetBitContext *gb = &s->gb;
529  int pwr, count, val, i, x, ret;
530 
531  pwr = get_bits(gb, 4);
532  val = get_bits(gb, 16);
533 
534  count = 1 << pwr;
535 
536  for (i = 0, x = 0; i < count; i++) {
537  s->midbuf[i] = x;
538  x += val;
539  }
540 
541  for (i = 1, x = -val; i <= count; i++) {
542  s->midbuf[-i] = x;
543  x -= (unsigned)val;
544  }
545 
546  ret = fill_block(s);
547  if (ret < 0)
548  return ret;
549 
550  juggle_block(s);
551 
552  return 0;
553 }
554 
555 static int decode_frame(AVCodecContext *avctx, void *data,
556  int *got_frame_ptr, AVPacket *pkt)
557 {
558  InterplayACMContext *s = avctx->priv_data;
559  GetBitContext *gb = &s->gb;
560  AVFrame *frame = data;
561  const uint8_t *buf;
562  int16_t *samples;
563  int ret, n, buf_size, input_buf_size;
564 
565  if (!pkt->size && !s->bitstream_size) {
566  *got_frame_ptr = 0;
567  return 0;
568  }
569 
570  buf_size = FFMIN(pkt->size, s->max_framesize - s->bitstream_size);
571  input_buf_size = buf_size;
572  if (s->bitstream_index + s->bitstream_size + buf_size > s->max_framesize) {
573  memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
574  s->bitstream_index = 0;
575  }
576  if (pkt->data)
577  memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], pkt->data, buf_size);
578  buf = &s->bitstream[s->bitstream_index];
579  buf_size += s->bitstream_size;
580  s->bitstream_size = buf_size;
581  if (buf_size < s->max_framesize && pkt->data) {
582  *got_frame_ptr = 0;
583  return input_buf_size;
584  }
585 
586  if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
587  return ret;
588 
589  frame->nb_samples = FFMIN(s->block_len / avctx->channels, s->max_samples);
590  s->max_samples -= FFMIN(frame->nb_samples, s->max_samples);
591  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
592  return ret;
593 
594  skip_bits(gb, s->skip);
595  ret = decode_block(s);
596  if (ret < 0)
597  return ret;
598 
599  samples = (int16_t *)frame->data[0];
600  for (n = 0; n < frame->nb_samples * avctx->channels; n++) {
601  int val = s->block[n] >> s->level;
602  *samples++ = val;
603  }
604 
605  *got_frame_ptr = 1;
606  s->skip = get_bits_count(gb) - 8 * (get_bits_count(gb) / 8);
607  n = get_bits_count(gb) / 8;
608 
609  if (n > buf_size && pkt->data) {
610  s->bitstream_size = 0;
611  s->bitstream_index = 0;
612  return AVERROR_INVALIDDATA;
613  }
614 
615  if (s->bitstream_size > 0) {
616  s->bitstream_index += n;
617  s->bitstream_size -= FFMIN(s->bitstream_size, n);
618  return input_buf_size;
619  }
620  return n;
621 }
622 
623 static void decode_flush(AVCodecContext *avctx)
624 {
625  InterplayACMContext *s = avctx->priv_data;
626 
627  s->bitstream_size = 0;
628  s->bitstream_index = 0;
629 }
630 
632 {
633  InterplayACMContext *s = avctx->priv_data;
634 
635  av_freep(&s->block);
636  av_freep(&s->wrapbuf);
637  av_freep(&s->ampbuf);
638  av_freep(&s->bitstream);
639  s->bitstream_size = 0;
640 
641  return 0;
642 }
643 
645  .name = "interplayacm",
646  .long_name = NULL_IF_CONFIG_SMALL("Interplay ACM"),
647  .type = AVMEDIA_TYPE_AUDIO,
649  .init = decode_init,
650  .flush = decode_flush,
651  .close = decode_close,
652  .decode = decode_frame,
653  .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
654  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
655  .priv_data_size = sizeof(InterplayACMContext),
656 };
static double val(void *priv, double ch)
Definition: aeval.c:76
#define av_cold
Definition: attributes.h:88
uint8_t
Libavcodec external API header.
#define AV_RL16
Definition: intreadwrite.h:42
#define AV_RL32
Definition: intreadwrite.h:146
#define s(width, name)
Definition: cbs_vp9.c:257
#define FFMIN(a, b)
Definition: common.h:105
#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:1911
static AVFrame * frame
int
bitstream reader API header.
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
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:77
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
@ AV_CODEC_ID_INTERPLAY_ACM
Definition: codec_id.h:503
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition: avcodec.h:215
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
for(j=16;j >0;--j)
int i
Definition: input.c:407
static const int8_t map_1bit[]
Definition: interplayacm.c:28
static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:315
static int fill_block(InterplayACMContext *s)
Definition: interplayacm.c:428
#define set_pos(s, r, c, idx)
Definition: interplayacm.c:110
static int mul_3x3[3 *3 *3]
Definition: interplayacm.c:33
static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:362
static void juggle_block(InterplayACMContext *s)
Definition: interplayacm.c:473
static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:391
static int mul_3x5[5 *5 *5]
Definition: interplayacm.c:34
static av_cold int decode_close(AVCodecContext *avctx)
Definition: interplayacm.c:631
static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:333
static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:142
static const filler filler_list[]
Definition: interplayacm.c:417
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:129
static av_cold int decode_init(AVCodecContext *avctx)
Definition: interplayacm.c:58
static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:185
static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:167
static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:211
AVCodec ff_interplay_acm_decoder
Definition: interplayacm.c:644
static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:288
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:115
static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:229
static const int8_t map_2bit_near[]
Definition: interplayacm.c:29
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:124
static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
Definition: interplayacm.c:446
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
Definition: interplayacm.c:555
int(* filler)(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:415
static const int8_t map_2bit_far[]
Definition: interplayacm.c:30
static void decode_flush(AVCodecContext *avctx)
Definition: interplayacm.c:623
static const int8_t map_3bit[]
Definition: interplayacm.c:31
static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:263
static int decode_block(InterplayACMContext *s)
Definition: interplayacm.c:526
static int mul_2x11[11 *11]
Definition: interplayacm.c:35
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:49
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
const char data[16]
Definition: mxf.c:142
main external API structure.
Definition: avcodec.h:536
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1204
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
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 * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:332
This structure stores compressed data.
Definition: packet.h:346
int size
Definition: packet.h:370
uint8_t * data
Definition: packet.h:369
GetBitContext gb
Definition: interplayacm.c:38
#define av_freep(p)
#define av_log(a,...)
AVPacket * pkt
Definition: movenc.c:59
const char * b
Definition: vf_curves.c:119