FFmpeg
Data Structures | Macros | Typedefs | Functions | Variables
dec.c File Reference
#include "libavcodec/codec_internal.h"
#include "libavcodec/decode.h"
#include "libavcodec/profiles.h"
#include "libavcodec/refstruct.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "libavutil/thread.h"
#include "dec.h"
#include "ctu.h"
#include "data.h"
#include "refs.h"
#include "thread.h"

Go to the source code of this file.

Data Structures

struct  Tab
 
struct  TabList
 

Macros

#define TAB_MAX   32
 
#define TL_ADD(t, s)
 
#define VVC_MAX_DELAYED_FRAMES   16
 

Typedefs

typedef void(* tl_init_fn) (TabList *l, VVCFrameContext *fc)
 
typedef int(* smvd_find_fxn) (const int idx, const int diff, const int old_diff)
 

Functions

static void tl_init (TabList *l, const int zero, const int realloc)
 
static int tl_free (TabList *l)
 
static int tl_create (TabList *l)
 
static int tl_zero (TabList *l)
 
static void ctu_nz_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_cb_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_cb_nz_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_pu_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_pu_nz_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_tu_tl_init (TabList *l, VVCFrameContext *fc)
 
static void min_tu_nz_tl_init (TabList *l, VVCFrameContext *fc)
 
static void pixel_buffer_nz_tl_init (TabList *l, VVCFrameContext *fc)
 
static void msm_tl_init (TabList *l, VVCFrameContext *fc)
 
static void ispmf_tl_init (TabList *l, VVCFrameContext *fc)
 
static void ibc_tl_init (TabList *l, VVCFrameContext *fc)
 
static int frame_context_for_each_tl (VVCFrameContext *fc, int(*unary_fn)(TabList *l))
 
static void free_cus (VVCFrameContext *fc)
 
static void pic_arrays_free (VVCFrameContext *fc)
 
static int pic_arrays_init (VVCContext *s, VVCFrameContext *fc)
 
int ff_vvc_per_frame_init (VVCFrameContext *fc)
 
static int min_positive (const int idx, const int diff, const int min_diff)
 
static int max_negtive (const int idx, const int diff, const int max_diff)
 
static int8_t smvd_find (const VVCFrameContext *fc, const SliceContext *sc, int lx, smvd_find_fxn find)
 
static void smvd_ref_idx (const VVCFrameContext *fc, SliceContext *sc)
 
static void eps_free (SliceContext *slice)
 
static void slices_free (VVCFrameContext *fc)
 
static int slices_realloc (VVCFrameContext *fc)
 
static int ep_init_cabac_decoder (SliceContext *sc, const int index, const H2645NAL *nal, GetBitContext *gb, const CodedBitstreamUnit *unit)
 
