Go to the documentation of this file.
21 #include "config_components.h"
46 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768,
47 15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142,
48 15087, 15033, 14980, 14926, 14873, 14821, 14769, 14717, 14665, 14614, 14564,
49 14513, 14463, 14413, 14364, 14315, 14266, 14218, 14170, 14122, 14075, 14028,
50 13981, 13935, 13888, 13843, 13797, 13752, 13707, 13662, 13618, 13574, 13530,
51 13487, 13443, 13400, 13358, 13315, 13273, 13231, 13190, 13148, 13107, 13066,
52 13026, 12985, 12945, 12906, 12866, 12827, 12788, 12749, 12710, 12672, 12633,
53 12596, 12558, 12520, 12483, 12446, 12409, 12373, 12336, 12300, 12264, 12228,
54 12193, 12157, 12122, 12087, 12053, 12018, 11984, 11950, 11916, 11882, 11848,
55 11815, 11782, 11749, 11716, 11683, 11651, 11619, 11586, 11555, 11523, 11491,
56 11460, 11429, 11398, 11367, 11336, 11305, 11275, 11245, 11215, 11185, 11155,
57 11125, 11096, 11067, 11038, 11009, 10980, 10951, 10923, 10894, 10866, 10838,
58 10810, 10782, 10755, 10727, 10700, 10673, 10645, 10618, 10592, 10565, 10538,
59 10512, 10486, 10460, 10434, 10408, 10382, 10356, 10331, 10305, 10280, 10255,
60 10230, 10205, 10180, 10156, 10131, 10107, 10082, 10058, 10034, 10010, 9986,
61 9963, 9939, 9916, 9892, 9869, 9846, 9823, 9800, 9777, 9754, 9732,
62 9709, 9687, 9664, 9642, 9620, 9598, 9576, 9554, 9533, 9511, 9489,
63 9468, 9447, 9425, 9404, 9383, 9362, 9341, 9321, 9300, 9279, 9259,
64 9239, 9218, 9198, 9178, 9158, 9138, 9118, 9098, 9079, 9059, 9039,
65 9020, 9001, 8981, 8962, 8943, 8924, 8905, 8886, 8867, 8849, 8830,
66 8812, 8793, 8775, 8756, 8738, 8720, 8702, 8684, 8666, 8648, 8630,
67 8613, 8595, 8577, 8560, 8542, 8525, 8508, 8490, 8473, 8456, 8439,
68 8422, 8405, 8389, 8372, 8355, 8339, 8322, 8306, 8289, 8273, 8257,
69 8240, 8224, 8208, 8192
77 return r - ((v + 1) >> 1);
101 uint8_t primary_frame, prev_frame;
102 uint32_t abs_bits, prec_bits,
round, prec_diff, sub,
mx;
105 primary_frame =
s->raw_frame_header->primary_ref_frame;
106 prev_frame =
s->raw_frame_header->ref_frame_idx[primary_frame];
115 prev_gm_param =
s->cur_frame.gm_params[
ref][idx];
117 prev_gm_param =
s->ref[prev_frame].gm_params[
ref][idx];
122 !
s->raw_frame_header->allow_high_precision_mv;
124 !
s->raw_frame_header->allow_high_precision_mv;
132 sub = (idx % 3) == 2 ? (1 << prec_bits) : 0;
134 r = (prev_gm_param >> prec_diff) - sub;
136 s->cur_frame.gm_params[
ref][idx] =
145 return ((x + ((uint64_t)1 << (n - 1))) >> n);
162 e = d - (1 << (*shift));
179 int16_t
alpha, beta, gamma,
delta, divf, divs;
181 int32_t *param = &
s->cur_frame.gm_params[idx][0];
216 for (
int i = 0;
i < 6;
i++)
217 s->cur_frame.gm_params[
ref][
i] = (
i % 3 == 2) ?
244 s->cur_frame.gm_params[
ref][4] = -
s->cur_frame.gm_params[
ref][3];
245 s->cur_frame.gm_params[
ref][5] =
s->cur_frame.gm_params[
ref][2];
259 unsigned int a,
unsigned int b)
261 unsigned int diff =
a -
b;
263 return (
diff & (m - 1)) - (
diff & m);
271 int forward_idx, backward_idx;
272 int forward_hint, backward_hint;
273 int second_forward_idx, second_forward_hint;
274 int ref_hint, dist,
i;
284 if (!
s->ref[
header->ref_frame_idx[
i]].raw_frame_header)
286 ref_hint =
s->ref[
header->ref_frame_idx[
i]].raw_frame_header->order_hint;
289 if (forward_idx < 0 ||
292 forward_hint = ref_hint;
294 }
else if (dist > 0) {
295 if (backward_idx < 0 ||
298 backward_hint = ref_hint;
303 if (forward_idx < 0) {
305 }
else if (backward_idx >= 0) {
306 s->cur_frame.skip_mode_frame_idx[0] =
308 s->cur_frame.skip_mode_frame_idx[1] =
313 second_forward_idx = -1;
315 ref_hint =
s->ref[
header->ref_frame_idx[
i]].raw_frame_header->order_hint;
317 if (second_forward_idx < 0 ||
319 second_forward_idx =
i;
320 second_forward_hint = ref_hint;
325 if (second_forward_idx < 0)
328 s->cur_frame.skip_mode_frame_idx[0] =
330 s->cur_frame.skip_mode_frame_idx[1] =
342 s->cur_frame.coded_lossless = 0;
346 s->cur_frame.coded_lossless = 1;
350 qindex = (
header->base_q_idx +
353 qindex =
header->base_q_idx;
358 s->cur_frame.coded_lossless = 0;
374 int ref_slot =
header->ref_frame_idx[
i];
375 int ref_order_hint =
s->ref[ref_slot].order_hint;
377 frame->order_hints[ref_name] = ref_order_hint;
379 frame->ref_frame_sign_bias[ref_name] = 0;
381 frame->ref_frame_sign_bias[ref_name] =
383 frame->order_hint) > 0;
398 memcpy(
dst, film_grain,
sizeof(*
dst));
412 s->raw_frame_header->tile_cols *
s->raw_frame_header->tile_rows;
413 if (
s->tile_num < cur_tile_num) {
421 s->tile_num = cur_tile_num;
430 uint16_t tile_num, tile_row, tile_col;
431 uint32_t
size = 0, size_bytes = 0;
436 s->tg_end = tile_group->
tg_end;
438 for (tile_num = tile_group->
tg_start; tile_num <= tile_group->tg_end; tile_num++) {
439 tile_row = tile_num /
s->raw_frame_header->tile_cols;
440 tile_col = tile_num %
s->raw_frame_header->tile_cols;
442 if (tile_num == tile_group->
tg_end) {
445 s->tile_group_info[tile_num].tile_row = tile_row;
446 s->tile_group_info[tile_num].tile_column = tile_col;
449 size_bytes =
s->raw_frame_header->tile_size_bytes_minus1 + 1;
453 for (
int i = 0;
i < size_bytes;
i++)
454 size |= bytestream2_get_byteu(&gb) << 8 *
i;
459 s->tile_group_info[tile_num].tile_size =
size;
461 s->tile_group_info[tile_num].tile_row = tile_row;
462 s->tile_group_info[tile_num].tile_column = tile_col;
540 #define HWACCEL_MAX (CONFIG_AV1_DXVA2_HWACCEL + \
541 CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
542 CONFIG_AV1_D3D12VA_HWACCEL + \
543 CONFIG_AV1_NVDEC_HWACCEL + \
544 CONFIG_AV1_VAAPI_HWACCEL + \
545 CONFIG_AV1_VDPAU_HWACCEL + \
546 CONFIG_AV1_VIDEOTOOLBOX_HWACCEL + \
547 CONFIG_AV1_VULKAN_HWACCEL)
555 #if CONFIG_AV1_DXVA2_HWACCEL
558 #if CONFIG_AV1_D3D11VA_HWACCEL
562 #if CONFIG_AV1_D3D12VA_HWACCEL
565 #if CONFIG_AV1_NVDEC_HWACCEL
568 #if CONFIG_AV1_VAAPI_HWACCEL
571 #if CONFIG_AV1_VDPAU_HWACCEL
574 #if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL
577 #if CONFIG_AV1_VULKAN_HWACCEL
582 #if CONFIG_AV1_DXVA2_HWACCEL
585 #if CONFIG_AV1_D3D11VA_HWACCEL
589 #if CONFIG_AV1_D3D12VA_HWACCEL
592 #if CONFIG_AV1_NVDEC_HWACCEL
595 #if CONFIG_AV1_VAAPI_HWACCEL
598 #if CONFIG_AV1_VDPAU_HWACCEL
601 #if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL
604 #if CONFIG_AV1_VULKAN_HWACCEL
609 #if CONFIG_AV1_VULKAN_HWACCEL
614 #if CONFIG_AV1_VULKAN_HWACCEL
619 #if CONFIG_AV1_VULKAN_HWACCEL
624 #if CONFIG_AV1_VULKAN_HWACCEL
629 #if CONFIG_AV1_VULKAN_HWACCEL
634 #if CONFIG_AV1_VULKAN_HWACCEL
639 #if CONFIG_AV1_VULKAN_HWACCEL
644 #if CONFIG_AV1_NVDEC_HWACCEL
649 #if CONFIG_AV1_NVDEC_HWACCEL
673 " hardware accelerated AV1 decoding.\n");
692 f->raw_frame_header =
NULL;
693 f->spatial_id =
f->temporal_id = 0;
694 memset(
f->skip_mode_frame_idx, 0,
695 2 *
sizeof(uint8_t));
696 memset(&
f->film_grain, 0,
sizeof(
f->film_grain));
697 f->coded_lossless = 0;
706 dst->raw_frame_header =
src->raw_frame_header;
711 src->hwaccel_picture_private);
713 dst->spatial_id =
src->spatial_id;
714 dst->temporal_id =
src->temporal_id;
715 memcpy(
dst->gm_invalid,
721 memcpy(
dst->gm_params,
724 memcpy(
dst->skip_mode_frame_idx,
725 src->skip_mode_frame_idx,
726 2 *
sizeof(uint8_t));
727 memcpy(&
dst->film_grain,
729 sizeof(
dst->film_grain));
730 dst->coded_lossless =
src->coded_lossless;
732 dst->order_hint =
src->order_hint;
733 memcpy(
dst->ref_frame_sign_bias,
src->ref_frame_sign_bias,
734 sizeof(
dst->ref_frame_sign_bias));
735 memcpy(
dst->order_hints,
src->order_hints,
736 sizeof(
dst->order_hints));
738 dst->force_integer_mv =
src->force_integer_mv;
756 while (
s->itut_t35_fifo &&
av_fifo_read(
s->itut_t35_fifo, &itut_t35, 1) >= 0)
819 int r_width =
header->render_width_minus_1 + 1;
820 int r_height =
header->render_height_minus_1 + 1;
873 if (!
s->itut_t35_fifo)
876 av_opt_set_int(
s->cbc->priv_data,
"operating_point",
s->operating_point, 0);
903 s->dovi.logctx = avctx;
904 s->dovi.cfg.dv_profile = 10;
906 if (sd && sd->
size >=
sizeof(
s->dovi.cfg))
935 switch (
header->frame_type) {
964 int ret, provider_code;
968 provider_code = bytestream2_get_be16(&gb);
969 switch (provider_code) {
971 uint32_t user_identifier = bytestream2_get_be32(&gb);
972 switch (user_identifier) {
973 case MKBETAG(
'G',
'A',
'9',
'4'): {
996 int provider_oriented_code = bytestream2_get_be16(&gb);
997 int application_identifier = bytestream2_get_byte(&gb);
1000 provider_oriented_code != 1 || application_identifier != 4)
1014 int provider_oriented_code = bytestream2_get_be32(&gb);
1016 provider_oriented_code != 0x800)
1052 for (
int i = 0;
i < 3;
i++) {
1075 light->
MaxCLL =
s->cll->max_cll;
1141 for (
int i = 0;
i < 24;
i++) {
1144 for (
int i = 0;
i < 25;
i++) {
1162 const AVFrame *srcframe =
s->cur_frame.f;
1167 if (
s->operating_point_idc &&
1168 av_log2(
s->operating_point_idc >> 8) >
s->cur_frame.spatial_id)
1191 #if FF_API_FRAME_PKT
1209 if (
header->refresh_frame_flags & (1 <<
i))
1223 s->cur_frame.raw_frame_header =
s->raw_frame_header;
1248 s->seq_data_ref->data,
s->seq_data_ref->size);
1259 "Failed to allocate space for current frame.\n");
1269 s->cur_frame.force_integer_mv =
1270 s->raw_frame_header->force_integer_mv ||
1283 for (
i =
s->nb_unit; i < s->current_obu.nb_units;
i++) {
1301 switch (unit->
type) {
1307 s->seq_data_ref->data = unit->
data;
1320 s->operating_point_idc =
s->raw_seq->operating_point_idc[
s->operating_point];
1326 if (
s->raw_frame_header)
1344 if (
s->raw_frame_header->show_existing_frame) {
1346 &
s->ref[
s->raw_frame_header->frame_to_show_map_idx]);
1350 if (
s->cur_frame.f) {
1358 s->raw_frame_header =
NULL;
1371 s->cur_frame.spatial_id =
header->spatial_id;
1372 s->cur_frame.temporal_id =
header->temporal_id;
1374 if (avctx->
hwaccel &&
s->cur_frame.f) {
1385 if (!
s->raw_frame_header) {
1400 if (avctx->
hwaccel &&
s->cur_frame.f) {
1405 "HW accel decode slice fail.\n");
1449 if (raw_tile_group && (
s->tile_num == raw_tile_group->
tg_end + 1)) {
1455 if (avctx->
hwaccel &&
s->cur_frame.f) {
1466 s->start_unit =
s->nb_unit;
1467 raw_tile_group =
NULL;
1468 s->raw_frame_header =
NULL;
1472 if (
s->cur_frame.f) {
1491 if ((
ret < 0 &&
ret !=
AVERROR(EAGAIN)) ||
s->current_obu.nb_units ==
i) {
1493 s->raw_frame_header =
NULL;
1496 s->nb_unit =
s->start_unit = 0;
1510 if (!
s->current_obu.nb_units) {
1523 s->nb_unit =
s->start_unit = 0;
1525 s->current_obu.nb_units);
1543 s->operating_point_idc = 0;
1544 s->nb_unit =
s->start_unit = 0;
1545 s->raw_frame_header =
NULL;
1559 #define OFFSET(x) offsetof(AV1DecContext, x)
1560 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1562 {
"operating_point",
"Select an operating point of the scalable bitstream",
1591 #if CONFIG_AV1_DXVA2_HWACCEL
1594 #if CONFIG_AV1_D3D11VA_HWACCEL
1597 #if CONFIG_AV1_D3D11VA2_HWACCEL
1600 #if CONFIG_AV1_D3D12VA_HWACCEL
1603 #if CONFIG_AV1_NVDEC_HWACCEL
1606 #if CONFIG_AV1_VAAPI_HWACCEL
1609 #if CONFIG_AV1_VDPAU_HWACCEL
1612 #if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL
1615 #if CONFIG_AV1_VULKAN_HWACCEL
static void update_reference_list(AVCodecContext *avctx)
#define HWACCEL_D3D12VA(codec)
const AVPacketSideData * ff_get_coded_side_data(const AVCodecContext *avctx, enum AVPacketSideDataType type)
Get side data of the given type from a decoding context.
uint32_t num_units_in_display_tick
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define FF_ENABLE_DEPRECATION_WARNINGS
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
void * content_ref
If content is reference counted, a RefStruct reference backing content.
AVPixelFormat
Pixel format.
static av_cold int av1_decode_init(AVCodecContext *avctx)
@ AV1_OBU_REDUNDANT_FRAME_HEADER
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
void * ff_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
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
static int decode_slice(AVCodecContext *c, void *arg)
uint8_t clip_to_restricted_range
void ff_dovi_ctx_unref(DOVIContext *s)
Completely reset a DOVIContext, preserving only logctx.
enum AVColorSpace colorspace
YUV colorspace type.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
static void order_hint_info(AV1DecContext *s)
static void coded_lossless_param(AV1DecContext *s)
av_cold void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
@ AV_FRAME_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
uint8_t point_cb_value[10]
void * content
Pointer to the decomposed form of this unit.
int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, int err_recognition)
Parse the contents of a Dolby Vision RPU and update the parsed values in the DOVIContext struct.
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
uint8_t uv_points[2][10][2]
static int get_current_frame(AVCodecContext *avctx)
unsigned MaxCLL
Max content light level (cd/m^2).
This structure describes decoded (raw) audio or video data.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
static int set_context_with_sequence(AVCodecContext *avctx, const AV1RawSequenceHeader *seq)
#define HWACCEL_DXVA2(codec)
uint8_t point_y_value[14]
@ AVCOL_RANGE_JPEG
Full range content.
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
#define HWACCEL_D3D11VA2(codec)
int ff_progress_frame_get_buffer(AVCodecContext *avctx, ProgressFrame *f, int flags)
This function sets up the ProgressFrame, i.e.
#define AV_PIX_FMT_YUV420P10
enum AVColorSpace color_space
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
CodedBitstreamUnitType type
Codec-specific type of this unit.
#define FF_HW_SIMPLE_CALL(avctx, function)
@ AV1_METADATA_TYPE_ITUT_T35
static const CodedBitstreamUnitType decompose_unit_types[]
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
@ AV1_OBU_TEMPORAL_DELIMITER
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
static int get_relative_dist(const AV1RawSequenceHeader *seq, unsigned int a, unsigned int b)
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.
static void av1_frame_replace(AV1Frame *dst, const AV1Frame *src)
enum AVColorTransferCharacteristic color_trc
uint64_t seed
Seed to use for the synthesis process, if the codec allows for it.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Coded bitstream unit structure.
av_cold void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
static uint64_t round_two(uint64_t x, uint16_t n)
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
uint8_t chroma_scaling_from_luma
uint8_t ar_coeffs_cr_plus_128[25]
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
AVCodec p
The public AVCodec.
static const AVOption av1_options[]
enum AVDiscard skip_frame
Skip decoding for selected frames.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int grain_scale_shift
Signals the down shift applied to the generated gaussian numbers during synthesis.
uint8_t point_cr_scaling[10]
static uint32_t inverse_recenter(int r, uint32_t v)
#define HWACCEL_VDPAU(codec)
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 vf type
uint8_t ar_coeff_shift_minus_6
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
int limit_output_range
Signals to clip to limited color levels after film grain application.
@ AV1_WARP_MODEL_IDENTITY
int num_y_points
Number of points, and the scale and value for each point of the piecewise linear scaling function for...
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static int64_t round_two_signed(int64_t x, uint16_t n)
#define ITU_T_T35_PROVIDER_CODE_ATSC
int ff_frame_new_side_data_from_buf(const AVCodecContext *avctx, AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef **buf)
Similar to ff_frame_new_side_data, but using an existing buffer ref.
This structure describes how to handle film grain synthesis for AOM codecs.
#define AV_PIX_FMT_YUV444P10
#define FF_CODEC_CAP_USES_PROGRESSFRAMES
The decoder might make use of the ProgressFrame API.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
int width
Intended display resolution.
uint8_t grain_scaling_minus_8
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
static void global_motion_params(AV1DecContext *s)
update gm type/params, since cbs already implemented part of this function, so we don't need to full ...
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private)
Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it.
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
static enum AVPixelFormat pix_fmt
AVFilmGrainParams * av_film_grain_params_create_side_data(AVFrame *frame)
Allocate a complete AVFilmGrainParams and add it to the frame.
static av_cold int av1_decode_free(AVCodecContext *avctx)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV1_METADATA_TYPE_HDR_CLL
static enum AVPixelFormat pix_fmts[]
static int init_tile_data(AV1DecContext *s)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void ff_progress_frame_unref(ProgressFrame *f)
Give up a reference to the underlying frame contained in a ProgressFrame and reset the ProgressFrame,...
const AVProfile ff_av1_profiles[]
static enum AVPixelFormat get_sw_pixel_format(void *logctx, const AV1RawSequenceHeader *seq)
uint8_t transfer_characteristics
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
@ AV1_WARP_PARAM_REDUCE_BITS
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_group)
static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame, const AV1RawMetadataITUTT35 *itut_t35)
#define CODEC_LONG_NAME(str)
int ff_decode_mastering_display_new(const AVCodecContext *avctx, AVFrame *frame, AVMasteringDisplayMetadata **mdm)
Wrapper around av_mastering_display_metadata_create_side_data(), which rejects side data overridden b...
#define FF_CODEC_PROPERTY_FILM_GRAIN
static void load_grain_params(AV1DecContext *s)
#define AV_PIX_FMT_GRAY10
const FFCodec ff_av1_decoder
@ AVDISCARD_ALL
discard all
int ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size)
Parse a data array for ATSC A53 Part 4 Closed Captions and store them in an AVBufferRef.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
@ AV1_GM_ABS_TRANS_ONLY_BITS
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Rational number (pair of numerator and denominator).
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
struct AVCodecInternal * internal
Private context used for internal data.
static void av1_frame_unref(AV1Frame *f)
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PICTURE_TYPE_I
Intra.
uint8_t chroma_sample_position
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
void(* flush)(AVBSFContext *ctx)
static int update_context_with_frame_header(AVCodecContext *avctx, const AV1RawFrameHeader *header)
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
#define AV_PIX_FMT_YUV422P10
static void skip_mode_params(AV1DecContext *s)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
int subsampling_x
Intended subsampling ratio, or 0 for luma-only streams.
#define FF_HW_HAS_CB(avctx, function)
int level
Encoding level descriptor.
@ AV_PICTURE_TYPE_SP
Switching Predicted.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static av_always_inline int bytestream2_tell(GetByteContext *g)
@ AV1_WARP_MODEL_TRANSLATION
static int16_t resolve_divisor(uint32_t d, uint16_t *shift)
Resolve divisor process.
int num_uv_points[2]
If chroma_scaling_from_luma is set to 0, signals the chroma scaling function parameters.
#define ITU_T_T35_PROVIDER_CODE_DOLBY
uint8_t point_cr_value[10]
@ AVDISCARD_NONKEY
discard all frames except keyframes
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame)
Attach the decoded AVDOVIMetadata as side data to an AVFrame.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static uint32_t decode_unsigned_subexp_with_ref(uint32_t sub_exp, int mx, int r)
uint32_t num_ticks_per_picture_minus_1
static int shift(int a, int b)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define AV_PIX_FMT_YUV422P12
AV1RawSequenceHeader sequence_header
static AVRational av_make_q(int num, int den)
Create an AVRational.
#define MKBETAG(a, b, c, d)
#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...
#define AV_PIX_FMT_YUV444P12
This structure describes how to handle film grain synthesis in video for specific codecs.
@ AV1_OBU_SEQUENCE_HEADER
AVRational ff_av1_framerate(int64_t ticks_per_frame, int64_t units_per_tick, int64_t time_scale)
static const uint8_t header[24]
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
@ AV1_METADATA_TYPE_HDR_MDCV
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
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
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
#define HWACCEL_D3D11VA(codec)
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
uint8_t grain_scale_shift
#define HWACCEL_NVDEC(codec)
int8_t ar_coeffs_y[24]
Luma auto-regression coefficients.
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
AV1RawFrameHeader frame_header
int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecContext *avctx)
static int av1_receive_frame(AVCodecContext *avctx, AVFrame *frame)
static void av1_decode_flush(AVCodecContext *avctx)
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
@ AV_PIX_FMT_VIDEOTOOLBOX
hardware decoding through Videotoolbox
static int export_film_grain(AVCodecContext *avctx, AVFrame *frame)
enum AVColorPrimaries color_primaries
@ AVDISCARD_NONINTRA
discard all non intra frames
AVBufferRef * data_ref
A reference to the buffer containing data.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
unsigned properties
Properties of the stream that gets decoded.
static av_always_inline av_const double round(double x)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static const uint16_t div_lut[AV1_DIV_LUT_NUM]
< same with Div_Lut defined in spec 7.11.3.7
AVPacket * in_pkt
This packet is used to hold the packet given to decoders implementing the .decode API; it is unused b...
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int scaling_shift
Specifies the shift applied to the chroma components.
const char * name
Name of the codec implementation.
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
const uint8_t * buffer_end
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define HWACCEL_VIDEOTOOLBOX(codec)
AV1RawTileGroup tile_group
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static const AVClass av1_class
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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
int ff_decode_content_light_new(const AVCodecContext *avctx, AVFrame *frame, AVContentLightMetadata **clm)
Wrapper around av_content_light_metadata_create_side_data(), which rejects side data overridden by th...
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
uint8_t film_grain_params_ref_idx
static void read_global_param(AV1DecContext *s, int type, int ref, int idx)
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
#define AV_PIX_FMT_YUV420P12
void ff_progress_frame_replace(ProgressFrame *dst, const ProgressFrame *src)
Do nothing if dst and src already refer to the same AVFrame; otherwise unreference dst and if src is ...
#define HWACCEL_VULKAN(codec)
main external API structure.
static uint8_t get_shear_params_valid(AV1DecContext *s, int idx)
check if global motion params is valid.
int ar_coeff_lag
Specifies the auto-regression lag.
#define FF_CODEC_RECEIVE_FRAME_CB(func)
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
int uv_offset[2]
Offset used for component scaling function.
#define FF_HW_CALL(avctx, function,...)
@ AV_OPT_TYPE_INT
Underlying C type is int.
static int export_metadata(AVCodecContext *avctx, AVFrame *frame)
int uv_mult[2]
Specifies the luma/chroma multipliers for the index to the component scaling function.
static int ref[MAX_W *MAX_W]
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
uint8_t ar_coeffs_cb_plus_128[25]
uint8_t ar_coeffs_y_plus_128[24]
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
int ff_cbs_read_packet(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
Read the data bitstream from a packet into a fragment, then split into units and decompose.
uint8_t matrix_coefficients
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
enum AVColorRange color_range
Intended video signal characteristics.
@ AV1_GM_TRANS_ONLY_PREC_BITS
uint8_t point_y_scaling[14]
#define FF_DISABLE_DEPRECATION_WARNINGS
int overlap_flag
Signals whether to overlap film grain blocks.
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
A reference to a data buffer.
union AVFilmGrainParams::@434 codec
Additional fields may be added both here and in any structure included.
uint8_t point_cb_scaling[10]
AV1RawTileGroup tile_group
#define ITU_T_T35_COUNTRY_CODE_US
@ AV1_WARPEDMODEL_PREC_BITS
static int32_t decode_signed_subexp_with_ref(uint32_t sub_exp, int low, int high, int r)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
static int get_pixel_format(AVCodecContext *avctx)
static const int16_t alpha[]
#define ITU_T_T35_PROVIDER_CODE_SMTPE
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
@ AV1_MAX_OPERATING_POINTS
int64_t pos
byte position in stream, -1 if unknown
#define HWACCEL_VAAPI(codec)
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static int FUNC() sequence_header(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawSequenceHeader *current)
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
#define AV_PIX_FMT_GRAY12
int chroma_scaling_from_luma
Signals whether to derive the chroma scaling function from the luma.
av_cold void ff_cbs_flush(CodedBitstreamContext *ctx)
Reset all internal state in a context.
@ AV_FILM_GRAIN_PARAMS_AV1
The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
enum AVFilmGrainParamsType type
Specifies the codec for which this structure is valid.
static int set_output_frame(AVCodecContext *avctx, AVFrame *frame)
void ff_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define AV_CODEC_EXPORT_DATA_FILM_GRAIN
Decoding only.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
int ar_coeff_shift
Specifies the range of the auto-regressive coefficients.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int8_t ar_coeffs_uv[2][25]
Chroma auto-regression coefficients.