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 "codec_internal.h"
27 #include "decode.h"
28 #include "get_bits.h"
29 
30 static const int8_t map_1bit[] = { -1, +1 };
31 static const int8_t map_2bit_near[] = { -2, -1, +1, +2 };
32 static const int8_t map_2bit_far[] = { -3, -2, +2, +3 };
33 static const int8_t map_3bit[] = { -4, -3, -2, -1, +1, +2, +3, +4 };
34 
35 static int mul_3x3 [3 * 3 * 3];
36 static int mul_3x5 [5 * 5 * 5];
37 static int mul_2x11[11 * 11];
38 
39 typedef struct InterplayACMContext {
41  uint8_t *bitstream;
43  uint64_t max_samples;
46 
47  int level;
48  int rows;
49  int cols;
51  int block_len;
52  int skip;
53 
54  int *block;
55  int *wrapbuf;
56  int *ampbuf;
57  int *midbuf;
59 
60 static av_cold void decode_init_static(void)
61 {
62  for (int x3 = 0; x3 < 3; x3++)
63  for (int x2 = 0; x2 < 3; x2++)
64  for (int x1 = 0; x1 < 3; x1++)
65  mul_3x3[x1 + x2 * 3 + x3 * 3 * 3] = x1 + (x2 << 4) + (x3 << 8);
66  for (int x3 = 0; x3 < 5; x3++)
67  for (int x2 = 0; x2 < 5; x2++)
68  for (int x1 = 0; x1 < 5; x1++)
69  mul_3x5[x1 + x2 * 5 + x3 * 5 * 5] = x1 + (x2 << 4) + (x3 << 8);
70  for (int x2 = 0; x2 < 11; x2++)
71  for (int x1 = 0; x1 < 11; x1++)
72  mul_2x11[x1 + x2 * 11] = x1 + (x2 << 4);
73 }
74 
76 {
77  static AVOnce init_static_once = AV_ONCE_INIT;
79 
80  if (avctx->extradata_size < 14)
81  return AVERROR_INVALIDDATA;
82 
83  if (avctx->ch_layout.nb_channels <= 0) {
84  av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->ch_layout.nb_channels);
85  return AVERROR_INVALIDDATA;
86  }
87 
88  s->max_samples = AV_RL32(avctx->extradata + 4) / avctx->ch_layout.nb_channels;
89  if (s->max_samples == 0)
90  s->max_samples = UINT64_MAX;
91  s->level = AV_RL16(avctx->extradata + 12) & 0xf;
92  s->rows = AV_RL16(avctx->extradata + 12) >> 4;
93  s->cols = 1 << s->level;
94  s->wrapbuf_len = 2 * s->cols - 2;
95  s->block_len = s->rows * s->cols;
96  s->max_framesize = s->block_len;
97 
98  s->block = av_calloc(s->block_len, sizeof(int));
99  s->wrapbuf = av_calloc(s->wrapbuf_len, sizeof(int));
100  s->ampbuf = av_calloc(0x10000, sizeof(int));
101  s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*s->bitstream) + 1, sizeof(*s->bitstream));
102  if (!s->block || !s->wrapbuf || !s->ampbuf || !s->bitstream)
103  return AVERROR(ENOMEM);
104 
105  s->midbuf = s->ampbuf + 0x8000;
106  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
107 
108  ff_thread_once(&init_static_once, decode_init_static);
109 
110  return 0;
111 }
112 
113 #define set_pos(s, r, c, idx) do { \
114  unsigned pos = ((r) << s->level) + (c); \
115  s->block[pos] = s->midbuf[(idx)]; \
116  } while (0)
117 
118 static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
119 {
120  unsigned i;
121 
122  for (i = 0; i < s->rows; i++)
123  set_pos(s, i, col, 0);
124  return 0;
125 }
126 
127 static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
128 {
129  return AVERROR_INVALIDDATA;
130 }
131 
132 static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
133 {
134  GetBitContext *gb = &s->gb;
135  unsigned int i;
136  int b, middle = 1 << (ind - 1);
137 
138  for (i = 0; i < s->rows; i++) {
139  b = get_bits(gb, ind);
140  set_pos(s, i, col, b - middle);
141  }
142  return 0;
143 }
144 
145 static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
146 {
147  GetBitContext *gb = &s->gb;
148  unsigned i, b;
149 
150  for (i = 0; i < s->rows; i++) {
151  b = get_bits1(gb);
152  if (b == 0) {
153  set_pos(s, i++, col, 0);
154  if (i >= s->rows)
155  break;
156  set_pos(s, i, col, 0);
157  continue;
158  }
159  b = get_bits1(gb);
160  if (b == 0) {
161  set_pos(s, i, col, 0);
162  continue;
163  }
164  b = get_bits1(gb);
165  set_pos(s, i, col, map_1bit[b]);
166  }
167  return 0;
168 }
169 
170 static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
171 {
172  GetBitContext *gb = &s->gb;
173  unsigned i, b;
174 
175  for (i = 0; i < s->rows; i++) {
176  b = get_bits1(gb);
177  if (b == 0) {
178  set_pos(s, i, col, 0);
179  continue;
180  }
181 
182  b = get_bits1(gb);
183  set_pos(s, i, col, map_1bit[b]);
184  }
185  return 0;
186 }
187 
188 static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
189 {
190  GetBitContext *gb = &s->gb;
191  unsigned i, b;
192 
193  for (i = 0; i < s->rows; i++) {
194  b = get_bits1(gb);
195  if (b == 0) {
196  set_pos(s, i++, col, 0);
197  if (i >= s->rows) break;
198  set_pos(s, i, col, 0);
199  continue;
200  }
201 
202  b = get_bits1(gb);
203  if (b == 0) {
204  set_pos(s, i, col, 0);
205  continue;
206  }
207 
208  b = get_bits(gb, 2);
209  set_pos(s, i, col, map_2bit_near[b]);
210  }
211  return 0;
212 }
213 
214 static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
215 {
216  GetBitContext *gb = &s->gb;
217  unsigned i, b;
218 
219  for (i = 0; i < s->rows; i++) {
220  b = get_bits1(gb);
221  if (b == 0) {
222  set_pos(s, i, col, 0);
223  continue;
224  }
225 
226  b = get_bits(gb, 2);
227  set_pos(s, i, col, map_2bit_near[b]);
228  }
229  return 0;
230 }
231 
232 static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
233 {
234  GetBitContext *gb = &s->gb;
235  unsigned i, b;
236 
237  for (i = 0; i < s->rows; i++) {
238  b = get_bits1(gb);
239  if (b == 0) {
240  set_pos(s, i++, col, 0);
241  if (i >= s->rows)
242  break;
243  set_pos(s, i, col, 0);
244  continue;
245  }
246 
247  b = get_bits1(gb);
248  if (b == 0) {
249  set_pos(s, i, col, 0);
250  continue;
251  }
252 
253  b = get_bits1(gb);
254  if (b == 0) {
255  b = get_bits1(gb);
256  set_pos(s, i, col, map_1bit[b]);
257  continue;
258  }
259 
260  b = get_bits(gb, 2);
261  set_pos(s, i, col, map_2bit_far[b]);
262  }
263  return 0;
264 }
265 
266 static int k34(InterplayACMContext *s, unsigned ind, unsigned col)
267 {
268  GetBitContext *gb = &s->gb;
269  unsigned i, b;
270 
271  for (i = 0; i < s->rows; i++) {
272  b = get_bits1(gb);
273  if (b == 0) {
274  set_pos(s, i, col, 0);
275  continue;
276  }
277 
278  b = get_bits1(gb);
279  if (b == 0) {
280  b = get_bits1(gb);
281  set_pos(s, i, col, map_1bit[b]);
282  continue;
283  }
284 
285  b = get_bits(gb, 2);
286  set_pos(s, i, col, map_2bit_far[b]);
287  }
288  return 0;
289 }
290 
291 static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
292 {
293  GetBitContext *gb = &s->gb;
294  unsigned i, b;
295 
296  for (i = 0; i < s->rows; i++) {
297  b = get_bits1(gb);
298  if (b == 0) {
299  set_pos(s, i, col, 0); i++;
300  if (i >= s->rows)
301  break;
302  set_pos(s, i, col, 0);
303  continue;
304  }
305 
306  b = get_bits1(gb);
307  if (b == 0) {
308  set_pos(s, i, col, 0);
309  continue;
310  }
311 
312  b = get_bits(gb, 3);
313  set_pos(s, i, col, map_3bit[b]);
314  }
315  return 0;
316 }
317 
318 static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
319 {
320  GetBitContext *gb = &s->gb;
321  unsigned i, b;
322 
323  for (i = 0; i < s->rows; i++) {
324  b = get_bits1(gb);
325  if (b == 0) {
326  set_pos(s, i, col, 0);
327  continue;
328  }
329 
330  b = get_bits(gb, 3);
331  set_pos(s, i, col, map_3bit[b]);
332  }
333  return 0;
334 }
335 
336 static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
337 {
338  GetBitContext *gb = &s->gb;
339  unsigned i, b;
340  int n1, n2, n3;
341 
342  for (i = 0; i < s->rows; i++) {
343  /* b = (x1) + (x2 * 3) + (x3 * 9) */
344  b = get_bits(gb, 5);
345  if (b > 26) {
346  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 26\n", b);
347  return AVERROR_INVALIDDATA;
348  }
349 
350  n1 = (mul_3x3[b] & 0x0F) - 1;
351  n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1;
352  n3 = ((mul_3x3[b] >> 8) & 0x0F) - 1;
353 
354  set_pos(s, i++, col, n1);
355  if (i >= s->rows)
356  break;
357  set_pos(s, i++, col, n2);
358  if (i >= s->rows)
359  break;
360  set_pos(s, i, col, n3);
361  }
362  return 0;
363 }
364 
365 static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
366 {
367  GetBitContext *gb = &s->gb;
368  unsigned i, b;
369  int n1, n2, n3;
370 
371  for (i = 0; i < s->rows; i++) {
372  /* b = (x1) + (x2 * 5) + (x3 * 25) */
373  b = get_bits(gb, 7);
374  if (b > 124) {
375  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 124\n", b);
376  return AVERROR_INVALIDDATA;
377  }
378 
379  n1 = (mul_3x5[b] & 0x0F) - 2;
380  n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2;
381  n3 = ((mul_3x5[b] >> 8) & 0x0F) - 2;
382 
383  set_pos(s, i++, col, n1);
384  if (i >= s->rows)
385  break;
386  set_pos(s, i++, col, n2);
387  if (i >= s->rows)
388  break;
389  set_pos(s, i, col, n3);
390  }
391  return 0;
392 }
393 
394 static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
395 {
396  GetBitContext *gb = &s->gb;
397  unsigned i, b;
398  int n1, n2;
399  for (i = 0; i < s->rows; i++) {
400  /* b = (x1) + (x2 * 11) */
401  b = get_bits(gb, 7);
402  if (b > 120) {
403  av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 120\n", b);
404  return AVERROR_INVALIDDATA;
405  }
406 
407  n1 = (mul_2x11[b] & 0x0F) - 5;
408  n2 = ((mul_2x11[b] >> 4) & 0x0F) - 5;
409 
410  set_pos(s, i++, col, n1);
411  if (i >= s->rows)
412  break;
413  set_pos(s, i, col, n2);
414  }
415  return 0;
416 }
417 
418 typedef int (*filler)(InterplayACMContext *s, unsigned ind, unsigned col);
419 
420 static const filler filler_list[] = {
421  zero, bad, bad, linear,
425  linear, k13, k12, t15,
426  k24, k23, t27, k35,
427  k34, bad, k45, k44,
428  bad, t37, bad, bad,
429 };
430 
432 {
433  GetBitContext *gb = &s->gb;
434  unsigned i, ind;
435  int ret;
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 
556  int *got_frame_ptr, AVPacket *pkt)
557 {
558  InterplayACMContext *s = avctx->priv_data;
559  GetBitContext *gb = &s->gb;
560  const uint8_t *buf;
561  int16_t *samples;
562  int ret, n, buf_size, input_buf_size;
563 
564  if (!pkt->size && !s->bitstream_size) {
565  *got_frame_ptr = 0;
566  return 0;
567  }
568 
569  buf_size = FFMIN(pkt->size, s->max_framesize - s->bitstream_size);
570  input_buf_size = buf_size;
571  if (s->bitstream_index + s->bitstream_size + buf_size > s->max_framesize) {
572  memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
573  s->bitstream_index = 0;
574  }
575  if (pkt->data)
576  memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], pkt->data, buf_size);
577  buf = &s->bitstream[s->bitstream_index];
578  buf_size += s->bitstream_size;
579  s->bitstream_size = buf_size;
580  if (buf_size < s->max_framesize && pkt->data) {
581  *got_frame_ptr = 0;
582  return input_buf_size;
583  }
584 
585  if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
586  return ret;
587 
588  frame->nb_samples = FFMIN(s->block_len / avctx->ch_layout.nb_channels, s->max_samples);
589  s->max_samples -= FFMIN(frame->nb_samples, s->max_samples);
590  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
591  return ret;
592 
593  skip_bits(gb, s->skip);
594  ret = decode_block(s);
595  if (ret < 0)
596  return ret;
597 
598  samples = (int16_t *)frame->data[0];
599  for (n = 0; n < frame->nb_samples * avctx->ch_layout.nb_channels; n++) {
600  int val = s->block[n] >> s->level;
601  *samples++ = val;
602  }
603 
604  *got_frame_ptr = 1;
605  s->skip = get_bits_count(gb) - 8 * (get_bits_count(gb) / 8);
606  n = get_bits_count(gb) / 8;
607 
608  if (n > buf_size && pkt->data) {
609  s->bitstream_size = 0;
610  s->bitstream_index = 0;
611  return AVERROR_INVALIDDATA;
612  }
613 
614  if (s->bitstream_size > 0) {
615  s->bitstream_index += n;
616  s->bitstream_size -= FFMIN(s->bitstream_size, n);
617  return input_buf_size;
618  }
619  return n;
620 }
621 
623 {
624  InterplayACMContext *s = avctx->priv_data;
625 
626  av_freep(&s->block);
627  av_freep(&s->wrapbuf);
628  av_freep(&s->ampbuf);
629  av_freep(&s->bitstream);
630  s->bitstream_size = 0;
631 
632  return 0;
633 }
634 
636  .p.name = "interplayacm",
637  CODEC_LONG_NAME("Interplay ACM"),
638  .p.type = AVMEDIA_TYPE_AUDIO,
640  .init = decode_init,
641  .close = decode_close,
643  .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1,
644  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
645  .priv_data_size = sizeof(InterplayACMContext),
646 };
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: codec_internal.h:42
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:60
k45
static int k45(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:291
AV_CODEC_ID_INTERPLAY_ACM
@ AV_CODEC_ID_INTERPLAY_ACM
Definition: codec_id.h:516
thread.h
decode_frame
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *pkt)
Definition: interplayacm.c:555
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:256
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:330
decode_block
static int decode_block(InterplayACMContext *s)
Definition: interplayacm.c:526
AVPacket::data
uint8_t * data
Definition: packet.h:374
b
#define b
Definition: input.c:41
map_2bit_near
static const int8_t map_2bit_near[]
Definition: interplayacm.c:31
linear
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:132
ff_interplay_acm_decoder
const FFCodec ff_interplay_acm_decoder
Definition: interplayacm.c:635
FFCodec
Definition: codec_internal.h:127
InterplayACMContext::wrapbuf
int * wrapbuf
Definition: interplayacm.c:55
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:311
InterplayACMContext::bitstream_size
int bitstream_size
Definition: interplayacm.c:44
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:371
InterplayACMContext::skip
int skip
Definition: interplayacm.c:52
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:325
map_2bit_far
static const int8_t map_2bit_far[]
Definition: interplayacm.c:32
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
InterplayACMContext::cols
int cols
Definition: interplayacm.c:49
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:2054
GetBitContext
Definition: get_bits.h:107
val
static double val(void *priv, double ch)
Definition: aeval.c:77
mul_3x5
static int mul_3x5[5 *5 *5]
Definition: interplayacm.c:36
set_pos
#define set_pos(s, r, c, idx)
Definition: interplayacm.c:113
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:184
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:180
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:524
k44
static int k44(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:318
t15
static int t15(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:336
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:528
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:306
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:256
InterplayACMContext::max_samples
uint64_t max_samples
Definition: interplayacm.c:43
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
k35
static int k35(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:232
decode.h
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:266
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:182
NULL
#define NULL
Definition: coverity.c:32
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: interplayacm.c:75
mul_2x11
static int mul_2x11[11 *11]
Definition: interplayacm.c:37
k12
static int k12(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:170
decode_close
static av_cold int decode_close(AVCodecContext *avctx)
Definition: interplayacm.c:622
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:378
InterplayACMContext::bitstream
uint8_t * bitstream
Definition: interplayacm.c:41
InterplayACMContext::midbuf
int * midbuf
Definition: interplayacm.c:57
InterplayACMContext
Definition: interplayacm.c:39
AVOnce
#define AVOnce
Definition: thread.h:181
juggle_block
static void juggle_block(InterplayACMContext *s)
Definition: interplayacm.c:473
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1473
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:375
codec_internal.h
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
juggle
static void juggle(int *wrap_p, int *block_p, unsigned sub_len, unsigned sub_count)
Definition: interplayacm.c:446
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1050
filler_list
static const filler filler_list[]
Definition: interplayacm.c:420
t27
static int t27(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:365
InterplayACMContext::block
int * block
Definition: interplayacm.c:54
zero
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:118
InterplayACMContext::bitstream_index
int bitstream_index
Definition: interplayacm.c:45
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
k23
static int k23(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:214
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:527
map_1bit
static const int8_t map_1bit[]
Definition: interplayacm.c:30
InterplayACMContext::wrapbuf_len
int wrapbuf_len
Definition: interplayacm.c:50
InterplayACMContext::gb
GetBitContext gb
Definition: interplayacm.c:40
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:191
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
avcodec.h
fill_block
static int fill_block(InterplayACMContext *s)
Definition: interplayacm.c:431
InterplayACMContext::block_len
int block_len
Definition: interplayacm.c:51
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: defs.h:40
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
t37
static int t37(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:394
AVCodecContext
main external API structure.
Definition: avcodec.h:426
k13
static int k13(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:145
filler
int(* filler)(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:418
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:76
mul_3x3
static int mul_3x3[3 *3 *3]
Definition: interplayacm.c:35
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:42
bad
static int bad(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:127
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:453
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
map_3bit
static const int8_t map_3bit[]
Definition: interplayacm.c:33
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
k24
static int k24(InterplayACMContext *s, unsigned ind, unsigned col)
Definition: interplayacm.c:188
InterplayACMContext::level
int level
Definition: interplayacm.c:47
InterplayACMContext::rows
int rows
Definition: interplayacm.c:48
int
int
Definition: ffmpeg_filter.c:156
InterplayACMContext::ampbuf
int * ampbuf
Definition: interplayacm.c:56