FFmpeg
wavarc.c
Go to the documentation of this file.
1 /*
2  * WavArc audio decoder
3  * Copyright (c) 2023 Paul B Mahol
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/internal.h"
23 #include "libavutil/intreadwrite.h"
24 #include "avcodec.h"
25 #include "codec_internal.h"
26 #include "decode.h"
27 #include "get_bits.h"
28 #include "bytestream.h"
29 #include "mathops.h"
30 #include "unary.h"
31 
32 typedef struct WavArcContext {
34 
35  int shift;
37  int offset;
38  int align;
39 
40  int eof;
41  int skip;
42  uint8_t *bitstream;
43  int64_t max_framesize;
46 
47  int pred[2][70];
48  int filter[2][70];
49  int samples[2][640];
51 
53 {
54  WavArcContext *s = avctx->priv_data;
55 
56  if (avctx->extradata_size < 52)
57  return AVERROR_INVALIDDATA;
58  if (AV_RL32(avctx->extradata + 16) != MKTAG('R','I','F','F'))
59  return AVERROR_INVALIDDATA;
60  if (AV_RL32(avctx->extradata + 24) != MKTAG('W','A','V','E'))
61  return AVERROR_INVALIDDATA;
62  if (AV_RL32(avctx->extradata + 28) != MKTAG('f','m','t',' '))
63  return AVERROR_INVALIDDATA;
64  if (AV_RL16(avctx->extradata + 38) != 1 &&
65  AV_RL16(avctx->extradata + 38) != 2)
66  return AVERROR_INVALIDDATA;
67 
70  avctx->sample_rate = AV_RL32(avctx->extradata + 40);
71 
72  s->align = avctx->ch_layout.nb_channels;
73 
74  switch (AV_RL16(avctx->extradata + 50)) {
75  case 8: avctx->sample_fmt = AV_SAMPLE_FMT_U8P; break;
76  case 16: s->align *= 2;
77  avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break;
78  }
79 
80  s->shift = 0;
81  switch (avctx->codec_tag) {
82  case MKTAG('0','C','P','Y'):
83  s->nb_samples = 640;
84  s->offset = 0;
85  break;
86  case MKTAG('1','D','I','F'):
87  s->nb_samples = 256;
88  s->offset = 4;
89  break;
90  case MKTAG('2','S','L','P'):
91  case MKTAG('3','N','L','P'):
92  case MKTAG('4','A','L','P'):
93  s->nb_samples = 570;
94  s->offset = 70;
95  break;
96  default:
97  return AVERROR_INVALIDDATA;
98  }
99 
100  s->max_framesize = s->nb_samples * 16;
101  s->bitstream = av_calloc(s->max_framesize, sizeof(*s->bitstream));
102  if (!s->bitstream)
103  return AVERROR(ENOMEM);
104 
105  return 0;
106 }
107 
108 static unsigned get_urice(GetBitContext *gb, int k)
109 {
110  unsigned x = get_unary(gb, 1, get_bits_left(gb));
111  unsigned y = get_bits_long(gb, k);
112  unsigned z = (x << k) | y;
113 
114  return z;
115 }
116 
117 static int get_srice(GetBitContext *gb, int k)
118 {
119  unsigned z = get_urice(gb, k);
120 
121  return (z & 1) ? ~((int)(z >> 1)) : z >> 1;
122 }
123 
124 static void do_stereo(WavArcContext *s, int ch, int correlated, int len)
125 {
126  const int nb_samples = s->nb_samples;
127  const int shift = s->shift;
128 
129  if (ch == 0) {
130  if (correlated) {
131  for (int n = 0; n < len; n++) {
132  s->samples[0][n] = s->samples[0][nb_samples + n] >> shift;
133  s->samples[1][n] = s->pred[1][n] >> shift;
134  }
135  } else {
136  for (int n = 0; n < len; n++) {
137  s->samples[0][n] = s->samples[0][nb_samples + n] >> shift;
138  s->samples[1][n] = s->pred[0][n] >> shift;
139  }
140  }
141  } else {
142  if (correlated) {
143  for (int n = 0; n < nb_samples; n++)
144  s->samples[1][n + len] += s->samples[0][n + len];
145  }
146  for (int n = 0; n < len; n++) {
147  s->pred[0][n] = s->samples[1][nb_samples + n];
148  s->pred[1][n] = s->pred[0][n] - s->samples[0][nb_samples + n];
149  }
150  }
151 }
152 
153 static int decode_0cpy(AVCodecContext *avctx,
155 {
156  const int bits = s->align * 8;
157 
158  s->nb_samples = FFMIN(640, get_bits_left(gb) / bits);
159 
160  switch (avctx->sample_fmt) {
161  case AV_SAMPLE_FMT_U8P:
162  for (int n = 0; n < s->nb_samples; n++) {
163  for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
164  s->samples[ch][n] = get_bits(gb, 8) - 0x80;
165  }
166  break;
167  case AV_SAMPLE_FMT_S16P:
168  for (int n = 0; n < s->nb_samples; n++) {
169  for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
170  s->samples[ch][n] = sign_extend(av_bswap16(get_bits(gb, 16)), 16);
171  }
172  break;
173  }
174  return 0;
175 }
176 
177 static int decode_1dif(AVCodecContext *avctx,
179 {
180  int ch, finished, fill, correlated;
181 
182  ch = 0;
183  finished = 0;
184  while (!finished) {
185  int *samples = s->samples[ch];
186  int k, block_type;
187 
188  if (get_bits_left(gb) <= 0)
189  return AVERROR_INVALIDDATA;
190 
191  block_type = get_urice(gb, 1);
192  if (block_type < 4 && block_type >= 0) {
193  k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
194  k = get_urice(gb, k) + 1;
195  if (k > 32)
196  return AVERROR_INVALIDDATA;
197  }
198 
199  switch (block_type) {
200  case 8:
201  s->eof = 1;
202  return AVERROR_EOF;
203  case 7:
204  s->nb_samples = get_bits(gb, 8);
205  continue;
206  case 6:
207  s->shift = get_urice(gb, 2);
208  continue;
209  case 5:
210  if (avctx->sample_fmt == AV_SAMPLE_FMT_U8P) {
211  fill = (int8_t)get_bits(gb, 8);
212  fill -= 0x80;
213  } else {
214  fill = (int16_t)get_bits(gb, 16);
215  fill -= 0x8000;
216  }
217 
218  for (int n = 0; n < s->nb_samples; n++)
219  samples[n + 4] = fill;
220  finished = 1;
221  break;
222  case 4:
223  for (int n = 0; n < s->nb_samples; n++)
224  samples[n + 4] = 0;
225  finished = 1;
226  break;
227  case 3:
228  for (int n = 0; n < s->nb_samples; n++)
229  samples[n + 4] = get_srice(gb, k) + (samples[n + 3] - samples[n + 2]) * 3 +
230  samples[n + 1];
231  finished = 1;
232  break;
233  case 2:
234  for (int n = 0; n < s->nb_samples; n++)
235  samples[n + 4] = get_srice(gb, k) + (samples[n + 3] * 2 - samples[n + 2]);
236  finished = 1;
237  break;
238  case 1:
239  for (int n = 0; n < s->nb_samples; n++)
240  samples[n + 4] = get_srice(gb, k) + samples[n + 3];
241  finished = 1;
242  break;
243  case 0:
244  for (int n = 0; n < s->nb_samples; n++)
245  samples[n + 4] = get_srice(gb, k);
246  finished = 1;
247  break;
248  default:
249  return AVERROR_INVALIDDATA;
250  }
251 
252  if (finished == 1 && avctx->ch_layout.nb_channels == 2) {
253  if (ch == 0)
254  correlated = get_bits1(gb);
255  finished = ch != 0;
256  do_stereo(s, ch, correlated, 4);
257  ch = 1;
258  }
259  }
260 
261  if (avctx->ch_layout.nb_channels == 1) {
262  for (int n = 0; n < 4; n++)
263  s->samples[0][n] = s->samples[0][s->nb_samples + n];
264  }
265 
266  return 0;
267 }
268 
269 static int decode_2slp(AVCodecContext *avctx,
271 {
272  int ch, finished, fill, correlated, order;
273 
274  ch = 0;
275  finished = 0;
276  while (!finished) {
277  int *samples = s->samples[ch];
278  int k, block_type;
279 
280  if (get_bits_left(gb) <= 0)
281  return AVERROR_INVALIDDATA;
282 
283  block_type = get_urice(gb, 1);
284  if (block_type < 5 && block_type >= 0) {
285  k = 1 + (avctx->sample_fmt == AV_SAMPLE_FMT_S16P);
286  k = get_urice(gb, k) + 1;
287  if (k > 32)
288  return AVERROR_INVALIDDATA;
289  }
290 
291  switch (block_type) {
292  case 9:
293  s->eof = 1;
294  return AVERROR_EOF;
295  case 8:
296  s->nb_samples = get_urice(gb, 8);
297  if (s->nb_samples > 570) {
298  s->nb_samples = 570;
299  return AVERROR_INVALIDDATA;
300  }
301  continue;
302  case 7:
303  s->shift = get_urice(gb, 2);
304  continue;
305  case 6:
306  if (avctx->sample_fmt == AV_SAMPLE_FMT_U8P) {
307  fill = (int8_t)get_bits(gb, 8);
308  fill -= 0x80;
309  } else {
310  fill = (int16_t)get_bits(gb, 16);
311  fill -= 0x8000;
312  }
313 
314  for (int n = 0; n < s->nb_samples; n++)
315  samples[n + 70] = fill;
316  finished = 1;
317  break;
318  case 5:
319  for (int n = 0; n < s->nb_samples; n++)
320  samples[n + 70] = 0;
321  finished = 1;
322  break;
323  case 4:
324  for (int n = 0; n < s->nb_samples; n++)
325  samples[n + 70] = get_srice(gb, k) + (samples[n + 69] - samples[n + 68]) * 3 +
326  samples[n + 67];
327  finished = 1;
328  break;
329  case 3:
330  for (int n = 0; n < s->nb_samples; n++)
331  samples[n + 70] = get_srice(gb, k) + (samples[n + 69] * 2 - samples[n + 68]);
332  finished = 1;
333  break;
334  case 2:
335  for (int n = 0; n < s->nb_samples; n++)
336  samples[n + 70] = get_srice(gb, k);
337  finished = 1;
338  break;
339  case 1:
340  for (int n = 0; n < s->nb_samples; n++)
341  samples[n + 70] = get_srice(gb, k) + samples[n + 69];
342  finished = 1;
343  break;
344  case 0:
345  order = get_urice(gb, 2);
346  for (int o = 0; o < order; o++)
347  s->filter[ch][o] = get_srice(gb, 2);
348  for (int n = 0; n < s->nb_samples; n++) {
349  int sum = 15;
350 
351  for (int o = 0; o < order; o++)
352  sum += s->filter[ch][o] * samples[n + 70 - o - 1];
353 
354  samples[n + 70] = get_srice(gb, k) + (sum >> 4);
355  }
356  finished = 1;
357  break;
358  default:
359  return AVERROR_INVALIDDATA;
360  }
361 
362  if (finished == 1 && avctx->ch_layout.nb_channels == 2) {
363  if (ch == 0)
364  correlated = get_bits1(gb);
365  finished = ch != 0;
366  do_stereo(s, ch, correlated, 70);
367  ch = 1;
368  }
369  }
370 
371  if (avctx->ch_layout.nb_channels == 1) {
372  for (int n = 0; n < 70; n++)
373  s->samples[0][n] = s->samples[0][s->nb_samples + n];
374  }
375 
376  return 0;
377 }
378 
380  int *got_frame_ptr, AVPacket *pkt)
381 {
382  WavArcContext *s = avctx->priv_data;
383  GetBitContext *gb = &s->gb;
384  int buf_size, input_buf_size;
385  const uint8_t *buf;
386  int ret, n;
387 
388  if ((!pkt->size && !s->bitstream_size) || s->nb_samples == 0 || s->eof) {
389  *got_frame_ptr = 0;
390  return pkt->size;
391  }
392 
393  buf_size = FFMIN(pkt->size, s->max_framesize - s->bitstream_size);
394  input_buf_size = buf_size;
395  if (s->bitstream_index + s->bitstream_size + buf_size + AV_INPUT_BUFFER_PADDING_SIZE > s->max_framesize) {
396  memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
397  s->bitstream_index = 0;
398  }
399  if (pkt->data)
400  memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], pkt->data, buf_size);
401  buf = &s->bitstream[s->bitstream_index];
402  buf_size += s->bitstream_size;
403  s->bitstream_size = buf_size;
404  if (buf_size < s->max_framesize && pkt->data) {
405  *got_frame_ptr = 0;
406  return input_buf_size;
407  }
408 
409  if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
410  goto fail;
411  skip_bits(gb, s->skip);
412 
413  switch (avctx->codec_tag) {
414  case MKTAG('0','C','P','Y'):
415  ret = decode_0cpy(avctx, s, gb);
416  break;
417  case MKTAG('1','D','I','F'):
418  ret = decode_1dif(avctx, s, gb);
419  break;
420  case MKTAG('2','S','L','P'):
421  case MKTAG('3','N','L','P'):
422  case MKTAG('4','A','L','P'):
423  ret = decode_2slp(avctx, s, gb);
424  break;
425  default:
427  }
428 
429  if (ret < 0)
430  goto fail;
431 
432  s->skip = get_bits_count(gb) - 8 * (get_bits_count(gb) / 8);
433  n = get_bits_count(gb) / 8;
434 
435  if (n > buf_size) {
436 fail:
437  s->bitstream_size = 0;
438  s->bitstream_index = 0;
439  if (ret == AVERROR_EOF)
440  return 0;
441  return AVERROR_INVALIDDATA;
442  }
443 
444  frame->nb_samples = s->nb_samples;
445  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
446  goto fail;
447 
448  switch (avctx->sample_fmt) {
449  case AV_SAMPLE_FMT_U8P:
450  for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
451  uint8_t *dst = (uint8_t *)frame->extended_data[ch];
452  const int *src = s->samples[ch] + s->offset;
453 
454  for (int n = 0; n < frame->nb_samples; n++)
455  dst[n] = src[n] * (1 << s->shift) + 0x80U;
456  }
457  break;
458  case AV_SAMPLE_FMT_S16P:
459  for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
460  int16_t *dst = (int16_t *)frame->extended_data[ch];
461  const int *src = s->samples[ch] + s->offset;
462 
463  for (int n = 0; n < frame->nb_samples; n++)
464  dst[n] = src[n] * (1 << s->shift);
465  }
466  break;
467  }
468 
469  *got_frame_ptr = 1;
470 
471  if (s->bitstream_size) {
472  s->bitstream_index += n;
473  s->bitstream_size -= n;
474  return input_buf_size;
475  }
476 
477  return n;
478 }
479 
481 {
482  WavArcContext *s = avctx->priv_data;
483 
484  av_freep(&s->bitstream);
485  s->bitstream_size = 0;
486 
487  return 0;
488 }
489 
491  .p.name = "wavarc",
492  CODEC_LONG_NAME("Waveform Archiver"),
493  .p.type = AVMEDIA_TYPE_AUDIO,
494  .p.id = AV_CODEC_ID_WAVARC,
495  .priv_data_size = sizeof(WavArcContext),
496  .init = wavarc_init,
498  .close = wavarc_close,
499  .p.capabilities = AV_CODEC_CAP_DR1 |
502  .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
505 };
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:664
get_srice
static int get_srice(GetBitContext *gb, int k)
Definition: wavarc.c:117
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
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1034
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
WavArcContext::samples
int samples[2][640]
Definition: wavarc.c:49
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:411
AV_CODEC_ID_WAVARC
@ AV_CODEC_ID_WAVARC
Definition: codec_id.h:539
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
AVPacket::data
uint8_t * data
Definition: packet.h:374
FFCodec
Definition: codec_internal.h:127
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:311
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:371
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:325
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:2054
fail
#define fail()
Definition: checkasm.h:134
GetBitContext
Definition: get_bits.h:107
wavarc_decode
static int wavarc_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *pkt)
Definition: wavarc.c:379
do_stereo
static void do_stereo(WavArcContext *s, int ch, int correlated, int len)
Definition: wavarc.c:124
WavArcContext::filter
int filter[2][70]
Definition: wavarc.c:48
decode_0cpy
static int decode_0cpy(AVCodecContext *avctx, WavArcContext *s, GetBitContext *gb)
Definition: wavarc.c:153
pkt
AVPacket * pkt
Definition: movenc.c:59
WavArcContext::offset
int offset
Definition: wavarc.c:37
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
WavArcContext
Definition: wavarc.c:32
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
WavArcContext::eof
int eof
Definition: wavarc.c:40
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
bits
uint8_t bits
Definition: vp3data.h:128
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
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
WavArcContext::shift
int shift
Definition: wavarc.c:35
WavArcContext::bitstream_size
int bitstream_size
Definition: wavarc.c:44
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:378
mathops.h
get_unary
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
WavArcContext::gb
GetBitContext gb
Definition: wavarc.c:33
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
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
codec_internal.h
shift
static int shift(int a, int b)
Definition: bonk.c:257
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
WavArcContext::bitstream
uint8_t * bitstream
Definition: wavarc.c:42
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1050
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
WavArcContext::max_framesize
int64_t max_framesize
Definition: wavarc.c:43
av_bswap16
#define av_bswap16
Definition: bswap.h:31
unary.h
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
ff_wavarc_decoder
const FFCodec ff_wavarc_decoder
Definition: wavarc.c:490
decode_1dif
static int decode_1dif(AVCodecContext *avctx, WavArcContext *s, GetBitContext *gb)
Definition: wavarc.c:177
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:962
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:527
internal.h
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:191
len
int len
Definition: vorbis_enc_data.h:426
WavArcContext::align
int align
Definition: wavarc.c:38
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
wavarc_close
static av_cold int wavarc_close(AVCodecContext *avctx)
Definition: wavarc.c:480
avcodec.h
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
U
#define U(x)
Definition: vpx_arith.h:37
AVCodecContext
main external API structure.
Definition: avcodec.h:426
WavArcContext::bitstream_index
int bitstream_index
Definition: wavarc.c:45
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:632
sign_extend
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:133
decode_2slp
static int decode_2slp(AVCodecContext *avctx, WavArcContext *s, GetBitContext *gb)
Definition: wavarc.c:269
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
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
AV_CODEC_CAP_SUBFRAMES
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
Definition: codec.h:94
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:451
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:453
WavArcContext::skip
int skip
Definition: wavarc.c:41
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
get_urice
static unsigned get_urice(GetBitContext *gb, int k)
Definition: wavarc.c:108
bytestream.h
wavarc_init
static av_cold int wavarc_init(AVCodecContext *avctx)
Definition: wavarc.c:52
WavArcContext::nb_samples
int nb_samples
Definition: wavarc.c:36
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
int
int
Definition: ffmpeg_filter.c:156
WavArcContext::pred
int pred[2][70]
Definition: wavarc.c:47