FFmpeg
Macros | Functions | Variables
av1dec.c File Reference
#include "libavutil/film_grain_params.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "av1dec.h"
#include "bytestream.h"
#include "hwconfig.h"
#include "internal.h"
#include "profiles.h"

Go to the source code of this file.

Macros

#define HWACCEL_MAX
 
#define OFFSET(x)   offsetof(AV1DecContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static uint32_t inverse_recenter (int r, uint32_t v)
 
static uint32_t decode_unsigned_subexp_with_ref (uint32_t sub_exp, int mx, int r)
 
static int32_t decode_signed_subexp_with_ref (uint32_t sub_exp, int low, int high, int r)
 
static void read_global_param (AV1DecContext *s, int type, int ref, int idx)
 
static uint64_t round_two (uint64_t x, uint16_t n)
 
static int64_t round_two_signed (int64_t x, uint16_t n)
 
static int16_t resolve_divisor (uint32_t d, uint16_t *shift)
 Resolve divisor process. More...
 
static uint8_t get_shear_params_valid (AV1DecContext *s, int idx)
 check if global motion params is valid. More...
 
static void global_motion_params (AV1DecContext *s)
 update gm type/params, since cbs already implemented part of this funcation, so we don't need to full implement spec. More...
 
static int get_relative_dist (const AV1RawSequenceHeader *seq, unsigned int a, unsigned int b)
 
static void skip_mode_params (AV1DecContext *s)
 
static void coded_lossless_param (AV1DecContext *s)
 
static void load_grain_params (AV1DecContext *s)
 
static int init_tile_data (AV1DecContext *s)
 
static int get_tiles_info (AVCodecContext *avctx, const AV1RawTileGroup *tile_group)
 
static int get_pixel_format (AVCodecContext *avctx)
 
static void av1_frame_unref (AVCodecContext *avctx, AV1Frame *f)
 
static int av1_frame_ref (AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *src)
 
static av_cold int av1_decode_free (AVCodecContext *avctx)
 
static int set_context_with_sequence (AVCodecContext *avctx, const AV1RawSequenceHeader *seq)
 
static int update_context_with_frame_header (AVCodecContext *avctx, const AV1RawFrameHeader *header)
 
static av_cold int av1_decode_init (AVCodecContext *avctx)
 
static int av1_frame_alloc (AVCodecContext *avctx, AV1Frame *f)
 
static int export_film_grain (AVCodecContext *avctx, AVFrame *frame)
 
static int set_output_frame (AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt, int *got_frame)
 
static int update_reference_list (AVCodecContext *avctx)
 
static int get_current_frame (AVCodecContext *avctx)
 
static int av1_decode_frame (AVCodecContext *avctx, void *frame, int *got_frame, AVPacket *pkt)
 
static void av1_decode_flush (AVCodecContext *avctx)
 

Variables

static const uint16_t div_lut [AV1_DIV_LUT_NUM]
 < same with Div_Lut defined in spec 7.11.3.7 More...
 
static const AVOption av1_options []
 
static const AVClass av1_class
 
const AVCodec ff_av1_decoder
 

Macro Definition Documentation

◆ HWACCEL_MAX

#define HWACCEL_MAX
Value:
(CONFIG_AV1_DXVA2_HWACCEL + \
CONFIG_AV1_D3D11VA_HWACCEL * 2 + \
CONFIG_AV1_NVDEC_HWACCEL + \
CONFIG_AV1_VAAPI_HWACCEL)

◆ OFFSET

#define OFFSET (   x)    offsetof(AV1DecContext, x)

Definition at line 1222 of file av1dec.c.

◆ VD

Definition at line 1223 of file av1dec.c.

Function Documentation

◆ inverse_recenter()

static uint32_t inverse_recenter ( int  r,
uint32_t  v 
)
static

Definition at line 59 of file av1dec.c.

Referenced by decode_unsigned_subexp_with_ref().

◆ decode_unsigned_subexp_with_ref()

static uint32_t decode_unsigned_subexp_with_ref ( uint32_t  sub_exp,
int  mx,
int  r 
)
static

Definition at line 69 of file av1dec.c.

Referenced by decode_signed_subexp_with_ref().

◆ decode_signed_subexp_with_ref()

static int32_t decode_signed_subexp_with_ref ( uint32_t  sub_exp,
int  low,
int  high,
int  r 
)
static

Definition at line 79 of file av1dec.c.

Referenced by read_global_param().

◆ read_global_param()