static int slice_init_entry_points (SliceContext *sc, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
 
static VVCFrameContextget_frame_context (const VVCContext *s, const VVCFrameContext *fc, const int delta)
 
static int ref_frame (VVCFrame *dst, const VVCFrame *src)
 
static av_cold void frame_context_free (VVCFrameContext *fc)
 
static av_cold int frame_context_init (VVCFrameContext *fc, AVCodecContext *avctx)
 
static int frame_context_setup (VVCFrameContext *fc, VVCContext *s)
 
static int frame_start (VVCContext *s, VVCFrameContext *fc, SliceContext *sc)
 
static int slice_start (SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
 
static void export_frame_params (VVCContext *s, const VVCFrameContext *fc)
 
static int frame_setup (VVCFrameContext *fc, VVCContext *s)
 
static int decode_slice (VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
 
static int decode_nal_unit (VVCContext *s, VVCFrameContext *fc, const H2645NAL *nal, const CodedBitstreamUnit *unit)
 
static int decode_nal_units (VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt)
 
static int set_output_format (const VVCContext *s, const AVFrame *output)
 
static int wait_delayed_frame (VVCContext *s, AVFrame *output, int *got_output)
 
static int submit_frame (VVCContext *s, VVCFrameContext *fc, AVFrame *output, int *got_output)
 
static int get_decoded_frame (VVCContext *s, AVFrame *output, int *got_output)
 
static int vvc_decode_frame (AVCodecContext *avctx, AVFrame *output, int *got_output, AVPacket *avpkt)
 
static av_cold void vvc_decode_flush (AVCodecContext *avctx)
 
static av_cold int vvc_decode_free (AVCodecContext *avctx)
 
static av_cold void init_default_scale_m (void)
 
static av_cold int vvc_decode_init (AVCodecContext *avctx)
 

Variables

const FFCodec ff_vvc_decoder
 

Macro Definition Documentation

◆ TAB_MAX

#define TAB_MAX   32

Definition at line 37 of file dec.c.

◆ TL_ADD

#define TL_ADD (   t,
  s 
)
Value:
do { \
av_assert0(l->nb_tabs < TAB_MAX); \
l->tabs[l->nb_tabs].tab = (void**)&fc->tab.t; \
l->tabs[l->nb_tabs].size = sizeof(*fc->tab.t) * (s); \
l->nb_tabs++; \
} while (0)

Definition at line 52 of file dec.c.

◆ VVC_MAX_DELAYED_FRAMES

#define VVC_MAX_DELAYED_FRAMES   16

Definition at line 1054 of file dec.c.

Typedef Documentation

◆ tl_init_fn

typedef void(* tl_init_fn) (TabList *l, VVCFrameContext *fc)

Definition at line 316 of file dec.c.

◆ smvd_find_fxn

typedef int(* smvd_find_fxn) (const int idx, const int diff, const int old_diff)

Definition at line 428 of file dec.c.

Function Documentation

◆ tl_init()

static void tl_init ( TabList l,
const int  zero,
const int  realloc 
)
static

◆ tl_free()

static int tl_free ( TabList l)
static

Definition at line 66 of file dec.c.

Referenced by pic_arrays_free(), and tl_create().

◆ tl_create()

static int tl_create ( TabList l)
static

Definition at line 74 of file dec.c.

Referenced by pic_arrays_init().

◆ tl_zero()

static int tl_zero ( TabList l)
static

Definition at line 89 of file dec.c.

Referenced by ff_vvc_per_frame_init().

◆ ctu_nz_tl_init()

static void ctu_nz_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 100 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_cb_tl_init()

static void min_cb_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 119 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_cb_nz_tl_init()

static void min_cb_nz_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 134 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_pu_tl_init()

static void min_pu_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 158 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_pu_nz_tl_init()

static void min_pu_nz_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 169 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_tu_tl_init()

static void min_tu_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 182 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ min_tu_nz_tl_init()

static void min_tu_nz_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 203 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ pixel_buffer_nz_tl_init()

static void pixel_buffer_nz_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 228 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ msm_tl_init()

static void msm_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 264 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ ispmf_tl_init()

static void ispmf_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 278 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ ibc_tl_init()

static void ibc_tl_init ( TabList l,
VVCFrameContext fc 
)
static

Definition at line 291 of file dec.c.

Referenced by frame_context_for_each_tl().

◆ frame_context_for_each_tl()

static int frame_context_for_each_tl ( VVCFrameContext fc,
int(*)(TabList *l)  unary_fn 
)
static

Definition at line 318 of file dec.c.

Referenced by ff_vvc_per_frame_init(), pic_arrays_free(), and pic_arrays_init().

◆ free_cus()

static void free_cus ( VVCFrameContext fc)
static

Definition at line 346 of file dec.c.

Referenced by pic_arrays_free(), and pic_arrays_init().

◆ pic_arrays_free()

static void pic_arrays_free ( VVCFrameContext fc)
static

Definition at line 354 of file dec.c.

Referenced by frame_context_free().

◆ pic_arrays_init()

static int pic_arrays_init ( VVCContext s,
VVCFrameContext fc 
)
static

Definition at line 364 of file dec.c.

Referenced by frame_context_setup().

◆ ff_vvc_per_frame_init()

int ff_vvc_per_frame_init ( VVCFrameContext fc)

Definition at line 413 of file dec.c.

Referenced by run_init().

◆ min_positive()

static int min_positive ( const int  idx,
const int  diff,
const int  min_diff 
)
static

Definition at line 418 of file dec.c.

Referenced by smvd_ref_idx().

◆ max_negtive()

static int max_negtive ( const int  idx,
const int  diff,
const int  max_diff 
)
static

Definition at line 423 of file dec.c.

Referenced by smvd_ref_idx().

◆ smvd_find()

static int8_t smvd_find ( const VVCFrameContext fc,
const SliceContext sc,
int  lx,
smvd_find_fxn  find 
)
static

Definition at line 430 of file dec.c.

Referenced by smvd_ref_idx().

◆ smvd_ref_idx()

static void smvd_ref_idx ( const VVCFrameContext fc,
SliceContext sc 
)
static

Definition at line 449 of file dec.c.

Referenced by slice_start().

◆ eps_free()

static void eps_free ( SliceContext slice)
static

Definition at line 462 of file dec.c.

Referenced by slice_init_entry_points(), and slices_free().

◆ slices_free()

static void slices_free ( VVCFrameContext fc)
static

Definition at line 468 of file dec.c.

Referenced by frame_context_free().

◆ slices_realloc()

static int slices_realloc ( VVCFrameContext fc)
static

Definition at line 486 of file dec.c.

Referenced by decode_slice().

◆ ep_init_cabac_decoder()

static int ep_init_cabac_decoder ( SliceContext sc,
const int  index,
const H2645NAL nal,
GetBitContext gb,
const CodedBitstreamUnit unit 
)
static

Definition at line 512 of file dec.c.

Referenced by slice_init_entry_points().

◆ slice_init_entry_points()

static int slice_init_entry_points ( SliceContext sc,
VVCFrameContext fc,
const H2645NAL nal,
const CodedBitstreamUnit unit 
)
static

Definition at line 545 of file dec.c.

Referenced by decode_slice().

◆ get_frame_context()

static VVCFrameContext* get_frame_context ( const VVCContext s,
const VVCFrameContext fc,
const int  delta 
)
static

◆ ref_frame()

static int ref_frame ( VVCFrame dst,
const VVCFrame src 
)
static

◆ frame_context_free()

static av_cold void frame_context_free ( VVCFrameContext fc)
static

Definition at line 628 of file dec.c.

Referenced by vvc_decode_free().

◆ frame_context_init()

static av_cold int frame_context_init ( VVCFrameContext fc,
AVCodecContext avctx 
)
static

Definition at line 646 of file dec.c.

Referenced by vvc_decode_init().

◆ frame_context_setup()

static int frame_context_setup ( VVCFrameContext fc,
VVCContext s 
)
static

Definition at line 671 of file dec.c.

Referenced by frame_setup().

◆ frame_start()

static int frame_start ( VVCContext s,
VVCFrameContext fc,
SliceContext sc 
)
static

Definition at line 703 of file dec.c.

Referenced by slice_start().

◆ slice_start()

static int slice_start ( SliceContext sc,
VVCContext s,
VVCFrameContext fc,
const CodedBitstreamUnit unit,
const int  is_first_slice 
)
static

Definition at line 737 of file dec.c.

Referenced by allocate_plane(), average_slice16(), average_slice8(), bilateralo_planes(), blend_frame_partial(), blend_slice_packed_rgb(), blur_planes(), box_slice(), cas_slice16(), cas_slice8(), check_sobel(), clear_slice16(), clear_slice8(), color_balance16(), color_balance16_p(), color_balance8(), color_balance8_p(), colorcontrast_slice16(), colorcontrast_slice16p(), colorcontrast_slice8(), colorcontrast_slice8p(), colorcorrect_slice16(), colorcorrect_slice8(), colorize_slice16(), colorize_slice8(), colorizey_slice16(), colorizey_slice8(), colormap_slice(), compute_images_identity(), compute_images_msad(), compute_images_mse(), compute_sat_hue_metrics16(), compute_sat_hue_metrics8(), convert_frame(), convert_frame_partial(), copy_horizontal(), copy_vertical(), correct_frame(), decode_frame(), decode_slice(), denoise(), diagonal_transformation(), displace_packed(), displace_planar(), distortion_correction_filter_slice(), do_backgroundkey16_slice(), do_backgroundkey_slice(), do_chromahold16_slice(), do_chromahold_slice(), do_chromakey16_slice(), do_chromakey_slice(), do_despill_slice(), do_hsvhold16_slice(), do_hsvhold_slice(), do_hsvkey16_slice(), do_hsvkey_slice(), do_lumakey_slice16(), do_lumakey_slice8(), do_slice(), epx2_slice(), epx3_slice(), exposure_slice(), fade(), ff_sws_slice_worker(), filter16_brng(), filter16_tout(), filter16_vrep(), filter8_brng(), filter8_tout(), filter8_vrep(), filter_color(), filter_color2(), filter_horizontally(), filter_mono(), filter_postscale(), filter_rgb(), filter_rgb_planar(), filter_slice(), filter_slice_alpha(), filter_slice_alpha16(), filter_slice_chroma(), filter_slice_chroma16(), filter_slice_grey_edge(), filter_slice_luma(), filter_slice_luma16(), filter_slice_packed(), filter_slice_planar(), filter_slice_rgb(), filter_slice_rgba_packed(), filter_slice_rgba_planar(), filter_vertically(), hqx_filter(), irdft_horizontal16(), irdft_horizontal8(), irdft_vertical(), limitdiff_slice(), lut_packed_16bits(), lut_packed_8bits(), lut_planar_16bits(), lut_planar_8bits(), maskedclamp_slice(), maskedminmax_slice(), minmax_slice16(), minmax_slice8(), monochrome_slice16(), monochrome_slice8(), multiply_data(), multiply_slice(), nlmeans_slice(), pixelize_slice(), premultiply_slice(), process_frame(), process_slice_uyvy422(), process_slice_yuv420p(), process_slice_yuv422p(), process_slice_yuv444p(), qoa_decode_frame(), rdft_horizontal16(), rdft_horizontal8(), rdft_vertical(), restore_gradient_planar(), restore_gradient_planar_il(), restore_median_planar(), restore_median_planar_il(), scroll_slice(), slice_geq_filter(), slice_get_derivative(), slice_normalize(), ssim_plane(), ssim_plane_16bit(), super2xsai(), sws_receive_slice(), sws_send_slice(), temperature_slice16(), temperature_slice16p(), temperature_slice32(), temperature_slice8(), temperature_slice8p(), threshold_slice(), tonemap_slice(), v210_decode_slice(), v360_slice(), v410_decode_slice(), verti_slice_c(), vibrance_slice16(), vibrance_slice16p(), vibrance_slice8(), vibrance_slice8p(), vif_filter1d(), vignetting_filter_slice(), xbr_filter(), and xfade_slice().

◆ export_frame_params()

static void export_frame_params ( VVCContext s,
const VVCFrameContext fc 
)
static

Definition at line 773 of file dec.c.

Referenced by frame_setup().

◆ frame_setup()

static int frame_setup ( VVCFrameContext fc,
VVCContext s 
)
static

Definition at line 787 of file dec.c.

Referenced by decode_slice().

◆ decode_slice()

static int decode_slice ( VVCContext s,
VVCFrameContext fc,
const H2645NAL nal,
const CodedBitstreamUnit unit 
)
static

Definition at line 801 of file dec.c.

Referenced by decode_nal_unit().

◆ decode_nal_unit()

static int decode_nal_unit ( VVCContext s,
VVCFrameContext fc,
const H2645NAL nal,
const CodedBitstreamUnit unit 
)
static

Definition at line 832 of file dec.c.

Referenced by decode_nal_units().

◆ decode_nal_units()

static int decode_nal_units ( VVCContext s,
VVCFrameContext fc,
AVPacket avpkt 
)
static

Definition at line 873 of file dec.c.

Referenced by vvc_decode_frame().

◆ set_output_format()

static int set_output_format ( const VVCContext s,
const AVFrame output 
)
static

Definition at line 911 of file dec.c.

Referenced by get_decoded_frame(), and wait_delayed_frame().

◆ wait_delayed_frame()

static int wait_delayed_frame ( VVCContext s,
AVFrame output,
int *  got_output 
)
static

Definition at line 924 of file dec.c.

Referenced by get_decoded_frame(), submit_frame(), and vvc_decode_flush().

◆ submit_frame()

static int submit_frame ( VVCContext s,
VVCFrameContext fc,
AVFrame output,
int *  got_output 
)
static

Definition at line 940 of file dec.c.

Referenced by vvc_decode_frame().

◆ get_decoded_frame()

static int get_decoded_frame ( VVCContext s,
AVFrame output,
int *  got_output 
)
static

Definition at line 959 of file dec.c.

Referenced by vvc_decode_frame().

◆ vvc_decode_frame()

static int vvc_decode_frame ( AVCodecContext avctx,
AVFrame output,
int *  got_output,
AVPacket avpkt 
)
static

Definition at line 984 of file dec.c.

◆ vvc_decode_flush()

static av_cold void vvc_decode_flush ( AVCodecContext avctx)
static

Definition at line 1013 of file dec.c.

Referenced by vvc_decode_free().

◆ vvc_decode_free()

static av_cold int vvc_decode_free ( AVCodecContext avctx)
static

Definition at line 1031 of file dec.c.

◆ init_default_scale_m()

static av_cold void init_default_scale_m ( void  )
static

Definition at line 1049 of file dec.c.

Referenced by vvc_decode_init().

◆ vvc_decode_init()

static av_cold int vvc_decode_init ( AVCodecContext avctx)
static

Definition at line 1055 of file dec.c.

Variable Documentation

◆ ff_vvc_decoder

const FFCodec ff_vvc_decoder
Initial value:
= {
.p.name = "vvc",
.p.long_name = NULL_IF_CONFIG_SMALL("VVC (Versatile Video Coding)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VVC,
.priv_data_size = sizeof(VVCContext),
.close = vvc_decode_free,
.flush = vvc_decode_flush,
}

Definition at line 1101 of file dec.c.

FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:472
vvc_decode_frame
static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output, int *got_output, AVPacket *avpkt)
Definition: dec.c:984
vvc_decode_init
static av_cold int vvc_decode_init(AVCodecContext *avctx)
Definition: dec.c:1055
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_CODEC_CAP_OTHER_THREADS
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:124
vvc_decode_free
static av_cold int vvc_decode_free(AVCodecContext *avctx)
Definition: dec.c:1031
TAB_MAX
#define TAB_MAX
Definition: dec.c:37
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
vvc_decode_flush
static av_cold void vvc_decode_flush(AVCodecContext *avctx)
Definition: dec.c:1013
FF_CODEC_CAP_EXPORTS_CROPPING
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
Definition: codec_internal.h:61
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:250
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
ff_vvc_profiles
const AVProfile ff_vvc_profiles[]
Definition: profiles.c:91
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:73
VVCContext
Definition: dec.h:214