Go to the documentation of this file.
23 #ifndef AVCODEC_HEVCDEC_H
24 #define AVCODEC_HEVCDEC_H
26 #include <stdatomic.h>
46 #define SHIFT_CTB_WPP 2
48 #define MAX_TB_SIZE 32
50 #define DEFAULT_INTRA_TC_OFFSET 2
52 #define HEVC_CONTEXTS 199
53 #define HEVC_STAT_COEFFS 4
55 #define MRG_MAX_NUM_CANDS 5
60 #define EPEL_EXTRA_BEFORE 1
61 #define EPEL_EXTRA_AFTER 2
63 #define QPEL_EXTRA_BEFORE 3
64 #define QPEL_EXTRA_AFTER 4
67 #define EDGE_EMU_BUFFER_STRIDE 80
72 #define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
73 #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
75 #define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP)
76 #define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \
77 (s)->nal_unit_type == HEVC_NAL_BLA_N_LP)
78 #define IS_IRAP(s) ((s)->nal_unit_type >= HEVC_NAL_BLA_W_LP && (s)->nal_unit_type <= HEVC_NAL_RSV_IRAP_VCL23)
398 #define HEVC_FRAME_FLAG_OUTPUT (1 << 0)
399 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
400 #define HEVC_FRAME_FLAG_LONG_REF (1 << 2)
401 #define HEVC_FRAME_FLAG_BUMPING (1 << 3)
403 #define HEVC_SEQUENCE_COUNTER_MASK 0xff
404 #define HEVC_SEQUENCE_COUNTER_INVALID (HEVC_SEQUENCE_COUNTER_MASK + 1)
485 #define BOUNDARY_LEFT_SLICE (1 << 0)
486 #define BOUNDARY_LEFT_TILE (1 << 1)
487 #define BOUNDARY_UPPER_SLICE (1 << 2)
488 #define BOUNDARY_UPPER_TILE (1 << 3)
698 int nPbW,
int nPbH,
int log2_cb_size,
699 int part_idx,
int merge_idx,
MvField *
mv);
701 int nPbW,
int nPbH,
int log2_cb_size,
702 int part_idx,
int merge_idx,
709 int log2_trafo_size);
715 int log2_trafo_size,
enum ScanType scan_idx,
uint16_t seq_decode
Sequence counters for decoded and output frames, so that old frames are output first after a POC rese...
int temporal_id
temporal_id_plus1 - 1
int ff_hevc_cabac_init(HEVCLocalContext *lc, int ctb_addr_ts)
const RefPicList * ff_hevc_get_ref_list(const HEVCContext *s, const HEVCFrame *frame, int x0, int y0)
uint8_t * filter_slice_edges
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
void ff_hevc_bump_frame(HEVCContext *s)
uint8_t slice_initialized
1 if the independent slice segment header was successfully parsed
int ff_hevc_res_scale_sign_flag(HEVCLocalContext *lc, int idx)
static const int8_t mv[256][2]
void ff_hevc_flush_dpb(HEVCContext *s)
Drop all frames currently in DPB.
int ff_hevc_part_mode_decode(HEVCLocalContext *lc, int log2_cb_size)
This structure describes decoded (raw) audio or video data.
void ff_hevc_hls_filter(HEVCLocalContext *lc, int x, int y, int ctb_size)
int ff_hevc_sao_type_idx_decode(HEVCLocalContext *lc)
int ff_hevc_intra_chroma_pred_mode_decode(HEVCLocalContext *lc)
void * hwaccel_picture_private
RefStruct reference.
const uint8_t ff_hevc_qpel_extra_before[4]
HEVCFrame * collocated_ref
@ LAST_SIGNIFICANT_COEFF_X_PREFIX
int16_t y
vertical component of motion vector
@ CU_CHROMA_QP_OFFSET_FLAG
int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCLocalContext *lc)
uint8_t * sao_pixel_buffer_h[3]
int ff_hevc_sao_eo_class_decode(HEVCLocalContext *lc)
int ff_hevc_cu_qp_delta_abs(HEVCLocalContext *lc)
Decoded Picture Buffer (DPB).
int ff_hevc_ref_idx_lx_decode(HEVCLocalContext *lc, int num_ref_idx_lx)
uint8_t * checksum_buf
used on BE to byteswap the lines for checksumming
int ff_hevc_output_frame(HEVCContext *s, AVFrame *frame, int flush)
Find next frame in output order and put a reference to it in frame.
@ COEFF_ABS_LEVEL_GREATER2_FLAG
int ff_hevc_cbf_luma_decode(HEVCLocalContext *lc, int trafo_depth)
int ff_hevc_cbf_cb_cr_decode(HEVCLocalContext *lc, int trafo_depth)
uint8_t ctb_up_right_flag
HEVCCABACState * common_cabac_state
This is a pointer to the common CABAC state.
int ff_hevc_cu_qp_delta_sign_flag(HEVCLocalContext *lc)
int ff_hevc_end_of_slice_flag_decode(HEVCLocalContext *lc)
uint8_t intra_pred_mode_c[4]
@ COEFF_ABS_LEVEL_REMAINING
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
H274FilmGrainDatabase h274db
int ff_hevc_cu_chroma_qp_offset_idx(HEVCLocalContext *lc)
void ff_hevc_luma_mv_mvp_mode(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX)
const struct HEVCContext * parent
void ff_hevc_save_states(HEVCLocalContext *lc, int ctb_addr_ts)
int last_eos
last packet contains an EOS/EOB NAL
@ PREV_INTRA_LUMA_PRED_FLAG
int slice_idx
number of the slice being currently decoded
static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
int ff_hevc_frame_rps(HEVCContext *s)
Construct the reference picture sets for the current frame.
const uint8_t ff_hevc_qpel_extra[4]
RefPicListTab * rpl
RefStruct reference.
void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, int x0, int y0, int log2_trafo_size)
struct HEVCFrame * ref[HEVC_MAX_REFS]
void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, int x0, int y0, int log2_trafo_size, enum ScanType scan_idx, int c_idx)
uint8_t max_trafo_depth
MaxTrafoDepth.
enum HEVCNALUnitType nal_unit_type
int rem_intra_luma_pred_mode
int enable_parallel_tiles
Describe the class of an AVClass context structure.
uint8_t state[HEVC_CONTEXTS]
int16_t tmp[MAX_PB_SIZE *MAX_PB_SIZE]
int ff_hevc_merge_flag_decode(HEVCLocalContext *lc)
uint8_t cu_transquant_bypass_flag
@ COEFF_ABS_LEVEL_GREATER1_FLAG
uint8_t poc_msb_present[32]
int ff_hevc_split_transform_flag_decode(HEVCLocalContext *lc, int log2_trafo_size)
int film_grain_warning_shown
int is_nalff
this flag is != 0 if bitstream is encapsulated as a format defined in 14496-15
int16_t x
horizontal component of motion vector
AVBufferPool * rpl_tab_pool
candidate references for the current frame
uint8_t edge_emu_buffer[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
int ff_hevc_sao_offset_abs_decode(HEVCLocalContext *lc)
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
void ff_hevc_luma_mv_merge_mode(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv)
int ff_hevc_cu_transquant_bypass_flag_decode(HEVCLocalContext *lc)
#define DECLARE_ALIGNED(n, t, v)
int ff_hevc_skip_flag_decode(HEVCLocalContext *lc, int x0, int y0, int x_cb, int y_cb)
void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
int ff_hevc_mpm_idx_decode(HEVCLocalContext *lc)
uint8_t cabac_state[HEVC_CONTEXTS]
int32_t * tab_slice_address
DOVIContext dovi_ctx
Dolby Vision decoding context.
int ff_hevc_no_residual_syntax_flag_decode(HEVCLocalContext *lc)
@ SIGNIFICANT_COEFF_GROUP_FLAG
AVBufferRef * rpl_tab_buf
@ CU_TRANSQUANT_BYPASS_FLAG
@ LAST_SIGNIFICANT_COEFF_Y_SUFFIX
int ff_hevc_inter_pred_idc_decode(HEVCLocalContext *lc, int nPbW, int nPbH)
HEVCCABACState cabac
The target for the common_cabac_state of the local contexts.
int ff_hevc_sao_merge_flag_decode(HEVCLocalContext *lc)
void ff_hevc_hls_filters(HEVCLocalContext *lc, int x_ctb, int y_ctb, int ctb_size)
@ REM_INTRA_LUMA_PRED_MODE
uint16_t sequence
A sequence counter, so that old frames are output first after a POC reset.
#define EDGE_EMU_BUFFER_STRIDE
int ff_hevc_pred_mode_decode(HEVCLocalContext *lc)
const uint8_t ff_hevc_qpel_extra_after[4]
HEVCNALUnitType
Table 7-1 – NAL unit type codes and NAL unit type classes in T-REC-H.265-201802.
uint8_t stat_coeff[HEVC_STAT_COEFFS]
HEVCLocalContext ** HEVClcList
enum HEVCNALUnitType first_nal_type
uint8_t edge_emu_buffer2[(MAX_PB_SIZE+7) *EDGE_EMU_BUFFER_STRIDE *2]
HEVCLocalContext * HEVClc
int ff_hevc_merge_idx_decode(HEVCLocalContext *lc)
main external API structure.
void ff_hevc_hls_mvd_coding(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size)
AVBufferPool * tab_mvf_pool
int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCLocalContext *lc)
enum PredMode pred_mode
PredMode.
AVBufferRef * rpu_buf
0 or 1 Dolby Vision RPUs.
AVBufferRef * tab_mvf_buf
int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, int ct_depth, int x0, int y0)
int ff_hevc_sao_offset_sign_decode(HEVCLocalContext *lc)
int ff_hevc_log2_res_scale_abs(HEVCLocalContext *lc, int idx)
void(* flush)(AVBSFContext *ctx)
A reference to a data buffer.
uint8_t stat_coeff[HEVC_STAT_COEFFS]
int ff_hevc_slice_rpl(HEVCContext *s)
Construct the reference picture list(s) for the current slice.
int eos
current packet contains an EOS/EOB NAL
void ff_hevc_set_qPy(HEVCLocalContext *lc, int xBase, int yBase, int log2_cb_size)
int ff_hevc_sao_band_position_decode(HEVCLocalContext *lc)
enum PartMode part_mode
PartMode.
uint8_t * sao_pixel_buffer_v[3]
void ff_hevc_set_neighbour_available(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH)
#define flags(name, subs,...)
@ LAST_SIGNIFICANT_COEFF_Y_PREFIX
@ CU_CHROMA_QP_OFFSET_IDX
int ff_hevc_frame_nb_refs(const HEVCContext *s)
Get the number of candidate references for the current frame.
uint8_t intra_pred_mode[4]
int ff_hevc_pcm_flag_decode(HEVCLocalContext *lc)
int isLongTerm[HEVC_MAX_REFS]
uint8_t intra_split_flag
IntraSplitFlag.
int ff_hevc_mvp_lx_flag_decode(HEVCLocalContext *lc)
void ff_hevc_clear_refs(HEVCContext *s)
Mark all frames in DPB as unused for reference.
@ LAST_SIGNIFICANT_COEFF_X_SUFFIX
@ EXPLICIT_RDPCM_DIR_FLAG
int ff_hevc_cu_chroma_qp_offset_flag(HEVCLocalContext *lc)