FFmpeg
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"
32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/mem.h"
34 #include "libavutil/pixdesc.h"
35 #include "libavutil/imgutils.h"
36 #include "libavutil/pixfmt.h"
37 #include "avcodec.h"
38 #include "codec.h"
39 #include "hwconfig.h"
40 #include "thread.h"
41 #include "internal.h"
42 #include "put_bits.h"
43 #include "raw.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  }
59  if (*p)
60  memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
61 }
62 
63 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
64 {
65  uint8_t **p = ptr;
66  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
67  av_freep(p);
68  *size = 0;
69  return;
70  }
72  if (*p)
73  memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
74 }
75 
76 int av_codec_is_encoder(const AVCodec *codec)
77 {
78  return codec && (codec->encode_sub || codec->encode2 || codec->receive_packet);
79 }
80 
81 int av_codec_is_decoder(const AVCodec *codec)
82 {
83  return codec && (codec->decode || codec->receive_frame);
84 }
85 
87 {
88  int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
89 
90  if (ret < 0)
91  width = height = 0;
92 
93  s->coded_width = width;
94  s->coded_height = height;
95  s->width = AV_CEIL_RSHIFT(width, s->lowres);
96  s->height = AV_CEIL_RSHIFT(height, s->lowres);
97 
98  return ret;
99 }
100 
102 {
103  int ret = av_image_check_sar(avctx->width, avctx->height, sar);
104 
105  if (ret < 0) {
106  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %d/%d\n",
107  sar.num, sar.den);
108  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
109  return ret;
110  } else {
111  avctx->sample_aspect_ratio = sar;
112  }
113  return 0;
114 }
115 
117  enum AVMatrixEncoding matrix_encoding)
118 {
119  AVFrameSideData *side_data;
120  enum AVMatrixEncoding *data;
121 
123  if (!side_data)
125  sizeof(enum AVMatrixEncoding));
126 
127  if (!side_data)
128  return AVERROR(ENOMEM);
129 
130  data = (enum AVMatrixEncoding*)side_data->data;
131  *data = matrix_encoding;
132 
133  return 0;
134 }
135 
137  int linesize_align[AV_NUM_DATA_POINTERS])
138 {
139  int i;
140  int w_align = 1;
141  int h_align = 1;
142  AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
143 
144  if (desc) {
145  w_align = 1 << desc->log2_chroma_w;
146  h_align = 1 << desc->log2_chroma_h;
147  }
148 
149  switch (s->pix_fmt) {
150  case AV_PIX_FMT_YUV420P:
151  case AV_PIX_FMT_YUYV422:
152  case AV_PIX_FMT_YVYU422:
153  case AV_PIX_FMT_UYVY422:
154  case AV_PIX_FMT_YUV422P:
155  case AV_PIX_FMT_YUV440P:
156  case AV_PIX_FMT_YUV444P:
157  case AV_PIX_FMT_GBRP:
158  case AV_PIX_FMT_GBRAP:
159  case AV_PIX_FMT_GRAY8:
160  case AV_PIX_FMT_GRAY16BE:
161  case AV_PIX_FMT_GRAY16LE:
162  case AV_PIX_FMT_YUVJ420P:
163  case AV_PIX_FMT_YUVJ422P:
164  case AV_PIX_FMT_YUVJ440P:
165  case AV_PIX_FMT_YUVJ444P:
166  case AV_PIX_FMT_YUVA420P:
167  case AV_PIX_FMT_YUVA422P:
168  case AV_PIX_FMT_YUVA444P:
225  case AV_PIX_FMT_GBRP9LE:
226  case AV_PIX_FMT_GBRP9BE:
227  case AV_PIX_FMT_GBRP10LE:
228  case AV_PIX_FMT_GBRP10BE:
229  case AV_PIX_FMT_GBRP12LE:
230  case AV_PIX_FMT_GBRP12BE:
231  case AV_PIX_FMT_GBRP14LE:
232  case AV_PIX_FMT_GBRP14BE:
233  case AV_PIX_FMT_GBRP16LE:
234  case AV_PIX_FMT_GBRP16BE:
239  w_align = 16; //FIXME assume 16 pixel per macroblock
240  h_align = 16 * 2; // interlaced needs 2 macroblocks height
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  }
253  break;
254  case AV_PIX_FMT_RGB555:
255  if (s->codec_id == AV_CODEC_ID_RPZA) {
256  w_align = 4;
257  h_align = 4;
258  }
259  if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
260  w_align = 8;
261  h_align = 8;
262  }
263  break;
264  case AV_PIX_FMT_PAL8:
265  case AV_PIX_FMT_BGR8:
266  case AV_PIX_FMT_RGB8:
267  if (s->codec_id == AV_CODEC_ID_SMC ||
268  s->codec_id == AV_CODEC_ID_CINEPAK) {
269  w_align = 4;
270  h_align = 4;
271  }
272  if (s->codec_id == AV_CODEC_ID_JV ||
273  s->codec_id == AV_CODEC_ID_ARGO ||
274  s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
275  w_align = 8;
276  h_align = 8;
277  }
278  if (s->codec_id == AV_CODEC_ID_MJPEG ||
279  s->codec_id == AV_CODEC_ID_MJPEGB ||
280  s->codec_id == AV_CODEC_ID_LJPEG ||
281  s->codec_id == AV_CODEC_ID_SMVJPEG ||
282  s->codec_id == AV_CODEC_ID_AMV ||
283  s->codec_id == AV_CODEC_ID_SP5X ||
284  s->codec_id == AV_CODEC_ID_JPEGLS) {
285  w_align = 8;
286  h_align = 2*8;
287  }
288  break;
289  case AV_PIX_FMT_BGR24:
290  if ((s->codec_id == AV_CODEC_ID_MSZH) ||
291  (s->codec_id == AV_CODEC_ID_ZLIB)) {
292  w_align = 4;
293  h_align = 4;
294  }
295  break;
296  case AV_PIX_FMT_RGB24:
297  if (s->codec_id == AV_CODEC_ID_CINEPAK) {
298  w_align = 4;
299  h_align = 4;
300  }
301  break;
302  case AV_PIX_FMT_BGR0:
303  if (s->codec_id == AV_CODEC_ID_ARGO) {
304  w_align = 8;
305  h_align = 8;
306  }
307  break;
308  default:
309  break;
310  }
311 
312  if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
313  w_align = FFMAX(w_align, 8);
314  }
315 
316  *width = FFALIGN(*width, w_align);
317  *height = FFALIGN(*height, h_align);
318  if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
319  s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
320  s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
321  ) {
322  // some of the optimized chroma MC reads one line too much
323  // which is also done in mpeg decoders with lowres > 0
324  *height += 2;
325 
326  // H.264 uses edge emulation for out of frame motion vectors, for this
327  // it requires a temporary area large enough to hold a 21x21 block,
328  // increasing witdth ensure that the temporary area is large enough,
329  // the next rounded up width is 32
330  *width = FFMAX(*width, 32);
331  }
332 
333  for (i = 0; i < 4; i++)
334  linesize_align[i] = STRIDE_ALIGN;
335 }
336 
338 {
339  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
340  int chroma_shift = desc->log2_chroma_w;
341  int linesize_align[AV_NUM_DATA_POINTERS];
342  int align;
343 
344  avcodec_align_dimensions2(s, width, height, linesize_align);
345  align = FFMAX(linesize_align[0], linesize_align[3]);
346  linesize_align[1] <<= chroma_shift;
347  linesize_align[2] <<= chroma_shift;
348  align = FFMAX3(align, linesize_align[1], linesize_align[2]);
349  *width = FFALIGN(*width, align);
350 }
351 
352 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
353 {
354  if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
355  return AVERROR(EINVAL);
356  pos--;
357 
358  *xpos = (pos&1) * 128;
359  *ypos = ((pos>>1)^(pos<4)) * 128;
360 
361  return 0;
362 }
363 
365 {
366  int pos, xout, yout;
367 
369  if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
370  return pos;
371  }
373 }
374 
376  enum AVSampleFormat sample_fmt, const uint8_t *buf,
377  int buf_size, int align)
378 {
379  int ch, planar, needed_size, ret = 0;
380 
382  frame->nb_samples, sample_fmt,
383  align);
384  if (buf_size < needed_size)
385  return AVERROR(EINVAL);
386 
387  planar = av_sample_fmt_is_planar(sample_fmt);
389  if (!FF_ALLOCZ_TYPED_ARRAY(frame->extended_data, nb_channels))
390  return AVERROR(ENOMEM);
391  } else {
392  frame->extended_data = frame->data;
393  }
394 
395  if ((ret = av_samples_fill_arrays(frame->extended_data, &frame->linesize[0],
396  (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples,
397  sample_fmt, align)) < 0) {
398  if (frame->extended_data != frame->data)
399  av_freep(&frame->extended_data);
400  return ret;
401  }
402  if (frame->extended_data != frame->data) {
403  for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++)
404  frame->data[ch] = frame->extended_data[ch];
405  }
406 
407  return ret;
408 }
409 
410 void ff_color_frame(AVFrame *frame, const int c[4])
411 {
413  int p, y;
414 
416 
417  for (p = 0; p<desc->nb_components; p++) {
418  uint8_t *dst = frame->data[p];
419  int is_chroma = p == 1 || p == 2;
420  int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
421  int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
422  if (desc->comp[0].depth >= 9) {
423  ((uint16_t*)dst)[0] = c[p];
424  av_memcpy_backptr(dst + 2, 2, bytes - 2);
425  dst += frame->linesize[p];
426  for (y = 1; y < height; y++) {
427  memcpy(dst, frame->data[p], 2*bytes);
428  dst += frame->linesize[p];
429  }
430  } else {
431  for (y = 0; y < height; y++) {
432  memset(dst, c[p], bytes);
433  dst += frame->linesize[p];
434  }
435  }
436  }
437 }
438 
440  unsigned int fourcc)
441 {
442  while (tags->pix_fmt >= 0) {
443  if (tags->fourcc == fourcc)
444  return tags->pix_fmt;
445  tags++;
446  }
447  return AV_PIX_FMT_NONE;
448 }
449 
452 }
453 
454 const char *avcodec_get_name(enum AVCodecID id)
455 {
456  const AVCodecDescriptor *cd;
457  const AVCodec *codec;
458 
459  if (id == AV_CODEC_ID_NONE)
460  return "none";
461  cd = avcodec_descriptor_get(id);
462  if (cd)
463  return cd->name;
464  av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
465  codec = avcodec_find_decoder(id);
466  if (codec)
467  return codec->name;
468  codec = avcodec_find_encoder(id);
469  if (codec)
470  return codec->name;
471  return "unknown_codec";
472 }
473 
474 const char *av_get_profile_name(const AVCodec *codec, int profile)
475 {
476  const AVProfile *p;
477  if (profile == FF_PROFILE_UNKNOWN || !codec->profiles)
478  return NULL;
479 
480  for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
481  if (p->profile == profile)
482  return p->name;
483 
484  return NULL;
485 }
486 
488 {
490  const AVProfile *p;
491 
492  if (profile == FF_PROFILE_UNKNOWN || !desc || !desc->profiles)
493  return NULL;
494 
495  for (p = desc->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
496  if (p->profile == profile)
497  return p->name;
498 
499  return NULL;
500 }
501 
503 {
504  switch (codec_id) {
520  return 4;
528  case AV_CODEC_ID_PCM_S8:
530  case AV_CODEC_ID_PCM_SGA:
531  case AV_CODEC_ID_PCM_U8:
534  return 8;
541  return 16;
548  return 24;
558  return 32;
563  return 64;
564  default:
565  return 0;
566  }
567 }
568 
570 {
571  static const enum AVCodecID map[][2] = {
583  };
584  if (fmt < 0 || fmt >= FF_ARRAY_ELEMS(map))
585  return AV_CODEC_ID_NONE;
586  if (be < 0 || be > 1)
587  be = AV_NE(1, 0);
588  return map[fmt][be];
589 }
590 
592 {
593  switch (codec_id) {
595  return 2;
597  return 3;
603  return 4;
604  default:
606  }
607 }
608 
609 static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
610  uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
611  uint8_t * extradata, int frame_size, int frame_bytes)
612 {
614  int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
615 
616  /* codecs with an exact constant bits per sample */
617  if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
618  return (frame_bytes * 8LL) / (bps * ch);
619  bps = bits_per_coded_sample;
620 
621  /* codecs with a fixed packet duration */
622  switch (id) {
623  case AV_CODEC_ID_ADPCM_ADX: return 32;
624  case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
625  case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
626  case AV_CODEC_ID_AMR_NB:
627  case AV_CODEC_ID_EVRC:
628  case AV_CODEC_ID_GSM:
629  case AV_CODEC_ID_QCELP:
630  case AV_CODEC_ID_RA_288: return 160;
631  case AV_CODEC_ID_AMR_WB:
632  case AV_CODEC_ID_GSM_MS: return 320;
633  case AV_CODEC_ID_MP1: return 384;
634  case AV_CODEC_ID_ATRAC1: return 512;
635  case AV_CODEC_ID_ATRAC9:
636  case AV_CODEC_ID_ATRAC3:
637  if (framecount > INT_MAX/1024)
638  return 0;
639  return 1024 * framecount;
640  case AV_CODEC_ID_ATRAC3P: return 2048;
641  case AV_CODEC_ID_MP2:
642  case AV_CODEC_ID_MUSEPACK7: return 1152;
643  case AV_CODEC_ID_AC3: return 1536;
644  }
645 
646  if (sr > 0) {
647  /* calc from sample rate */
648  if (id == AV_CODEC_ID_TTA)
649  return 256 * sr / 245;
650  else if (id == AV_CODEC_ID_DST)
651  return 588 * sr / 44100;
652  else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
653  if (sr / 22050 > 22)
654  return 0;
655  return (480 << (sr / 22050));
656  }
657 
658  if (id == AV_CODEC_ID_MP3)
659  return sr <= 24000 ? 576 : 1152;
660  }
661 
662  if (ba > 0) {
663  /* calc from block_align */
664  if (id == AV_CODEC_ID_SIPR) {
665  switch (ba) {
666  case 20: return 160;
667  case 19: return 144;
668  case 29: return 288;
669  case 37: return 480;
670  }
671  } else if (id == AV_CODEC_ID_ILBC) {
672  switch (ba) {
673  case 38: return 160;
674  case 50: return 240;
675  }
676  }
677  }
678 
679  if (frame_bytes > 0) {
680  /* calc from frame_bytes only */
681  if (id == AV_CODEC_ID_TRUESPEECH)
682  return 240 * (frame_bytes / 32);
683  if (id == AV_CODEC_ID_NELLYMOSER)
684  return 256 * (frame_bytes / 64);
685  if (id == AV_CODEC_ID_RA_144)
686  return 160 * (frame_bytes / 20);
687 
688  if (bps > 0) {
689  /* calc from frame_bytes and bits_per_coded_sample */
691  return frame_bytes * 8 / bps;
692  }
693 
694  if (ch > 0 && ch < INT_MAX/16) {
695  /* calc from frame_bytes and channels */
696  switch (id) {
698  return frame_bytes / (40 * ch) * 256;
700  return (frame_bytes - 4 * ch) / (128 * ch) * 256;
702  return frame_bytes / (9 * ch) * 16;
705  frame_bytes /= 16 * ch;
706  if (frame_bytes > INT_MAX / 28)
707  return 0;
708  return frame_bytes * 28;
713  return (frame_bytes - 4 * ch) * 2 / ch;
715  return (frame_bytes - 4) * 2 / ch;
717  return (frame_bytes - 8) * 2;
720  if (extradata)
721  return frame_bytes * 14LL / (8 * ch);
722  break;
724  return (frame_bytes / 128) * 224 / ch;
726  return (frame_bytes - 6 - ch) / ch;
728  return (frame_bytes - 8) / ch;
730  return (frame_bytes - 2 * ch) / ch;
731  case AV_CODEC_ID_MACE3:
732  return 3 * frame_bytes / ch;
733  case AV_CODEC_ID_MACE6:
734  return 6 * frame_bytes / ch;
735  case AV_CODEC_ID_PCM_LXF:
736  return 2 * (frame_bytes / (5 * ch));
737  case AV_CODEC_ID_IAC:
738  case AV_CODEC_ID_IMC:
739  return 4 * frame_bytes / ch;
740  }
741 
742  if (tag) {
743  /* calc from frame_bytes, channels, and codec_tag */
744  if (id == AV_CODEC_ID_SOL_DPCM) {
745  if (tag == 3)
746  return frame_bytes / ch;
747  else
748  return frame_bytes * 2 / ch;
749  }
750  }
751 
752  if (ba > 0) {
753  /* calc from frame_bytes, channels, and block_align */
754  int blocks = frame_bytes / ba;
755  int64_t tmp = 0;
756  switch (id) {
758  if (bps < 2 || bps > 5)
759  return 0;
760  tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
761  break;
763  tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
764  break;
766  tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
767  break;
769  tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
770  break;
772  tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
773  break;
775  tmp = blocks * (ba - 16LL) * 2 / ch;
776  break;
777  }
778  if (tmp) {
779  if (tmp != (int)tmp)
780  return 0;
781  return tmp;
782  }
783  }
784 
785  if (bps > 0) {
786  /* calc from frame_bytes, channels, and bits_per_coded_sample */
787  switch (id) {
788  case AV_CODEC_ID_PCM_DVD:
789  if(bps<4 || frame_bytes<3)
790  return 0;
791  return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch));
793  if(bps<4 || frame_bytes<4)
794  return 0;
795  return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8);
796  case AV_CODEC_ID_S302M:
797  return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
798  }
799  }
800  }
801  }
802 
803  /* Fall back on using frame_size */
804  if (frame_size > 1 && frame_bytes)
805  return frame_size;
806 
807  //For WMA we currently have no other means to calculate duration thus we
808  //do it here by assuming CBR, which is true for all known cases.
809  if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) {
810  if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2)
811  return (frame_bytes * 8LL * sr) / bitrate;
812  }
813 
814  return 0;
815 }
816 
817 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
818 {
820  avctx->channels, avctx->block_align,
821  avctx->codec_tag, avctx->bits_per_coded_sample,
822  avctx->bit_rate, avctx->extradata, avctx->frame_size,
823  frame_bytes);
824  return FFMAX(0, duration);
825 }
826 
828 {
830  par->channels, par->block_align,
831  par->codec_tag, par->bits_per_coded_sample,
832  par->bit_rate, par->extradata, par->frame_size,
833  frame_bytes);
834  return FFMAX(0, duration);
835 }
836 
837 #if !HAVE_THREADS
839 {
840  return -1;
841 }
842 
843 #endif
844 
845 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
846 {
847  unsigned int n = 0;
848 
849  while (v >= 0xff) {
850  *s++ = 0xff;
851  v -= 0xff;
852  n++;
853  }
854  *s = v;
855  n++;
856  return n;
857 }
858 
859 int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
860 {
861  int i;
862  for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
863  return i;
864 }
865 
867 {
868  int i;
869  if (!codec->hw_configs || index < 0)
870  return NULL;
871  for (i = 0; i <= index; i++)
872  if (!codec->hw_configs[i])
873  return NULL;
874  return &codec->hw_configs[index]->public;
875 }
876 
877 unsigned int avpriv_toupper4(unsigned int x)
878 {
879  return av_toupper(x & 0xFF) +
880  (av_toupper((x >> 8) & 0xFF) << 8) +
881  (av_toupper((x >> 16) & 0xFF) << 16) +
882 ((unsigned)av_toupper((x >> 24) & 0xFF) << 24);
883 }
884 
886 {
887  int ret;
888 
889  dst->owner[0] = src->owner[0];
890  dst->owner[1] = src->owner[1];
891 
892  ret = av_frame_ref(dst->f, src->f);
893  if (ret < 0)
894  return ret;
895 
896  av_assert0(!dst->progress);
897 
898  if (src->progress &&
899  !(dst->progress = av_buffer_ref(src->progress))) {
900  ff_thread_release_buffer(dst->owner[0], dst);
901  return AVERROR(ENOMEM);
902  }
903 
904  return 0;
905 }
906 
907 #if !HAVE_THREADS
908 
910 {
911  return ff_get_format(avctx, fmt);
912 }
913 
915 {
916  f->owner[0] = f->owner[1] = avctx;
917  return ff_get_buffer(avctx, f->f, flags);
918 }
919 
921 {
922  if (f->f)
923  av_frame_unref(f->f);
924 }
925 
927 {
928 }
929 
930 void ff_thread_report_progress(ThreadFrame *f, int progress, int field)
931 {
932 }
933 
934 void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
935 {
936 }
937 
939 {
940  return 1;
941 }
942 
943 int ff_alloc_entries(AVCodecContext *avctx, int count)
944 {
945  return 0;
946 }
947 
949 {
950 }
951 
952 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
953 {
954 }
955 
956 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
957 {
958 }
959 
960 #endif
961 
962 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
963  const uint8_t *end,
964  uint32_t *av_restrict state)
965 {
966  int i;
967 
968  av_assert0(p <= end);
969  if (p >= end)
970  return end;
971 
972  for (i = 0; i < 3; i++) {
973  uint32_t tmp = *state << 8;
974  *state = tmp + *(p++);
975  if (tmp == 0x100 || p == end)
976  return p;
977  }
978 
979  while (p < end) {
980  if (p[-1] > 1 ) p += 3;
981  else if (p[-2] ) p += 2;
982  else if (p[-3]|(p[-1]-1)) p++;
983  else {
984  p++;
985  break;
986  }
987  }
988 
989  p = FFMIN(p, end) - 4;
990  *state = AV_RB32(p);
991 
992  return p + 4;
993 }
994 
996 {
997  AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
998  if (!props)
999  return NULL;
1000 
1001  if (size)
1002  *size = sizeof(*props);
1003 
1004  props->vbv_delay = UINT64_MAX;
1005 
1006  return props;
1007 }
1008 
1010 {
1012  AVCPBProperties *props;
1013  size_t size;
1014  int i;
1015 
1016  for (i = 0; i < avctx->nb_coded_side_data; i++)
1018  return (AVCPBProperties *)avctx->coded_side_data[i].data;
1019 
1020  props = av_cpb_properties_alloc(&size);
1021  if (!props)
1022  return NULL;
1023 
1024  tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
1025  if (!tmp) {
1026  av_freep(&props);
1027  return NULL;
1028  }
1029 
1030  avctx->coded_side_data = tmp;
1031  avctx->nb_coded_side_data++;
1032 
1034  avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
1035  avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
1036 
1037  return props;
1038 }
1039 
1040 static unsigned bcd2uint(uint8_t bcd)
1041 {
1042  unsigned low = bcd & 0xf;
1043  unsigned high = bcd >> 4;
1044  if (low > 9 || high > 9)
1045  return 0;
1046  return low + 10*high;
1047 }
1048 
1049 int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len,
1050  void **data, size_t *sei_size)
1051 {
1052  AVFrameSideData *sd = NULL;
1053  uint8_t *sei_data;
1054  PutBitContext pb;
1055  uint32_t *tc;
1056  int m;
1057 
1058  if (frame)
1060 
1061  if (!sd) {
1062  *data = NULL;
1063  return 0;
1064  }
1065  tc = (uint32_t*)sd->data;
1066  m = tc[0] & 3;
1067 
1068  *sei_size = sizeof(uint32_t) * 4;
1069  *data = av_mallocz(*sei_size + prefix_len);
1070  if (!*data)
1071  return AVERROR(ENOMEM);
1072  sei_data = (uint8_t*)*data + prefix_len;
1073 
1074  init_put_bits(&pb, sei_data, *sei_size);
1075  put_bits(&pb, 2, m); // num_clock_ts
1076 
1077  for (int j = 1; j <= m; j++) {
1078  uint32_t tcsmpte = tc[j];
1079  unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours
1080  unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes
1081  unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds
1082  unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames
1083  unsigned drop = tcsmpte & 1<<30 && !0; // 1-bit drop if not arbitrary bit
1084 
1085  /* Calculate frame number of HEVC by SMPTE ST 12-1:2014 Sec 12.2 if rate > 30FPS */
1086  if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
1087  unsigned pc;
1088  ff *= 2;
1089  if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
1090  pc = !!(tcsmpte & 1 << 7);
1091  else
1092  pc = !!(tcsmpte & 1 << 23);
1093  ff = (ff + pc) & 0x7f;
1094  }
1095 
1096  put_bits(&pb, 1, 1); // clock_timestamp_flag
1097  put_bits(&pb, 1, 1); // units_field_based_flag
1098  put_bits(&pb, 5, 0); // counting_type
1099  put_bits(&pb, 1, 1); // full_timestamp_flag
1100  put_bits(&pb, 1, 0); // discontinuity_flag
1101  put_bits(&pb, 1, drop);
1102  put_bits(&pb, 9, ff);
1103  put_bits(&pb, 6, ss);
1104  put_bits(&pb, 6, mm);
1105  put_bits(&pb, 5, hh);
1106  put_bits(&pb, 5, 0);
1107  }
1108  flush_put_bits(&pb);
1109 
1110  return 0;
1111 }
1112 
1114 {
1115  AVRational framerate = avctx->framerate;
1116  int bits_per_coded_sample = avctx->bits_per_coded_sample;
1117  int64_t bitrate;
1118 
1119  if (!(framerate.num && framerate.den))
1120  framerate = av_inv_q(avctx->time_base);
1121  if (!(framerate.num && framerate.den))
1122  return 0;
1123 
1124  if (!bits_per_coded_sample) {
1126  bits_per_coded_sample = av_get_bits_per_pixel(desc);
1127  }
1128  bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
1129  framerate.num / framerate.den;
1130 
1131  return bitrate;
1132 }
1133 
1134 int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
1135  const int * array_valid_values, int default_value)
1136 {
1137  int i = 0, ref_val;
1138 
1139  while (1) {
1140  ref_val = array_valid_values[i];
1141  if (ref_val == INT_MAX)
1142  break;
1143  if (val == ref_val)
1144  return val;
1145  i++;
1146  }
1147  /* val is not a valid value */
1149  "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value);
1150  return default_value;
1151 }
FF_ALLOCZ_TYPED_ARRAY
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
Definition: internal.h:98
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:314
hwconfig.h
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1012
AV_CODEC_ID_MACE6
@ AV_CODEC_ID_MACE6
Definition: codec_id.h:433
be
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
AVCodec
AVCodec.
Definition: codec.h:202
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
AV_PIX_FMT_YUV420P9LE
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:147
AV_CODEC_ID_VP6F
@ AV_CODEC_ID_VP6F
Definition: codec_id.h:142
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:334
AV_CODEC_ID_DSD_LSBF
@ AV_CODEC_ID_DSD_LSBF
Definition: codec_id.h:496
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:74
AV_CODEC_ID_ADPCM_MS
@ AV_CODEC_ID_ADPCM_MS
Definition: codec_id.h:359
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: codec_id.h:353
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:426
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AV_CODEC_ID_PCM_BLURAY
@ AV_CODEC_ID_PCM_BLURAY
Definition: codec_id.h:338
ff_get_format
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
Definition: decode.c:1087
ff_thread_get_buffer
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: utils.c:914
AV_CODEC_ID_ADPCM_DTK
@ AV_CODEC_ID_ADPCM_DTK
Definition: codec_id.h:386
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:992
PixelFormatTag
Definition: raw.h:33
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:617
av_frame_new_side_data
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
Definition: frame.c:605
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:164
ff_thread_report_progress2
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
Definition: utils.c:956
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:162
AVProfile::name
const char * name
short name for the profile
Definition: codec.h:190
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2564
AV_CODEC_ID_8SVX_EXP
@ AV_CODEC_ID_8SVX_EXP
Definition: codec_id.h:477
AV_PIX_FMT_YUV422P14LE
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:239
ff_thread_await_progress2
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
Definition: utils.c:952
avpriv_toupper4
unsigned int avpriv_toupper4(unsigned int x)
Definition: utils.c:877
AVCodecDescriptor::name
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
AVCodecContext::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
Definition: avcodec.h:1833
ff_thread_can_start_frame
int ff_thread_can_start_frame(AVCodecContext *avctx)
Definition: utils.c:938
av_samples_fill_arrays
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
init_put_bits
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:61
AV_FRAME_DATA_S12M_TIMECODE
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition: frame.h:151
AV_CODEC_ID_PCM_S32LE_PLANAR
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition: codec_id.h:343
profile
mfxU16 profile
Definition: qsvenc.c:45
avcodec_find_encoder
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:914
AV_CODEC_ID_FASTAUDIO
@ AV_CODEC_ID_FASTAUDIO
Definition: codec_id.h:517
AV_CODEC_ID_RA_144
@ AV_CODEC_ID_RA_144
Definition: codec_id.h:410
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:220
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
AV_PIX_FMT_YUVA444P10BE
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:178
pixdesc.h
index
fg index
Definition: ffmpeg_filter.c:168
AV_PIX_FMT_YUV440P12BE
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:268
AVPacketSideData
Definition: packet.h:314
internal.h
AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition: codec_id.h:344
AV_CODEC_ID_VP6
@ AV_CODEC_ID_VP6
Definition: codec_id.h:141
b
#define b
Definition: input.c:40
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
data
const char data[16]
Definition: mxf.c:143
AV_CODEC_ID_PCM_U24LE
@ AV_CODEC_ID_PCM_U24LE
Definition: codec_id.h:328
AV_PIX_FMT_YUV420P14BE
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:234
avcodec_align_dimensions
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:337
AV_CODEC_ID_AMR_NB
@ AV_CODEC_ID_AMR_NB
Definition: codec_id.h:406
AV_PIX_FMT_YUV420P16LE
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:121
AV_CODEC_ID_ADPCM_AICA
@ AV_CODEC_ID_ADPCM_AICA
Definition: codec_id.h:391
AV_CODEC_ID_ADPCM_IMA_OKI
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition: codec_id.h:385
AV_CODEC_ID_PCM_SGA
@ AV_CODEC_ID_PCM_SGA
Definition: codec_id.h:350
AV_CODEC_ID_SOL_DPCM
@ AV_CODEC_ID_SOL_DPCM
Definition: codec_id.h:417
float.h
AV_CODEC_ID_WMAV2
@ AV_CODEC_ID_WMAV2
Definition: codec_id.h:431
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:381
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:246
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
av_get_bits_per_pixel
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:2516
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:64
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AV_CODEC_ID_IMC
@ AV_CODEC_ID_IMC
Definition: codec_id.h:450
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
AV_PIX_FMT_YUVA444P9BE
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:172
AV_PIX_FMT_YUV422P9BE
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:156
avcodec_profile_name
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:487
thread.h
ThreadFrame::f
AVFrame * f
Definition: thread.h:35
AV_CODEC_ID_PCM_S16LE_PLANAR
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: codec_id.h:332
AV_CODEC_ID_ADPCM_THP_LE
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: codec_id.h:389
AV_CODEC_ID_AMR_WB
@ AV_CODEC_ID_AMR_WB
Definition: codec_id.h:407
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:125
AV_CODEC_ID_PCM_S64LE
@ AV_CODEC_ID_PCM_S64LE
Definition: codec_id.h:345
AVProfile
AVProfile.
Definition: codec.h:188
AV_PIX_FMT_GBRAP12LE
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:278
state
static struct @319 state
AV_CODEC_ID_DSD_MSBF_PLANAR
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition: codec_id.h:499
AV_CODEC_ID_ADPCM_CT
@ AV_CODEC_ID_ADPCM_CT
Definition: codec_id.h:365
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:1710
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
framerate
int framerate
Definition: h264_levels.c:65
avcodec_enum_to_chroma_pos
int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
Definition: utils.c:352
AVPacketSideData::size
size_t size
Definition: packet.h:316
AVCodecParameters::channels
int channels
Audio only.
Definition: codec_par.h:166
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_CODEC_ID_IFF_ILBM
@ AV_CODEC_ID_IFF_ILBM
Definition: codec_id.h:186
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:233
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:315
AV_FRAME_DATA_MATRIXENCODING
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:67
STRIDE_ALIGN
#define STRIDE_ALIGN
Definition: internal.h:112
AV_CODEC_ID_XAN_DPCM
@ AV_CODEC_ID_XAN_DPCM
Definition: codec_id.h:416
AV_CODEC_ID_MSZH
@ AV_CODEC_ID_MSZH
Definition: codec_id.h:103
AVCodec::encode_sub
int(* encode_sub)(struct AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Definition: codec.h:290
avpriv_find_start_code
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:962
tab
static const struct twinvq_data tab
Definition: twinvq_data.h:10345
ThreadFrame::owner
AVCodecContext * owner[2]
Definition: thread.h:36
val
static double val(void *priv, double ch)
Definition: aeval.c:76
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:72
ff_thread_get_format
enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
Definition: utils.c:909
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: codec_id.h:99
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:424
ss
#define ss(width, name, subs,...)
Definition: cbs_vp9.c:261
AV_PIX_FMT_YUVA444P16BE
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:184
AV_CODEC_ID_8SVX_FIB
@ AV_CODEC_ID_8SVX_FIB
Definition: codec_id.h:478
codec.h
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_PIX_FMT_YUV444P10BE
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:154
av_image_check_size2
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:289
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:149
AV_CODEC_ID_ATRAC3
@ AV_CODEC_ID_ATRAC3
Definition: codec_id.h:454
PixelFormatTag::pix_fmt
enum AVPixelFormat pix_fmt
Definition: raw.h:34
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
#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:62
raw.h
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:241
AV_PIX_FMT_YUVJ411P
@ 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:248
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:591
AV_CODEC_ID_SIPR
@ AV_CODEC_ID_SIPR
Definition: codec_id.h:464
AV_CODEC_ID_ADPCM_SBPRO_2
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition: codec_id.h:370
AV_PIX_FMT_YUV422P12BE
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:236
AV_PIX_FMT_YUV444P14LE
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:243
AV_CODEC_ID_WMAV1
@ AV_CODEC_ID_WMAV1
Definition: codec_id.h:430
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:318
AV_PIX_FMT_BGR8
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:83
avassert.h
AV_CODEC_ID_MACE3
@ AV_CODEC_ID_MACE3
Definition: codec_id.h:432
AV_CODEC_ID_ATRAC3P
@ AV_CODEC_ID_ATRAC3P
Definition: codec_id.h:462
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AV_CODEC_ID_TTA
@ AV_CODEC_ID_TTA
Definition: codec_id.h:445
avpriv_find_pix_fmt
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
Definition: utils.c:439
duration
int64_t duration
Definition: movenc.c:64
AVCodecParameters::frame_size
int frame_size
Audio only.
Definition: codec_par.h:181
av_memcpy_backptr
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
Definition: mem.c:454
AV_CODEC_ID_S302M
@ AV_CODEC_ID_S302M
Definition: codec_id.h:340
AV_PIX_FMT_YUVJ422P
@ 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_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:206
AV_CODEC_ID_ADPCM_IMA_ACORN
@ AV_CODEC_ID_ADPCM_IMA_ACORN
Definition: codec_id.h:403
AV_CODEC_ID_ADPCM_G726
@ AV_CODEC_ID_ADPCM_G726
Definition: codec_id.h:364
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:165
AV_CODEC_ID_PCM_LXF
@ AV_CODEC_ID_PCM_LXF
Definition: codec_id.h:339
AV_NE
#define AV_NE(be, le)
Definition: macros.h:33
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
height
static int height
Definition: utils.c:158
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:224
AV_CODEC_ID_ADPCM_AFC
@ AV_CODEC_ID_ADPCM_AFC
Definition: codec_id.h:384
AV_CODEC_ID_ADPCM_IMA_EA_SEAD
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition: codec_id.h:376
frame_size
int frame_size
Definition: mxfenc.c:2205
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:423
AV_CODEC_ID_ADPCM_IMA_DK3
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition: codec_id.h:355
AV_CODEC_ID_ARGO
@ AV_CODEC_ID_ARGO
Definition: codec_id.h:306
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:245
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1526
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
av_sample_fmt_is_planar
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:112
AV_CODEC_ID_ADPCM_IMA_APC
@ AV_CODEC_ID_ADPCM_IMA_APC
Definition: codec_id.h:382
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:511
AV_PIX_FMT_YUVA420P16BE
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:180
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ff_side_data_update_matrix_encoding
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:116
AVPacketSideData::data
uint8_t * data
Definition: packet.h:315
AV_CODEC_ID_ADPCM_IMA_ISS
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition: codec_id.h:380
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:471
ctx
AVFormatContext * ctx
Definition: movenc.c:48
avcodec_fill_audio_frame
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:375
ff_alloc_entries
int ff_alloc_entries(AVCodecContext *avctx, int count)
Definition: utils.c:943
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:348
limits.h
avcodec_align_dimensions2
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:136
AV_CODEC_ID_DERF_DPCM
@ AV_CODEC_ID_DERF_DPCM
Definition: codec_id.h:420
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:320
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
AV_CODEC_ID_PCM_U16BE
@ AV_CODEC_ID_PCM_U16BE
Definition: codec_id.h:317
AV_CODEC_ID_ADPCM_IMA_SMJPEG
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition: codec_id.h:358
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:163
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:369
AV_CODEC_ID_PCM_DVD
@ AV_CODEC_ID_PCM_DVD
Definition: codec_id.h:333
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:104
f
#define f(width, name)
Definition: cbs_vp9.c:255
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:77
PutBitContext
Definition: put_bits.h:49
AV_PIX_FMT_YUVJ444P
@ 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
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:393
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:155
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:177
ThreadFrame::progress
AVBufferRef * progress
Definition: thread.h:39
ff_thread_ref_frame
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition: utils.c:885
AVMatrixEncoding
AVMatrixEncoding
Definition: channel_layout.h:120
AV_PIX_FMT_YUV444P9BE
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:152
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:321
AV_PIX_FMT_YUV422P10BE
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:150
AV_PIX_FMT_YUV422P16LE
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:123
AV_CODEC_ID_ADPCM_EA_XAS
@ AV_CODEC_ID_ADPCM_EA_XAS
Definition: codec_id.h:378
ff_match_2uint16
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:859
AV_CODEC_ID_SP5X
@ AV_CODEC_ID_SP5X
Definition: codec_id.h:60
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:277
NULL
#define NULL
Definition: coverity.c:32
ff_thread_release_buffer
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
Definition: utils.c:920
AV_CODEC_ID_DST
@ AV_CODEC_ID_DST
Definition: codec_id.h:504
AV_CODEC_ID_INTERPLAY_VIDEO
@ AV_CODEC_ID_INTERPLAY_VIDEO
Definition: codec_id.h:89
AV_CODEC_ID_ADPCM_YAMAHA
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition: codec_id.h:367
AV_CODEC_ID_ADPCM_IMA_WS
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition: codec_id.h:357
AV_CODEC_ID_PCM_U24BE
@ AV_CODEC_ID_PCM_U24BE
Definition: codec_id.h:329
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_CODEC_ID_INTERPLAY_DPCM
@ AV_CODEC_ID_INTERPLAY_DPCM
Definition: codec_id.h:415
AV_CODEC_ID_PCM_U32BE
@ AV_CODEC_ID_PCM_U32BE
Definition: codec_id.h:325
AVCodecContext::nb_coded_side_data
int nb_coded_side_data
Definition: avcodec.h:1834
AV_CODEC_ID_ADPCM_ARGO
@ AV_CODEC_ID_ADPCM_ARGO
Definition: codec_id.h:395
AV_PIX_FMT_YUVJ420P
@ 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_CODEC_ID_ADPCM_IMA_DK4
@ AV_CODEC_ID_ADPCM_IMA_DK4
Definition: codec_id.h:356
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:433
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: packet.h:317
AV_PIX_FMT_YUVA422P12LE
@ 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:334
AV_CODEC_ID_CINEPAK
@ AV_CODEC_ID_CINEPAK
Definition: codec_id.h:93
src
#define src
Definition: vp8dsp.c:255
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:346
AV_CODEC_ID_ZLIB
@ AV_CODEC_ID_ZLIB
Definition: codec_id.h:104
AV_PIX_FMT_YUVA444P12BE
@ 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:335
AVCodec::profiles
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
Definition: codec.h:229
av_fast_mallocz
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
Allocate and clear a buffer, reusing the given one if large enough.
Definition: mem.c:565
AV_PIX_FMT_YUVA444P9LE
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:173
AV_CODEC_ID_ADPCM_IMA_AMV
@ AV_CODEC_ID_ADPCM_IMA_AMV
Definition: codec_id.h:372
AV_PIX_FMT_YUVA420P16LE
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:181
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:230
AV_CODEC_ID_ROQ_DPCM
@ AV_CODEC_ID_ROQ_DPCM
Definition: codec_id.h:414
AV_PIX_FMT_YUV440P10LE
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:265
AVProfile::profile
int profile
Definition: codec.h:189
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_YUVA420P9LE
@ 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:169
AV_CODEC_ID_VP6A
@ AV_CODEC_ID_VP6A
Definition: codec_id.h:156
ff_color_frame
void ff_color_frame(AVFrame *frame, const int c[4])
Definition: utils.c:410
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:170
AV_PIX_FMT_YUV420P14LE
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:235
AV_CODEC_ID_PCM_S24LE_PLANAR
@ AV_CODEC_ID_PCM_S24LE_PLANAR
Definition: codec_id.h:342
AV_CODEC_ID_ADPCM_XA
@ AV_CODEC_ID_ADPCM_XA
Definition: codec_id.h:361
AV_CODEC_ID_GSM
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition: codec_id.h:441
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:47
AV_CODEC_ID_PCM_VIDC
@ AV_CODEC_ID_PCM_VIDC
Definition: codec_id.h:349
AV_PIX_FMT_YUV444P14BE
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:242
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:919
AV_CODEC_ID_MJPEGB
@ AV_CODEC_ID_MJPEGB
Definition: codec_id.h:58
AV_PIX_FMT_YUV420P9BE
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:146
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:506
av_codec_is_decoder
int av_codec_is_decoder(const AVCodec *codec)
Definition: utils.c:81
AV_CODEC_ID_QCELP
@ AV_CODEC_ID_QCELP
Definition: codec_id.h:447
av_get_exact_bits_per_sample
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:502
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:326
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1652
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
AV_PIX_FMT_YUV440P12LE
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:267
AV_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:362
av_frame_ref
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:327
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
AV_CODEC_ID_ADPCM_IMA_RAD
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition: codec_id.h:387
AV_PIX_FMT_YUV420P12BE
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:232
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:151
AV_CODEC_ID_DSD_MSBF
@ AV_CODEC_ID_DSD_MSBF
Definition: codec_id.h:497
AV_CODEC_ID_ADPCM_IMA_ALP
@ AV_CODEC_ID_ADPCM_IMA_ALP
Definition: codec_id.h:399
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:238
bps
unsigned bps
Definition: movenc.c:1596
AV_CODEC_ID_ADPCM_SWF
@ AV_CODEC_ID_ADPCM_SWF
Definition: codec_id.h:366
size
int size
Definition: twinvq_data.h:10344
AV_CODEC_ID_SMVJPEG
@ AV_CODEC_ID_SMVJPEG
Definition: codec_id.h:263
avpriv_codec_get_cap_skip_frame_fill_param
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition: utils.c:450
AVCodec::encode2
int(* encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
Definition: codec.h:302
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:304
AV_RB32
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:96
AVCodec::receive_packet
int(* receive_packet)(struct AVCodecContext *avctx, struct AVPacket *avpkt)
Encode API with decoupled frame/packet dataflow.
Definition: codec.h:324
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:160
ff_add_cpb_side_data
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
Definition: utils.c:1009
AVFrameSideData::data
uint8_t * data
Definition: frame.h:211
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:599
AV_PIX_FMT_YUV420P10BE
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:148
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:161
AVCodec::receive_frame
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
Definition: codec.h:331
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
ff_reset_entries
void ff_reset_entries(AVCodecContext *avctx)
Definition: utils.c:948
bitrate
int64_t bitrate
Definition: h264_levels.c:131
ff_int_from_list_or_default
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:1134
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:175
AV_CODEC_ID_SVQ1
@ AV_CODEC_ID_SVQ1
Definition: codec_id.h:72
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
ff_thread_await_progress
void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
Definition: utils.c:934
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:993
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:598
AV_PIX_FMT_YUVA422P10BE
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:176
av_codec_is_encoder
int av_codec_is_encoder(const AVCodec *codec)
Definition: utils.c:76
AV_CODEC_ID_VP5
@ AV_CODEC_ID_VP5
Definition: codec_id.h:140
AVCPBProperties::vbv_delay
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: defs.h:134
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:454
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:57
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1418
AV_PIX_FMT_YUVA444P12LE
@ 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:336
AVCodec::hw_configs
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:351
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:170
AV_CODEC_ID_ATRAC1
@ AV_CODEC_ID_ATRAC1
Definition: codec_id.h:469
AV_CODEC_ID_RA_288
@ AV_CODEC_ID_RA_288
Definition: codec_id.h:411
ff_thread_finish_setup
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:926
AV_CODEC_ID_ADPCM_MTAF
@ AV_CODEC_ID_ADPCM_MTAF
Definition: codec_id.h:393
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
av_get_profile_name
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:474
width
static int width
Definition: utils.c:158
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:484
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:60
AV_CODEC_ID_EVRC
@ AV_CODEC_ID_EVRC
Definition: codec_id.h:494
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:177
av_cpb_properties_alloc
AVCPBProperties * av_cpb_properties_alloc(size_t *size)
Allocate a CPB properties structure and initialize its fields to default values.
Definition: utils.c:995
AV_CODEC_ID_DSD_LSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: codec_id.h:498
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:336
av_fast_padded_malloc
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
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:379
av_toupper
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
Definition: avstring.h:236
av_xiphlacing
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:845
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_CODEC_ID_ADPCM_IMA_APM
@ AV_CODEC_ID_ADPCM_IMA_APM
Definition: codec_id.h:398
AV_PIX_FMT_YUVJ440P
@ 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_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:323
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:437
av_get_audio_frame_duration
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition: utils.c:817
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:263
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:209
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:145
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:347
AV_CODEC_ID_ADPCM_IMA_DAT4
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition: codec_id.h:392
av_samples_get_buffer_size
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
AV_PIX_FMT_YUV444P16BE
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:126
AVCodecContext::height
int height
Definition: avcodec.h:556
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:593
ff_guess_coded_bitrate
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:1113
avcodec.h
AV_CODEC_ID_IAC
@ AV_CODEC_ID_IAC
Definition: codec_id.h:481
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AV_PIX_FMT_GBRAP16LE
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:207
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_CODEC_ID_GSM_MS
@ AV_CODEC_ID_GSM_MS
Definition: codec_id.h:453
AV_PIX_FMT_YVYU422
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:200
tag
uint32_t tag
Definition: movenc.c:1595
ret
ret
Definition: filter_design.txt:187
AVCodec::caps_internal
int caps_internal
Internal codec capabilities.
Definition: codec.h:254
AVCodecContext::block_align
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition: avcodec.h:1029
pixfmt.h
get_audio_frame_duration
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:609
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
pos
unsigned int pos
Definition: spdifenc.c:412
AV_CODEC_ID_JV
@ AV_CODEC_ID_JV
Definition: codec_id.h:199
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:244
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
AV_PIX_FMT_YUV444P12BE
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:240
AV_CODEC_ID_AMV
@ AV_CODEC_ID_AMV
Definition: codec_id.h:157
AVCodecContext
main external API structure.
Definition: avcodec.h:383
ThreadFrame
Definition: thread.h:34
AV_CODEC_ID_ADPCM_G726LE
@ AV_CODEC_ID_ADPCM_G726LE
Definition: codec_id.h:388
channel_layout.h
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:61
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:153
av_fast_padded_mallocz
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:63
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
AV_CODEC_ID_PCM_U32LE
@ AV_CODEC_ID_PCM_U32LE
Definition: codec_id.h:324
AV_PIX_FMT_FLAG_PLANAR
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:132
avcodec_chroma_pos_to_enum
enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
Converts swscale x/y chroma position to AVChromaLocation.
Definition: utils.c:364
AV_PIX_FMT_YUVA420P10BE
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:174
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
avcodec_get_hw_config
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
Definition: utils.c:866
AV_PIX_FMT_YUV420P16BE
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:122
AV_CODEC_ID_TRUESPEECH
@ AV_CODEC_ID_TRUESPEECH
Definition: codec_id.h:444
shift
static int shift(int a, int b)
Definition: sonic.c:83
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
av_get_pcm_codec
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
Return the PCM codec associated with a sample format.
Definition: utils.c:569
AV_CODEC_ID_ADPCM_THP
@ AV_CODEC_ID_ADPCM_THP
Definition: codec_id.h:371
AV_PIX_FMT_YUV422P16BE
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:124
tc
#define tc
Definition: regdef.h:69
desc
const char * desc
Definition: libsvtav1.c:79
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:322
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:102
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
mem.h
bcd2uint
static unsigned bcd2uint(uint8_t bcd)
Definition: utils.c:1040
AV_CODEC_ID_ADPCM_SBPRO_4
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition: codec_id.h:368
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:319
AV_CODEC_ID_RPZA
@ AV_CODEC_ID_RPZA
Definition: codec_id.h:92
AV_CODEC_ID_SDX2_DPCM
@ AV_CODEC_ID_SDX2_DPCM
Definition: codec_id.h:418
ff_set_dimensions
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:86
ff_set_sar
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:101
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:179
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:209
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:142
AV_CODEC_ID_PCM_S24DAUD
@ AV_CODEC_ID_PCM_S24DAUD
Definition: codec_id.h:330
AV_CODEC_ID_ADPCM_IMA_SSI
@ AV_CODEC_ID_ADPCM_IMA_SSI
Definition: codec_id.h:396
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:337
ff_alloc_timecode_sei
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:1049
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:408
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AV_CODEC_ID_ADPCM_IMA_MOFLEX
@ AV_CODEC_ID_ADPCM_IMA_MOFLEX
Definition: codec_id.h:402
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: codec_id.h:354
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_get_audio_frame_duration2
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:827
av_fast_malloc
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:560
AV_PIX_FMT_YUV411P
@ 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_YUV440P10BE
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:266
AV_PIX_FMT_YUVA422P16BE
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:182
FFMAX3
#define FFMAX3(a, b, c)
Definition: macros.h:48
AV_PIX_FMT_YUV422P9LE
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:157
AV_PIX_FMT_YUVA422P16LE
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:183
PixelFormatTag::fourcc
unsigned int fourcc
Definition: raw.h:35
AV_CODEC_ID_ILBC
@ AV_CODEC_ID_ILBC
Definition: codec_id.h:482
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:247
AV_CODEC_ID_PCM_S8_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: codec_id.h:341
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:556
AV_CODEC_ID_PCM_U16LE
@ AV_CODEC_ID_PCM_U16LE
Definition: codec_id.h:316
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVCHROMA_LOC_NB
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition: pixfmt.h:606
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:335
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:89
AVCodec::decode
int(* decode)(struct AVCodecContext *avctx, void *outdata, int *got_frame_ptr, struct AVPacket *avpkt)
Decode picture or subtitle data.
Definition: codec.h:316
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVCodecHWConfig
Definition: codec.h:460
AV_CODEC_ID_ADPCM_4XM
@ AV_CODEC_ID_ADPCM_4XM
Definition: codec_id.h:360
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3521
av_image_check_sar
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:323
avstring.h
AV_PIX_FMT_YUVA444P16LE
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:185
AV_CODEC_ID_MUSEPACK7
@ AV_CODEC_ID_MUSEPACK7
Definition: codec_id.h:451
AV_CODEC_ID_ADPCM_PSX
@ AV_CODEC_ID_ADPCM_PSX
Definition: codec_id.h:390
planar
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 &&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);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
AV_PIX_FMT_YUVA422P12BE
@ 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:333
AVCodecHWConfigInternal::public
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwconfig.h:34
put_bits.h
ff_thread_report_progress
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:930
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
fourcc
uint32_t fourcc
Definition: vaapi_decode.c:239
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:59
AV_CODEC_ID_MP1
@ AV_CODEC_ID_MP1
Definition: codec_id.h:465
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:237
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:327
ff_thread_init
int ff_thread_init(AVCodecContext *s)
Definition: utils.c:838
AV_PIX_FMT_YUVA420P9BE
@ 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:168
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63
AVCodecContext::sample_aspect_ratio
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:753
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166
AV_CODEC_ID_NELLYMOSER
@ AV_CODEC_ID_NELLYMOSER
Definition: codec_id.h:456
AV_PIX_FMT_UYYVYY411
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:82
AV_CODEC_ID_ADPCM_SBPRO_3
@ AV_CODEC_ID_ADPCM_SBPRO_3
Definition: codec_id.h:369
nb_channels
int nb_channels
Definition: channel_layout.c:81
AV_PIX_FMT_YUVA422P9LE
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:171