FFmpeg
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 #include "libavutil/thread.h"
23 
24 #define BITSTREAM_READER_LE
25 #include "avcodec.h"
26 #include "get_bits.h"
27 #include "internal.h"
28 
29 static const int8_t map_1bit[] = { -1, +1 };
30 static const int8_t map_2bit_near[] = { -2, -1, +1, +2 };
31 static const int8_t map_2bit_far[] = { -3, -2, +2, +3 };
32 static const int8_t map_3bit[] = { -4, -3, -2, -1, +1, +2, +3, +4 };
33 
34 static int mul_3x3 [3 * 3 * 3];
35 static int mul_3x5 [5 * 5 * 5];
36 static int mul_2x11[11 * 11];
37 
38 typedef struct InterplayACMContext {
40  uint8_t *bitstream;
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 
58 static av_cold void decode_init_static(void)
59 {
60  for (int x3 = 0; x3 < 3; x3++)
61  for (int x2 = 0; x2 < 3; x2++)
62  for (int x1 = 0; x1 < 3; x1++)
63  mul_3x3[x1 + x2 * 3 + x3 * 3 * 3] = x1 + (x2 << 4) + (x3 << 8);
64  for (int x3 = 0; x3 < 5; x3++)
65  for (int x2 = 0; x2 < 5; x2++)
66  for (int x1 = 0; x1 < 5; x1++)
67  mul_3x5[x1 + x2 * 5 + x3 * 5 * 5] = x1 + (x2 << 4) + (x3 << 8);
68  for (int x2 = 0; x2 < 11; x2++)
69  for (int x1 = 0; x1 < 11; x1++)
70  mul_2x11[x1 + x2 * 11] = x1 + (x2 << 4);
71 }
72 
74 {
75  static AVOnce init_static_once = AV_ONCE_INIT;
77 
78  if (avctx->extradata_size < 14)
79  return AVERROR_INVALIDDATA;
80 
81  if (avctx->channels <= 0) {
82  av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels);
83  return AVERROR_INVALIDDATA;
84  }
85 
86  s->level = AV_RL16(avctx->extradata + 12) & 0xf;
87  s->rows = AV_RL16(avctx->extradata + 12) >> 4;
88  s->cols = 1 << s->level;
89  s->wrapbuf_len = 2 * s->cols - 2;
90  s->block_len = s->rows * s->cols;
91  s->max_framesize = s->block_len;
92 
93  s->block = av_calloc(s->block_len, sizeof(int));
94  s->wrapbuf = av_calloc(s->wrapbuf_len, sizeof(int));
95  s->ampbuf = av_calloc(0x10000, sizeof(int));
96  s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*s->bitstream) + 1, sizeof(*s->bitstream));
97  if (!s->block || !s->wrapbuf || !s->ampbuf || !s->bitstream)
98  return AVERROR(ENOMEM);
99 
100  s->midbuf = s->ampbuf + 0x8000;
101  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
102 
103  ff_thread_once(&init_static_once, decode_init_static);
104 
105  return 0;
106 }
107 
108 #define set_pos(s, r, c, idx) do { \
109  unsigned pos = ((r) << s->level) + (c); \
110  s->block[pos] = s->midbuf[(idx)]; \
111  } while (0)
112 
113 static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
114 {
115  unsigned i;
116 
117  for (i = 0; i < s->rows; i++)
118  set_pos(s, i, col, 0);
119  return 0;
120 }
121 
122 static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
123 {
124  return AVERROR_INVALIDDATA;
125 }
126 
127 static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
128 {
129  GetBitContext *gb = &s->gb;
130  unsigned int i;
131  int b, middle = 1 << (ind - 1);
132 
133  for (i = 0; i < s->rows; i++) {
134  b = get_bits(gb, ind);
135  set_pos(s, i, col, b - middle);
136  }
137  return 0;
138 }
139 
140 static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
141 {
142  GetBitContext *gb = &s->gb;
143  unsigned i, b;
144 
145  for (i = 0; i < s->rows; i++) {
146  b = get_bits1(gb);
147  if (b == 0) {
148  set_pos(s, i++, col, 0);
149  if (i >= s->rows)
150  break;
151  set_pos(s, i, col, 0);
152  continue;
153  }
154  b = get_bits1(gb);
155  if (b == 0) {
156  set_pos(s, i, col, 0);
157  continue;
158  }
159  b = get_bits1(gb);
160  set_pos(s, i, col, map_1bit[b]);
161  }
162  return 0;
163 }
164 
165 static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
166 {
167  GetBitContext *gb = &s->gb;
168  unsigned i, b;
169 
170  for (i = 0; i < s->rows; i++) {
171  b = get_bits1(gb);
172  if (b == 0) {
173  set_pos(s, i, col, 0);
174  continue;
175  }
176 
177  b = get_bits1(gb);
178  set_pos(s, i, col, map_1bit[b]);
179  }
180  return 0;
181 }
182 
183 static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
184 {
185  GetBitContext *gb = &s->gb;
186  unsigned i, b;
187 
188  for (i = 0; i < s->rows; i++) {
189  b = get_bits1(gb);
190  if (b == 0) {
191  set_pos(s, i++, col, 0);
192  if (i >= s->rows) break;
193  set_pos(s, i, col, 0);
194  continue;
195  }
196 
197  b = get_bits1(gb);
198  if (b == 0) {
199  set_pos(s, i, col, 0);
200  continue;
201  }
202 
203  b = get_bits(gb, 2);
204  set_pos(s, i, col, map_2bit_near[b]);
205  }
206  return 0;
207 }
208 
209 static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
210 {
211  GetBitContext *gb = &s->gb;
212  unsigned i, b;
213 
214  for (i = 0; i < s->rows; i++) {
215  b = get_bits1(gb);
216  if (b == 0) {
217  set_pos(s, i, col, 0);
218  continue;
219  }
220 
221  b = get_bits(gb, 2);
222  set_pos(s, i, col, map_2bit_near[b]);
223  }
224  return 0;
225 }
226 
227 static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
228 {
229  GetBitContext *gb = &s->gb;
230  unsigned i, b;
231 
232  for (i = 0; i < s->rows; i++) {
233  b = get_bits1(gb);
234  if (b == 0) {
235  set_pos(s, i++, col, 0);
236  if (i >= s->rows)
237  break;
238  set_pos(s, i, col, 0);
239  continue;
240  }
241 
242  b = get_bits1(gb);
243  if (b == 0) {
244  set_pos(s, i, col, 0);
245  continue;
246  }
247 
248  b = get_bits1(gb);
249  if (b == 0) {
250  b = get_bits1(gb);
251  set_pos(s, i, col, map_1bit[b]);
252  continue;
253  }
254 
255  b = get_bits(gb, 2);
256  set_pos(s, i, col, map_2bit_far[b]);
257  }
258  return 0;
259 }
260 
261 static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
262 {
263  GetBitContext *gb = &s->gb;
264  unsigned i, b;
265 
266  for (i = 0; i < s->rows; i++) {
267  b = get_bits1(gb);
268  if (b == 0) {
269  set_pos(s, i, col, 0);
270  continue;
271  }
272 
273  b = get_bits1(gb);
274  if (b == 0) {
275  b = get_bits1(gb);
276  set_pos(s, i, col, map_1bit[b]);
277  continue;
278  }
279 
280  b = get_bits(gb, 2);
281  set_pos(s, i, col, map_2bit_far[b]);
282  }
283  return 0;
284 }
285 
286 static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
287 {
288  GetBitContext *gb = &s->gb;
289  unsigned i, b;
290 
291  for (i = 0; i < s->rows; i++) {
292  b = get_bits1(gb);
293  if (b == 0) {
294  set_pos(s, i, col, 0); i++;
295  if (i >= s->rows)
296  break;
297  set_pos(s, i, col, 0);
298  continue;
299  }
300 
301  b = get_bits1(gb);
302  if (b == 0) {
303  set_pos(s, i, col, 0);
304  continue;
305  }
306 
307  b = get_bits(gb, 3);
308  set_pos(s, i, col, map_3bit[b]);
309  }
310  return 0;
311 }
312 
313 static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
314 {
315  GetBitContext *gb = &s->gb;
316  unsigned i, b;
317 
318  for (i = 0; i < s->rows; i++) {
319  b = get_bits1(gb);
320  if (b == 0) {
321  set_pos(s, i, col, 0);
322  continue;
323  }
324 
325  b = get_bits(gb, 3);
326  set_pos(s, i, col, map_3bit[b]);
327  }
328  return 0;
329 }
330 
331 static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
332 {
333  GetBitContext *gb = &s->gb;
334  unsigned i, b;
335  int n1, n2, n3;
336 
337  for (i = 0; i < s->rows; i++) {
338  /* b = (x1) + (x2 * 3) + (x3 * 9) */
339  b = get_bits(gb, 5);
340  if (b > 26) {
341  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 26\n", b);
342  return AVERROR_INVALIDDATA;
343  }
344 
345  n1 = (mul_3x3[b] & 0x0F) - 1;
346  n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1;
347  n3 = ((mul_3x3[b] >> 8) & 0x0F) - 1;
348 
349  set_pos(s, i++, col, n1);
350  if (i >= s->rows)
351  break;
352  set_pos(s, i++, col, n2);
353  if (i >= s->rows)
354  break;
355  set_pos(s, i, col, n3);
356  }
357  return 0;
358 }
359 
360 static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
361 {
362  GetBitContext *gb = &s->gb;
363  unsigned i, b;
364  int n1, n2, n3;
365 
366  for (i = 0; i < s->rows; i++) {
367  /* b = (x1) + (x2 * 5) + (x3 * 25) */
368  b = get_bits(gb, 7);
369  if (b > 124) {
370  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 124\n", b);
371  return AVERROR_INVALIDDATA;
372  }
373 
374  n1 = (mul_3x5[b] & 0x0F) - 2;
375  n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2;
376  n3 = ((mul_3x5[b] >> 8) & 0x0F) - 2;
377 
378  set_pos(s, i++, col, n1);
379  if (i >= s->rows)
380  break;
381  set_pos(s, i++, col, n2);
382  if (i >= s->rows)
383  break;
384  set_pos(s, i, col, n3);
385  }
386  return 0;
387 }
388 
389 static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
390 {
391  GetBitContext *gb = &s->gb;
392  unsigned i, b;
393  int n1, n2;
394  for (i = 0; i < s->rows; i++) {
395  /* b = (x1) + (x2 * 11) */
396  b = get_bits(gb, 7);
397  if (b > 120) {
398  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 120\n", b);
399  return AVERROR_INVALIDDATA;
400  }
401 
402  n1 = (mul_2x11[b] & 0x0F) - 5;
403  n2 = ((mul_2x11[b] >> 4) & 0x0F) - 5;
404 
405  set_pos(s, i++, col, n1);
406  if (i >= s->rows)
407  break;
408  set_pos(s, i, col, n2);
409  }
410  return 0;
411 }
412 
413 typedef int (*filler)(InterplayACMContext *s, unsigned ind, unsigned col);
414 
415 static const filler filler_list[] = {
416  zero, bad, bad, linear,
420  linear, k13, k12, t15,
421  k24, k23, t27, k35,
422  k34, bad, k45, k44,
423  bad, t37, bad, bad,
424 };
425 
427 {
428  GetBitContext *gb = &s->gb;
429  unsigned i, ind;
430  int ret;
431 
432  for (i = 0; i < s->cols; i++) {
433  ind = get_bits(gb, 5);
434  ret = filler_list[ind](s, ind, i);
435  if (ret < 0)
436  return ret;
437  }
438  return 0;
439 }
440 
441 static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
442 {
443  unsigned i, j;
444  int *p;
445  unsigned int r0, r1, r2, r3;
446 
447  for (i = 0; i < sub_len; i++) {
448  p = block_p;
449  r0 = wrap_p[0];
450  r1 = wrap_p[1];
451  for (j = 0; j < sub_count/2; j++) {
452  r2 = *p;
453  *p = r1 * 2 + (r0 + r2);
454  p += sub_len;
455  r3 = *p;
456  *p = r2 * 2 - (r1 + r3);
457  p += sub_len;
458  r0 = r2;
459  r1 = r3;
460  }
461 
462  *wrap_p++ = r0;
463  *wrap_p++ = r1;
464  block_p++;
465  }
466 }
467 
469 {
470  unsigned sub_count, sub_len, todo_count, step_subcount, i;
471  int *wrap_p, *block_p, *p;
472 
473  /* juggle only if subblock_len > 1 */
474  if (s->level == 0)
475  return;
476 
477  /* 2048 / subblock_len */
478  if (s->level > 9)
479  step_subcount = 1;
480  else
481  step_subcount = (2048 >> s->level) - 2;
482 
483  /* Apply juggle() (rows)x(cols)
484  * from (step_subcount * 2) x (subblock_len/2)
485  * to (step_subcount * subblock_len) x (1)
486  */
487  todo_count = s->rows;
488  block_p = s->block;
489  while (1) {
490  wrap_p = s->wrapbuf;
491  sub_count = step_subcount;
492  if (sub_count > todo_count)
493  sub_count = todo_count;
494 
495  sub_len = s->cols / 2;
496  sub_count *= 2;
497 
498  juggle(wrap_p, block_p, sub_len, sub_count);
499  wrap_p += sub_len * 2;
500 
501  for (i = 0, p = block_p; i < sub_count; i++) {
502  p[0]++;
503  p += sub_len;
504  }
505 
506  while (sub_len > 1) {
507  sub_len /= 2;
508  sub_count *= 2;
509  juggle(wrap_p, block_p, sub_len, sub_count);
510  wrap_p += sub_len * 2;
511  }
512 
513  if (todo_count <= step_subcount)
514  break;
515 
516  todo_count -= step_subcount;
517  block_p += step_subcount << s->level;
518  }
519 }
520 
522 {
523  GetBitContext *gb = &s->gb;
524  int pwr, count, val, i, x, ret;
525 
526  pwr = get_bits(gb, 4);
527  val = get_bits(gb, 16);
528 
529  count = 1 << pwr;
530 
531  for (i = 0, x = 0; i < count; i++) {
532  s->midbuf[i] = x;
533  x += val;
534  }
535 
536  for (i = 1, x = -val; i <= count; i++) {
537  s->midbuf[-i] = x;
538  x -= (unsigned)val;
539  }
540 
541  ret = fill_block(s);
542  if (ret < 0)
543  return ret;
544 
545  juggle_block(s);
546 
547  return 0;
548 }
549 
550 static int decode_frame(AVCodecContext *avctx, void *data,
551  int *got_frame_ptr, AVPacket *pkt)
552 {
553  InterplayACMContext *s = avctx->priv_data;
554  GetBitContext *gb = &s->gb;
555  AVFrame *frame = data;
556  const uint8_t *buf;
557  int16_t *samples;
558  int ret, n, buf_size, input_buf_size;
559 
560  if (!pkt->size && !s->bitstream_size) {
561  *got_frame_ptr = 0;
562  return 0;
563  }
564 
565  buf_size = FFMIN(pkt->size, s->max_framesize - s->bitstream_size);
566  input_buf_size = buf_size;
567  if (s->bitstream_index + s->bitstream_size + buf_size > s->max_framesize) {
568  memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
569  s->bitstream_index = 0;
570  }
571  if (pkt->data)
572  memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], pkt->data, buf_size);
573  buf = &s->bitstream[s->bitstream_index];
574  buf_size += s->bitstream_size;
575  s->bitstream_size = buf_size;
576  if (buf_size < s->max_framesize && pkt->data) {
577  *got_frame_ptr = 0;
578  return input_buf_size;
579  }
580 
581  if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
582  return ret;
583 
584  frame->nb_samples = s->block_len / avctx->channels;
585  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
586  return ret;
587 
588  skip_bits(gb, s->skip);
589  ret = decode_block(s);
590  if (ret < 0)
591  return ret;
592 
593  samples = (int16_t *)frame->data[0];
594  for (n = 0; n < frame->nb_samples * avctx->channels; n++) {
595  int val = s->block[n] >> s->level;
596  *samples++ = val;
597  }
598 
599  *got_frame_ptr = 1;
600  s->skip = get_bits_count(gb) - 8 * (get_bits_count(gb) / 8);
601  n = get_bits_count(gb) / 8;
602 
603  if (n > buf_size && pkt->data) {
604  s->bitstream_size = 0;
605  s->bitstream_index = 0;
606  return AVERROR_INVALIDDATA;
607  }
608 
609  if (s->bitstream_size) {
610  s->bitstream_index += n;
611  s->bitstream_size -= n;
612  return input_buf_size;
613  }
614  return n;
615 }
616 
618 {
619  InterplayACMContext *s = avctx->priv_data;
620 
621  av_freep(&s->block);
622  av_freep(&s->wrapbuf);
623  av_freep(&s->ampbuf);
624  av_freep(&s->bitstream);
625  s->bitstream_size = 0;
626 
627  return 0;
628 }
629 
631  .name = "interplayacm",
632  .long_name = NULL_IF_CONFIG_SMALL("Interplay ACM"),
633  .type = AVMEDIA_TYPE_AUDIO,
635  .init = decode_init,
636  .close = decode_close,
637  .decode = decode_frame,
638  .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
640  .priv_data_size = sizeof(InterplayACMContext),
641 };
AVCodec
AVCodec.
Definition: codec.h:197
FF_CODEC_CAP_INIT_THREADSAFE
#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
AVERROR
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
decode_init_static
static av_cold void decode_init_static(void)
Definition: interplayacm.c:58
k45
static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:286
AV_CODEC_ID_INTERPLAY_ACM
@ AV_CODEC_ID_INTERPLAY_ACM
Definition: codec_id.h:499
thread.h
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
internal.h
decode_block
static int decode_block(InterplayACMContext *s)
Definition: interplayacm.c:521
AVPacket::data
uint8_t * data
Definition: packet.h:365
b
#define b
Definition: input.c:41
map_2bit_near
static const int8_t map_2bit_near[]
Definition: interplayacm.c:30
data
const char data[16]
Definition: mxf.c:142
linear
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:127
InterplayACMContext::wrapbuf
int * wrapbuf
Definition: interplayacm.c:53
InterplayACMContext::bitstream_size
int bitstream_size
Definition: interplayacm.c:42
ff_interplay_acm_decoder
const AVCodec ff_interplay_acm_decoder
Definition: interplayacm.c:630
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
InterplayACMContext::skip
int skip
Definition: interplayacm.c:50
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
map_2bit_far
static const int8_t map_2bit_far[]
Definition: interplayacm.c:31
InterplayACMContext::cols
int cols
Definition: interplayacm.c:47
GetBitContext
Definition: get_bits.h:61
val
static double val(void *priv, double ch)
Definition: aeval.c:76
mul_3x5
static int mul_3x5[5 *5 *5]
Definition: interplayacm.c:35
set_pos
#define set_pos(s, r, c, idx)
Definition: interplayacm.c:108
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:175
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:181
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:677
k44
static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:313
t15
static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:331
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:603
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
decode_frame
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
Definition: interplayacm.c:550
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
k35
static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:227
get_bits.h
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
k34
static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:261
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:173
NULL
#define NULL
Definition: coverity.c:32
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: interplayacm.c:73
mul_2x11
static int mul_2x11[11 *11]
Definition: interplayacm.c:36
k12
static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:165
decode_close
static av_cold int decode_close(AVCodecContext *avctx)
Definition: interplayacm.c:617
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
InterplayACMContext::bitstream
uint8_t * bitstream
Definition: interplayacm.c:40
InterplayACMContext::midbuf
int * midbuf
Definition: interplayacm.c:55
InterplayACMContext
Definition: interplayacm.c:38
AVOnce
#define AVOnce
Definition: thread.h:172
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
juggle_block
static void juggle_block(InterplayACMContext *s)
Definition: interplayacm.c:468
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1638
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
AVPacket::size
int size
Definition: packet.h:366
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
juggle
static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
Definition: interplayacm.c:441
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1106
filler_list
static const filler filler_list[]
Definition: interplayacm.c:415
t27
static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:360
FFMIN
#define FFMIN(a, b)
Definition: common.h:105
InterplayACMContext::block
int * block
Definition: interplayacm.c:52
zero
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:113
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:1099
InterplayACMContext::bitstream_index
int bitstream_index
Definition: interplayacm.c:43
i
int i
Definition: input.c:407
k23
static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:209
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:602
FF_CODEC_CAP_INIT_CLEANUP
#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
map_1bit
static const int8_t map_1bit[]
Definition: interplayacm.c:29
InterplayACMContext::wrapbuf_len
int wrapbuf_len
Definition: interplayacm.c:48
InterplayACMContext::gb
GetBitContext gb
Definition: interplayacm.c:39
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:204
avcodec.h
fill_block
static int fill_block(InterplayACMContext *s)
Definition: interplayacm.c:426
InterplayACMContext::block_len
int block_len
Definition: interplayacm.c:49
ret
ret
Definition: filter_design.txt:187
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_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: avcodec.h:192
t37
static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:389
AVCodecContext
main external API structure.
Definition: avcodec.h:501
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:251
k13
static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:140
filler
int(* filler)(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:413
AV_CODEC_CAP_DELAY
#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
mul_3x3
static int mul_3x3[3 *3 *3]
Definition: interplayacm.c:34
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
InterplayACMContext::max_framesize
int max_framesize
Definition: interplayacm.c:41
bad
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:122
AVPacket
This structure stores compressed data.
Definition: packet.h:342
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:528
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
map_3bit
static const int8_t map_3bit[]
Definition: interplayacm.c:32
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
k24
static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:183
InterplayACMContext::level
int level
Definition: interplayacm.c:45
InterplayACMContext::rows
int rows
Definition: interplayacm.c:46
int
int
Definition: ffmpeg_filter.c:156
InterplayACMContext::ampbuf
int * ampbuf
Definition: interplayacm.c:54