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