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"
31 #include "libavutil/intreadwrite.h"
32 #include "libavutil/mem.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 "codec_desc.h"
39 #include "codec_internal.h"
40 #include "codec_par.h"
41 #include "decode.h"
42 #include "hwconfig.h"
43 #include "refstruct.h"
44 #include "thread.h"
45 #include "threadframe.h"
46 #include "internal.h"
47 #include "put_bits.h"
48 #include "startcode.h"
49 #include <stdlib.h>
50 #include <limits.h>
51 
52 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
53 {
54  uint8_t **p = ptr;
55  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
56  av_freep(p);
57  *size = 0;
58  return;
59  }
61  if (*p)
62  memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
63 }
64 
65 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
66 {
67  uint8_t **p = ptr;
68  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
69  av_freep(p);
70  *size = 0;
71  return;
72  }
74  if (*p)
75  memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
76 }
77 
78 int av_codec_is_encoder(const AVCodec *avcodec)
79 {
80  const FFCodec *const codec = ffcodec(avcodec);
81  return codec && (codec->cb_type == FF_CODEC_CB_TYPE_ENCODE ||
84 }
85 
86 int av_codec_is_decoder(const AVCodec *avcodec)
87 {
88  const FFCodec *const codec = ffcodec(avcodec);
89  return codec && (codec->cb_type == FF_CODEC_CB_TYPE_DECODE ||
92 }
93 
95 {
96  int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
97 
98  if (ret < 0)
99  width = height = 0;
100 
101  s->coded_width = width;
102  s->coded_height = height;
103  s->width = AV_CEIL_RSHIFT(width, s->lowres);
104  s->height = AV_CEIL_RSHIFT(height, s->lowres);
105 
106  return ret;
107 }
108 
110 {
111  int ret = av_image_check_sar(avctx->width, avctx->height, sar);
112 
113  if (ret < 0) {
114  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %d/%d\n",
115  sar.num, sar.den);
116  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
117  return ret;
118  } else {
119  avctx->sample_aspect_ratio = sar;
120  }
121  return 0;
122 }
123 
125  enum AVMatrixEncoding matrix_encoding)
126 {
127  AVFrameSideData *side_data;
128  enum AVMatrixEncoding *data;
129 
131  if (!side_data)
133  sizeof(enum AVMatrixEncoding));
134 
135  if (!side_data)
136  return AVERROR(ENOMEM);
137 
138  data = (enum AVMatrixEncoding*)side_data->data;
139  *data = matrix_encoding;
140 
141  return 0;
142 }
143 
145  int linesize_align[AV_NUM_DATA_POINTERS])
146 {
147  int i;
148  int w_align = 1;
149  int h_align = 1;
150  AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
151 
152  if (desc) {
153  w_align = 1 << desc->log2_chroma_w;
154  h_align = 1 << desc->log2_chroma_h;
155  }
156 
157  switch (s->pix_fmt) {
158  case AV_PIX_FMT_YUV420P:
159  case AV_PIX_FMT_YUYV422:
160  case AV_PIX_FMT_YVYU422:
161  case AV_PIX_FMT_UYVY422:
162  case AV_PIX_FMT_YUV422P:
163  case AV_PIX_FMT_YUV440P:
164  case AV_PIX_FMT_YUV444P:
165  case AV_PIX_FMT_GBRP:
166  case AV_PIX_FMT_GBRAP:
167  case AV_PIX_FMT_GRAY8:
168  case AV_PIX_FMT_GRAY16BE:
169  case AV_PIX_FMT_GRAY16LE:
170  case AV_PIX_FMT_YUVJ420P:
171  case AV_PIX_FMT_YUVJ422P:
172  case AV_PIX_FMT_YUVJ440P:
173  case AV_PIX_FMT_YUVJ444P:
174  case AV_PIX_FMT_YUVA420P:
175  case AV_PIX_FMT_YUVA422P:
176  case AV_PIX_FMT_YUVA444P:
233  case AV_PIX_FMT_GBRP9LE:
234  case AV_PIX_FMT_GBRP9BE:
235  case AV_PIX_FMT_GBRP10LE:
236  case AV_PIX_FMT_GBRP10BE:
237  case AV_PIX_FMT_GBRP12LE:
238  case AV_PIX_FMT_GBRP12BE:
239  case AV_PIX_FMT_GBRP14LE:
240  case AV_PIX_FMT_GBRP14BE:
241  case AV_PIX_FMT_GBRP16LE:
242  case AV_PIX_FMT_GBRP16BE:
247  w_align = 16; //FIXME assume 16 pixel per macroblock
248  h_align = 16 * 2; // interlaced needs 2 macroblocks height
249  if (s->codec_id == AV_CODEC_ID_BINKVIDEO)
250  w_align = 16*2;
251  break;
252  case AV_PIX_FMT_YUV411P:
253  case AV_PIX_FMT_YUVJ411P:
255  w_align = 32;
256  h_align = 16 * 2;
257  break;
258  case AV_PIX_FMT_YUV410P:
259  if (s->codec_id == AV_CODEC_ID_SVQ1) {
260  w_align = 64;
261  h_align = 64;
262  }
263  break;
264  case AV_PIX_FMT_RGB555:
265  if (s->codec_id == AV_CODEC_ID_RPZA) {
266  w_align = 4;
267  h_align = 4;
268  }
269  if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
270  w_align = 8;
271  h_align = 8;
272  }
273  break;
274  case AV_PIX_FMT_PAL8:
275  case AV_PIX_FMT_BGR8:
276  case AV_PIX_FMT_RGB8:
277  if (s->codec_id == AV_CODEC_ID_SMC ||
278  s->codec_id == AV_CODEC_ID_CINEPAK) {
279  w_align = 4;
280  h_align = 4;
281  }
282  if (s->codec_id == AV_CODEC_ID_JV ||
283  s->codec_id == AV_CODEC_ID_ARGO ||
284  s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
285  w_align = 8;
286  h_align = 8;
287  }
288  if (s->codec_id == AV_CODEC_ID_MJPEG ||
289  s->codec_id == AV_CODEC_ID_MJPEGB ||
290  s->codec_id == AV_CODEC_ID_LJPEG ||
291  s->codec_id == AV_CODEC_ID_SMVJPEG ||
292  s->codec_id == AV_CODEC_ID_AMV ||
293  s->codec_id == AV_CODEC_ID_SP5X ||
294  s->codec_id == AV_CODEC_ID_JPEGLS) {
295  w_align = 8;
296  h_align = 2*8;
297  }
298  break;
299  case AV_PIX_FMT_BGR24:
300  if ((s->codec_id == AV_CODEC_ID_MSZH) ||
301  (s->codec_id == AV_CODEC_ID_ZLIB)) {
302  w_align = 4;
303  h_align = 4;
304  }
305  break;
306  case AV_PIX_FMT_RGB24:
307  if (s->codec_id == AV_CODEC_ID_CINEPAK) {
308  w_align = 4;
309  h_align = 4;
310  }
311  break;
312  case AV_PIX_FMT_BGR0:
313  if (s->codec_id == AV_CODEC_ID_ARGO) {
314  w_align = 8;
315  h_align = 8;
316  }
317  break;
318  default:
319  break;
320  }
321 
322  if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
323  w_align = FFMAX(w_align, 16);
324  }
325 
326  *width = FFALIGN(*width, w_align);
327  *height = FFALIGN(*height, h_align);
328  if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
329  s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
330  s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
331  s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
332  ) {
333  // some of the optimized chroma MC reads one line too much
334  // which is also done in mpeg decoders with lowres > 0
335  *height += 2;
336 
337  // H.264 uses edge emulation for out of frame motion vectors, for this
338  // it requires a temporary area large enough to hold a 21x21 block,
339  // increasing witdth ensure that the temporary area is large enough,
340  // the next rounded up width is 32
341  *width = FFMAX(*width, 32);
342  }
343  if (s->codec_id == AV_CODEC_ID_SVQ3) {
344  *width = FFMAX(*width, 32);
345  }
346 
347  for (i = 0; i < 4; i++)
348  linesize_align[i] = STRIDE_ALIGN;
349 }
350 
352 {
353  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
354  int chroma_shift = desc->log2_chroma_w;
355  int linesize_align[AV_NUM_DATA_POINTERS];
356  int align;
357 
358  avcodec_align_dimensions2(s, width, height, linesize_align);
359  align = FFMAX(linesize_align[0], linesize_align[3]);
360  linesize_align[1] <<= chroma_shift;
361  linesize_align[2] <<= chroma_shift;
362  align = FFMAX3(align, linesize_align[1], linesize_align[2]);
363  *width = FFALIGN(*width, align);
364 }
365 #if FF_API_AVCODEC_CHROMA_POS
366 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
367 {
368  return av_chroma_location_enum_to_pos(xpos, ypos, pos);
369 }
370 
372 {
373  return av_chroma_location_pos_to_enum(xpos, ypos);
374 }
375 #endif
376 
377 int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
378  enum AVSampleFormat sample_fmt, const uint8_t *buf,
379  int buf_size, int align)
380 {
381  int ch, planar, needed_size, ret = 0;
382 
383  needed_size = av_samples_get_buffer_size(NULL, nb_channels,
384  frame->nb_samples, sample_fmt,
385  align);
386  if (buf_size < needed_size)
387  return AVERROR(EINVAL);
388 
389  planar = av_sample_fmt_is_planar(sample_fmt);
390  if (planar && nb_channels > AV_NUM_DATA_POINTERS) {
391  if (!FF_ALLOCZ_TYPED_ARRAY(frame->extended_data, nb_channels))
392  return AVERROR(ENOMEM);
393  } else {
395  }
396 
398  (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples,
399  sample_fmt, align)) < 0) {
400  if (frame->extended_data != frame->data)
402  return ret;
403  }
404  if (frame->extended_data != frame->data) {
405  for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++)
406  frame->data[ch] = frame->extended_data[ch];
407  }
408 
409  return ret;
410 }
411 
412 
415 }
416 
417 const char *avcodec_get_name(enum AVCodecID id)
418 {
419  const AVCodecDescriptor *cd;
420  const AVCodec *codec;
421 
422  if (id == AV_CODEC_ID_NONE)
423  return "none";
424  cd = avcodec_descriptor_get(id);
425  if (cd)
426  return cd->name;
427  av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
428  codec = avcodec_find_decoder(id);
429  if (codec)
430  return codec->name;
431  codec = avcodec_find_encoder(id);
432  if (codec)
433  return codec->name;
434  return "unknown_codec";
435 }
436 
437 const char *av_get_profile_name(const AVCodec *codec, int profile)
438 {
439  const AVProfile *p;
440  if (profile == AV_PROFILE_UNKNOWN || !codec->profiles)
441  return NULL;
442 
443  for (p = codec->profiles; p->profile != AV_PROFILE_UNKNOWN; p++)
444  if (p->profile == profile)
445  return p->name;
446 
447  return NULL;
448 }
449 
451 {
453  const AVProfile *p;
454 
455  if (profile == AV_PROFILE_UNKNOWN || !desc || !desc->profiles)
456  return NULL;
457 
458  for (p = desc->profiles; p->profile != AV_PROFILE_UNKNOWN; p++)
459  if (p->profile == profile)
460  return p->name;
461 
462  return NULL;
463 }
464 
466 {
467  switch (codec_id) {
468  case AV_CODEC_ID_DFPWM:
469  return 1;
485  return 4;
493  case AV_CODEC_ID_PCM_S8:
495  case AV_CODEC_ID_PCM_SGA:
496  case AV_CODEC_ID_PCM_U8:
501  return 8;
508  return 16;
515  return 24;
525  return 32;
530  return 64;
531  default:
532  return 0;
533  }
534 }
535 
537 {
538  static const enum AVCodecID map[][2] = {
550  };
551  if (fmt < 0 || fmt >= FF_ARRAY_ELEMS(map))
552  return AV_CODEC_ID_NONE;
553  if (be < 0 || be > 1)
554  be = AV_NE(1, 0);
555  return map[fmt][be];
556 }
557 
559 {
560  switch (codec_id) {
561  case AV_CODEC_ID_DFPWM:
562  return 1;
564  return 2;
566  return 3;
572  return 4;
573  default:
575  }
576 }
577 
578 static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
579  uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
580  uint8_t * extradata, int frame_size, int frame_bytes)
581 {
583  int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
584 
585  /* codecs with an exact constant bits per sample */
586  if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
587  return (frame_bytes * 8LL) / (bps * ch);
588  bps = bits_per_coded_sample;
589 
590  /* codecs with a fixed packet duration */
591  switch (id) {
592  case AV_CODEC_ID_ADPCM_ADX: return 32;
593  case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
594  case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
595  case AV_CODEC_ID_AMR_NB:
596  case AV_CODEC_ID_EVRC:
597  case AV_CODEC_ID_GSM:
598  case AV_CODEC_ID_QCELP:
599  case AV_CODEC_ID_RA_288: return 160;
600  case AV_CODEC_ID_AMR_WB:
601  case AV_CODEC_ID_GSM_MS: return 320;
602  case AV_CODEC_ID_MP1: return 384;
603  case AV_CODEC_ID_ATRAC1: return 512;
604  case AV_CODEC_ID_ATRAC9:
605  case AV_CODEC_ID_ATRAC3:
606  if (framecount > INT_MAX/1024)
607  return 0;
608  return 1024 * framecount;
609  case AV_CODEC_ID_ATRAC3P: return 2048;
610  case AV_CODEC_ID_MP2:
611  case AV_CODEC_ID_MUSEPACK7: return 1152;
612  case AV_CODEC_ID_AC3: return 1536;
613  case AV_CODEC_ID_FTR: return 1024;
614  }
615 
616  if (sr > 0) {
617  /* calc from sample rate */
618  if (id == AV_CODEC_ID_TTA)
619  return 256ll * sr / 245;
620  else if (id == AV_CODEC_ID_DST)
621  return 588ll * sr / 44100;
622  else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
623  if (sr / 22050 > 22)
624  return 0;
625  return (480 << (sr / 22050));
626  }
627 
628  if (id == AV_CODEC_ID_MP3)
629  return sr <= 24000 ? 576 : 1152;
630  }
631 
632  if (ba > 0) {
633  /* calc from block_align */
634  if (id == AV_CODEC_ID_SIPR) {
635  switch (ba) {
636  case 20: return 160;
637  case 19: return 144;
638  case 29: return 288;
639  case 37: return 480;
640  }
641  } else if (id == AV_CODEC_ID_ILBC) {
642  switch (ba) {
643  case 38: return 160;
644  case 50: return 240;
645  }
646  }
647  }
648 
649  if (frame_bytes > 0) {
650  /* calc from frame_bytes only */
651  if (id == AV_CODEC_ID_TRUESPEECH)
652  return 240 * (frame_bytes / 32);
653  if (id == AV_CODEC_ID_NELLYMOSER)
654  return 256 * (frame_bytes / 64);
655  if (id == AV_CODEC_ID_RA_144)
656  return 160 * (frame_bytes / 20);
657  if (id == AV_CODEC_ID_APTX)
658  return 4 * (frame_bytes / 4);
659  if (id == AV_CODEC_ID_APTX_HD)
660  return 4 * (frame_bytes / 6);
661 
662  if (bps > 0) {
663  /* calc from frame_bytes and bits_per_coded_sample */
665  return frame_bytes * 8 / bps;
666  }
667 
668  if (ch > 0 && ch < INT_MAX/16) {
669  /* calc from frame_bytes and channels */
670  switch (id) {
672  return frame_bytes / (40 * ch) * 256;
674  return (frame_bytes - 4 * ch) / (128 * ch) * 256;
676  return frame_bytes / (9 * ch) * 16;
679  frame_bytes /= 16 * ch;
680  if (frame_bytes > INT_MAX / 28)
681  return 0;
682  return frame_bytes * 28;
687  return (frame_bytes - 4 * ch) * 2 / ch;
689  return (frame_bytes - 4) * 2 / ch;
691  return (frame_bytes - 8) * 2;
694  if (extradata)
695  return frame_bytes * 14LL / (8 * ch);
696  break;
698  return (frame_bytes / 128) * 224 / ch;
700  return (frame_bytes - 6 - ch) / ch;
702  return (frame_bytes - 8) / ch;
704  return (frame_bytes - 2 * ch) / ch;
705  case AV_CODEC_ID_MACE3:
706  return 3 * frame_bytes / ch;
707  case AV_CODEC_ID_MACE6:
708  return 6 * frame_bytes / ch;
709  case AV_CODEC_ID_PCM_LXF:
710  return 2 * (frame_bytes / (5 * ch));
711  case AV_CODEC_ID_IAC:
712  case AV_CODEC_ID_IMC:
713  return 4 * frame_bytes / ch;
714  }
715 
716  if (tag) {
717  /* calc from frame_bytes, channels, and codec_tag */
718  if (id == AV_CODEC_ID_SOL_DPCM) {
719  if (tag == 3)
720  return frame_bytes / ch;
721  else
722  return frame_bytes * 2 / ch;
723  }
724  }
725 
726  if (ba > 0) {
727  /* calc from frame_bytes, channels, and block_align */
728  int blocks = frame_bytes / ba;
729  int64_t tmp = 0;
730  switch (id) {
732  if (bps < 2 || bps > 5)
733  return 0;
734  tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
735  break;
737  tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
738  break;
740  tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
741  break;
743  tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
744  break;
746  tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
747  break;
749  tmp = blocks * (ba - 16LL) * 2 / ch;
750  break;
752  tmp = blocks * 32;
753  break;
754  }
755  if (tmp) {
756  if (tmp != (int)tmp)
757  return 0;
758  return tmp;
759  }
760  }
761 
762  if (bps > 0) {
763  /* calc from frame_bytes, channels, and bits_per_coded_sample */
764  switch (id) {
765  case AV_CODEC_ID_PCM_DVD:
766  if(bps<4 || frame_bytes<3)
767  return 0;
768  return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch));
770  if(bps<4 || frame_bytes<4)
771  return 0;
772  return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8);
773  case AV_CODEC_ID_S302M:
774  return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
775  }
776  }
777  }
778  }
779 
780  /* Fall back on using frame_size */
781  if (frame_size > 1 && frame_bytes)
782  return frame_size;
783 
784  //For WMA we currently have no other means to calculate duration thus we
785  //do it here by assuming CBR, which is true for all known cases.
786  if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) {
787  if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2)
788  return (frame_bytes * 8LL * sr) / bitrate;
789  }
790 
791  return 0;
792 }
793 
794 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
795 {
796  int channels = avctx->ch_layout.nb_channels;
797  int duration;
798 #if FF_API_OLD_CHANNEL_LAYOUT
800  if (!channels)
801  channels = avctx->channels;
803 #endif
805  channels, avctx->block_align,
806  avctx->codec_tag, avctx->bits_per_coded_sample,
807  avctx->bit_rate, avctx->extradata, avctx->frame_size,
808  frame_bytes);
809  return FFMAX(0, duration);
810 }
811 
813 {
814  int channels = par->ch_layout.nb_channels;
815  int duration;
816 #if FF_API_OLD_CHANNEL_LAYOUT
818  if (!channels)
819  channels = par->channels;
821 #endif
823  channels, par->block_align,
824  par->codec_tag, par->bits_per_coded_sample,
825  par->bit_rate, par->extradata, par->frame_size,
826  frame_bytes);
827  return FFMAX(0, duration);
828 }
829 
830 #if !HAVE_THREADS
832 {
833  return -1;
834 }
835 
836 #endif
837 
838 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
839 {
840  unsigned int n = 0;
841 
842  while (v >= 0xff) {
843  *s++ = 0xff;
844  v -= 0xff;
845  n++;
846  }
847  *s = v;
848  n++;
849  return n;
850 }
851 
852 int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
853 {
854  int i;
855  for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
856  return i;
857 }
858 
860 {
861  const FFCodec *const codec = ffcodec(avcodec);
862  int i;
863  if (!codec->hw_configs || index < 0)
864  return NULL;
865  for (i = 0; i <= index; i++)
866  if (!codec->hw_configs[i])
867  return NULL;
868  return &codec->hw_configs[index]->public;
869 }
870 
872 {
873  int ret;
874 
875  dst->owner[0] = src->owner[0];
876  dst->owner[1] = src->owner[1];
877 
878  ret = av_frame_ref(dst->f, src->f);
879  if (ret < 0)
880  return ret;
881 
882  av_assert0(!dst->progress);
883 
884  if (src->progress)
885  dst->progress = ff_refstruct_ref(src->progress);
886 
887  return 0;
888 }
889 
891 {
892  int ret;
893 
894  dst->owner[0] = src->owner[0];
895  dst->owner[1] = src->owner[1];
896 
897  ret = av_frame_replace(dst->f, src->f);
898  if (ret < 0)
899  return ret;
900 
901  ff_refstruct_replace(&dst->progress, src->progress);
902 
903  return 0;
904 }
905 
906 #if !HAVE_THREADS
907 
909 {
910  return ff_get_buffer(avctx, f, flags);
911 }
912 
914 {
915  f->owner[0] = f->owner[1] = avctx;
916  return ff_get_buffer(avctx, f->f, flags);
917 }
918 
920 {
921  f->owner[0] = f->owner[1] = NULL;
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(const ThreadFrame *f, int progress, int field)
935 {
936 }
937 
939 {
940  return 1;
941 }
942 
944 {
945  return 0;
946 }
947 
949 {
950  return 0;
951 }
952 
953 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
954 {
955 }
956 
957 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
958 {
959 }
960 
961 #endif
962 
963 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
964  const uint8_t *end,
965  uint32_t *av_restrict state)
966 {
967  int i;
968 
969  av_assert0(p <= end);
970  if (p >= end)
971  return end;
972 
973  for (i = 0; i < 3; i++) {
974  uint32_t tmp = *state << 8;
975  *state = tmp + *(p++);
976  if (tmp == 0x100 || p == end)
977  return p;
978  }
979 
980  while (p < end) {
981  if (p[-1] > 1 ) p += 3;
982  else if (p[-2] ) p += 2;
983  else if (p[-3]|(p[-1]-1)) p++;
984  else {
985  p++;
986  break;
987  }
988  }
989 
990  p = FFMIN(p, end) - 4;
991  *state = AV_RB32(p);
992 
993  return p + 4;
994 }
995 
997 {
998  AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
999  if (!props)
1000  return NULL;
1001 
1002  if (size)
1003  *size = sizeof(*props);
1004 
1005  props->vbv_delay = UINT64_MAX;
1006 
1007  return props;
1008 }
1009 
1010 static unsigned bcd2uint(uint8_t bcd)
1011 {
1012  unsigned low = bcd & 0xf;
1013  unsigned high = bcd >> 4;
1014  if (low > 9 || high > 9)
1015  return 0;
1016  return low + 10*high;
1017 }
1018 
1019 int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len,
1020  void **data, size_t *sei_size)
1021 {
1022  AVFrameSideData *sd = NULL;
1023  uint8_t *sei_data;
1024  PutBitContext pb;
1025  uint32_t *tc;
1026  int m;
1027 
1028  if (frame)
1030 
1031  if (!sd) {
1032  *data = NULL;
1033  return 0;
1034  }
1035  tc = (uint32_t*)sd->data;
1036  m = tc[0] & 3;
1037 
1038  *sei_size = sizeof(uint32_t) * 4;
1039  *data = av_mallocz(*sei_size + prefix_len);
1040  if (!*data)
1041  return AVERROR(ENOMEM);
1042  sei_data = (uint8_t*)*data + prefix_len;
1043 
1044  init_put_bits(&pb, sei_data, *sei_size);
1045  put_bits(&pb, 2, m); // num_clock_ts
1046 
1047  for (int j = 1; j <= m; j++) {
1048  uint32_t tcsmpte = tc[j];
1049  unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours
1050  unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes
1051  unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds
1052  unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames
1053  unsigned drop = tcsmpte & 1<<30 && !0; // 1-bit drop if not arbitrary bit
1054 
1055  /* Calculate frame number of HEVC by SMPTE ST 12-1:2014 Sec 12.2 if rate > 30FPS */
1056  if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) {
1057  unsigned pc;
1058  ff *= 2;
1059  if (av_cmp_q(rate, (AVRational) {50, 1}) == 0)
1060  pc = !!(tcsmpte & 1 << 7);
1061  else
1062  pc = !!(tcsmpte & 1 << 23);
1063  ff = (ff + pc) & 0x7f;
1064  }
1065 
1066  put_bits(&pb, 1, 1); // clock_timestamp_flag
1067  put_bits(&pb, 1, 1); // units_field_based_flag
1068  put_bits(&pb, 5, 0); // counting_type
1069  put_bits(&pb, 1, 1); // full_timestamp_flag
1070  put_bits(&pb, 1, 0); // discontinuity_flag
1071  put_bits(&pb, 1, drop);
1072  put_bits(&pb, 9, ff);
1073  put_bits(&pb, 6, ss);
1074  put_bits(&pb, 6, mm);
1075  put_bits(&pb, 5, hh);
1076  put_bits(&pb, 5, 0);
1077  }
1078  flush_put_bits(&pb);
1079 
1080  return 0;
1081 }
1082 
1084 {
1085  AVRational framerate = avctx->framerate;
1086  int bits_per_coded_sample = avctx->bits_per_coded_sample;
1087  int64_t bitrate;
1088 
1089  if (!(framerate.num && framerate.den))
1090  framerate = av_inv_q(avctx->time_base);
1091  if (!(framerate.num && framerate.den))
1092  return 0;
1093 
1094  if (!bits_per_coded_sample) {
1096  bits_per_coded_sample = av_get_bits_per_pixel(desc);
1097  }
1098  bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
1099  framerate.num / framerate.den;
1100 
1101  return bitrate;
1102 }
FF_ALLOCZ_TYPED_ARRAY
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
Definition: internal.h:88
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:330
hwconfig.h
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1092
AV_CODEC_ID_MACE6
@ AV_CODEC_ID_MACE6
Definition: codec_id.h:452
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:187
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
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:144
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:350
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:366
AV_CODEC_ID_DSD_LSBF
@ AV_CODEC_ID_DSD_LSBF
Definition: codec_id.h:515
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
AV_CODEC_ID_ADPCM_MS
@ AV_CODEC_ID_ADPCM_MS
Definition: codec_id.h:375
AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: codec_id.h:369
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:445
ff_refstruct_ref
void * ff_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
Definition: refstruct.c:136
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:354
FF_CODEC_CB_TYPE_RECEIVE_PACKET
@ FF_CODEC_CB_TYPE_RECEIVE_PACKET
Definition: codec_internal.h:124
AV_CODEC_ID_ADPCM_DTK
@ AV_CODEC_ID_ADPCM_DTK
Definition: codec_id.h:402
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1064
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:824
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:812
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
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:957
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:181
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2964
AV_CODEC_ID_8SVX_EXP
@ AV_CODEC_ID_8SVX_EXP
Definition: codec_id.h:496
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:267
ff_thread_release_ext_buffer
void ff_thread_release_ext_buffer(ThreadFrame *f)
Unref a ThreadFrame.
Definition: utils.c:919
ff_thread_await_progress2
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
Definition: utils.c:953
AVCodecDescriptor::name
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
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:153
init_put_bits
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:62
AV_FRAME_DATA_S12M_TIMECODE
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition: frame.h:152
AV_CODEC_ID_PCM_S32LE_PLANAR
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition: codec_id.h:359
avcodec_find_encoder
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:970
AV_CODEC_ID_FASTAUDIO
@ AV_CODEC_ID_FASTAUDIO
Definition: codec_id.h:536
AV_CODEC_ID_RA_144
@ AV_CODEC_ID_RA_144
Definition: codec_id.h:427
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:222
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
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
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:298
internal.h
AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition: codec_id.h:360
AV_CODEC_ID_VP6
@ AV_CODEC_ID_VP6
Definition: codec_id.h:143
b
#define b
Definition: input.c:41
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
data
const char data[16]
Definition: mxf.c:148
AV_CODEC_ID_PCM_U24LE
@ AV_CODEC_ID_PCM_U24LE
Definition: codec_id.h:344
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:262
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:351
AV_CODEC_ID_AMR_NB
@ AV_CODEC_ID_AMR_NB
Definition: codec_id.h:423
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:407
AV_CODEC_ID_ADPCM_IMA_OKI
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition: codec_id.h:401
AV_CODEC_ID_PCM_SGA
@ AV_CODEC_ID_PCM_SGA
Definition: codec_id.h:366
FFCodec
Definition: codec_internal.h:127
AV_CODEC_ID_SOL_DPCM
@ AV_CODEC_ID_SOL_DPCM
Definition: codec_id.h:434
AV_CODEC_ID_WMAV2
@ AV_CODEC_ID_WMAV2
Definition: codec_id.h:450
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:397
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:274
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:2916
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:59
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
FF_CODEC_CB_TYPE_ENCODE_SUB
@ FF_CODEC_CB_TYPE_ENCODE_SUB
Definition: codec_internal.h:121
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AV_CODEC_ID_IMC
@ AV_CODEC_ID_IMC
Definition: codec_id.h:469
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:450
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:317
AV_CODEC_ID_ADPCM_XMD
@ AV_CODEC_ID_ADPCM_XMD
Definition: codec_id.h:420
thread.h
ThreadFrame::f
AVFrame * f
Definition: threadframe.h:28
AV_CODEC_ID_PCM_S16LE_PLANAR
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: codec_id.h:348
AV_CODEC_ID_ADPCM_THP_LE
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: codec_id.h:405
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:361
AV_CODEC_ID_AMR_WB
@ AV_CODEC_ID_AMR_WB
Definition: codec_id.h:424
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:361
AVProfile
AVProfile.
Definition: codec.h:179
AV_PIX_FMT_GBRAP12LE
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:308
AV_CODEC_ID_DSD_MSBF_PLANAR
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition: codec_id.h:518
AV_CODEC_ID_ADPCM_CT
@ AV_CODEC_ID_ADPCM_CT
Definition: codec_id.h:381
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:1803
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
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:371
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:188
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:261
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:331
AV_FRAME_DATA_MATRIXENCODING
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:68
STRIDE_ALIGN
#define STRIDE_ALIGN
Definition: internal.h:49
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:2107
AV_CODEC_ID_XAN_DPCM
@ AV_CODEC_ID_XAN_DPCM
Definition: codec_id.h:433
AV_CODEC_ID_MSZH
@ AV_CODEC_ID_MSZH
Definition: codec_id.h:105
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:963
tab
static const struct twinvq_data tab
Definition: twinvq_data.h:10345
ThreadFrame::owner
AVCodecContext * owner[2]
Definition: threadframe.h:29
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:69
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: codec_id.h:101
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:443
ss
#define ss(width, name, subs,...)
Definition: cbs_vp9.c:202
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
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;} } 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_CODEC_ID_8SVX_FIB
@ AV_CODEC_ID_8SVX_FIB
Definition: codec_id.h:497
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
refstruct.h
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:473
FF_CODEC_CB_TYPE_DECODE
@ FF_CODEC_CB_TYPE_DECODE
Definition: codec_internal.h:109
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:269
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:276
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:558
AV_CODEC_ID_SIPR
@ AV_CODEC_ID_SIPR
Definition: codec_id.h:483
AV_CODEC_ID_ADPCM_SBPRO_2
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition: codec_id.h:386
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:264
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:271
AV_CODEC_ID_WMAV1
@ AV_CODEC_ID_WMAV1
Definition: codec_id.h:449
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:334
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:451
AV_CODEC_ID_ATRAC3P
@ AV_CODEC_ID_ATRAC3P
Definition: codec_id.h:481
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_CODEC_ID_TTA
@ AV_CODEC_ID_TTA
Definition: codec_id.h:464
duration
int64_t duration
Definition: movenc.c:64
AVCodecParameters::frame_size
int frame_size
Audio only.
Definition: codec_par.h:182
AV_CODEC_ID_S302M
@ AV_CODEC_ID_S302M
Definition: codec_id.h:356
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:419
AV_CODEC_ID_ADPCM_G726
@ AV_CODEC_ID_ADPCM_G726
Definition: codec_id.h:380
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:198
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:355
AV_NE
#define AV_NE(be, le)
Definition: macros.h:33
av_chroma_location_enum_to_pos
int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
Definition: pixdesc.c:3382
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_CODEC_ID_ADPCM_AFC
@ AV_CODEC_ID_ADPCM_AFC
Definition: codec_id.h:400
AV_CODEC_ID_ADPCM_IMA_EA_SEAD
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition: codec_id.h:392
bitrate
int64_t bitrate
Definition: av1_levels.c:47
frame_size
int frame_size
Definition: mxfenc.c:2311
AV_CODEC_ID_WADY_DPCM
@ AV_CODEC_ID_WADY_DPCM
Definition: codec_id.h:438
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:442
AV_CODEC_ID_ADPCM_IMA_DK3
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition: codec_id.h:371
AV_CODEC_ID_ARGO
@ AV_CODEC_ID_ARGO
Definition: codec_id.h:310
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:273
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
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:114
AV_CODEC_ID_ADPCM_IMA_APC
@ AV_CODEC_ID_ADPCM_IMA_APC
Definition: codec_id.h:398
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:530
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
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:124
AV_CODEC_ID_ADPCM_IMA_ISS
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition: codec_id.h:396
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:490
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:377
FF_CODEC_CB_TYPE_ENCODE
@ FF_CODEC_CB_TYPE_ENCODE
Definition: codec_internal.h:118
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:364
channels
channels
Definition: aptx.h:31
decode.h
ff_thread_get_buffer
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: utils.c:908
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:144
AV_CODEC_ID_DERF_DPCM
@ AV_CODEC_ID_DERF_DPCM
Definition: codec_id.h:437
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:336
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:333
ff_thread_await_progress
void ff_thread_await_progress(const ThreadFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
Definition: utils.c:934
AV_CODEC_ID_ADPCM_IMA_SMJPEG
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition: codec_id.h:374
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:389
AV_CODEC_ID_PCM_DVD
@ AV_CODEC_ID_PCM_DVD
Definition: codec_id.h:349
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
AV_CODEC_ID_SVQ3
@ AV_CODEC_ID_SVQ3
Definition: codec_id.h:75
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:269
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
PutBitContext
Definition: put_bits.h:50
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
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:451
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
ff_thread_ref_frame
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition: utils.c:871
AVMatrixEncoding
AVMatrixEncoding
Definition: channel_layout.h:248
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:337
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_CODEC_ID_WMV3
@ AV_CODEC_ID_WMV3
Definition: codec_id.h:123
threadframe.h
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:394
framerate
float framerate
Definition: av1_levels.c:29
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:852
AV_CODEC_ID_SP5X
@ AV_CODEC_ID_SP5X
Definition: codec_id.h:62
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:307
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_ID_DST
@ AV_CODEC_ID_DST
Definition: codec_id.h:523
AV_CODEC_ID_INTERPLAY_VIDEO
@ AV_CODEC_ID_INTERPLAY_VIDEO
Definition: codec_id.h:91
AV_CODEC_ID_ADPCM_YAMAHA
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition: codec_id.h:383
AV_CODEC_ID_ADPCM_IMA_WS
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition: codec_id.h:373
AV_CODEC_ID_PCM_U24BE
@ AV_CODEC_ID_PCM_U24BE
Definition: codec_id.h:345
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:432
AV_CODEC_ID_PCM_U32BE
@ AV_CODEC_ID_PCM_U32BE
Definition: codec_id.h:341
AV_CODEC_ID_ADPCM_ARGO
@ AV_CODEC_ID_ADPCM_ARGO
Definition: codec_id.h:411
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
FF_CODEC_CB_TYPE_DECODE_SUB
@ FF_CODEC_CB_TYPE_DECODE_SUB
Definition: codec_internal.h:112
AV_CODEC_ID_ADPCM_IMA_DK4
@ AV_CODEC_ID_ADPCM_IMA_DK4
Definition: codec_id.h:372
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:491
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:364
AV_CODEC_ID_CINEPAK
@ AV_CODEC_ID_CINEPAK
Definition: codec_id.h:95
ff_slice_thread_init_progress
int ff_slice_thread_init_progress(AVCodecContext *avctx)
Definition: utils.c:943
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:362
AV_CODEC_ID_ZLIB
@ AV_CODEC_ID_ZLIB
Definition: codec_id.h:106
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:365
AVCodec::profiles
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
Definition: codec.h:220
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:560
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:388
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:258
ff_thread_replace_frame
int ff_thread_replace_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition: utils.c:890
AV_CODEC_ID_ROQ_DPCM
@ AV_CODEC_ID_ROQ_DPCM
Definition: codec_id.h:431
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:295
AVProfile::profile
int profile
Definition: codec.h:180
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:206
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_chroma_location_pos_to_enum
enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
Converts swscale x/y chroma position to AVChromaLocation.
Definition: pixdesc.c:3394
AV_CODEC_ID_VP6A
@ AV_CODEC_ID_VP6A
Definition: codec_id.h:158
index
int index
Definition: gxfenc.c:89
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:171
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:263
AV_CODEC_ID_PCM_S24LE_PLANAR
@ AV_CODEC_ID_PCM_S24LE_PLANAR
Definition: codec_id.h:358
AV_CODEC_ID_ADPCM_XA
@ AV_CODEC_ID_ADPCM_XA
Definition: codec_id.h:377
AV_CODEC_ID_GSM
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition: codec_id.h:460
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
AV_CODEC_ID_PCM_VIDC
@ AV_CODEC_ID_PCM_VIDC
Definition: codec_id.h:365
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:270
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:975
AV_CODEC_ID_MJPEGB
@ AV_CODEC_ID_MJPEGB
Definition: codec_id.h:60
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
startcode.h
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:563
av_codec_is_decoder
int av_codec_is_decoder(const AVCodec *avcodec)
Definition: utils.c:86
AV_CODEC_ID_QCELP
@ AV_CODEC_ID_QCELP
Definition: codec_id.h:466
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:465
f
f
Definition: af_crystalizer.c:121
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:342
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1617
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:297
AV_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:378
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:361
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
codec_internal.h
shift
static int shift(int a, int b)
Definition: bonk.c:262
AV_CODEC_ID_ADPCM_IMA_RAD
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition: codec_id.h:403
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:260
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:516
AV_CODEC_ID_ADPCM_IMA_ALP
@ AV_CODEC_ID_ADPCM_IMA_ALP
Definition: codec_id.h:415
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:266
bps
unsigned bps
Definition: movenc.c:1738
AV_CODEC_ID_ADPCM_SWF
@ AV_CODEC_ID_ADPCM_SWF
Definition: codec_id.h:382
size
int size
Definition: twinvq_data.h:10344
AV_CODEC_ID_SMVJPEG
@ AV_CODEC_ID_SMVJPEG
Definition: codec_id.h:267
avpriv_codec_get_cap_skip_frame_fill_param
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition: utils.c:413
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:341
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
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: codec_internal.h:54
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:160
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:812
AVFrameSideData::data
uint8_t * data
Definition: frame.h:248
ffcodec
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
Definition: codec_internal.h:325
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
align
static const uint8_t *BS_FUNC() align(BSCTX *bc)
Skip bits to a byte boundary.
Definition: bitstream_template.h:411
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:161
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_thread_get_ext_buffer
int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around ff_get_buffer() for frame-multithreaded codecs.
Definition: utils.c:913
FFCodec::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_internal.h:261
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:74
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:692
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 *avcodec)
Definition: utils.c:78
AV_CODEC_ID_VP5
@ AV_CODEC_ID_VP5
Definition: codec_id.h:142
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:299
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:417
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1510
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:366
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
FFCodec::caps_internal
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
Definition: codec_internal.h:136
AV_CODEC_ID_ATRAC1
@ AV_CODEC_ID_ATRAC1
Definition: codec_id.h:488
AV_CODEC_ID_RA_288
@ AV_CODEC_ID_RA_288
Definition: codec_id.h:428
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:409
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:420
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
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:437
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:542
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
AV_CODEC_ID_EVRC
@ AV_CODEC_ID_EVRC
Definition: codec_id.h:513
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:178
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:401
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:996
AV_CODEC_ID_DSD_LSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: codec_id.h:517
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:352
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:52
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:456
av_xiphlacing
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:838
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:414
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:339
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:622
av_get_audio_frame_duration
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition: utils.c:794
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
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:254
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AV_CODEC_ID_VC1
@ AV_CODEC_ID_VC1
Definition: codec_id.h:122
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:363
AV_CODEC_ID_ADPCM_IMA_DAT4
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition: codec_id.h:408
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:121
profile
int profile
Definition: mxfenc.c:2115
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:621
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:658
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:1083
avcodec.h
AV_CODEC_ID_IAC
@ AV_CODEC_ID_IAC
Definition: codec_id.h:500
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:472
ThreadFrame::progress
struct ThreadFrameProgress * progress
Definition: threadframe.h:30
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:1737
ret
ret
Definition: filter_design.txt:187
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:1113
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:578
ff_refstruct_replace
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
Definition: refstruct.c:156
pos
unsigned int pos
Definition: spdifenc.c:413
AV_CODEC_ID_JV
@ AV_CODEC_ID_JV
Definition: codec_id.h:201
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:272
AV_CODEC_ID_CBD2_DPCM
@ AV_CODEC_ID_CBD2_DPCM
Definition: codec_id.h:439
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:268
AV_CODEC_ID_AMV
@ AV_CODEC_ID_AMV
Definition: codec_id.h:159
av_frame_replace
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
Definition: frame.c:482
AVCodecContext
main external API structure.
Definition: avcodec.h:441
ff_slice_thread_allocz_entries
int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
Definition: utils.c:948
ThreadFrame
Definition: threadframe.h:27
AV_CODEC_ID_ADPCM_G726LE
@ AV_CODEC_ID_ADPCM_G726LE
Definition: codec_id.h:404
channel_layout.h
AV_CODEC_ID_BINKVIDEO
@ AV_CODEC_ID_BINKVIDEO
Definition: codec_id.h:187
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:63
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:65
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
AV_CODEC_ID_PCM_U32LE
@ AV_CODEC_ID_PCM_U32LE
Definition: codec_id.h:340
FF_CODEC_CB_TYPE_RECEIVE_FRAME
@ FF_CODEC_CB_TYPE_RECEIVE_FRAME
Definition: codec_internal.h:115
FFCodec::cb_type
unsigned cb_type
This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemen...
Definition: codec_internal.h:143
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
state
static struct @362 state
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 *avcodec, int index)
Retrieve supported hardware configurations for a codec.
Definition: utils.c:859
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:463
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
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:536
AV_CODEC_ID_ADPCM_THP
@ AV_CODEC_ID_ADPCM_THP
Definition: codec_id.h:387
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:83
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:338
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:97
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:1010
AV_CODEC_ID_ADPCM_SBPRO_4
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition: codec_id.h:384
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:335
AV_CODEC_ID_RPZA
@ AV_CODEC_ID_RPZA
Definition: codec_id.h:94
AV_CODEC_ID_SDX2_DPCM
@ AV_CODEC_ID_SDX2_DPCM
Definition: codec_id.h:435
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:94
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:109
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:246
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:143
AV_CODEC_ID_PCM_S24DAUD
@ AV_CODEC_ID_PCM_S24DAUD
Definition: codec_id.h:346
AV_CODEC_ID_ADPCM_IMA_SSI
@ AV_CODEC_ID_ADPCM_IMA_SSI
Definition: codec_id.h:412
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:353
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:1019
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:466
codec_par.h
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:418
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: codec_id.h:370
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
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:555
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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:296
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
AV_CODEC_ID_ILBC
@ AV_CODEC_ID_ILBC
Definition: codec_id.h:501
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:275
AV_CODEC_ID_PCM_S8_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: codec_id.h:357
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:621
AV_CODEC_ID_PCM_U16LE
@ AV_CODEC_ID_PCM_U16LE
Definition: codec_id.h:332
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:385
AV_CODEC_ID_DFPWM
@ AV_CODEC_ID_DFPWM
Definition: codec_id.h:538
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:351
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:84
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVCodecHWConfig
Definition: codec.h:341
AV_CODEC_ID_ADPCM_4XM
@ AV_CODEC_ID_ADPCM_4XM
Definition: codec_id.h:376
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3722
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
AV_CODEC_ID_APTX
@ AV_CODEC_ID_APTX
Definition: codec_id.h:527
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:470
AV_CODEC_ID_ADPCM_PSX
@ AV_CODEC_ID_ADPCM_PSX
Definition: codec_id.h:406
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:363
AVCodecHWConfigInternal::public
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwconfig.h:30
codec_desc.h
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:59
AV_CODEC_ID_FTR
@ AV_CODEC_ID_FTR
Definition: codec_id.h:542
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:61
AV_CODEC_ID_MP1
@ AV_CODEC_ID_MP1
Definition: codec_id.h:484
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:265
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:343
ff_thread_init
int ff_thread_init(AVCodecContext *s)
Definition: utils.c:831
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:60
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:822
AV_CODEC_ID_APTX_HD
@ AV_CODEC_ID_APTX_HD
Definition: codec_id.h:528
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:475
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:385
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