FFmpeg
tta.c
Go to the documentation of this file.
1 /*
2  * TTA (The Lossless True Audio) decoder
3  * Copyright (c) 2006 Alex Beregszaszi
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 /**
23  * @file
24  * TTA (The Lossless True Audio) decoder
25  * @see http://www.true-audio.com/
26  * @see http://tta.corecodec.org/
27  * @author Alex Beregszaszi
28  */
29 
30 #include <limits.h>
31 
32 #include "libavutil/crc.h"
33 #include "libavutil/intreadwrite.h"
34 #include "libavutil/opt.h"
35 
36 #define BITSTREAM_READER_LE
37 #include "ttadata.h"
38 #include "ttadsp.h"
39 #include "avcodec.h"
40 #include "get_bits.h"
41 #include "thread.h"
42 #include "unary.h"
43 #include "internal.h"
44 
45 #define FORMAT_SIMPLE 1
46 #define FORMAT_ENCRYPTED 2
47 
48 typedef struct TTAContext {
49  AVClass *class;
51  const AVCRC *crc_table;
52 
54  unsigned data_length;
56 
58 
63 } TTAContext;
64 
65 static const int64_t tta_channel_layouts[7] = {
69  0,
71  AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER,
73 };
74 
75 static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size)
76 {
77  uint32_t crc, CRC;
78 
79  CRC = AV_RL32(buf + buf_size);
80  crc = av_crc(s->crc_table, 0xFFFFFFFFU, buf, buf_size);
81  if (CRC != (crc ^ 0xFFFFFFFFU)) {
82  av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
83  return AVERROR_INVALIDDATA;
84  }
85 
86  return 0;
87 }
88 
89 static uint64_t tta_check_crc64(uint8_t *pass)
90 {
91  uint64_t crc = UINT64_MAX, poly = 0x42F0E1EBA9EA3693U;
92  uint8_t *end = pass + strlen(pass);
93  int i;
94 
95  while (pass < end) {
96  crc ^= (uint64_t)*pass++ << 56;
97  for (i = 0; i < 8; i++)
98  crc = (crc << 1) ^ (poly & (((int64_t) crc) >> 63));
99  }
100 
101  return crc ^ UINT64_MAX;
102 }
103 
105 {
106  TTAContext *s = avctx->priv_data;
107 
108  if (s->bps < 3) {
110  if (!s->decode_buffer)
111  return AVERROR(ENOMEM);
112  } else
113  s->decode_buffer = NULL;
114  s->ch_ctx = av_malloc_array(avctx->channels, sizeof(*s->ch_ctx));
115  if (!s->ch_ctx) {
116  av_freep(&s->decode_buffer);
117  return AVERROR(ENOMEM);
118  }
119 
120  return 0;
121 }
122 
124 {
125  TTAContext *s = avctx->priv_data;
126  GetBitContext gb;
127  int total_frames;
128  int ret;
129 
130  s->avctx = avctx;
131 
132  // 30bytes includes TTA1 header
133  if (avctx->extradata_size < 22)
134  return AVERROR_INVALIDDATA;
135 
137  ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
138  if (ret < 0)
139  return ret;
140 
141  if (show_bits_long(&gb, 32) == AV_RL32("TTA1")) {
142  /* signature */
143  skip_bits_long(&gb, 32);
144 
145  s->format = get_bits(&gb, 16);
146  if (s->format > 2) {
147  av_log(avctx, AV_LOG_ERROR, "Invalid format\n");
148  return AVERROR_INVALIDDATA;
149  }
150  if (s->format == FORMAT_ENCRYPTED) {
151  if (!s->pass) {
152  av_log(avctx, AV_LOG_ERROR, "Missing password for encrypted stream. Please use the -password option\n");
153  return AVERROR(EINVAL);
154  }
156  }
157  avctx->channels = s->channels = get_bits(&gb, 16);
158  if (s->channels > 1 && s->channels < 9)
160  avctx->bits_per_raw_sample = get_bits(&gb, 16);
161  s->bps = (avctx->bits_per_raw_sample + 7) / 8;
162  avctx->sample_rate = get_bits_long(&gb, 32);
163  s->data_length = get_bits_long(&gb, 32);
164  skip_bits_long(&gb, 32); // CRC32 of header
165 
166  if (s->channels == 0 || s->channels > 16) {
167  av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
168  return AVERROR_INVALIDDATA;
169  } else if (avctx->sample_rate == 0) {
170  av_log(avctx, AV_LOG_ERROR, "Invalid samplerate\n");
171  return AVERROR_INVALIDDATA;
172  }
173 
174  switch(s->bps) {
175  case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break;
176  case 2:
177  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
178  break;
179  case 3:
180  avctx->sample_fmt = AV_SAMPLE_FMT_S32;
181  break;
182  //case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break;
183  default:
184  av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\n");
185  return AVERROR_INVALIDDATA;
186  }
187 
188  // prevent overflow
189  if (avctx->sample_rate > 0x7FFFFFu) {
190  av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
191  return AVERROR(EINVAL);
192  }
193  s->frame_length = 256 * avctx->sample_rate / 245;
194 
196  total_frames = s->data_length / s->frame_length +
197  (s->last_frame_length ? 1 : 0);
198 
199  av_log(avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",
200  s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
201  avctx->block_align);
202  av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
203  s->data_length, s->frame_length, s->last_frame_length, total_frames);
204 
205  if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
206  av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
207  return AVERROR_INVALIDDATA;
208  }
209  } else {
210  av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
211  return AVERROR_INVALIDDATA;
212  }
213 
214  ff_ttadsp_init(&s->dsp);
215 
216  return allocate_buffers(avctx);
217 }
218 
220  int *got_frame_ptr, AVPacket *avpkt)
221 {
222  AVFrame *frame = data;
223  ThreadFrame tframe = { .f = data };
224  const uint8_t *buf = avpkt->data;
225  int buf_size = avpkt->size;
226  TTAContext *s = avctx->priv_data;
227  GetBitContext gb;
228  int i, ret;
229  int cur_chan = 0, framelen = s->frame_length;
230  int32_t *p;
231 
232  if (avctx->err_recognition & AV_EF_CRCCHECK) {
233  if (buf_size < 4 ||
234  (tta_check_crc(s, buf, buf_size - 4) && avctx->err_recognition & AV_EF_EXPLODE))
235  return AVERROR_INVALIDDATA;
236  }
237 
238  if ((ret = init_get_bits8(&gb, avpkt->data, avpkt->size)) < 0)
239  return ret;
240 
241  /* get output buffer */
242  frame->nb_samples = framelen;
243  if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
244  return ret;
245 
246  // decode directly to output buffer for 24-bit sample format
247  if (s->bps == 3)
248  s->decode_buffer = (int32_t *)frame->data[0];
249 
250  // init per channel states
251  for (i = 0; i < s->channels; i++) {
252  TTAFilter *filter = &s->ch_ctx[i].filter;
253  s->ch_ctx[i].predictor = 0;
255  if (s->format == FORMAT_ENCRYPTED) {
256  int i;
257  for (i = 0; i < 8; i++)
258  filter->qm[i] = sign_extend(s->crc_pass[i], 8);
259  }
260  ff_tta_rice_init(&s->ch_ctx[i].rice, 10, 10);
261  }
262 
263  i = 0;
264  for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
265  int32_t *predictor = &s->ch_ctx[cur_chan].predictor;
266  TTAFilter *filter = &s->ch_ctx[cur_chan].filter;
267  TTARice *rice = &s->ch_ctx[cur_chan].rice;
268  uint32_t unary, depth, k;
269  int32_t value;
270 
271  unary = get_unary(&gb, 0, get_bits_left(&gb));
272 
273  if (unary == 0) {
274  depth = 0;
275  k = rice->k0;
276  } else {
277  depth = 1;
278  k = rice->k1;
279  unary--;
280  }
281 
282  if (get_bits_left(&gb) < k) {
283  ret = AVERROR_INVALIDDATA;
284  goto error;
285  }
286 
287  if (k) {
288  if (k > MIN_CACHE_BITS || unary > INT32_MAX >> k) {
289  ret = AVERROR_INVALIDDATA;
290  goto error;
291  }
292  value = (unary << k) + get_bits(&gb, k);
293  } else
294  value = unary;
295 
296  // FIXME: copy paste from original
297  switch (depth) {
298  case 1:
299  rice->sum1 += value - (rice->sum1 >> 4);
300  if (rice->k1 > 0 && rice->sum1 < ff_tta_shift_16[rice->k1])
301  rice->k1--;
302  else if(rice->sum1 > ff_tta_shift_16[rice->k1 + 1])
303  rice->k1++;
304  value += ff_tta_shift_1[rice->k0];
305  default:
306  rice->sum0 += value - (rice->sum0 >> 4);
307  if (rice->k0 > 0 && rice->sum0 < ff_tta_shift_16[rice->k0])
308  rice->k0--;
309  else if(rice->sum0 > ff_tta_shift_16[rice->k0 + 1])
310  rice->k0++;
311  }
312 
313  // extract coded value
314  *p = 1 + ((value >> 1) ^ ((value & 1) - 1));
315 
316  // run hybrid filter
317  s->dsp.filter_process(filter->qm, filter->dx, filter->dl, &filter->error, p,
318  filter->shift, filter->round);
319 
320  // fixed order prediction
321 #define PRED(x, k) (int32_t)((((uint64_t)(x) << (k)) - (x)) >> (k))
322  switch (s->bps) {
323  case 1: *p += PRED(*predictor, 4); break;
324  case 2:
325  case 3: *p += PRED(*predictor, 5); break;
326  case 4: *p += *predictor; break;
327  }
328  *predictor = *p;
329 
330  // flip channels
331  if (cur_chan < (s->channels-1))
332  cur_chan++;
333  else {
334  // decorrelate in case of multiple channels
335  if (s->channels > 1) {
336  int32_t *r = p - 1;
337  for (*p += *r / 2; r > p - s->channels; r--)
338  *r = *(r + 1) - *r;
339  }
340  cur_chan = 0;
341  i++;
342  // check for last frame
343  if (i == s->last_frame_length && get_bits_left(&gb) / 8 == 4) {
344  frame->nb_samples = framelen = s->last_frame_length;
345  break;
346  }
347  }
348  }
349 
350  align_get_bits(&gb);
351  if (get_bits_left(&gb) < 32) {
352  ret = AVERROR_INVALIDDATA;
353  goto error;
354  }
355  skip_bits_long(&gb, 32); // frame crc
356 
357  // convert to output buffer
358  switch (s->bps) {
359  case 1: {
360  uint8_t *samples = (uint8_t *)frame->data[0];
361  for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
362  *samples++ = *p + 0x80;
363  break;
364  }
365  case 2: {
366  int16_t *samples = (int16_t *)frame->data[0];
367  for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
368  *samples++ = *p;
369  break;
370  }
371  case 3: {
372  // shift samples for 24-bit sample format
373  int32_t *samples = (int32_t *)frame->data[0];
374  for (i = 0; i < framelen * s->channels; i++)
375  *samples++ *= 256;
376  // reset decode buffer
377  s->decode_buffer = NULL;
378  break;
379  }
380  }
381 
382  *got_frame_ptr = 1;
383 
384  return buf_size;
385 error:
386  // reset decode buffer
387  if (s->bps == 3)
388  s->decode_buffer = NULL;
389  return ret;
390 }
391 
393 {
394  TTAContext *s = avctx->priv_data;
395  s->avctx = avctx;
396  return allocate_buffers(avctx);
397 }
398 
400  TTAContext *s = avctx->priv_data;
401 
402  if (s->bps < 3)
403  av_freep(&s->decode_buffer);
404  s->decode_buffer = NULL;
405  av_freep(&s->ch_ctx);
406 
407  return 0;
408 }
409 
410 #define OFFSET(x) offsetof(TTAContext, x)
411 #define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
412 static const AVOption options[] = {
413  { "password", "Set decoding password", OFFSET(pass), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, DEC },
414  { NULL },
415 };
416 
417 static const AVClass tta_decoder_class = {
418  .class_name = "TTA Decoder",
419  .item_name = av_default_item_name,
420  .option = options,
421  .version = LIBAVUTIL_VERSION_INT,
422 };
423 
425  .name = "tta",
426  .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
427  .type = AVMEDIA_TYPE_AUDIO,
428  .id = AV_CODEC_ID_TTA,
429  .priv_data_size = sizeof(TTAContext),
431  .close = tta_decode_close,
435  .priv_class = &tta_decoder_class,
436 };
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:602
static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size)
Definition: tta.c:75
#define NULL
Definition: coverity.c:32
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
AVOption.
Definition: opt.h:246
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:100
TTAChannel * ch_ctx
Definition: tta.c:61
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
static int init_thread_copy(AVCodecContext *avctx)
Definition: tta.c:392
AVFrame * f
Definition: thread.h:35
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:291
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int tta_decode_init(AVCodecContext *avctx)
Definition: tta.c:123
static int tta_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: tta.c:219
void ff_tta_rice_init(TTARice *c, uint32_t k0, uint32_t k1)
Definition: ttadata.c:40
int size
Definition: avcodec.h:1478
int32_t predictor
Definition: ttadata.h:39
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
Definition: tta.c:48
int format
Definition: tta.c:53
int bps
Definition: tta.c:53
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2796
#define AV_CH_LAYOUT_STEREO
static const int64_t tta_channel_layouts[7]
Definition: tta.c:65
AVCodec.
Definition: avcodec.h:3481
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:2262
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
int32_t error
Definition: ttadata.h:28
int32_t round
Definition: ttadata.h:28
static av_cold int tta_decode_close(AVCodecContext *avctx)
Definition: tta.c:399
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:2233
uint8_t
#define av_cold
Definition: attributes.h:82
AV_SAMPLE_FMT_U8
AVOptions.
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
Multithreading support functions.
TTADSPContext dsp
Definition: tta.c:62
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
static uint64_t tta_check_crc64(uint8_t *pass)
Definition: tta.c:89
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1666
#define AV_CH_LOW_FREQUENCY
Public header for CRC hash function implementation.
uint8_t * data
Definition: avcodec.h:1477
static const AVOption options[]
Definition: tta.c:412
int32_t qm[MAX_ORDER]
Definition: ttadata.h:29
bitstream reader API header.
int32_t shift
Definition: ttadata.h:28
av_cold void ff_ttadsp_init(TTADSPContext *c)
Definition: ttadsp.c:53
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2789
uint8_t crc_pass[8]
Definition: tta.c:59
signed 32 bits
Definition: samplefmt.h:62
#define av_log(a,...)
#define U(x)
Definition: vp56_arith.h:37
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
#define AV_WL64(p, v)
Definition: intreadwrite.h:440
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static int allocate_buffers(AVCodecContext *avctx)
Definition: tta.c:104
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
AVCodec ff_tta_decoder
Definition: tta.c:424
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
const char * r
Definition: vf_curves.c:114
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
#define AV_CH_LAYOUT_QUAD
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1037
#define OFFSET(x)
Definition: tta.c:410
const AVCRC * crc_table
Definition: tta.c:51
uint32_t sum1
Definition: ttadata.h:35
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2276
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:225
unsigned data_length
Definition: tta.c:54
const uint32_t ff_tta_shift_1[]
Definition: ttadata.c:23
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:2694
const uint32_t *const ff_tta_shift_16
Definition: ttadata.c:36
int32_t
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
Definition: crc.c:392
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
#define s(width, name)
Definition: cbs_vp9.c:257
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:2705
#define AV_CH_LAYOUT_5POINT1_BACK
static void error(const char *err)
uint32_t k1
Definition: ttadata.h:35
Libavcodec external API header.
AVCodecContext * avctx
Definition: tta.c:50
static const AVClass tta_decoder_class
Definition: tta.c:417
int sample_rate
samples per second
Definition: avcodec.h:2225
const uint8_t ff_tta_filter_configs[]
Definition: ttadata.c:38
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
Definition: avcodec.h:1565
int32_t dx[MAX_ORDER]
Definition: ttadata.h:30
void * buf
Definition: avisynth_c.h:766
int extradata_size
Definition: avcodec.h:1667
Describe the class of an AVClass context structure.
Definition: log.h:67
#define DEC
Definition: tta.c:411
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data...
Definition: avcodec.h:2702
uint8_t * pass
Definition: tta.c:60
int frame_length
Definition: tta.c:55
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:546
int last_frame_length
Definition: tta.c:55
#define MIN_CACHE_BITS
Definition: get_bits.h:128
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:130
#define AV_CH_BACK_CENTER
#define AV_CH_LAYOUT_7POINT1_WIDE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:374
uint32_t k0
Definition: ttadata.h:35
#define PRED(x, k)
int channels
Definition: tta.c:53
common internal api header.
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
signed 16 bits
Definition: samplefmt.h:61
int32_t * decode_buffer
Definition: tta.c:57
void * priv_data
Definition: avcodec.h:1592
TTAFilter filter
Definition: ttadata.h:40
int channels
number of audio channels
Definition: avcodec.h:2226
int32_t dl[MAX_ORDER]
Definition: ttadata.h:31
#define FORMAT_ENCRYPTED
Definition: tta.c:46
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:693
Filter the word “frame” indicates either a video frame or a group of audio samples
#define av_freep(p)
#define av_malloc_array(a, b)
TTARice rice
Definition: ttadata.h:41
void ff_tta_filter_init(TTAFilter *c, int32_t shift)
Definition: ttadata.c:48
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
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
This structure stores compressed data.
Definition: avcodec.h:1454
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:361
uint32_t AVCRC
Definition: crc.h:47
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
for(j=16;j >0;--j)
uint32_t sum0
Definition: ttadata.h:35
void(* filter_process)(int32_t *qm, int32_t *dx, int32_t *dl, int32_t *error, int32_t *in, int32_t shift, int32_t round)
Definition: ttadsp.h:25
void * av_mallocz_array(size_t nmemb, size_t size)
Definition: mem.c:191