static void read_global_param ( AV1DecContext s,
int  type,
int  ref,
int  idx 
)
static

Definition at line 86 of file av1dec.c.

Referenced by global_motion_params().

◆ round_two()

static uint64_t round_two ( uint64_t  x,
uint16_t  n 
)
static

Definition at line 128 of file av1dec.c.

Referenced by resolve_divisor(), and round_two_signed().

◆ round_two_signed()

static int64_t round_two_signed ( int64_t  x,
uint16_t  n 
)
static

Definition at line 135 of file av1dec.c.

Referenced by get_shear_params_valid().

◆ resolve_divisor()

static int16_t resolve_divisor ( uint32_t  d,
uint16_t *  shift 
)
static

Resolve divisor process.

see spec 7.11.3.7

Definition at line 144 of file av1dec.c.

Referenced by get_shear_params_valid().

◆ get_shear_params_valid()

static uint8_t get_shear_params_valid ( AV1DecContext s,
int  idx 
)
static

check if global motion params is valid.

see spec 7.11.3.6

Definition at line 164 of file av1dec.c.

Referenced by global_motion_params().

◆ global_motion_params()

static void global_motion_params ( AV1DecContext s)
static

update gm type/params, since cbs already implemented part of this funcation, so we don't need to full implement spec.

Definition at line 196 of file av1dec.c.

Referenced by get_current_frame().

◆ get_relative_dist()

static int get_relative_dist ( const AV1RawSequenceHeader seq,
unsigned int  a,
unsigned int  b 
)
static

Definition at line 245 of file av1dec.c.

Referenced by skip_mode_params().

◆ skip_mode_params()

static void skip_mode_params ( AV1DecContext s)
static

Definition at line 253 of file av1dec.c.

Referenced by get_current_frame().

◆ coded_lossless_param()

static void coded_lossless_param ( AV1DecContext s)
static

Definition at line 317 of file av1dec.c.

Referenced by get_current_frame().

◆ load_grain_params()

static void load_grain_params ( AV1DecContext s)
static

Definition at line 347 of file av1dec.c.

Referenced by get_current_frame().

◆ init_tile_data()

static int init_tile_data ( AV1DecContext s)
static

Definition at line 367 of file av1dec.c.

Referenced by get_current_frame().

◆ get_tiles_info()

static int get_tiles_info ( AVCodecContext avctx,
const AV1RawTileGroup tile_group 
)
static

Definition at line 385 of file av1dec.c.

Referenced by av1_decode_frame().

◆ get_pixel_format()

static int get_pixel_format ( AVCodecContext avctx)
static

check if the HW accel is inited correctly. If not, return un-implemented. Since now the av1 decoder doesn't support native decode, if it will be implemented in the future, need remove this check.

Definition at line 430 of file av1dec.c.

Referenced by av1_decode_frame().

◆ av1_frame_unref()

static void av1_frame_unref ( AVCodecContext avctx,
AV1Frame f 
)
static

◆ av1_frame_ref()

static int av1_frame_ref ( AVCodecContext avctx,
AV1Frame dst,
const AV1Frame src 
)
static

Definition at line 584 of file av1dec.c.

Referenced by av1_decode_frame(), and update_reference_list().

◆ av1_decode_free()

static av_cold int av1_decode_free ( AVCodecContext avctx)
static

Definition at line 634 of file av1dec.c.

◆ set_context_with_sequence()

static int set_context_with_sequence ( AVCodecContext avctx,
const AV1RawSequenceHeader seq 
)
static

Definition at line 655 of file av1dec.c.

Referenced by av1_decode_frame(), and av1_decode_init().

◆ update_context_with_frame_header()

static int update_context_with_frame_header ( AVCodecContext avctx,
const AV1RawFrameHeader header 
)
static

Definition at line 704 of file av1dec.c.

Referenced by av1_frame_alloc().

◆ av1_decode_init()

static av_cold int av1_decode_init ( AVCodecContext avctx)
static

Definition at line 734 of file av1dec.c.

◆ av1_frame_alloc()

static int av1_frame_alloc ( AVCodecContext avctx,
AV1Frame f 
)
static

Definition at line 793 of file av1dec.c.

Referenced by get_current_frame().

◆ export_film_grain()

static int export_film_grain ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 844 of file av1dec.c.

Referenced by set_output_frame().

◆ set_output_frame()

static int set_output_frame ( AVCodecContext avctx,
AVFrame frame,
const AVPacket pkt,
int got_frame 
)
static

