FFmpeg: libavcodec/av1_parser.c Source File
Go to the documentation of this file. 1 /*
2 * AV1 parser
3 *
4 * Copyright (C) 2018 James Almer <jamrial@gmail.com>
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
25
30
36
40 };
44 };
48 };
49
52 };
53
56 const uint8_t **out_data,
int *
out_size,
58 {
65
68
72
73 s->cbc->log_ctx = avctx;
74
76 s->parsed_extradata = 1;
77
78 ret = ff_cbs_read_extradata_from_codec(
s->cbc, td, avctx);
81 }
82
83 ff_cbs_fragment_reset(td);
84 }
85
89 goto end;
90 }
91
94 goto end;
95 }
96
99
104
109 else
110 continue;
111
113 continue;
114
115 if (!
frame->show_frame && !
frame->show_existing_frame)
116 continue;
117
118 ctx->width =
frame->frame_width_minus_1 + 1;
119 ctx->height =
frame->frame_height_minus_1 + 1;
120
122
123 switch (
frame->frame_type) {
127 break;
130 break;
133 break;
134 }
136 }
137
139 case 8:
142 break;
143 case 10:
146 break;
147 case 12:
150 break;
151 }
153
154 if (!
color->subsampling_x && !
color->subsampling_y &&
159
162
167
172
173 end:
174 ff_cbs_fragment_reset(td);
175
176 s->cbc->log_ctx =
NULL;
177
179 }
180
187 };
188
190 {
193
197
200
201 return 0;
202 }
203
205 {
207
208 ff_cbs_fragment_free(&
s->temporal_unit);
209 ff_cbs_close(&
s->cbc);
210 }
211
218 };
uint32_t num_units_in_display_tick
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
static enum AVPixelFormat pix_fmts_rgb[3]
enum AVColorSpace colorspace
YUV colorspace type.
AVColorTransferCharacteristic
Color Transfer Characteristic.
static av_cold void av1_parser_close(AVCodecParserContext *ctx)
@ AV_PICTURE_STRUCTURE_UNKNOWN
unknown
static enum AVPixelFormat pix_fmts_8bit[2][2]
void * content
Pointer to the decomposed form of this unit.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
@ AVCOL_RANGE_JPEG
Full range content.
Context structure for coded bitstream operations.
#define AV_PIX_FMT_YUV420P10
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
CodedBitstreamUnitType type
Codec-specific type of this unit.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
@ AV1_OBU_TEMPORAL_DELIMITER
static av_cold int av1_parser_init(AVCodecParserContext *ctx)
Coded bitstream unit structure.
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV444P10
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
@ AV_PICTURE_STRUCTURE_FRAME
coded as frame
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
Coded bitstream fragment structure, combining one or more units.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_GRAY10
enum AVColorRange color_range
MPEG vs JPEG YUV range.
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
static int av1_parser_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t **out_data, int *out_size, const uint8_t *data, int size)
@ AV_PICTURE_TYPE_I
Intra.
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
int level
Encoding level descriptor.
@ AV_PICTURE_TYPE_SP
Switching Predicted.
uint32_t num_ticks_per_picture_minus_1
#define AV_PIX_FMT_YUV422P12
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
#define AV_PIX_FMT_YUV444P12
@ AV1_OBU_SEQUENCE_HEADER
@ AV_PICTURE_TYPE_NONE
Undefined.
AVRational ff_av1_framerate(int64_t ticks_per_frame, int64_t units_per_tick, int64_t time_scale)
const AVCodecParser ff_av1_parser
AV1RawFrameHeader frame_header
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static const CodedBitstreamUnitType decompose_unit_types[]
#define i(width, name, range_min, range_max)
static enum AVPixelFormat pix_fmts_12bit[2][2]
CodedBitstreamContext * cbc
#define AV_PIX_FMT_GBRP12
AVColorSpace
YUV colorspace type.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AV_PIX_FMT_YUV420P12
main external API structure.
AV1RawSequenceHeader * sequence_header
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static enum AVPixelFormat pix_fmts_10bit[2][2]
#define AV_PIX_FMT_GRAY12
CodedBitstreamFragment temporal_unit
void * priv_data
Format private data.
int nb_units
Number of units in this fragment.
Generated on Sat Oct 18 2025 19:21:52 for FFmpeg by
doxygen
1.8.17