FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
flacdec.c
Go to the documentation of this file.
1 /*
2  * FLAC (Free Lossless Audio Codec) decoder
3  * Copyright (c) 2003 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  * FLAC (Free Lossless Audio Codec) decoder
25  * @author Alex Beregszaszi
26  * @see http://flac.sourceforge.net/
27  *
28  * This decoder can be used in 1 of 2 ways: Either raw FLAC data can be fed
29  * through, starting from the initial 'fLaC' signature; or by passing the
30  * 34-byte streaminfo structure through avctx->extradata[_size] followed
31  * by data starting with the 0xFFF8 marker.
32  */
33 
34 #include <limits.h>
35 
36 #include "libavutil/avassert.h"
37 #include "libavutil/crc.h"
38 #include "libavutil/opt.h"
39 #include "avcodec.h"
40 #include "internal.h"
41 #include "get_bits.h"
42 #include "bytestream.h"
43 #include "golomb.h"
44 #include "flac.h"
45 #include "flacdata.h"
46 #include "flacdsp.h"
47 #include "thread.h"
48 #include "unary.h"
49 
50 
51 typedef struct FLACContext {
52  AVClass *class;
54 
55  AVCodecContext *avctx; ///< parent AVCodecContext
56  GetBitContext gb; ///< GetBitContext initialized to start at the current frame
57 
58  int blocksize; ///< number of samples in the current frame
59  int sample_shift; ///< shift required to make output samples 16-bit or 32-bit
60  int ch_mode; ///< channel decorrelation type in the current frame
61  int got_streaminfo; ///< indicates if the STREAMINFO has been read
62 
63  int32_t *decoded[FLAC_MAX_CHANNELS]; ///< decoded samples
65  unsigned int decoded_buffer_size;
66  int buggy_lpc; ///< use workaround for old lavc encoded files
67 
69 } FLACContext;
70 
71 static int allocate_buffers(FLACContext *s);
72 
73 static void flac_set_bps(FLACContext *s)
74 {
76  int need32 = s->flac_stream_info.bps > 16;
77  int want32 = av_get_bytes_per_sample(req) > 2;
79 
80  if (need32 || want32) {
81  if (planar)
83  else
85  s->sample_shift = 32 - s->flac_stream_info.bps;
86  } else {
87  if (planar)
89  else
91  s->sample_shift = 16 - s->flac_stream_info.bps;
92  }
93 }
94 
96 {
98  uint8_t *streaminfo;
99  int ret;
100  FLACContext *s = avctx->priv_data;
101  s->avctx = avctx;
102 
103  /* for now, the raw FLAC header is allowed to be passed to the decoder as
104  frame data instead of extradata. */
105  if (!avctx->extradata)
106  return 0;
107 
108  if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
109  return AVERROR_INVALIDDATA;
110 
111  /* initialize based on the demuxer-supplied streamdata header */
112  ret = ff_flac_parse_streaminfo(avctx, &s->flac_stream_info, streaminfo);
113  if (ret < 0)
114  return ret;
115  ret = allocate_buffers(s);
116  if (ret < 0)
117  return ret;
118  flac_set_bps(s);
119  ff_flacdsp_init(&s->dsp, avctx->sample_fmt,
120  s->flac_stream_info.channels, s->flac_stream_info.bps);
121  s->got_streaminfo = 1;
122 
123  return 0;
124 }
125 
127 {
128  av_log(avctx, AV_LOG_DEBUG, " Max Blocksize: %d\n", s->max_blocksize);
129  av_log(avctx, AV_LOG_DEBUG, " Max Framesize: %d\n", s->max_framesize);
130  av_log(avctx, AV_LOG_DEBUG, " Samplerate: %d\n", s->samplerate);
131  av_log(avctx, AV_LOG_DEBUG, " Channels: %d\n", s->channels);
132  av_log(avctx, AV_LOG_DEBUG, " Bits: %d\n", s->bps);
133 }
134 
136 {
137  int buf_size;
138  int ret;
139 
140  av_assert0(s->flac_stream_info.max_blocksize);
141 
142  buf_size = av_samples_get_buffer_size(NULL, s->flac_stream_info.channels,
143  s->flac_stream_info.max_blocksize,
144  AV_SAMPLE_FMT_S32P, 0);
145  if (buf_size < 0)
146  return buf_size;
147 
149  if (!s->decoded_buffer)
150  return AVERROR(ENOMEM);
151 
153  s->decoded_buffer,
154  s->flac_stream_info.channels,
155  s->flac_stream_info.max_blocksize,
156  AV_SAMPLE_FMT_S32P, 0);
157  return ret < 0 ? ret : 0;
158 }
159 
160 /**
161  * Parse the STREAMINFO from an inline header.
162  * @param s the flac decoding context
163  * @param buf input buffer, starting with the "fLaC" marker
164  * @param buf_size buffer size
165  * @return non-zero if metadata is invalid
166  */
167 static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
168 {
169  int metadata_type, metadata_size, ret;
170 
171  if (buf_size < FLAC_STREAMINFO_SIZE+8) {
172  /* need more data */
173  return 0;
174  }
175  flac_parse_block_header(&buf[4], NULL, &metadata_type, &metadata_size);
176  if (metadata_type != FLAC_METADATA_TYPE_STREAMINFO ||
177  metadata_size != FLAC_STREAMINFO_SIZE) {
178  return AVERROR_INVALIDDATA;
179  }
180  ret = ff_flac_parse_streaminfo(s->avctx, &s->flac_stream_info, &buf[8]);
181  if (ret < 0)
182  return ret;
183  ret = allocate_buffers(s);
184  if (ret < 0)
185  return ret;
186  flac_set_bps(s);
188  s->flac_stream_info.channels, s->flac_stream_info.bps);
189  s->got_streaminfo = 1;
190 
191  return 0;
192 }
193 
194 /**
195  * Determine the size of an inline header.
196  * @param buf input buffer, starting with the "fLaC" marker
197  * @param buf_size buffer size
198  * @return number of bytes in the header, or 0 if more data is needed
199  */
200 static int get_metadata_size(const uint8_t *buf, int buf_size)
201 {
202  int metadata_last, metadata_size;
203  const uint8_t *buf_end = buf + buf_size;
204 
205  buf += 4;
206  do {
207  if (buf_end - buf < 4)
208  return 0;
209  flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
210  buf += 4;
211  if (buf_end - buf < metadata_size) {
212  /* need more data in order to read the complete header */
213  return 0;
214  }
215  buf += metadata_size;
216  } while (!metadata_last);
217 
218  return buf_size - (buf_end - buf);
219 }
220 
221 static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
222 {
223  int i, tmp, partition, method_type, rice_order;
224  int rice_bits, rice_esc;
225  int samples;
226 
227  method_type = get_bits(&s->gb, 2);
228  if (method_type > 1) {
229  av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
230  method_type);
231  return AVERROR_INVALIDDATA;
232  }
233 
234  rice_order = get_bits(&s->gb, 4);
235 
236  samples= s->blocksize >> rice_order;
237  if (samples << rice_order != s->blocksize) {
238  av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n",
239  rice_order, s->blocksize);
240  return AVERROR_INVALIDDATA;
241  }
242 
243  if (pred_order > samples) {
244  av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
245  pred_order, samples);
246  return AVERROR_INVALIDDATA;
247  }
248 
249  rice_bits = 4 + method_type;
250  rice_esc = (1 << rice_bits) - 1;
251 
252  decoded += pred_order;
253  i= pred_order;
254  for (partition = 0; partition < (1 << rice_order); partition++) {
255  tmp = get_bits(&s->gb, rice_bits);
256  if (tmp == rice_esc) {
257  tmp = get_bits(&s->gb, 5);
258  for (; i < samples; i++)
259  *decoded++ = get_sbits_long(&s->gb, tmp);
260  } else {
261  int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
262  for (; i < samples; i++) {
263  int v = get_sr_golomb_flac(&s->gb, tmp, real_limit, 0);
264  if (v == 0x80000000){
265  av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
266  return AVERROR_INVALIDDATA;
267  }
268 
269  *decoded++ = v;
270  }
271  }
272  i= 0;
273  }
274 
275  return 0;
276 }
277 
279  int pred_order, int bps)
280 {
281  const int blocksize = s->blocksize;
282  unsigned av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d);
283  int i;
284  int ret;
285 
286  /* warm up samples */
287  for (i = 0; i < pred_order; i++) {
288  decoded[i] = get_sbits_long(&s->gb, bps);
289  }
290 
291  if ((ret = decode_residuals(s, decoded, pred_order)) < 0)
292  return ret;
293 
294  if (pred_order > 0)
295  a = decoded[pred_order-1];
296  if (pred_order > 1)
297  b = a - decoded[pred_order-2];
298  if (pred_order > 2)
299  c = b - decoded[pred_order-2] + decoded[pred_order-3];
300  if (pred_order > 3)
301  d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
302 
303  switch (pred_order) {
304  case 0:
305  break;
306  case 1:
307  for (i = pred_order; i < blocksize; i++)
308  decoded[i] = a += decoded[i];
309  break;
310  case 2:
311  for (i = pred_order; i < blocksize; i++)
312  decoded[i] = a += b += decoded[i];
313  break;
314  case 3:
315  for (i = pred_order; i < blocksize; i++)
316  decoded[i] = a += b += c += decoded[i];
317  break;
318  case 4:
319  for (i = pred_order; i < blocksize; i++)
320  decoded[i] = a += b += c += d += decoded[i];
321  break;
322  default:
323  av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order);
324  return AVERROR_INVALIDDATA;
325  }
326 
327  return 0;
328 }
329 
330 static void lpc_analyze_remodulate(SUINT32 *decoded, const int coeffs[32],
331  int order, int qlevel, int len, int bps)
332 {
333  int i, j;
334  int ebps = 1 << (bps-1);
335  unsigned sigma = 0;
336 
337  for (i = order; i < len; i++)
338  sigma |= decoded[i] + ebps;
339 
340  if (sigma < 2*ebps)
341  return;
342 
343  for (i = len - 1; i >= order; i--) {
344  int64_t p = 0;
345  for (j = 0; j < order; j++)
346  p += coeffs[j] * (int64_t)(int32_t)decoded[i-order+j];
347  decoded[i] -= p >> qlevel;
348  }
349  for (i = order; i < len; i++, decoded++) {
350  int32_t p = 0;
351  for (j = 0; j < order; j++)
352  p += coeffs[j] * (uint32_t)decoded[j];
353  decoded[j] += p >> qlevel;
354  }
355 }
356 
357 static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order,
358  int bps)
359 {
360  int i, ret;
361  int coeff_prec, qlevel;
362  int coeffs[32];
363 
364  /* warm up samples */
365  for (i = 0; i < pred_order; i++) {
366  decoded[i] = get_sbits_long(&s->gb, bps);
367  }
368 
369  coeff_prec = get_bits(&s->gb, 4) + 1;
370  if (coeff_prec == 16) {
371  av_log(s->avctx, AV_LOG_ERROR, "invalid coeff precision\n");
372  return AVERROR_INVALIDDATA;
373  }
374  qlevel = get_sbits(&s->gb, 5);
375  if (qlevel < 0) {
376  av_log(s->avctx, AV_LOG_ERROR, "qlevel %d not supported, maybe buggy stream\n",
377  qlevel);
378  return AVERROR_INVALIDDATA;
379  }
380 
381  for (i = 0; i < pred_order; i++) {
382  coeffs[pred_order - i - 1] = get_sbits(&s->gb, coeff_prec);
383  }
384 
385  if ((ret = decode_residuals(s, decoded, pred_order)) < 0)
386  return ret;
387 
388  if ( ( s->buggy_lpc && s->flac_stream_info.bps <= 16)
389  || ( !s->buggy_lpc && bps <= 16
390  && bps + coeff_prec + av_log2(pred_order) <= 32)) {
391  s->dsp.lpc16(decoded, coeffs, pred_order, qlevel, s->blocksize);
392  } else {
393  s->dsp.lpc32(decoded, coeffs, pred_order, qlevel, s->blocksize);
394  if (s->flac_stream_info.bps <= 16)
395  lpc_analyze_remodulate(decoded, coeffs, pred_order, qlevel, s->blocksize, bps);
396  }
397 
398  return 0;
399 }
400 
401 static inline int decode_subframe(FLACContext *s, int channel)
402 {
403  int32_t *decoded = s->decoded[channel];
404  int type, wasted = 0;
405  int bps = s->flac_stream_info.bps;
406  int i, tmp, ret;
407 
408  if (channel == 0) {
410  bps++;
411  } else {
413  bps++;
414  }
415 
416  if (get_bits1(&s->gb)) {
417  av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");
418  return AVERROR_INVALIDDATA;
419  }
420  type = get_bits(&s->gb, 6);
421 
422  if (get_bits1(&s->gb)) {
423  int left = get_bits_left(&s->gb);
424  if ( left <= 0 ||
425  (left < bps && !show_bits_long(&s->gb, left)) ||
426  !show_bits_long(&s->gb, bps)) {
428  "Invalid number of wasted bits > available bits (%d) - left=%d\n",
429  bps, left);
430  return AVERROR_INVALIDDATA;
431  }
432  wasted = 1 + get_unary(&s->gb, 1, get_bits_left(&s->gb));
433  bps -= wasted;
434  }
435  if (bps > 32) {
436  avpriv_report_missing_feature(s->avctx, "Decorrelated bit depth > 32");
437  return AVERROR_PATCHWELCOME;
438  }
439 
440 //FIXME use av_log2 for types
441  if (type == 0) {
442  tmp = get_sbits_long(&s->gb, bps);
443  for (i = 0; i < s->blocksize; i++)
444  decoded[i] = tmp;
445  } else if (type == 1) {
446  for (i = 0; i < s->blocksize; i++)
447  decoded[i] = get_sbits_long(&s->gb, bps);
448  } else if ((type >= 8) && (type <= 12)) {
449  if ((ret = decode_subframe_fixed(s, decoded, type & ~0x8, bps)) < 0)
450  return ret;
451  } else if (type >= 32) {
452  if ((ret = decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps)) < 0)
453  return ret;
454  } else {
455  av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");
456  return AVERROR_INVALIDDATA;
457  }
458 
459  if (wasted) {
460  int i;
461  for (i = 0; i < s->blocksize; i++)
462  decoded[i] = (unsigned)decoded[i] << wasted;
463  }
464 
465  return 0;
466 }
467 
469 {
470  int i, ret;
471  GetBitContext *gb = &s->gb;
473 
474  if ((ret = ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) < 0) {
475  av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n");
476  return ret;
477  }
478 
479  if ( s->flac_stream_info.channels
480  && fi.channels != s->flac_stream_info.channels
481  && s->got_streaminfo) {
482  s->flac_stream_info.channels = s->avctx->channels = fi.channels;
484  ret = allocate_buffers(s);
485  if (ret < 0)
486  return ret;
487  }
488  s->flac_stream_info.channels = s->avctx->channels = fi.channels;
489  if (!s->avctx->channel_layout)
491  s->ch_mode = fi.ch_mode;
492 
493  if (!s->flac_stream_info.bps && !fi.bps) {
494  av_log(s->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n");
495  return AVERROR_INVALIDDATA;
496  }
497  if (!fi.bps) {
498  fi.bps = s->flac_stream_info.bps;
499  } else if (s->flac_stream_info.bps && fi.bps != s->flac_stream_info.bps) {
500  av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not "
501  "supported\n");
502  return AVERROR_INVALIDDATA;
503  }
504 
505  if (!s->flac_stream_info.bps) {
506  s->flac_stream_info.bps = s->avctx->bits_per_raw_sample = fi.bps;
507  flac_set_bps(s);
508  }
509 
510  if (!s->flac_stream_info.max_blocksize)
511  s->flac_stream_info.max_blocksize = FLAC_MAX_BLOCKSIZE;
512  if (fi.blocksize > s->flac_stream_info.max_blocksize) {
513  av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize,
514  s->flac_stream_info.max_blocksize);
515  return AVERROR_INVALIDDATA;
516  }
517  s->blocksize = fi.blocksize;
518 
519  if (!s->flac_stream_info.samplerate && !fi.samplerate) {
520  av_log(s->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO"
521  " or frame header\n");
522  return AVERROR_INVALIDDATA;
523  }
524  if (fi.samplerate == 0)
525  fi.samplerate = s->flac_stream_info.samplerate;
526  s->flac_stream_info.samplerate = s->avctx->sample_rate = fi.samplerate;
527 
528  if (!s->got_streaminfo) {
529  ret = allocate_buffers(s);
530  if (ret < 0)
531  return ret;
532  s->got_streaminfo = 1;
534  }
536  s->flac_stream_info.channels, s->flac_stream_info.bps);
537 
538 // dump_headers(s->avctx, &s->flac_stream_info);
539 
540  /* subframes */
541  for (i = 0; i < s->flac_stream_info.channels; i++) {
542  if ((ret = decode_subframe(s, i)) < 0)
543  return ret;
544  }
545 
546  align_get_bits(gb);
547 
548  /* frame footer */
549  skip_bits(gb, 16); /* data crc */
550 
551  return 0;
552 }
553 
554 static int flac_decode_frame(AVCodecContext *avctx, void *data,
555  int *got_frame_ptr, AVPacket *avpkt)
556 {
557  AVFrame *frame = data;
558  ThreadFrame tframe = { .f = data };
559  const uint8_t *buf = avpkt->data;
560  int buf_size = avpkt->size;
561  FLACContext *s = avctx->priv_data;
562  int bytes_read = 0;
563  int ret;
564 
565  *got_frame_ptr = 0;
566 
567  if (s->flac_stream_info.max_framesize == 0) {
568  s->flac_stream_info.max_framesize =
570  FLAC_MAX_CHANNELS, 32);
571  }
572 
573  if (buf_size > 5 && !memcmp(buf, "\177FLAC", 5)) {
574  av_log(s->avctx, AV_LOG_DEBUG, "skipping flac header packet 1\n");
575  return buf_size;
576  }
577 
578  if (buf_size > 0 && (*buf & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
579  av_log(s->avctx, AV_LOG_DEBUG, "skipping vorbis comment\n");
580  return buf_size;
581  }
582 
583  /* check that there is at least the smallest decodable amount of data.
584  this amount corresponds to the smallest valid FLAC frame possible.
585  FF F8 69 02 00 00 9A 00 00 34 46 */
586  if (buf_size < FLAC_MIN_FRAME_SIZE)
587  return buf_size;
588 
589  /* check for inline header */
590  if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
591  if (!s->got_streaminfo && (ret = parse_streaminfo(s, buf, buf_size))) {
592  av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");
593  return ret;
594  }
595  return get_metadata_size(buf, buf_size);
596  }
597 
598  /* decode frame */
599  if ((ret = init_get_bits8(&s->gb, buf, buf_size)) < 0)
600  return ret;
601  if ((ret = decode_frame(s)) < 0) {
602  av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");
603  return ret;
604  }
605  bytes_read = get_bits_count(&s->gb)/8;
606 
609  0, buf, bytes_read)) {
610  av_log(s->avctx, AV_LOG_ERROR, "CRC error at PTS %"PRId64"\n", avpkt->pts);
612  return AVERROR_INVALIDDATA;
613  }
614 
615  /* get output buffer */
616  frame->nb_samples = s->blocksize;
617  if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
618  return ret;
619 
620  s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded,
621  s->flac_stream_info.channels,
622  s->blocksize, s->sample_shift);
623 
624  if (bytes_read > buf_size) {
625  av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size);
626  return AVERROR_INVALIDDATA;
627  }
628  if (bytes_read < buf_size) {
629  av_log(s->avctx, AV_LOG_DEBUG, "underread: %d orig size: %d\n",
630  buf_size - bytes_read, buf_size);
631  }
632 
633  *got_frame_ptr = 1;
634 
635  return bytes_read;
636 }
637 
638 #if HAVE_THREADS
639 static int init_thread_copy(AVCodecContext *avctx)
640 {
641  FLACContext *s = avctx->priv_data;
642  s->decoded_buffer = NULL;
643  s->decoded_buffer_size = 0;
644  s->avctx = avctx;
645  if (s->flac_stream_info.max_blocksize)
646  return allocate_buffers(s);
647  return 0;
648 }
649 #endif
650 
652 {
653  FLACContext *s = avctx->priv_data;
654 
656 
657  return 0;
658 }
659 
660 static const AVOption options[] = {
661 { "use_buggy_lpc", "emulate old buggy lavc behavior", offsetof(FLACContext, buggy_lpc), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM },
662 { NULL },
663 };
664 
665 static const AVClass flac_decoder_class = {
666  "FLAC decoder",
668  options,
670 };
671 
673  .name = "flac",
674  .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
675  .type = AVMEDIA_TYPE_AUDIO,
676  .id = AV_CODEC_ID_FLAC,
677  .priv_data_size = sizeof(FLACContext),
679  .close = flac_decode_close,
683  .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
688  .priv_class = &flac_decoder_class,
689 };
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:397
static int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len)
read signed golomb rice code (flac).
Definition: golomb.h:380
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
#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:187
AVOption.
Definition: opt.h:246
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:261
static int init_thread_copy(AVCodecContext *avctx)
Definition: tta.c:392
AVFrame * f
Definition: thread.h:36
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps)
Definition: flacdsp.c:88
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int allocate_buffers(FLACContext *s)
Definition: flacdec.c:135
int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
Calculate an estimate for the maximum frame size based on verbatim mode.
Definition: flac.c:148
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:281
int size
Definition: avcodec.h:1643
const char * b
Definition: vf_curves.c:113
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
Definition: avcodec.h:3020
int av_log2(unsigned v)
Definition: intmath.c:26
AVCodecContext * avctx
parent AVCodecContext
Definition: flacdec.c:55
#define FLAC_MAX_BLOCKSIZE
Definition: flac.h:37
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:3118
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
Definition: flacdec.c:221
AVCodec.
Definition: avcodec.h:3657
FLACCOMMONINFO int blocksize
block size of the frame
Definition: flac.h:86
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:246
int ff_flac_is_extradata_valid(AVCodecContext *avctx, enum FLACExtradataFormat *format, uint8_t **streaminfo_start)
Validate the FLAC extradata.
Definition: flac.c:169
static int get_sbits_long(GetBitContext *s, int n)
Read 0-32 bits as a signed integer.
Definition: get_bits.h:385
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
void(* lpc32)(int32_t *samples, const int coeffs[32], int order, int qlevel, int len)
Definition: flacdsp.h:31
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:2487
uint8_t
#define av_cold
Definition: attributes.h:82
FLACDSPContext dsp
Definition: flacdec.c:68
static const AVClass flac_decoder_class
Definition: flacdec.c:665
AVOptions.
Multithreading support functions.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1832
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
static AVFrame * frame
static void flac_set_bps(FLACContext *s)
Definition: flacdec.c:73
Public header for CRC hash function implementation.
uint8_t * decoded_buffer
Definition: flacdec.c:64
uint8_t * data
Definition: avcodec.h:1642
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:199
bitstream reader API header.
unsigned int decoded_buffer_size
Definition: flacdec.c:65
signed 32 bits
Definition: samplefmt.h:62
#define av_log(a,...)
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:112
FLACExtradataFormat
Definition: flac.h:58
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:587
AVS_FilterInfo ** fi
Definition: avisynth_c.h:731
int32_t * decoded[FLAC_MAX_CHANNELS]
decoded samples
Definition: flacdec.c:63
int ch_mode
channel decorrelation mode
Definition: flac.h:87
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_YASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch const uint8_t **in ch off *out planar
Definition: audioconvert.c:56
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.
av_default_item_name
#define AVERROR(e)
Definition: error.h:43
enum AVSampleFormat request_sample_fmt
desired sample format
Definition: avcodec.h:2552
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:180
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order, int bps)
Definition: flacdec.c:357
simple assert() macros that are a bit more flexible than ISO C assert().
static int get_metadata_size(const uint8_t *buf, int buf_size)
Determine the size of an inline header.
Definition: flacdec.c:200
GetBitContext gb
GetBitContext initialized to start at the current frame.
Definition: flacdec.c:56
const char * name
Name of the codec implementation.
Definition: avcodec.h:3664
static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s)
Definition: flacdec.c:126
int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
Validate and decode a frame header.
Definition: flac.c:50
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1057
static int decode_subframe_fixed(FLACContext *s, int32_t *decoded, int pred_order, int bps)
Definition: flacdec.c:278
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2530
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:219
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Definition: mem.c:469
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:3005
signed 32 bits, planar
Definition: samplefmt.h:68
int buggy_lpc
use workaround for old lavc encoded files
Definition: flacdec.c:66
int got_streaminfo
indicates if the STREAMINFO has been read
Definition: flacdec.c:61
#define SUINT32
int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
Definition: flac.c:204
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:357
#define FLAC_STREAMINFO_SIZE
Definition: flac.h:34
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:3016
int sample_shift
shift required to make output samples 16-bit or 32-bit
Definition: flacdec.c:59
AVCodec ff_flac_decoder
Definition: flacdec.c:672
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
Libavcodec external API header.
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
int sample_rate
samples per second
Definition: avcodec.h:2479
static const AVOption options[]
Definition: flacdec.c:660
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:456
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
static int decode_frame(FLACContext *s)
Definition: flacdec.c:468
main external API structure.
Definition: avcodec.h:1717
void * buf
Definition: avisynth_c.h:690
GLint GLenum type
Definition: opengl_enc.c:105
void ff_flac_set_channel_layout(AVCodecContext *avctx)
Definition: flac.c:196
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:313
static const char * format
Definition: movenc.c:47
Describe the class of an AVClass context structure.
Definition: log.h:67
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:306
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
Definition: samplefmt.c:119
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:277
static av_always_inline void flac_parse_block_header(const uint8_t *block_header, int *last, int *type, int *size)
Parse the metadata block parameters from the header.
Definition: flac.h:145
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data...
Definition: avcodec.h:3013
static void lpc_analyze_remodulate(SUINT32 *decoded, const int coeffs[32], int order, int qlevel, int len, int bps)
Definition: flacdec.c:330
static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
Parse the STREAMINFO from an inline header.
Definition: flacdec.c:167
struct FLACStreaminfo flac_stream_info
Definition: flacdec.c:53
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:201
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:106
int blocksize
number of samples in the current frame
Definition: flacdec.c:58
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:343
static int decode_subframe(FLACContext *s, int channel)
Definition: flacdec.c:401
void(* lpc16)(int32_t *samples, const int coeffs[32], int order, int qlevel, int len)
Definition: flacdsp.h:29
common internal api header.
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:33
signed 16 bits
Definition: samplefmt.h:61
static double c[64]
channel
Use these values when setting the channel map with ebur128_set_channel().
Definition: ebur128.h:39
#define FLAC_MIN_FRAME_SIZE
Definition: flac.h:38
unsigned bps
Definition: movenc.c:1413
#define MKBETAG(a, b, c, d)
Definition: common.h:343
void * priv_data
Definition: avcodec.h:1759
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt.
Definition: samplefmt.c:151
static const int16_t coeffs[]
int len
int channels
number of audio channels
Definition: avcodec.h:2480
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:464
#define av_uninit(x)
Definition: attributes.h:148
static av_cold int flac_decode_init(AVCodecContext *avctx)
Definition: flacdec.c:95
#define av_freep(p)
signed 16 bits, planar
Definition: samplefmt.h:67
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
Definition: ffmpeg.c:2242
exp golomb vlc stuff
This structure stores compressed data.
Definition: avcodec.h:1619
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:244
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:994
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1635
void(* decorrelate[4])(uint8_t **out, int32_t **in, int channels, int len, int shift)
Definition: flacdsp.h:27
#define FLAC_MAX_CHANNELS
Definition: flac.h:35
static av_cold int flac_decode_close(AVCodecContext *avctx)
Definition: flacdec.c:651
int ch_mode
channel decorrelation type in the current frame
Definition: flacdec.c:60
static int flac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: flacdec.c:554
static uint8_t tmp[11]
Definition: aes_ctr.c:26