Definition at line 904 of file av1dec.c.

Referenced by av1_decode_frame().

◆ update_reference_list()

static int update_reference_list ( AVCodecContext avctx)
static

Definition at line 937 of file av1dec.c.

Referenced by av1_decode_frame().

◆ get_current_frame()

static int get_current_frame ( AVCodecContext avctx)
static

Definition at line 956 of file av1dec.c.

Referenced by av1_decode_frame().

◆ av1_decode_frame()

static int av1_decode_frame ( AVCodecContext avctx,
void *  frame,
int got_frame,
AVPacket pkt 
)
static

Definition at line 998 of file av1dec.c.

◆ av1_decode_flush()

static void av1_decode_flush ( AVCodecContext avctx)
static

Definition at line 1207 of file av1dec.c.

Variable Documentation

◆ div_lut

const uint16_t div_lut[AV1_DIV_LUT_NUM]
static
Initial value:
= {
16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768,
15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142,
15087, 15033, 14980, 14926, 14873, 14821, 14769, 14717, 14665, 14614, 14564,
14513, 14463, 14413, 14364, 14315, 14266, 14218, 14170, 14122, 14075, 14028,
13981, 13935, 13888, 13843, 13797, 13752, 13707, 13662, 13618, 13574, 13530,
13487, 13443, 13400, 13358, 13315, 13273, 13231, 13190, 13148, 13107, 13066,
13026, 12985, 12945, 12906, 12866, 12827, 12788, 12749, 12710, 12672, 12633,
12596, 12558, 12520, 12483, 12446, 12409, 12373, 12336, 12300, 12264, 12228,
12193, 12157, 12122, 12087, 12053, 12018, 11984, 11950, 11916, 11882, 11848,
11815, 11782, 11749, 11716, 11683, 11651, 11619, 11586, 11555, 11523, 11491,
11460, 11429, 11398, 11367, 11336, 11305, 11275, 11245, 11215, 11185, 11155,
11125, 11096, 11067, 11038, 11009, 10980, 10951, 10923, 10894, 10866, 10838,
10810, 10782, 10755, 10727, 10700, 10673, 10645, 10618, 10592, 10565, 10538,
10512, 10486, 10460, 10434, 10408, 10382, 10356, 10331, 10305, 10280, 10255,
10230, 10205, 10180, 10156, 10131, 10107, 10082, 10058, 10034, 10010, 9986,
9963, 9939, 9916, 9892, 9869, 9846, 9823, 9800, 9777, 9754, 9732,
9709, 9687, 9664, 9642, 9620, 9598, 9576, 9554, 9533, 9511, 9489,
9468, 9447, 9425, 9404, 9383, 9362, 9341, 9321, 9300, 9279, 9259,
9239, 9218, 9198, 9178, 9158, 9138, 9118, 9098, 9079, 9059, 9039,
9020, 9001, 8981, 8962, 8943, 8924, 8905, 8886, 8867, 8849, 8830,
8812, 8793, 8775, 8756, 8738, 8720, 8702, 8684, 8666, 8648, 8630,
8613, 8595, 8577, 8560, 8542, 8525, 8508, 8490, 8473, 8456, 8439,
8422, 8405, 8389, 8372, 8355, 8339, 8322, 8306, 8289, 8273, 8257,
8240, 8224, 8208, 8192
}

< same with Div_Lut defined in spec 7.11.3.7

Definition at line 32 of file av1dec.c.

Referenced by resolve_divisor().

◆ av1_options

const AVOption av1_options[]
static
Initial value:
= {
{ "operating_point", "Select an operating point of the scalable bitstream",
OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, AV1_MAX_OPERATING_POINTS - 1, VD },
{ NULL }
}

Definition at line 1224 of file av1dec.c.

◆ av1_class

const AVClass av1_class
static
Initial value:
= {
.class_name = "AV1 decoder",
.item_name = av_default_item_name,
.option = av1_options,
}

Definition at line 1230 of file av1dec.c.

◆ ff_av1_decoder

const AVCodec ff_av1_decoder

Definition at line 1237 of file av1dec.c.

AV1_MAX_OPERATING_POINTS
@ AV1_MAX_OPERATING_POINTS
Definition: av1.h:73
av1_options
static const AVOption av1_options[]
Definition: av1dec.c:1224
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
VD
#define VD
Definition: av1dec.c:1223
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
OFFSET
#define OFFSET(x)
Definition: av1dec.c:1222