FFmpeg  4.4.8
utils.c
Go to the documentation of this file.
1 /*
2  * utils for libavcodec
3  * Copyright (c) 2001 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * utils.
26  */
27 
28 #include "config.h"
29 #include "libavutil/avassert.h"
30 #include "libavutil/avstring.h"
31 #include "libavutil/intreadwrite.h"
32 #include "libavutil/mem_internal.h"
33 #include "libavutil/pixdesc.h"
34 #include "libavutil/imgutils.h"
35 #include "libavutil/pixfmt.h"
36 #include "avcodec.h"
37 #include "codec.h"
38 #include "hwconfig.h"
39 #include "thread.h"
40 #include "internal.h"
41 #include "put_bits.h"
42 #include "raw.h"
43 #include "version.h"
44 #include <stdlib.h>
45 #include <stdarg.h>
46 #include <stdatomic.h>
47 #include <limits.h>
48 #include <float.h>
49 
50 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
51 {
52  uint8_t **p = ptr;
53  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
54  av_freep(p);
55  *size = 0;
56  return;
57  }
58  if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
59  memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
60 }
61 
62 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
63 {
64  uint8_t **p = ptr;
65  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
66  av_freep(p);
67  *size = 0;
68  return;
69  }
70  if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
71  memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
72 }
73 
74 int av_codec_is_encoder(const AVCodec *codec)
75 {
76  return codec && (codec->encode_sub || codec->encode2 || codec->receive_packet);
77 }
78 
79 int av_codec_is_decoder(const AVCodec *codec)
80 {
81  return codec && (codec->decode || codec->receive_frame);
82 }
83 
85 {
86  int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
87 
88  if (ret < 0)
89  width = height = 0;
90 
91  s->coded_width = width;
92  s->coded_height = height;
93  s->width = AV_CEIL_RSHIFT(width, s->lowres);
94  s->height = AV_CEIL_RSHIFT(height, s->lowres);
95 
96  return ret;
97 }
98 
100 {
101  int ret = av_image_check_sar(avctx->width, avctx->height, sar);
102 
103  if (ret < 0) {
104  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %d/%d\n",
105  sar.num, sar.den);
106  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
107  return ret;
108  } else {
109  avctx->sample_aspect_ratio = sar;
110  }
111  return 0;
112 }
113 
115  enum AVMatrixEncoding matrix_encoding)
116 {
117  AVFrameSideData *side_data;
118  enum AVMatrixEncoding *data;
119 
121  if (!side_data)
123  sizeof(enum AVMatrixEncoding));
124 
125  if (!side_data)
126  return AVERROR(ENOMEM);
127 
128  data = (enum AVMatrixEncoding*)side_data->data;
129  *data = matrix_encoding;
130 
131  return 0;
132 }
133 
135  int linesize_align[AV_NUM_DATA_POINTERS])
136 {
137  int i;
138  int w_align = 1;
139  int h_align = 1;
140  AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
141 
142  if (desc) {
143  w_align = 1 << desc->log2_chroma_w;
144  h_align = 1 << desc->log2_chroma_h;
145  }
146 
147  switch (s->pix_fmt) {
148  case AV_PIX_FMT_YUV420P:
149  case AV_PIX_FMT_YUYV422:
150  case AV_PIX_FMT_YVYU422:
151  case AV_PIX_FMT_UYVY422:
152  case AV_PIX_FMT_YUV422P:
153  case AV_PIX_FMT_YUV440P:
154  case AV_PIX_FMT_YUV444P:
155  case AV_PIX_FMT_GBRP:
156  case AV_PIX_FMT_GBRAP:
157  case AV_PIX_FMT_GRAY8:
158  case AV_PIX_FMT_GRAY16BE:
159  case AV_PIX_FMT_GRAY16LE:
160  case AV_PIX_FMT_YUVJ420P:
161  case AV_PIX_FMT_YUVJ422P:
162  case AV_PIX_FMT_YUVJ440P:
163  case AV_PIX_FMT_YUVJ444P:
164  case AV_PIX_FMT_YUVA420P:
165  case AV_PIX_FMT_YUVA422P:
166  case AV_PIX_FMT_YUVA444P:
223  case AV_PIX_FMT_GBRP9LE:
224  case AV_PIX_FMT_GBRP9BE:
225  case AV_PIX_FMT_GBRP10LE:
226  case AV_PIX_FMT_GBRP10BE:
227  case AV_PIX_FMT_GBRP12LE:
228  case AV_PIX_FMT_GBRP12BE:
229  case AV_PIX_FMT_GBRP14LE:
230  case AV_PIX_FMT_GBRP14BE:
231  case AV_PIX_FMT_GBRP16LE:
232  case AV_PIX_FMT_GBRP16BE:
237  w_align = 16; //FIXME assume 16 pixel per macroblock
238  h_align = 16 * 2; // interlaced needs 2 macroblocks height
239  if (s->codec_id == AV_CODEC_ID_BINKVIDEO)
240  w_align = 16*2;
241  break;
242  case AV_PIX_FMT_YUV411P:
243  case AV_PIX_FMT_YUVJ411P:
245  w_align = 32;
246  h_align = 16 * 2;
247  break;
248  case AV_PIX_FMT_YUV410P:
249  if (s->codec_id == AV_CODEC_ID_SVQ1) {
250  w_align = 64;
251  h_align = 64;
252  } else if (s->codec_id == AV_CODEC_ID_SNOW) {
253  w_align = 16;
254  h_align = 16;
255  }
256  break;
257  case AV_PIX_FMT_RGB555:
258  if (s->codec_id == AV_CODEC_ID_RPZA) {
259  w_align = 4;
260  h_align = 4;
261  }
262  if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
263  w_align = 8;
264  h_align = 8;
265  }
266  break;
267  case AV_PIX_FMT_PAL8:
268  case AV_PIX_FMT_BGR8:
269  case AV_PIX_FMT_RGB8:
270  if (s->codec_id == AV_CODEC_ID_SMC ||
271  s->codec_id == AV_CODEC_ID_CINEPAK) {
272  w_align = 4;
273  h_align = 4;
274  }
275  if (s->codec_id == AV_CODEC_ID_JV ||
276  s->codec_id == AV_CODEC_ID_ARGO ||
277  s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
278  w_align = 8;
279  h_align = 8;
280  }
281  if (s->codec_id == AV_CODEC_ID_MJPEG ||
282  s->codec_id == AV_CODEC_ID_MJPEGB ||
283  s->codec_id == AV_CODEC_ID_LJPEG ||
284  s->codec_id == AV_CODEC_ID_SMVJPEG ||
285  s->codec_id == AV_CODEC_ID_AMV ||
286  s->codec_id == AV_CODEC_ID_SP5X ||
287  s->codec_id == AV_CODEC_ID_JPEGLS) {
288  w_align = 8;
289  h_align = 2*8;
290  }
291  break;
292  case AV_PIX_FMT_BGR24:
293  if ((s->codec_id == AV_CODEC_ID_MSZH) ||
294  (s->codec_id == AV_CODEC_ID_ZLIB)) {
295  w_align = 4;
296  h_align = 4;
297  }
298  break;
299  case AV_PIX_FMT_RGB24:
300  if (s->codec_id == AV_CODEC_ID_CINEPAK) {
301  w_align = 4;
302  h_align = 4;
303  }
304  break;
305  case AV_PIX_FMT_BGR0:
306  if (s->codec_id == AV_CODEC_ID_ARGO) {
307  w_align = 8;
308  h_align = 8;
309  }
310  break;
311  default:
312  break;
313  }
314 
315  if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
316  w_align = FFMAX(w_align, 16);
317  }
318 
319  *width = FFALIGN(*width, w_align);
320  *height = FFALIGN(*height, h_align);
321  if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
322  s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
323  s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
324  s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
325  ) {
326  // some of the optimized chroma MC reads one line too much
327  // which is also done in mpeg decoders with lowres > 0
328  *height += 2;
329 
330  // H.264 uses edge emulation for out of frame motion vectors, for this
331  // it requires a temporary area large enough to hold a 21x21 block,
332  // increasing witdth ensure that the temporary area is large enough,
333  // the next rounded up width is 32
334  *width = FFMAX(*width, 32);
335  }
336  if (s->codec_id == AV_CODEC_ID_SVQ3) {
337  *width = FFMAX(*width, 32);
338  }
339 
340  for (i = 0; i < 4; i++)
341  linesize_align[i] = STRIDE_ALIGN;
342 }
343 
345 {
346  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
347  int chroma_shift = desc->log2_chroma_w;
348  int linesize_align[AV_NUM_DATA_POINTERS];
349  int align;
350 
351  avcodec_align_dimensions2(s, width, height, linesize_align);
352  align = FFMAX(linesize_align[0], linesize_align[3]);
353  linesize_align[1] <<= chroma_shift;
354  linesize_align[2] <<= chroma_shift;
355  align = FFMAX3(align, linesize_align[1], linesize_align[2]);
356  *width = FFALIGN(*width, align);
357 }
358 
359 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
360 {
361  if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
362  return AVERROR(EINVAL);
363  pos--;
364 
365  *xpos = (pos&1) * 128;
366  *ypos = ((pos>>1)^(pos<4)) * 128;
367 
368  return 0;
369 }
370 
371 enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
372 {
373  int pos, xout, yout;
374 
376  if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
377  return pos;
378  }
380 }
381 
383  enum AVSampleFormat sample_fmt, const uint8_t *buf,
384  int buf_size, int align)
385 {
386  int ch, planar, needed_size, ret = 0;
387 
389  frame->nb_samples, sample_fmt,
390  align);
391  if (buf_size < needed_size)
392  return AVERROR(EINVAL);
393 
394  planar = av_sample_fmt_is_planar(sample_fmt);
397  sizeof(*frame->extended_data))))
398  return AVERROR(ENOMEM);
399  } else {
401  }
402 
404  (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples,
405  sample_fmt, align)) < 0) {
406  if (frame->extended_data != frame->data)
408  return ret;
409  }
410  if (frame->extended_data != frame->data) {
411  for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++)
412  frame->data[ch] = frame->extended_data[ch];
413  }
414 
415  return ret;
416 }
417 
418 void ff_color_frame(AVFrame *frame, const int c[4])
419 {
421  int p, y;
422 
424 
425  for (p = 0; p<desc->nb_components; p++) {
426  uint8_t *dst = frame->data[p];
427  int is_chroma = p == 1 || p == 2;
428  int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
429  int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
430  if (desc->comp[0].depth >= 9) {
431  if (bytes >= 1)
432  ((uint16_t*)dst)[0] = c[p];
433  if (bytes >= 2)
434  av_memcpy_backptr(dst + 2, 2, 2 * (bytes - 1));
435  dst += frame->linesize[p];
436  for (y = 1; y < height; y++) {
437  memcpy(dst, frame->data[p], 2*bytes);
438  dst += frame->linesize[p];
439  }
440  } else {
441  for (y = 0; y < height; y++) {
442  memset(dst, c[p], bytes);
443  dst += frame->linesize[p];
444  }
445  }
446  }
447 }
448 
450  unsigned int fourcc)
451 {
452  while (tags->pix_fmt >= 0) {
453  if (tags->fourcc == fourcc)
454  return tags->pix_fmt;
455  tags++;
456  }
457  return AV_PIX_FMT_NONE;
458 }
459 
460 #if FF_API_CODEC_GET_SET
461 MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
462 MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
464 MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll)
465 MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix)
466 
468 {
469  return codec->properties;
470 }
471 
473 {
474  return codec->max_lowres;
475 }
476 #endif
477 
480 }
481 
482 const char *avcodec_get_name(enum AVCodecID id)
483 {
484  const AVCodecDescriptor *cd;
485  const AVCodec *codec;
486 
487  if (id == AV_CODEC_ID_NONE)
488  return "none";
489  cd = avcodec_descriptor_get(id);
490  if (cd)
491  return cd->name;
492  av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
493  codec = avcodec_find_decoder(id);
494  if (codec)
495  return codec->name;
496  codec = avcodec_find_encoder(id);
497  if (codec)
498  return codec->name;
499  return "unknown_codec";
500 }
501 
502 #if FF_API_TAG_STRING
503 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
504 {
505  int i, len, ret = 0;
506 
507 #define TAG_PRINT(x) \
508  (((x) >= '0' && (x) <= '9') || \
509  ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z') || \
510  ((x) == '.' || (x) == ' ' || (x) == '-' || (x) == '_'))
511 
512  for (i = 0; i < 4; i++) {
513  len = snprintf(buf, buf_size,
514  TAG_PRINT(codec_tag & 0xFF) ? "%c" : "[%d]", codec_tag & 0xFF);
515  buf += len;
516  buf_size = buf_size > len ? buf_size - len : 0;
517  ret += len;
518  codec_tag >>= 8;
519  }
520  return ret;
521 }
522 #endif
523 
524 const char *av_get_profile_name(const AVCodec *codec, int profile)
525 {
526  const AVProfile *p;
527  if (profile == FF_PROFILE_UNKNOWN || !codec->profiles)
528  return NULL;
529 
530  for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
531  if (p->profile == profile)
532  return p->name;
533 
534  return NULL;
535 }
536 
538 {
540  const AVProfile *p;
541 
542  if (profile == FF_PROFILE_UNKNOWN || !desc || !desc->profiles)
543  return NULL;
544 
545  for (p = desc->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
546  if (p->profile == profile)
547  return p->name;
548 
549  return NULL;
550 }
551 
553 {
554  switch (codec_id) {
570  return 4;
578  case AV_CODEC_ID_PCM_S8:
580  case AV_CODEC_ID_PCM_SGA:
581  case AV_CODEC_ID_PCM_U8:
584  return 8;
591  return 16;
598  return 24;
608  return 32;
613  return 64;
614  default:
615  return 0;
616  }
617 }
618 
619 enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
620 {
621  static const enum AVCodecID map[][2] = {
633  };
634  if (fmt < 0 || fmt >= FF_ARRAY_ELEMS(map))
635  return AV_CODEC_ID_NONE;
636  if (be < 0 || be > 1)
637  be = AV_NE(1, 0);
638  return map[fmt][be];
639 }
640 
642 {
643  switch (codec_id) {
645  return 2;
647  return 3;
653  return 4;
654  default:
656  }
657 }
658 
659 static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
660  uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
661  uint8_t * extradata, int frame_size, int frame_bytes)
662 {
664  int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
665 
666  /* codecs with an exact constant bits per sample */
667  if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
668  return (frame_bytes * 8LL) / (bps * ch);
669  bps = bits_per_coded_sample;
670 
671  /* codecs with a fixed packet duration */
672  switch (id) {
673  case AV_CODEC_ID_ADPCM_ADX: return 32;
674  case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
675  case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
676  case AV_CODEC_ID_AMR_NB:
677  case AV_CODEC_ID_EVRC:
678  case AV_CODEC_ID_GSM:
679  case AV_CODEC_ID_QCELP:
680  case AV_CODEC_ID_RA_288: return 160;
681  case AV_CODEC_ID_AMR_WB:
682  case AV_CODEC_ID_GSM_MS: return 320;
683  case AV_CODEC_ID_MP1: return 384;
684  case AV_CODEC_ID_ATRAC1: return 512;
685  case AV_CODEC_ID_ATRAC9:
686  case AV_CODEC_ID_ATRAC3:
687  if (framecount > INT_MAX/1024)
688  return 0;
689  return 1024 * framecount;
690  case AV_CODEC_ID_ATRAC3P: return 2048;
691  case AV_CODEC_ID_MP2:
692  case AV_CODEC_ID_MUSEPACK7: return 1152;
693  case AV_CODEC_ID_AC3: return 1536;
694  }
695 
696  if (sr > 0) {
697  /* calc from sample rate */
698  if (id == AV_CODEC_ID_TTA)
699  return 256ll * sr / 245;
700  else if (id == AV_CODEC_ID_DST)
701  return 588ll * sr / 44100;
702  else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
703  if (sr / 22050 > 22)
704  return 0;
705  return (480 << (sr / 22050));
706  }
707 
708  if (id == AV_CODEC_ID_MP3)
709  return sr <= 24000 ? 576 : 1152;
710  }
711 
712  if (ba > 0) {
713  /* calc from block_align */
714  if (id == AV_CODEC_ID_SIPR) {
715  switch (ba) {
716  case 20: return 160;
717  case 19: return 144;
718  case 29: return 288;
719  case 37: return 480;
720  }
721  } else if (id == AV_CODEC_ID_ILBC) {
722  switch (ba) {
723  case 38: return 160;
724  case 50: return 240;
725  }
726  }
727  }
728 
729  if (frame_bytes > 0) {
730  /* calc from frame_bytes only */
731  if (id == AV_CODEC_ID_TRUESPEECH)
732  return 240 * (frame_bytes / 32);
733  if (id == AV_CODEC_ID_NELLYMOSER)
734  return 256 * (frame_bytes / 64);
735  if (id == AV_CODEC_ID_RA_144)
736  return 160 * (frame_bytes / 20);
737 
738  if (bps > 0) {
739  /* calc from frame_bytes and bits_per_coded_sample */
741  return frame_bytes * 8 / bps;
742  }
743 
744  if (ch > 0 && ch < INT_MAX/16) {
745  /* calc from frame_bytes and channels */
746  switch (id) {
748  return frame_bytes / (40 * ch) * 256;
750  return (frame_bytes - 4 * ch) / (128 * ch) * 256;
752  return frame_bytes / (9 * ch) * 16;
755  frame_bytes /= 16 * ch;
756  if (frame_bytes > INT_MAX / 28)
757  return 0;
758  return frame_bytes * 28;
762  return (frame_bytes - 4 * ch) * 2 / ch;
764  return (frame_bytes - 4) * 2 / ch;
766  return (frame_bytes - 8) * 2;
769  if (extradata)
770  return frame_bytes * 14LL / (8 * ch);
771  break;
773  return (frame_bytes / 128) * 224 / ch;
775  return (frame_bytes - 6 - ch) / ch;
777  return (frame_bytes - 8) / ch;
779  return (frame_bytes - 2 * ch) / ch;
780  case AV_CODEC_ID_MACE3:
781  return 3 * frame_bytes / ch;
782  case AV_CODEC_ID_MACE6:
783  return 6 * frame_bytes / ch;
784  case AV_CODEC_ID_PCM_LXF:
785  return 2 * (frame_bytes / (5 * ch));
786  case AV_CODEC_ID_IAC:
787  case AV_CODEC_ID_IMC:
788  return 4 * frame_bytes / ch;
789  }
790 
791  if (tag) {
792  /* calc from frame_bytes, channels, and codec_tag */
793  if (id == AV_CODEC_ID_SOL_DPCM) {
794  if (tag == 3)
795  return frame_bytes / ch;
796  else
797  return frame_bytes * 2 / ch;
798  }
799  }
800 
801  if (ba > 0) {
802  /* calc from frame_bytes, channels, and block_align */
803  int blocks = frame_bytes / ba;
804  int64_t tmp = 0;
805  switch (id) {
807  if (bps < 2 || bps > 5)
808  return 0;
809  tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
810  break;
812  tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
813  break;
815  tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
816  break;
818  tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
819  break;
821  tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
822  break;
824  tmp = blocks * (ba - 16LL) * 2 / ch;
825  break;
826  }
827  if (tmp) {
828  if (tmp != (int)tmp)
829  return 0;
830  return tmp;
831  }
832  }
833 
834  if (bps > 0) {
835  /* calc from frame_bytes, channels, and bits_per_coded_sample */
836  switch (id) {
837  case AV_CODEC_ID_PCM_DVD:
838  if(bps<4 || frame_bytes<3)
839  return 0;
840  return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch));
842  if(bps<4 || frame_bytes<4)
843  return 0;
844  return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8);
845  case AV_CODEC_ID_S302M:
846  return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
847  }
848  }
849  }
850  }
851 
852  /* Fall back on using frame_size */
853  if (frame_size > 1 && frame_bytes)
854  return frame_size;
855 
856  //For WMA we currently have no other means to calculate duration thus we
857  //do it here by assuming CBR, which is true for all known cases.
858  if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) {
859  if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2)
860  return (frame_bytes * 8LL * sr) / bitrate;
861  }
862 
863  return 0;
864 }
865 
866 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
867 {
869  avctx->channels, avctx->block_align,
870  avctx->codec_tag, avctx->bits_per_coded_sample,
871  avctx->bit_rate, avctx->extradata, avctx->frame_size,
872  frame_bytes);
873  return FFMAX(0, duration);
874 }
875 
877 {
879  par->channels, par->block_align,
880  par->codec_tag, par->bits_per_coded_sample,
881  par->bit_rate, par->extradata, par->frame_size,
882  frame_bytes);
883  return FFMAX(0, duration);
884 }
885 
886 #if !HAVE_THREADS
888 {
889  return -1;
890 }
891 
892 #endif
893 
894 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
895 {
896  unsigned int n = 0;
897 
898  while (v >= 0xff) {
899  *s++ = 0xff;
900  v -= 0xff;
901  n++;
902  }
903  *s = v;
904  n++;
905  return n;
906 }
907 
908 int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
909 {
910  int i;
911  for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
912  return i;
913 }
914 
916 {
917  int i;
918  if (!codec->hw_configs || index < 0)
919  return NULL;
920  for (i = 0; i <= index; i++)
921  if (!codec->hw_configs[i])
922  return NULL;
923  return &codec->hw_configs[index]->public;
924 }
925 
926 #if FF_API_USER_VISIBLE_AVHWACCEL
928 {
929  return NULL;
930 }
931 
933 {
934 }
935 #endif
936 
937 unsigned int avpriv_toupper4(unsigned int x)
938 {
939  return av_toupper(x & 0xFF) +
940  (av_toupper((x >> 8) & 0xFF) << 8) +
941  (av_toupper((x >> 16) & 0xFF) << 16) +
942 ((unsigned)av_toupper((x >> 24) & 0xFF) << 24);
943 }
944 
946 {
947  int ret;
948 
949  dst->owner[0] = src->owner[0];
950  dst->owner[1] = src->owner[1];
951 
952  ret = av_frame_ref(dst->f, src->f);
953  if (ret < 0)
954  return ret;
955 
956  av_assert0(!dst->progress);
957 
958  if (src->progress &&
959  !(dst->progress = av_buffer_ref(src->progress))) {
960  ff_thread_release_buffer(dst->owner[0], dst);
961  return AVERROR(ENOMEM);
962  }
963 
964  return 0;
965 }
966 
967 #if !HAVE_THREADS
968 
970 {
971  return ff_get_format(avctx, fmt);
972 }
973 
975 {
976  f->owner[0] = f->owner[1] = avctx;
977  return ff_get_buffer(avctx, f->f, flags);
978 }
979 
981 {
982  if (f->f)
983  av_frame_unref(f->f);
984 }
985 
987 {
988 }
989 
990 void ff_thread_report_progress(ThreadFrame *f, int progress, int field)
991 {
992 }
993 
994 void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
995 {
996 }
997 
999 {
1000  return 1;
1001 }
1002 
1003 int ff_alloc_entries(AVCodecContext *avctx, int count)
1004 {
1005  return 0;
1006 }
1007 
1009 {
1010 }
1011 
1012 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
1013 {
1014 }
1015 
1016 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
1017 {
1018 }
1019 
1020 #endif
1021 
1023  const uint8_t *end,
1024  uint32_t *av_restrict state)
1025 {
1026  int i;
1027 
1028  av_assert0(p <= end);
1029  if (p >= end)
1030  return end;
1031 
1032  for (i = 0; i < 3; i++) {
1033  uint32_t tmp = *state << 8;
1034  *state = tmp + *(p++);
1035  if (tmp == 0x100 || p == end)
1036  return p;
1037  }
1038 
1039  while (p < end) {
1040  if (p[-1] > 1 ) p += 3;
1041  else if (p[-2] ) p += 2;
1042  else if (p[-3]|(p[-1]-1)) p++;
1043  else {
1044  p++;
1045  break;
1046  }
1047  }
1048 
1049  p = FFMIN(p, end) - 4;
1050  *state = AV_RB32(p);
1051 
1052  return p + 4;
1053 }
1054 
1056 {
1057  AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
1058  if (!props)
1059  return NULL;
1060 
1061  if (size)
1062  *size = sizeof(*props);
1063 
1064  props->vbv_delay = UINT64_MAX;
1065 
1066  return props;
1067 }
1068 
1070 {
1072  AVCPBProperties *props;
1073  size_t size;
1074  int i;
1075 
1076  for (i = 0; i < avctx->nb_coded_side_data; i++)
1078  return (AVCPBProperties *)avctx->coded_side_data[i].data;
1079 
1080  props = av_cpb_properties_alloc(&size);
1081  if (!props)
1082  return NULL;
1083 
1084  tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
1085  if (!tmp) {
1086  av_freep(&props);
1087  return NULL;
1088  }
1089 
1090  avctx->coded_side_data = tmp;
1091  avctx->nb_coded_side_data++;
1092 
1094  avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
1095  avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
1096 
1097  return props;
1098 }
1099 
1100 static unsigned bcd2uint(uint8_t bcd)
1101 {
1102  unsigned low = bcd & 0xf;
1103  unsigned high = bcd >> 4;
1104  if (low > 9 || high > 9)
1105  return 0;
1106  return low + 10*high;
1107 }
1108 
1109 int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len,
1110  void **data, size_t *sei_size)
1111 {
1112  AVFrameSideData *sd = NULL;
1113  uint8_t *sei_data;
1114  PutBitContext pb;
1115  uint32_t *tc;
1116  int m;
1117 
1118  if (frame)
1120 
1121  if (!sd) {
1122  *data = NULL;
1123  return 0;
1124  }
1125  tc = (uint32_t*)sd->data;
1126  m = tc[0] & 3;
1127 
1128  *sei_size = sizeof(uint32_t) * 4;
1129  *data = av_mallocz(*sei_size + prefix_len);
1130  if (!*data)
1131  return AVERROR(ENOMEM);
1132  sei_data = (uint8_t*)*data + prefix_len;
1133 
1134  init_put_bits(&pb, sei_data, *sei_size);
1135  put_bits(&pb, 2, m); // num_clock_ts
1136 
1137  for (int j = 1; j <= m; j++) {
1138  uint32_t tcsmpte = tc[j];
1139  unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours
1140  unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes
1141  unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds
1142  unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames
1143  unsigned drop = tcsmpte & 1<<30 && !0; // 1-bit drop if not arbitrary bit
1144 
1145  /* Calculate frame number of HEVC by SMPTE ST 12-1:2014 Sec 12.2 if rate > 30FPS */
1146  if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
1147  unsigned pc;
1148  ff *= 2;
1149  if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
1150  pc = !!(tcsmpte & 1 << 7);
1151  else
1152  pc = !!(tcsmpte & 1 << 23);
1153  ff = (ff + pc) & 0x7f;
1154  }
1155 
1156  put_bits(&pb, 1, 1); // clock_timestamp_flag
1157  put_bits(&pb, 1, 1); // units_field_based_flag
1158  put_bits(&pb, 5, 0); // counting_type
1159  put_bits(&pb, 1, 1); // full_timestamp_flag
1160  put_bits(&pb, 1, 0); // discontinuity_flag
1161  put_bits(&pb, 1, drop);
1162  put_bits(&pb, 9, ff);
1163  put_bits(&pb, 6, ss);
1164  put_bits(&pb, 6, mm);
1165  put_bits(&pb, 5, hh);
1166  put_bits(&pb, 5, 0);
1167  }
1168  flush_put_bits(&pb);
1169 
1170  return 0;
1171 }
1172 
1174 {
1175  AVRational framerate = avctx->framerate;
1176  int bits_per_coded_sample = avctx->bits_per_coded_sample;
1177  int64_t bitrate;
1178 
1179  if (!(framerate.num && framerate.den))
1180  framerate = av_inv_q(avctx->time_base);
1181  if (!(framerate.num && framerate.den))
1182  return 0;
1183 
1184  if (!bits_per_coded_sample) {
1186  bits_per_coded_sample = av_get_bits_per_pixel(desc);
1187  }
1188  bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
1189  framerate.num / framerate.den;
1190 
1191  return bitrate;
1192 }
1193 
1194 int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
1195  const int * array_valid_values, int default_value)
1196 {
1197  int i = 0, ref_val;
1198 
1199  while (1) {
1200  ref_val = array_valid_values[i];
1201  if (ref_val == INT_MAX)
1202  break;
1203  if (val == ref_val)
1204  return val;
1205  i++;
1206  }
1207  /* val is not a valid value */
1209  "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value);
1210  return default_value;
1211 }
static double val(void *priv, double ch)
Definition: aeval.c:76
AV_SAMPLE_FMT_U8
uint8_t
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_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), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { 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) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;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)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&HAVE_MMX) 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);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=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) { int planes=out->planar ? out->ch_count :1;unsigned m=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){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
Definition: audioconvert.c:56
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
Libavcodec external API header.
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1863
#define AV_RB32
Definition: intreadwrite.h:130
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define ss(width, name, subs,...)
Definition: cbs_vp9.c:261
#define s(width, name)
Definition: cbs_vp9.c:257
#define f(width, name)
Definition: cbs_vp9.c:255
int nb_channels
static struct @321 state
#define FFMAX3(a, b, c)
Definition: common.h:104
#define FFMIN(a, b)
Definition: common.h:105
#define AV_NE(be, le)
Definition: common.h:50
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
#define FFMAX(a, b)
Definition: common.h:103
#define av_restrict
Definition: config.h:11
#define NULL
Definition: coverity.c:32
long long int64_t
Definition: coverity.c:34
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1900
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
Definition: decode.c:1326
static AVFrame * frame
static int lowres
Definition: ffplay.c:336
#define AV_NUM_DATA_POINTERS
Definition: frame.h:319
AVMatrixEncoding
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:946
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:482
int av_codec_is_encoder(const AVCodec *codec)
Definition: utils.c:74
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
Definition: utils.c:915
int av_codec_is_decoder(const AVCodec *codec)
Definition: utils.c:79
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:941
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:46
unsigned av_codec_get_codec_properties(const AVCodecContext *codec)
Definition: utils.c:467
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3501
int av_codec_get_max_lowres(const AVCodec *codec)
Definition: utils.c:472
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:348
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:334
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:326
@ AV_CODEC_ID_IFF_ILBM
Definition: codec_id.h:185
@ AV_CODEC_ID_ADPCM_SWF
Definition: codec_id.h:366
@ AV_CODEC_ID_MUSEPACK7
Definition: codec_id.h:452
@ AV_CODEC_ID_ATRAC1
Definition: codec_id.h:470
@ AV_CODEC_ID_VP6
Definition: codec_id.h:140
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:346
@ AV_CODEC_ID_VP6F
Definition: codec_id.h:141
@ AV_CODEC_ID_IAC
Definition: codec_id.h:482
@ AV_CODEC_ID_ADPCM_CT
Definition: codec_id.h:365
@ AV_CODEC_ID_S302M
Definition: codec_id.h:339
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition: codec_id.h:357
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition: codec_id.h:343
@ AV_CODEC_ID_DSD_LSBF
Definition: codec_id.h:498
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:318
@ AV_CODEC_ID_ADPCM_4XM
Definition: codec_id.h:360
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition: codec_id.h:386
@ AV_CODEC_ID_SNOW
Definition: codec_id.h:262
@ AV_CODEC_ID_PCM_DVD
Definition: codec_id.h:332
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:313
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition: codec_id.h:342
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition: codec_id.h:442
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:347
@ AV_CODEC_ID_8SVX_EXP
Definition: codec_id.h:478
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:333
@ AV_CODEC_ID_RPZA
Definition: codec_id.h:91
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition: codec_id.h:370
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:381
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition: codec_id.h:501
@ AV_CODEC_ID_PCM_BLURAY
Definition: codec_id.h:337
@ AV_CODEC_ID_ADPCM_DTK
Definition: codec_id.h:387
@ AV_CODEC_ID_SVQ3
Definition: codec_id.h:72
@ AV_CODEC_ID_SIPR
Definition: codec_id.h:465
@ AV_CODEC_ID_H264
Definition: codec_id.h:76
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition: codec_id.h:376
@ AV_CODEC_ID_NONE
Definition: codec_id.h:47
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: codec_id.h:500
@ AV_CODEC_ID_EVRC
Definition: codec_id.h:496
@ AV_CODEC_ID_PCM_S24LE_PLANAR
Definition: codec_id.h:341
@ AV_CODEC_ID_ZLIB
Definition: codec_id.h:103
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:314
@ AV_CODEC_ID_INTERPLAY_DPCM
Definition: codec_id.h:415
@ AV_CODEC_ID_ADPCM_PSX
Definition: codec_id.h:391
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:325
@ AV_CODEC_ID_ADPCM_XA
Definition: codec_id.h:361
@ AV_CODEC_ID_PCM_U24BE
Definition: codec_id.h:328
@ AV_CODEC_ID_MP1
Definition: codec_id.h:466
@ AV_CODEC_ID_CINEPAK
Definition: codec_id.h:92
@ AV_CODEC_ID_IMC
Definition: codec_id.h:451
@ AV_CODEC_ID_PCM_S24DAUD
Definition: codec_id.h:329
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition: codec_id.h:367
@ AV_CODEC_ID_ADPCM_SBPRO_3
Definition: codec_id.h:369
@ AV_CODEC_ID_SDX2_DPCM
Definition: codec_id.h:419
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:321
@ AV_CODEC_ID_RA_288
Definition: codec_id.h:411
@ AV_CODEC_ID_ATRAC3P
Definition: codec_id.h:463
@ AV_CODEC_ID_ADPCM_G726LE
Definition: codec_id.h:389
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition: codec_id.h:380
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:317
@ AV_CODEC_ID_DERF_DPCM
Definition: codec_id.h:421
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:472
@ AV_CODEC_ID_SOL_DPCM
Definition: codec_id.h:417
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:362
@ AV_CODEC_ID_ADPCM_MS
Definition: codec_id.h:359
@ AV_CODEC_ID_GSM_MS
Definition: codec_id.h:454
@ AV_CODEC_ID_PCM_U32LE
Definition: codec_id.h:323
@ AV_CODEC_ID_PCM_VIDC
Definition: codec_id.h:349
@ AV_CODEC_ID_BINKVIDEO
Definition: codec_id.h:184
@ AV_CODEC_ID_INTERPLAY_VIDEO
Definition: codec_id.h:88
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition: codec_id.h:368
@ AV_CODEC_ID_FASTAUDIO
Definition: codec_id.h:519
@ AV_CODEC_ID_VC1
Definition: codec_id.h:119
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:320
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:336
@ AV_CODEC_ID_ADPCM_ARGO
Definition: codec_id.h:396
@ AV_CODEC_ID_ADPCM_IMA_APC
Definition: codec_id.h:382
@ AV_CODEC_ID_WMAV1
Definition: codec_id.h:431
@ AV_CODEC_ID_ARGO
Definition: codec_id.h:306
@ AV_CODEC_ID_AMR_NB
Definition: codec_id.h:406
@ AV_CODEC_ID_VP6A
Definition: codec_id.h:155
@ AV_CODEC_ID_ADPCM_IMA_AMV
Definition: codec_id.h:372
@ AV_CODEC_ID_TRUESPEECH
Definition: codec_id.h:445
@ AV_CODEC_ID_ADPCM_EA_XAS
Definition: codec_id.h:378
@ AV_CODEC_ID_PCM_U16BE
Definition: codec_id.h:316
@ AV_CODEC_ID_MP2
Definition: codec_id.h:424
@ AV_CODEC_ID_WMAV2
Definition: codec_id.h:432
@ AV_CODEC_ID_TTA
Definition: codec_id.h:446
@ AV_CODEC_ID_ADPCM_IMA_DK4
Definition: codec_id.h:356
@ AV_CODEC_ID_ROQ_DPCM
Definition: codec_id.h:414
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition: codec_id.h:355
@ AV_CODEC_ID_PCM_LXF
Definition: codec_id.h:338
@ AV_CODEC_ID_JV
Definition: codec_id.h:198
@ AV_CODEC_ID_PCM_SGA
Definition: codec_id.h:350
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition: codec_id.h:393
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: codec_id.h:353
@ AV_CODEC_ID_DSD_MSBF
Definition: codec_id.h:499
@ AV_CODEC_ID_PCM_S64LE
Definition: codec_id.h:345
@ AV_CODEC_ID_MJPEGB
Definition: codec_id.h:57
@ AV_CODEC_ID_ADPCM_G726
Definition: codec_id.h:364
@ AV_CODEC_ID_SMC
Definition: codec_id.h:98
@ AV_CODEC_ID_ATRAC3
Definition: codec_id.h:455
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition: codec_id.h:358
@ AV_CODEC_ID_SMVJPEG
Definition: codec_id.h:263
@ AV_CODEC_ID_ADPCM_MTAF
Definition: codec_id.h:394
@ AV_CODEC_ID_XAN_DPCM
Definition: codec_id.h:416
@ AV_CODEC_ID_DST
Definition: codec_id.h:506
@ AV_CODEC_ID_NELLYMOSER
Definition: codec_id.h:457
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:513
@ AV_CODEC_ID_VP5
Definition: codec_id.h:139
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:335
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:58
@ AV_CODEC_ID_ADPCM_AICA
Definition: codec_id.h:392
@ AV_CODEC_ID_QCELP
Definition: codec_id.h:448
@ AV_CODEC_ID_AMR_WB
Definition: codec_id.h:407
@ AV_CODEC_ID_AC3
Definition: codec_id.h:427
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:60
@ AV_CODEC_ID_MACE3
Definition: codec_id.h:433
@ AV_CODEC_ID_MACE6
Definition: codec_id.h:434
@ AV_CODEC_ID_ADPCM_IMA_APM
Definition: codec_id.h:399
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:322
@ AV_CODEC_ID_ADPCM_THP
Definition: codec_id.h:371
@ AV_CODEC_ID_8SVX_FIB
Definition: codec_id.h:479
@ AV_CODEC_ID_SVQ1
Definition: codec_id.h:71
@ AV_CODEC_ID_RA_144
Definition: codec_id.h:410
@ AV_CODEC_ID_ADPCM_AFC
Definition: codec_id.h:385
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:56
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: codec_id.h:354
@ AV_CODEC_ID_WMV3
Definition: codec_id.h:120
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: codec_id.h:390
@ AV_CODEC_ID_SP5X
Definition: codec_id.h:59
@ AV_CODEC_ID_ADPCM_IMA_ALP
Definition: codec_id.h:400
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: codec_id.h:331
@ AV_CODEC_ID_PCM_U24LE
Definition: codec_id.h:327
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition: codec_id.h:388
@ AV_CODEC_ID_ILBC
Definition: codec_id.h:483
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:425
@ AV_CODEC_ID_ADPCM_IMA_SSI
Definition: codec_id.h:397
@ AV_CODEC_ID_MSZH
Definition: codec_id.h:102
@ AV_CODEC_ID_PCM_U16LE
Definition: codec_id.h:315
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: codec_id.h:340
@ AV_CODEC_ID_PCM_U32BE
Definition: codec_id.h:324
@ AV_CODEC_ID_AMV
Definition: codec_id.h:156
@ AV_CODEC_ID_ADPCM_IMA_MOFLEX
Definition: codec_id.h:403
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:319
int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
Definition: utils.c:359
enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
Converts swscale x/y chroma position to AVChromaLocation.
Definition: utils.c:371
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS])
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
Definition: utils.c:134
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
Definition: utils.c:344
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition: avcodec.h:215
AVHWAccel * av_hwaccel_next(const AVHWAccel *hwaccel)
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL,...
Definition: utils.c:927
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:50
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:641
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:524
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:894
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters in...
Definition: utils.c:876
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition: utils.c:866
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align)
Fill AVFrame audio data and linesize pointers.
Definition: utils.c:382
void av_register_hwaccel(AVHWAccel *hwaccel)
Register the hardware accelerator hwaccel.
Definition: utils.c:932
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:537
AVCPBProperties * av_cpb_properties_alloc(size_t *size)
Allocate a CPB properties structure and initialize its fields to default values.
Definition: utils.c:1055
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:552
void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
Definition: utils.c:62
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
Definition: utils.c:503
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
Return the PCM codec associated with a sample format.
Definition: utils.c:619
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:145
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
#define AVERROR(e)
Definition: error.h:43
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:553
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:443
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, buffer_size_t size)
Add a new side data to a frame.
Definition: frame.c:726
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:738
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition: frame.h:168
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:67
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
Definition: mem.c:428
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
Definition: mem.c:198
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
Definition: mem.c:190
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
Definition: imgutils.c:288
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
Check if the given sample aspect ratio of an image is valid.
Definition: imgutils.c:322
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:112
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
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:72
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
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 av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
Definition: avstring.h:236
int index
Definition: gxfenc.c:89
const VDPAUPixFmtMap * map
misc image utilities
int i
Definition: input.c:407
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:218
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
Definition: internal.h:61
#define STRIDE_ALIGN
Definition: internal.h:118
static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, uint32_t tag, int bits_per_coded_sample, int64_t bitrate, uint8_t *extradata, int frame_size, int frame_bytes)
Definition: utils.c:659
static unsigned bcd2uint(uint8_t bcd)
Definition: utils.c:1100
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition: utils.c:478
void ff_reset_entries(AVCodecContext *avctx)
Definition: utils.c:1008
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
Definition: utils.c:114
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: utils.c:974
int ff_int_from_list_or_default(void *ctx, const char *val_name, int val, const int *array_valid_values, int default_value)
Check if a value is in the list.
Definition: utils.c:1194
int ff_thread_init(AVCodecContext *s)
Definition: utils.c:887
int ff_alloc_entries(AVCodecContext *avctx, int count)
Definition: utils.c:1003
void ff_color_frame(AVFrame *frame, const int c[4])
Definition: utils.c:418
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
Definition: utils.c:1012
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:99
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
Definition: utils.c:449
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
Definition: utils.c:1069
void ff_thread_report_progress(ThreadFrame *f, int progress, int field)
Notify later decoding threads when part of their reference picture is ready.
Definition: utils.c:990
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition: utils.c:945
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
Definition: utils.c:986
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
Definition: utils.c:1016
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
Definition: utils.c:980
void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
Definition: utils.c:994
int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len, void **data, size_t *sei_size)
Check AVFrame for S12M timecode side data and allocate and fill TC SEI message with timecode info.
Definition: utils.c:1109
enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
Definition: utils.c:969
int64_t ff_guess_coded_bitrate(AVCodecContext *avctx)
Get an estimated video bitrate based on frame size, frame rate and coded bits per pixel.
Definition: utils.c:1173
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:84
const uint8_t * avpriv_find_start_code(const uint8_t *av_restrict p, const uint8_t *end, uint32_t *av_restrict state)
Definition: utils.c:1022
unsigned int avpriv_toupper4(unsigned int x)
Definition: utils.c:937
int ff_thread_can_start_frame(AVCodecContext *avctx)
Definition: utils.c:998
int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
Definition: utils.c:908
#define TAG_PRINT(x)
common internal API header
#define MAKE_ACCESSORS(str, name, type, field)
Definition: internal.h:90
const char * desc
Definition: libsvtav1.c:79
swscale version macros
#define FFALIGN(x, a)
Definition: macros.h:48
static int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
Definition: mem_internal.h:139
uint32_t tag
Definition: movenc.c:1611
unsigned bps
Definition: movenc.c:1612
const char data[16]
Definition: mxf.c:142
int frame_size
Definition: mxfenc.c:2206
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:2525
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:144
pixel format definitions
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:605
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition: pixfmt.h:613
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:606
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:136
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:132
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:172
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:178
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:345
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:245
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:276
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:343
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:183
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:240
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:189
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:171
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:252
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:184
@ AV_PIX_FMT_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:344
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:210
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:254
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:181
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:287
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:157
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:185
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:160
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:187
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:159
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:133
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:244
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:216
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:253
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:182
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:247
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:83
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:164
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:277
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
Definition: pixfmt.h:179
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:163
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:255
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:195
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:186
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:82
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:192
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:174
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:288
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:170
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:191
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:190
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:243
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:162
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:167
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:166
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:257
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:161
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:173
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:242
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:278
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:134
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:249
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:217
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:158
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:156
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:188
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:275
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:135
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:256
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:248
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:250
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:194
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:193
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:175
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:180
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:346
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:165
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:246
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:131
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:251
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:387
bitstream writer API
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:57
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:110
mfxU16 profile
Definition: qsvenc.c:45
Raw Video Codec.
#define tc
Definition: regdef.h:69
#define FF_ARRAY_ELEMS(a)
#define snprintf
Definition: snprintf.h:34
static int shift(int a, int b)
Definition: sonic.c:82
unsigned int pos
Definition: spdifenc.c:412
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:453
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: avcodec.h:495
main external API structure.
Definition: avcodec.h:536
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:746
int width
picture width / height.
Definition: avcodec.h:709
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
Definition: avcodec.h:2197
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:561
int nb_coded_side_data
Definition: avcodec.h:2198
AVRational framerate
Definition: avcodec.h:2075
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:915
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1744
int64_t bit_rate
the average bitrate
Definition: avcodec.h:586
int sample_rate
samples per second
Definition: avcodec.h:1196
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:659
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:637
int channels
number of audio channels
Definition: avcodec.h:1197
enum AVCodecID codec_id
Definition: avcodec.h:546
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition: avcodec.h:1233
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1216
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwconfig.h:34
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
int frame_size
Audio only.
Definition: codec_par.h:181
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:102
int channels
Audio only.
Definition: codec_par.h:166
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:89
int block_align
Audio only.
Definition: codec_par.h:177
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:64
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:74
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
int sample_rate
Audio only.
Definition: codec_par.h:170
AVCodec.
Definition: codec.h:197
int(* receive_packet)(struct AVCodecContext *avctx, struct AVPacket *avpkt)
Encode API with decoupled frame/packet dataflow.
Definition: codec.h:311
int caps_internal
Internal codec capabilities.
Definition: codec.h:328
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
Definition: codec.h:318
const struct AVCodecHWConfigInternal *const * hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
Definition: codec.h:343
int(* decode)(struct AVCodecContext *avctx, void *outdata, int *got_frame_ptr, struct AVPacket *avpkt)
Decode picture or subtitle data.
Definition: codec.h:303
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
Definition: codec.h:224
const char * name
Name of the codec implementation.
Definition: codec.h:204
int(* encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
Definition: codec.h:289
int(* encode_sub)(struct AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Definition: codec.h:277
uint8_t max_lowres
maximum value for lowres supported by the decoder
Definition: codec.h:222
Structure to hold side data for an AVFrame.
Definition: frame.h:220
uint8_t * data
Definition: frame.h:222
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:384
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:332
int width
Definition: frame.h:376
int height
Definition: frame.h:376
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:349
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:391
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:365
uint8_t * data
Definition: packet.h:307
enum AVPacketSideDataType type
Definition: packet.h:313
size_t size
Definition: packet.h:311
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
AVProfile.
Definition: codec.h:183
int profile
Definition: codec.h:184
const char * name
short name for the profile
Definition: codec.h:185
Rational number (pair of numerator and denominator).
Definition: rational.h:58
int num
Numerator.
Definition: rational.h:59
int den
Denominator.
Definition: rational.h:60
enum AVPixelFormat pix_fmt
Definition: raw.h:35
unsigned int fourcc
Definition: raw.h:36
AVCodecContext * owner[2]
Definition: thread.h:36
AVFrame * f
Definition: thread.h:35
AVBufferRef * progress
Definition: thread.h:39
#define av_freep(p)
#define av_log(a,...)
static uint8_t tmp[11]
Definition: aes_ctr.c:27
#define src
Definition: vp8dsp.c:255
int framerate
Definition: h264_levels.c:65
int64_t bitrate
Definition: h264_levels.c:131
int64_t duration
Definition: movenc.c:64
AVFormatContext * ctx
Definition: movenc.c:48
static int width
Definition: utils.c:158
static int height
Definition: utils.c:158
int size
static const struct twinvq_data tab
enum AVCodecID codec_id
Definition: vaapi_decode.c:369
uint32_t fourcc
Definition: vaapi_decode.c:239
const char * b
Definition: vf_curves.c:119
int len
static double c[64]