FFmpeg
Loading...
Searching...
No Matches
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"
32#include "libavutil/mem.h"
33#include "libavutil/pixdesc.h"
34#include "libavutil/imgutils.h"
35#include "libavutil/pixfmt.h"
37#include "avcodec.h"
38#include "codec.h"
39#include "codec_desc.h"
40#include "codec_internal.h"
41#include "codec_par.h"
42#include "decode.h"
43#include "hwconfig.h"
44#include "libavutil/refstruct.h"
45#include "thread.h"
46#include "threadframe.h"
47#include "internal.h"
48#include "put_bits.h"
49#include "startcode.h"
50#include <stdlib.h>
51#include <limits.h>
52
53void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
54{
55 uint8_t **p = ptr;
56 if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
57 av_freep(p);
58 *size = 0;
59 return;
60 }
62 if (*p)
63 memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
64}
65
66void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
67{
68 uint8_t **p = ptr;
69 if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
70 av_freep(p);
71 *size = 0;
72 return;
73 }
75 if (*p)
76 memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
77}
78
79int av_codec_is_encoder(const AVCodec *avcodec)
80{
81 const FFCodec *const codec = ffcodec(avcodec);
82 return codec && !codec->is_decoder;
83}
84
85int av_codec_is_decoder(const AVCodec *avcodec)
86{
87 const FFCodec *const codec = ffcodec(avcodec);
88 return codec && codec->is_decoder;
89}
90
92{
93 int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
94
95 if (ret < 0)
96 width = height = 0;
97
98 s->coded_width = width;
99 s->coded_height = height;
100 s->width = AV_CEIL_RSHIFT(width, s->lowres);
101 s->height = AV_CEIL_RSHIFT(height, s->lowres);
102
103 return ret;
104}
105
107{
108 int ret = av_image_check_sar(avctx->width, avctx->height, sar);
109
110 if (ret < 0) {
111 av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %d/%d\n",
112 sar.num, sar.den);
113 avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
114 return ret;
115 } else {
116 avctx->sample_aspect_ratio = sar;
117 }
118 return 0;
119}
120
122 enum AVMatrixEncoding matrix_encoding)
123{
124 AVFrameSideData *side_data;
126
128 if (!side_data)
130 sizeof(enum AVMatrixEncoding));
131
132 if (!side_data)
133 return AVERROR(ENOMEM);
134
135 data = (enum AVMatrixEncoding*)side_data->data;
136 *data = matrix_encoding;
137
138 return 0;
139}
140
142 int linesize_align[AV_NUM_DATA_POINTERS])
143{
144 int i;
145 int w_align = 1;
146 int h_align = 1;
147 AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
148
149 if (desc) {
150 w_align = 1 << desc->log2_chroma_w;
151 h_align = 1 << desc->log2_chroma_h;
152 }
153
154 switch (s->pix_fmt) {
162 case AV_PIX_FMT_GBRP:
163 case AV_PIX_FMT_GBRAP:
164 case AV_PIX_FMT_GRAY8:
244 w_align = 16; //FIXME assume 16 pixel per macroblock
245 h_align = 16 * 2; // interlaced needs 2 macroblocks height
246 if (s->codec_id == AV_CODEC_ID_BINKVIDEO)
247 w_align = 16*2;
248 break;
252 w_align = 32;
253 h_align = 16 * 2;
254 break;
256 if (s->codec_id == AV_CODEC_ID_SVQ1) {
257 w_align = 64;
258 h_align = 64;
259 } else if (s->codec_id == AV_CODEC_ID_SNOW) {
260 w_align = 16;
261 h_align = 16;
262 }
263 break;
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;
330 w_align = FFMAX(w_align, 2);
331 h_align = FFMAX(h_align, 2);
332 break;
333 default:
334 break;
335 }
336
337 if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
338 w_align = FFMAX(w_align, 16);
339 }
340
341 *width = FFALIGN(*width, w_align);
342 *height = FFALIGN(*height, h_align);
343 if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
344 s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
345 s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
346 s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
347 ) {
348 // some of the optimized chroma MC reads one line too much
349 // which is also done in mpeg decoders with lowres > 0
350 *height += 2;
351
352 // H.264 uses edge emulation for out of frame motion vectors, for this
353 // it requires a temporary area large enough to hold a 21x21 block,
354 // increasing width ensure that the temporary area is large enough,
355 // the next rounded up width is 32
356 *width = FFMAX(*width, 32);
357 }
358 if (s->codec_id == AV_CODEC_ID_SVQ3) {
359 *width = FFMAX(*width, 32);
360 }
361
362 for (i = 0; i < 4; i++)
363 linesize_align[i] = STRIDE_ALIGN;
364}
365
367{
368 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
369 int chroma_shift = desc->log2_chroma_w;
370 int linesize_align[AV_NUM_DATA_POINTERS];
371 int align;
372
373 avcodec_align_dimensions2(s, width, height, linesize_align);
374 align = FFMAX(linesize_align[0], linesize_align[3]);
375 linesize_align[1] <<= chroma_shift;
376 linesize_align[2] <<= chroma_shift;
377 align = FFMAX3(align, linesize_align[1], linesize_align[2]);
378 *width = FFALIGN(*width, align);
379}
380
382 enum AVSampleFormat sample_fmt, const uint8_t *buf,
383 int buf_size, int align)
384{
385 int ch, planar, needed_size, ret = 0;
386
387 needed_size = av_samples_get_buffer_size(NULL, nb_channels,
388 frame->nb_samples, sample_fmt,
389 align);
390 if (buf_size < needed_size)
391 return AVERROR(EINVAL);
392
393 planar = av_sample_fmt_is_planar(sample_fmt);
394 if (planar && nb_channels > AV_NUM_DATA_POINTERS) {
395 if (!FF_ALLOCZ_TYPED_ARRAY(frame->extended_data, nb_channels))
396 return AVERROR(ENOMEM);
397 } else {
398 frame->extended_data = frame->data;
399 }
400
401 if ((ret = av_samples_fill_arrays(frame->extended_data, &frame->linesize[0],
402 (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples,
403 sample_fmt, align)) < 0) {
404 if (frame->extended_data != frame->data)
405 av_freep(&frame->extended_data);
406 return ret;
407 }
408 if (frame->extended_data != frame->data) {
409 for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++)
410 frame->data[ch] = frame->extended_data[ch];
411 }
412
413 return ret;
414}
415
416
420
421const char *avcodec_get_name(enum AVCodecID id)
422{
423 const AVCodecDescriptor *cd;
424
425 if (id == AV_CODEC_ID_NONE)
426 return "none";
427 cd = avcodec_descriptor_get(id);
428 if (cd)
429 return cd->name;
430 return "unknown_codec";
431}
432
433const char *av_get_profile_name(const AVCodec *codec, int profile)
434{
435 const AVProfile *p;
436 if (profile == AV_PROFILE_UNKNOWN || !codec->profiles)
437 return NULL;
438
439 for (p = codec->profiles; p->profile != AV_PROFILE_UNKNOWN; p++)
440 if (p->profile == profile)
441 return p->name;
442
443 return NULL;
444}
445
447{
449 const AVProfile *p;
450
451 if (profile == AV_PROFILE_UNKNOWN || !desc || !desc->profiles)
452 return NULL;
453
454 for (p = desc->profiles; p->profile != AV_PROFILE_UNKNOWN; p++)
455 if (p->profile == profile)
456 return p->name;
457
458 return NULL;
459}
460
462{
463 switch (codec_id) {
465 return 1;
483 return 4;
500 return 8;
507 return 16;
514 return 24;
524 return 32;
529 return 64;
530 default:
531 return 0;
532 }
533}
534
556
558{
559 switch (codec_id) {
561 return 1;
564 case AV_CODEC_ID_G728:
565 return 2;
567 return 3;
574 return 4;
575 default:
577 }
578}
579
580static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
581 uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
582 uint8_t * extradata, int frame_size, int frame_bytes)
583{
585 int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
586
587 /* codecs with an exact constant bits per sample */
588 if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
589 return (frame_bytes * 8LL) / (bps * ch);
590 bps = bits_per_coded_sample;
591
592 /* codecs with a fixed packet duration */
593 switch (id) {
594 case AV_CODEC_ID_ADPCM_ADX: return 32;
595 case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
596 case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
598 case AV_CODEC_ID_EVRC:
599 case AV_CODEC_ID_GSM:
601 case AV_CODEC_ID_RA_288: return 160;
603 case AV_CODEC_ID_GSM_MS: return 320;
604 case AV_CODEC_ID_MP1: return 384;
605 case AV_CODEC_ID_ATRAC1: return 512;
608 if (framecount > INT_MAX/1024)
609 return 0;
610 return 1024 * framecount;
611 case AV_CODEC_ID_ATRAC3P: return 2048;
612 case AV_CODEC_ID_MP2:
613 case AV_CODEC_ID_MUSEPACK7: return 1152;
614 case AV_CODEC_ID_AC3: return 1536;
615 case AV_CODEC_ID_FTR: return 1024;
616 }
617
618 if (sr > 0) {
619 /* calc from sample rate */
620 if (id == AV_CODEC_ID_TTA)
621 return 256ll * sr / 245;
622 else if (id == AV_CODEC_ID_DST)
623 return 588ll * sr / 44100;
624 else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
625 if (sr / 22050 > 22)
626 return 0;
627 return (480 << (sr / 22050));
628 }
629
630 if (id == AV_CODEC_ID_MP3)
631 return sr <= 24000 ? 576 : 1152;
632 }
633
634 if (ba > 0) {
635 /* calc from block_align */
636 if (id == AV_CODEC_ID_SIPR) {
637 switch (ba) {
638 case 20: return 160;
639 case 19: return 144;
640 case 29: return 288;
641 case 37: return 480;
642 }
643 } else if (id == AV_CODEC_ID_ILBC) {
644 switch (ba) {
645 case 38: return 160;
646 case 50: return 240;
647 }
648 }
649 }
650
651 if (frame_bytes > 0) {
652 /* calc from frame_bytes only */
653 int64_t d = INT64_MIN;
654 switch(id) {
655 case AV_CODEC_ID_TRUESPEECH : d = 240LL * (frame_bytes / 32); break;
656 case AV_CODEC_ID_NELLYMOSER : d = 256LL * (frame_bytes / 64); break;
657 case AV_CODEC_ID_RA_144 : d = 160LL * (frame_bytes / 20); break;
658 case AV_CODEC_ID_APTX : d = 4LL * (frame_bytes / 4); break;
659 case AV_CODEC_ID_APTX_HD : d = 4LL * (frame_bytes / 6); break;
660 }
661 if (d > INT64_MIN)
662 return ((int)d == d && d > 0) ? d : 0;
663
664 if (bps > 0) {
665 /* calc from frame_bytes and bits_per_coded_sample */
667 return frame_bytes * 8 / bps;
668 }
669
670 if (ch > 0 && ch < INT_MAX/16) {
671 /* calc from frame_bytes and channels */
672 switch (id) {
674 return frame_bytes / (40 * ch) * 256;
676 return (frame_bytes - 4 * ch) / (128 * ch) * 256;
678 return frame_bytes / (9 * ch) * 16;
680 frame_bytes /= 9 * ch;
681 if (frame_bytes > INT_MAX / 16)
682 return 0;
683 return frame_bytes * 16;
686 frame_bytes /= 16 * ch;
687 if (frame_bytes > INT_MAX / 28)
688 return 0;
689 return frame_bytes * 28;
691 frame_bytes = (frame_bytes - 1) / ch;
692 if (frame_bytes > INT_MAX / 2)
693 return 0;
694 return frame_bytes * 2;
700 return (frame_bytes - 4 * ch) * 2 / ch;
702 return (frame_bytes - 4) * 2 / ch;
704 return (frame_bytes - 8) * 2;
707 if (extradata)
708 return frame_bytes * 14LL / (8 * ch);
709 break;
711 return (frame_bytes / 128) * 224 / ch;
713 return (frame_bytes - 6 - ch) / ch;
715 return (frame_bytes - 8) / ch;
717 return (frame_bytes - 2 * ch) / ch;
719 return 3 * frame_bytes / ch;
721 return 6 * frame_bytes / ch;
723 return 2 * (frame_bytes / (5 * ch));
724 case AV_CODEC_ID_IAC:
725 case AV_CODEC_ID_IMC:
726 return 4 * frame_bytes / ch;
727 }
728
729 if (tag) {
730 /* calc from frame_bytes, channels, and codec_tag */
731 if (id == AV_CODEC_ID_SOL_DPCM) {
732 if (tag == 3)
733 return frame_bytes / ch;
734 else
735 return frame_bytes * 2 / ch;
736 }
737 }
738
739 if (ba > 0) {
740 /* calc from frame_bytes, channels, and block_align */
741 int blocks = frame_bytes / ba;
742 int64_t tmp = 0;
743 switch (id) {
745 if (bps != 4)
746 return 0;
747 tmp = blocks * ((ba - 4 * ch) / (bps * ch) * 8);
748 break;
750 if (bps < 2 || bps > 5)
751 return 0;
752 tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
753 break;
755 tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
756 break;
758 tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
759 break;
761 tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
762 break;
764 tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
765 break;
767 tmp = blocks * (ba - 16LL) * 2 / ch;
768 break;
770 tmp = blocks * 32;
771 break;
773 if (bps != 2 || ch > 2 || ba < 4 * ch || (ch == 2 && ba % 8))
774 return 0;
775 tmp = blocks * (1LL + (ba / ch - 4) * 4LL);
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) {
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);
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
817int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
818{
819 int channels = avctx->ch_layout.nb_channels;
820 int duration;
821
823 channels, avctx->block_align,
824 avctx->codec_tag, avctx->bits_per_coded_sample,
825 avctx->bit_rate, avctx->extradata, avctx->frame_size,
826 frame_bytes);
827 return FFMAX(0, duration);
828}
829
831{
832 int channels = par->ch_layout.nb_channels;
833 int duration;
834
836 channels, par->block_align,
838 par->bit_rate, par->extradata, par->frame_size,
839 frame_bytes);
840 return FFMAX(0, duration);
841}
842
843unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
844{
845 unsigned int n = 0;
846
847 while (v >= 0xff) {
848 *s++ = 0xff;
849 v -= 0xff;
850 n++;
851 }
852 *s = v;
853 n++;
854 return n;
855}
856
857int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
858{
859 int i;
860 for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
861 return i;
862}
863
865{
866 const FFCodec *const codec = ffcodec(avcodec);
867 int i;
868 if (!codec->hw_configs || index < 0)
869 return NULL;
870 for (i = 0; i <= index; i++)
871 if (!codec->hw_configs[i])
872 return NULL;
873 return &codec->hw_configs[index]->public;
874}
875
877{
878 int ret;
879
880 dst->owner[0] = src->owner[0];
881 dst->owner[1] = src->owner[1];
882
883 ret = av_frame_ref(dst->f, src->f);
884 if (ret < 0)
885 return ret;
886
887 av_assert0(!dst->progress);
888
889 if (src->progress)
890 dst->progress = av_refstruct_ref(src->progress);
891
892 return 0;
893}
894
896{
897 int ret;
898
899 dst->owner[0] = src->owner[0];
900 dst->owner[1] = src->owner[1];
901
902 ret = av_frame_replace(dst->f, src->f);
903 if (ret < 0)
904 return ret;
905
906 av_refstruct_replace(&dst->progress, src->progress);
907
908 return 0;
909}
910
911#if !HAVE_THREADS
912
914{
915 return ff_get_buffer(avctx, f, flags);
916}
917
919{
920 f->owner[0] = f->owner[1] = avctx;
921 return ff_get_buffer(avctx, f->f, flags);
922}
923
925{
926 f->owner[0] = f->owner[1] = NULL;
927 if (f->f)
928 av_frame_unref(f->f);
929}
930
934
935void ff_thread_report_progress(ThreadFrame *f, int progress, int field)
936{
937}
938
939void ff_thread_await_progress(const ThreadFrame *f, int progress, int field)
940{
941}
942
944{
945 return 1;
946}
947#endif
948
949const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
950 const uint8_t *end,
951 uint32_t *restrict state)
952{
953 int i;
954
955 av_assert0(p <= end);
956 if (p >= end)
957 return end;
958
959 for (i = 0; i < 3; i++) {
960 uint32_t tmp = *state << 8;
961 *state = tmp + *(p++);
962 if (tmp == 0x100 || p == end)
963 return p;
964 }
965
966 while (p < end) {
967 if (p[-1] > 1 ) p += 3;
968 else if (p[-2] ) p += 2;
969 else if (p[-3]|(p[-1]-1)) p++;
970 else {
971 p++;
972 break;
973 }
974 }
975
976 p = FFMIN(p, end) - 4;
977 *state = AV_RB32(p);
978
979 return p + 4;
980}
981
983{
985 if (!props)
986 return NULL;
987
988 if (size)
989 *size = sizeof(*props);
990
991 props->vbv_delay = UINT64_MAX;
992
993 return props;
994}
995
996static void put_timecode_fields(PutBitContext *pb, AVRational rate, uint32_t tc)
997{
998 unsigned hours, minutes, seconds, frames, drop;
999
1000 ff_timecode_set_smpte(&drop, &hours, &minutes, &seconds, &frames, rate, tc, 0, 0);
1001
1002 put_bits(pb, 5, 0); // counting_type
1003 put_bits(pb, 1, 1); // full_timestamp_flag
1004 put_bits(pb, 1, 0); // discontinuity_flag
1005 put_bits(pb, 1, drop); // cnt_dropped_flag
1006 put_bits(pb, 9, frames);
1007 put_bits(pb, 6, seconds);
1008 put_bits(pb, 6, minutes);
1009 put_bits(pb, 5, hours);
1010}
1011
1012int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len,
1013 void **data, size_t *sei_size)
1014{
1015 AVFrameSideData *sd = NULL;
1016 uint8_t *sei_data;
1017 PutBitContext pb;
1018 uint32_t *tc;
1019 int m;
1020
1021 if (frame)
1023
1024 if (!sd) {
1025 *data = NULL;
1026 return 0;
1027 }
1028 tc = (uint32_t*)sd->data;
1029 m = tc[0] & 3;
1030
1031 *sei_size = sizeof(uint32_t) * 4;
1032 *data = av_mallocz(*sei_size + prefix_len);
1033 if (!*data)
1034 return AVERROR(ENOMEM);
1035 sei_data = (uint8_t*)*data + prefix_len;
1036
1037 init_put_bits(&pb, sei_data, *sei_size);
1038 put_bits(&pb, 2, m); // num_clock_ts
1039
1040 for (int j = 1; j <= m; j++) {
1041 put_bits(&pb, 1, 1); // clock_timestamp_flag
1042 put_bits(&pb, 1, 1); // units_field_based_flag
1043 put_timecode_fields(&pb, rate, tc[j]);
1044 put_bits(&pb, 5, 0); // time_offset_length
1045 }
1046 flush_put_bits(&pb);
1047
1048 return 0;
1049}
1050
1052 void **data, size_t *size)
1053{
1054 AVFrameSideData *sd = NULL;
1055 PutBitContext pb;
1056 uint32_t *tc;
1057
1058 if (frame)
1060
1061 *data = NULL;
1062 if (!sd)
1063 return 0;
1064 tc = (uint32_t*)sd->data;
1065 if (!(tc[0] & 3)) // num_clock_ts
1066 return 0;
1067
1068 *size = 5;
1069 *data = av_mallocz(*size);
1070 if (!*data)
1071 return AVERROR(ENOMEM);
1072
1073 init_put_bits(&pb, *data, *size);
1074 put_timecode_fields(&pb, rate, tc[1]);
1075 put_bits(&pb, 5, 1); // time_offset_length
1076 put_bits(&pb, 1, 0); // time_offset_value
1077 flush_put_bits(&pb);
1078
1079 return 0;
1080}
1081
1083{
1085 int bits_per_coded_sample = avctx->bits_per_coded_sample;
1087
1088 if (!(framerate.num && framerate.den))
1089 framerate = av_inv_q(avctx->time_base);
1090 if (!(framerate.num && framerate.den))
1091 return 0;
1092
1093 if (!bits_per_coded_sample) {
1095 bits_per_coded_sample = av_get_bits_per_pixel(desc);
1096 }
1097 bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
1098 framerate.num / framerate.den;
1099
1100 return bitrate;
1101}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
static int frames
channels
Definition aptx.h:31
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Libavcodec external API header.
static const uint8_t *BS_FUNC align(BSCTX *bc)
Skip bits to a byte boundary.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters if all frames are skipped due to the skip_frame setting...
static av_always_inline const FFCodec * ffcodec(const AVCodec *codec)
#define AV_CEIL_RSHIFT(a, b)
Definition common.h:60
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition decode.c:1781
#define AV_PROFILE_UNKNOWN
Definition defs.h:65
static AVFrame * frame
static struct @346255127015250356166251341105367306144006377143 state
static int64_t duration
Definition ffplay.c:399
#define AV_NUM_DATA_POINTERS
Definition frame.h:480
static const uint8_t frame_size[4]
Definition g723_1.h:222
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition utils.c:557
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int av_codec_is_encoder(const AVCodec *avcodec)
Definition utils.c:79
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition utils.c:446
int av_codec_is_decoder(const AVCodec *avcodec)
Definition utils.c:85
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition utils.c:421
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *avcodec, int index)
Retrieve supported hardware configurations for a codec.
Definition utils.c:864
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition utils.c:461
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
Definition utils.c:433
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
Return the PCM codec associated with a sample format.
Definition utils.c:535
@ AV_CODEC_ID_PCM_F24LE
Definition codec_id.h:366
@ AV_CODEC_ID_PCM_F32LE
Definition codec_id.h:353
@ AV_CODEC_ID_ADPCM_IMA_PDA
Definition codec_id.h:427
@ AV_CODEC_ID_PCM_S24BE
Definition codec_id.h:345
@ AV_CODEC_ID_IFF_ILBM
Definition codec_id.h:186
@ AV_CODEC_ID_ADPCM_SWF
Definition codec_id.h:385
@ AV_CODEC_ID_MUSEPACK7
Definition codec_id.h:485
@ AV_CODEC_ID_ATRAC1
Definition codec_id.h:503
@ AV_CODEC_ID_VP6
Definition codec_id.h:141
@ AV_CODEC_ID_PCM_S64BE
Definition codec_id.h:364
@ AV_CODEC_ID_VP6F
Definition codec_id.h:142
@ AV_CODEC_ID_IAC
Definition codec_id.h:515
@ AV_CODEC_ID_ADPCM_CT
Definition codec_id.h:384
@ AV_CODEC_ID_S302M
Definition codec_id.h:358
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition codec_id.h:376
@ AV_CODEC_ID_ADPCM_IMA_CITRIX
Definition codec_id.h:435
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition codec_id.h:362
@ AV_CODEC_ID_DSD_LSBF
Definition codec_id.h:530
@ AV_CODEC_ID_PCM_U8
Definition codec_id.h:337
@ AV_CODEC_ID_ADPCM_4XM
Definition codec_id.h:379
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition codec_id.h:404
@ AV_CODEC_ID_SNOW
Definition codec_id.h:258
@ AV_CODEC_ID_PCM_DVD
Definition codec_id.h:351
@ AV_CODEC_ID_PCM_S16LE
Definition codec_id.h:332
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition codec_id.h:361
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition codec_id.h:475
@ AV_CODEC_ID_PCM_F16LE
Definition codec_id.h:365
@ AV_CODEC_ID_8SVX_EXP
Definition codec_id.h:511
@ AV_CODEC_ID_PCM_F32BE
Definition codec_id.h:352
@ AV_CODEC_ID_RPZA
Definition codec_id.h:92
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition codec_id.h:389
@ AV_CODEC_ID_ADPCM_G722
Definition codec_id.h:400
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition codec_id.h:533
@ AV_CODEC_ID_PCM_BLURAY
Definition codec_id.h:356
@ AV_CODEC_ID_ADPCM_DTK
Definition codec_id.h:405
@ AV_CODEC_ID_SVQ3
Definition codec_id.h:73
@ AV_CODEC_ID_SIPR
Definition codec_id.h:498
@ AV_CODEC_ID_FTR
Definition codec_id.h:557
@ AV_CODEC_ID_H264
Definition codec_id.h:77
@ AV_CODEC_ID_ADPCM_CIRCUS
Definition codec_id.h:432
@ AV_CODEC_ID_G728
Definition codec_id.h:564
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition codec_id.h:395
@ AV_CODEC_ID_APTX
Definition codec_id.h:542
@ AV_CODEC_ID_NONE
Definition codec_id.h:48
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition codec_id.h:532
@ AV_CODEC_ID_EVRC
Definition codec_id.h:528
@ AV_CODEC_ID_PCM_S24LE_PLANAR
Definition codec_id.h:360
@ AV_CODEC_ID_ZLIB
Definition codec_id.h:104
@ AV_CODEC_ID_PCM_S16BE
Definition codec_id.h:333
@ AV_CODEC_ID_INTERPLAY_DPCM
Definition codec_id.h:447
@ AV_CODEC_ID_ADPCM_PSX
Definition codec_id.h:409
@ AV_CODEC_ID_PCM_S24LE
Definition codec_id.h:344
@ AV_CODEC_ID_ADPCM_XA
Definition codec_id.h:380
@ AV_CODEC_ID_PCM_U24BE
Definition codec_id.h:347
@ AV_CODEC_ID_MP1
Definition codec_id.h:499
@ AV_CODEC_ID_CINEPAK
Definition codec_id.h:93
@ AV_CODEC_ID_IMC
Definition codec_id.h:484
@ AV_CODEC_ID_PCM_S24DAUD
Definition codec_id.h:348
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition codec_id.h:386
@ AV_CODEC_ID_APTX_HD
Definition codec_id.h:543
@ AV_CODEC_ID_ADPCM_SBPRO_3
Definition codec_id.h:388
@ AV_CODEC_ID_SDX2_DPCM
Definition codec_id.h:450
@ AV_CODEC_ID_PCM_S32LE
Definition codec_id.h:340
@ AV_CODEC_ID_RA_288
Definition codec_id.h:443
@ AV_CODEC_ID_ATRAC3P
Definition codec_id.h:496
@ AV_CODEC_ID_ADPCM_G726LE
Definition codec_id.h:407
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition codec_id.h:399
@ AV_CODEC_ID_PCM_S8
Definition codec_id.h:336
@ AV_CODEC_ID_DERF_DPCM
Definition codec_id.h:452
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition codec_id.h:505
@ AV_CODEC_ID_SOL_DPCM
Definition codec_id.h:449
@ AV_CODEC_ID_ADPCM_ADX
Definition codec_id.h:381
@ AV_CODEC_ID_ADPCM_RHETOREX
Definition codec_id.h:434
@ AV_CODEC_ID_ADPCM_MS
Definition codec_id.h:378
@ AV_CODEC_ID_GSM_MS
Definition codec_id.h:487
@ AV_CODEC_ID_PCM_U32LE
Definition codec_id.h:342
@ AV_CODEC_ID_PCM_VIDC
Definition codec_id.h:367
@ AV_CODEC_ID_BINKVIDEO
Definition codec_id.h:185
@ AV_CODEC_ID_INTERPLAY_VIDEO
Definition codec_id.h:89
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition codec_id.h:387
@ AV_CODEC_ID_FASTAUDIO
Definition codec_id.h:551
@ AV_CODEC_ID_VC1
Definition codec_id.h:120
@ AV_CODEC_ID_PCM_ALAW
Definition codec_id.h:339
@ AV_CODEC_ID_PCM_F64LE
Definition codec_id.h:355
@ AV_CODEC_ID_ADPCM_ARGO
Definition codec_id.h:414
@ AV_CODEC_ID_ADPCM_IMA_APC
Definition codec_id.h:401
@ AV_CODEC_ID_WMAV1
Definition codec_id.h:464
@ AV_CODEC_ID_ARGO
Definition codec_id.h:302
@ AV_CODEC_ID_AMR_NB
Definition codec_id.h:438
@ AV_CODEC_ID_WADY_DPCM
Definition codec_id.h:453
@ AV_CODEC_ID_VP6A
Definition codec_id.h:156
@ AV_CODEC_ID_ADPCM_IMA_AMV
Definition codec_id.h:391
@ AV_CODEC_ID_TRUESPEECH
Definition codec_id.h:478
@ AV_CODEC_ID_ADPCM_EA_XAS
Definition codec_id.h:397
@ AV_CODEC_ID_PCM_U16BE
Definition codec_id.h:335
@ AV_CODEC_ID_ADPCM_IMA_MAGIX
Definition codec_id.h:430
@ AV_CODEC_ID_MP2
Definition codec_id.h:457
@ AV_CODEC_ID_WMAV2
Definition codec_id.h:465
@ AV_CODEC_ID_TTA
Definition codec_id.h:479
@ AV_CODEC_ID_ADPCM_IMA_DK4
Definition codec_id.h:375
@ AV_CODEC_ID_ROQ_DPCM
Definition codec_id.h:446
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition codec_id.h:374
@ AV_CODEC_ID_PCM_LXF
Definition codec_id.h:357
@ AV_CODEC_ID_JV
Definition codec_id.h:199
@ AV_CODEC_ID_PCM_SGA
Definition codec_id.h:368
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition codec_id.h:411
@ AV_CODEC_ID_ADPCM_XMD
Definition codec_id.h:423
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition codec_id.h:372
@ AV_CODEC_ID_DSD_MSBF
Definition codec_id.h:531
@ AV_CODEC_ID_PCM_S64LE
Definition codec_id.h:363
@ AV_CODEC_ID_MJPEGB
Definition codec_id.h:58
@ AV_CODEC_ID_ADPCM_G726
Definition codec_id.h:383
@ AV_CODEC_ID_SMC
Definition codec_id.h:99
@ AV_CODEC_ID_ATRAC3
Definition codec_id.h:488
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition codec_id.h:377
@ AV_CODEC_ID_SMVJPEG
Definition codec_id.h:259
@ AV_CODEC_ID_ADPCM_MTAF
Definition codec_id.h:412
@ AV_CODEC_ID_XAN_DPCM
Definition codec_id.h:448
@ AV_CODEC_ID_DST
Definition codec_id.h:538
@ AV_CODEC_ID_NELLYMOSER
Definition codec_id.h:490
@ AV_CODEC_ID_ATRAC9
Definition codec_id.h:545
@ AV_CODEC_ID_VP5
Definition codec_id.h:140
@ AV_CODEC_ID_PCM_F64BE
Definition codec_id.h:354
@ AV_CODEC_ID_LJPEG
Definition codec_id.h:59
@ AV_CODEC_ID_ADPCM_AICA
Definition codec_id.h:410
@ AV_CODEC_ID_QCELP
Definition codec_id.h:481
@ AV_CODEC_ID_AMR_WB
Definition codec_id.h:439
@ AV_CODEC_ID_AC3
Definition codec_id.h:460
@ AV_CODEC_ID_JPEGLS
Definition codec_id.h:61
@ AV_CODEC_ID_MACE3
Definition codec_id.h:466
@ AV_CODEC_ID_MACE6
Definition codec_id.h:467
@ AV_CODEC_ID_ADPCM_IMA_APM
Definition codec_id.h:417
@ AV_CODEC_ID_PCM_S32BE
Definition codec_id.h:341
@ AV_CODEC_ID_ADPCM_THP
Definition codec_id.h:390
@ AV_CODEC_ID_8SVX_FIB
Definition codec_id.h:512
@ AV_CODEC_ID_ADPCM_IMA_XBOX
Definition codec_id.h:424
@ AV_CODEC_ID_SVQ1
Definition codec_id.h:72
@ AV_CODEC_ID_ADPCM_IMA_ACORN
Definition codec_id.h:422
@ AV_CODEC_ID_RA_144
Definition codec_id.h:442
@ AV_CODEC_ID_ADPCM_AFC
Definition codec_id.h:403
@ AV_CODEC_ID_MJPEG
Definition codec_id.h:57
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition codec_id.h:373
@ AV_CODEC_ID_WMV3
Definition codec_id.h:121
@ AV_CODEC_ID_ADPCM_THP_LE
Definition codec_id.h:408
@ AV_CODEC_ID_ADPCM_N64
Definition codec_id.h:428
@ AV_CODEC_ID_SP5X
Definition codec_id.h:60
@ AV_CODEC_ID_ADPCM_IMA_ALP
Definition codec_id.h:418
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition codec_id.h:350
@ AV_CODEC_ID_CBD2_DPCM
Definition codec_id.h:454
@ AV_CODEC_ID_PCM_U24LE
Definition codec_id.h:346
@ AV_CODEC_ID_ADPCM_PSXC
Definition codec_id.h:431
@ AV_CODEC_ID_DFPWM
Definition codec_id.h:553
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition codec_id.h:406
@ AV_CODEC_ID_ILBC
Definition codec_id.h:516
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition codec_id.h:458
@ AV_CODEC_ID_ADPCM_IMA_SSI
Definition codec_id.h:415
@ AV_CODEC_ID_MSZH
Definition codec_id.h:103
@ AV_CODEC_ID_PCM_U16LE
Definition codec_id.h:334
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition codec_id.h:359
@ AV_CODEC_ID_PCM_U32BE
Definition codec_id.h:343
@ AV_CODEC_ID_AMV
Definition codec_id.h:157
@ AV_CODEC_ID_ADPCM_IMA_MOFLEX
Definition codec_id.h:421
@ AV_CODEC_ID_PCM_MULAW
Definition codec_id.h:338
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:141
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:366
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition defs.h:40
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:53
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition utils.c:817
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:381
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:66
AVMatrixEncoding
#define AVERROR(e)
Definition error.h:45
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition frame.c:496
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:659
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:376
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:278
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:647
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
Definition frame.h:152
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition frame.h:68
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition rational.h:159
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:666
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:661
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
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
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition samplefmt.c:115
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:122
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition samplefmt.h:64
@ AV_SAMPLE_FMT_FLT
float
Definition samplefmt.h:60
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition samplefmt.h:63
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition samplefmt.h:65
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition samplefmt.h:59
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition samplefmt.h:57
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition samplefmt.h:67
@ AV_SAMPLE_FMT_DBL
double
Definition samplefmt.h:61
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition samplefmt.h:69
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
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:154
int index
Definition gxfenc.c:90
int a
const VDPAUPixFmtMap * map
misc image utilities
#define b
Definition input.c:43
#define AV_RB32(p)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition j2kenc.c:154
common internal api header.
#define STRIDE_ALIGN
Definition internal.h:46
Multithreading API for decoders.
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:580
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition utils.c:417
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:121
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition utils.c:843
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition utils.c:913
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
Definition utils.c:830
static void put_timecode_fields(PutBitContext *pb, AVRational rate, uint32_t tc)
Definition utils.c:996
int ff_thread_replace_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition utils.c:895
void ff_thread_release_ext_buffer(ThreadFrame *f)
Unref a ThreadFrame.
Definition utils.c:924
int ff_alloc_timecode_metadata_av1(const AVFrame *frame, AVRational rate, void **data, size_t *size)
Definition utils.c:1051
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:106
int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around ff_get_buffer() for frame-multithreaded codecs.
Definition utils.c:918
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:935
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
Definition utils.c:876
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:931
AVCPBProperties * av_cpb_properties_alloc(size_t *size)
Allocate a CPB properties structure and initialize its fields to default values.
Definition utils.c:982
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:1012
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:1082
const uint8_t * avpriv_find_start_code(const uint8_t *restrict p, const uint8_t *end, uint32_t *restrict state)
Definition utils.c:949
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Definition utils.c:91
void ff_thread_await_progress(const ThreadFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
Definition utils.c:939
int ff_thread_can_start_frame(AVCodecContext *avctx)
Definition utils.c:943
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:857
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem)
Definition internal.h:81
void ff_timecode_set_smpte(unsigned *drop, unsigned *hh, unsigned *mm, unsigned *ss, unsigned *ff, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Convert SMPTE 12M binary representation to sei info.
const char * desc
Definition libsvtav1.c:83
#define FFMAX3(a, b, c)
Definition macros.h:48
#define FFMIN(a, b)
Definition macros.h:49
#define AV_NE(be, le)
Definition macros.h:33
#define FFMAX(a, b)
Definition macros.h:47
#define FFALIGN(x, a)
Definition macros.h:78
Memory handling functions.
uint32_t tag
Definition movenc.c:2128
unsigned bps
Definition movenc.c:2129
const char data[16]
Definition mxf.c:149
int profile
Definition mxfenc.c:2299
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:3436
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3484
pixel format definitions
@ AV_PIX_FMT_BAYER_GBRG8
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
Definition pixfmt.h:287
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:133
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition pixfmt.h:104
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:129
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition pixfmt.h:169
@ 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:175
@ 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:368
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:270
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition pixfmt.h:299
@ 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:366
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition pixfmt.h:180
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition pixfmt.h:265
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition pixfmt.h:186
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition pixfmt.h:168
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:277
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition pixfmt.h:181
@ 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:367
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_BAYER_GRBG16LE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
Definition pixfmt.h:295
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition pixfmt.h:207
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition pixfmt.h:279
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition pixfmt.h:178
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition pixfmt.h:310
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:154
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition pixfmt.h:182
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition pixfmt.h:88
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:157
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition pixfmt.h:184
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:156
@ 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:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition pixfmt.h:93
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:130
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:269
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition pixfmt.h:213
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:278
@ AV_PIX_FMT_BAYER_RGGB16LE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
Definition pixfmt.h:291
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition pixfmt.h:179
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:272
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition pixfmt.h:90
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:161
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition pixfmt.h:300
@ 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:176
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:160
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ AV_PIX_FMT_BAYER_GRBG8
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
Definition pixfmt.h:288
@ 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:283
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition pixfmt.h:280
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition pixfmt.h:192
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition pixfmt.h:183
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition pixfmt.h:89
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition pixfmt.h:189
@ AV_PIX_FMT_BAYER_BGGR16BE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
Definition pixfmt.h:290
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition pixfmt.h:171
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition pixfmt.h:311
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition pixfmt.h:167
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition pixfmt.h:188
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition pixfmt.h:187
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:268
@ AV_PIX_FMT_BAYER_RGGB16BE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
Definition pixfmt.h:292
@ 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:86
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:159
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:164
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:163
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition pixfmt.h:282
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:158
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition pixfmt.h:105
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition pixfmt.h:170
@ AV_PIX_FMT_BAYER_GRBG16BE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
Definition pixfmt.h:296
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:267
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition pixfmt.h:301
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition pixfmt.h:74
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:131
@ AV_PIX_FMT_BAYER_GBRG16LE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
Definition pixfmt.h:293
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:274
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition pixfmt.h:214
@ AV_PIX_FMT_BAYER_BGGR16LE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
Definition pixfmt.h:289
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:155
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition pixfmt.h:153
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition pixfmt.h:185
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition pixfmt.h:298
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:132
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition pixfmt.h:281
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:273
@ AV_PIX_FMT_BAYER_GBRG16BE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
Definition pixfmt.h:294
@ 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:87
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:275
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition pixfmt.h:191
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition pixfmt.h:190
@ AV_PIX_FMT_BAYER_RGGB8
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
Definition pixfmt.h:286
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition pixfmt.h:172
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition pixfmt.h:177
@ 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:369
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:162
@ 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:85
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:271
@ AV_PIX_FMT_BAYER_BGGR8
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition pixfmt.h:285
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:128
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:276
#define AV_PIX_FMT_RGB555
Definition pixfmt.h:536
bitstream writer API
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition put_bits.h:62
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition put_bits.h:153
void av_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
Definition refstruct.c:161
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
Definition refstruct.c:141
#define FF_ARRAY_ELEMS(a)
Accelerated start code search function for start codes common to MPEG-1/2/4 video,...
This structure describes the bitrate properties of an encoded bitstream.
Definition defs.h:296
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:326
int nb_channels
Number of channels in this layout.
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:643
int width
picture width / height.
Definition avcodec.h:604
AVChannelLayout ch_layout
Audio channel layout.
Definition avcodec.h:1055
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition avcodec.h:468
AVRational framerate
Definition avcodec.h:563
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:628
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition avcodec.h:1569
int64_t bit_rate
the average bitrate
Definition avcodec.h:493
int sample_rate
samples per second
Definition avcodec.h:1040
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avcodec.h:547
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition avcodec.h:526
enum AVCodecID codec_id
Definition avcodec.h:453
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition avcodec.h:1075
int frame_size
Number of samples per channel in an audio frame.
Definition avcodec.h:1068
This struct describes the properties of a single codec described by an AVCodecID.
Definition codec_desc.h:38
const char * name
Name of the codec described by this descriptor.
Definition codec_desc.h:46
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition hwconfig.h:30
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
int frame_size
Audio frame size, if known.
Definition codec_par.h:227
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition codec_par.h:113
AVChannelLayout ch_layout
The channel layout and number of channels.
Definition codec_par.h:207
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition codec_par.h:99
int block_align
The number of bytes per coded audio frame, required by some formats.
Definition codec_par.h:221
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition codec_par.h:61
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition codec_par.h:71
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition codec_par.h:57
int sample_rate
The number of audio samples per second.
Definition codec_par.h:213
AVCodec.
Definition codec.h:175
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}
Definition codec.h:198
Structure to hold side data for an AVFrame.
Definition frame.h:334
uint8_t * data
Definition frame.h:336
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
AVProfile.
Definition codec.h:167
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
const struct AVCodecHWConfigInternal *const * hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
unsigned is_decoder
Is this a decoder?
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
#define av_mallocz(s)
#define av_freep(p)
#define av_log(a,...)
static uint8_t tmp[40]
Definition aes_ctr.c:52
float framerate
Definition av1_levels.c:29
int64_t bitrate
Definition av1_levels.c:47
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99
Timecode helpers header.
int size
static const struct twinvq_data tab
enum AVCodecID codec_id