23 #ifndef AVCODEC_HEVC_H
24 #define AVCODEC_HEVC_H
40 #define MAX_DPB_SIZE 16 // A.4.1
43 #define MAX_NB_THREADS 16
44 #define SHIFT_CTB_WPP 2
49 #define MAX_SUB_LAYERS 7
50 #define MAX_VPS_COUNT 16
51 #define MAX_SPS_COUNT 32
52 #define MAX_PPS_COUNT 256
53 #define MAX_SHORT_TERM_RPS_COUNT 64
54 #define MAX_CU_SIZE 128
57 #define MAX_TRANSFORM_DEPTH 5
59 #define MAX_TB_SIZE 32
60 #define MAX_LOG2_CTB_SIZE 6
62 #define DEFAULT_INTRA_TC_OFFSET 2
64 #define HEVC_CONTEXTS 199
66 #define MRG_MAX_NUM_CANDS 5
71 #define EPEL_EXTRA_BEFORE 1
72 #define EPEL_EXTRA_AFTER 2
74 #define QPEL_EXTRA_BEFORE 3
75 #define QPEL_EXTRA_AFTER 4
78 #define EDGE_EMU_BUFFER_STRIDE 80
83 #define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
84 #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
86 #define IS_IDR(s) ((s)->nal_unit_type == NAL_IDR_W_RADL || (s)->nal_unit_type == NAL_IDR_N_LP)
87 #define IS_BLA(s) ((s)->nal_unit_type == NAL_BLA_W_RADL || (s)->nal_unit_type == NAL_BLA_W_LP || \
88 (s)->nal_unit_type == NAL_BLA_N_LP)
89 #define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23)
714 #define HEVC_FRAME_FLAG_OUTPUT (1 << 0)
715 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
716 #define HEVC_FRAME_FLAG_LONG_REF (1 << 2)
717 #define HEVC_FRAME_FLAG_BUMPING (1 << 3)
784 #define BOUNDARY_LEFT_SLICE (1 << 0)
785 #define BOUNDARY_LEFT_TILE (1 << 1)
786 #define BOUNDARY_UPPER_SLICE (1 << 2)
787 #define BOUNDARY_UPPER_TILE (1 << 3)
1029 int nPbW,
int nPbH);
1031 int nPbW,
int nPbH,
int log2_cb_size,
1032 int part_idx,
int merge_idx,
MvField *
mv);
1034 int nPbW,
int nPbH,
int log2_cb_size,
1035 int part_idx,
int merge_idx,
1040 int log2_trafo_size);
1048 int log2_trafo_size,
enum ScanType scan_idx,
#define EDGE_EMU_BUFFER_STRIDE
int frame_packing_arrangement_type
unsigned int log2_min_cb_size
int sei_frame_packing_present
frame packing arrangement variables
uint8_t log2_sao_offset_scale_luma
int ff_hevc_merge_idx_decode(HEVCContext *s)
int min_spatial_segmentation_idc
int ff_hevc_frame_nb_refs(HEVCContext *s)
Get the number of candidate references for the current frame.
int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id, uint8_t *buf, int buf_size)
This structure describes decoded (raw) audio or video data.
static void flush(AVCodecContext *avctx)
uint8_t diff_cu_chroma_qp_offset_depth
int ff_hevc_merge_flag_decode(HEVCContext *s)
int ff_hevc_sao_band_position_decode(HEVCContext *s)
int active_seq_parameter_set_id
int vui_num_ticks_poc_diff_one_minus1
int max_dec_pic_buffering
uint8_t edge_emu_buffer[(MAX_PB_SIZE+7)*EDGE_EMU_BUFFER_STRIDE *2]
int transform_skip_rotation_enabled_flag
int content_interpretation_type
int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth)
int8_t cb_qp_offset_list[5]
int16_t x
horizontal component of motion vector
unsigned int * row_height
RowHeight.
const uint8_t ff_hevc_qpel_extra[4]
void * hwaccel_picture_private
int vps_num_ticks_poc_diff_one
vps_num_ticks_poc_diff_one_minus1 + 1
int ff_hevc_end_of_slice_flag_decode(HEVCContext *s)
uint8_t intra_split_flag
IntraSplitFlag.
int rem_intra_luma_pred_mode
void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv)
const uint8_t ff_hevc_diag_scan4x4_x[16]
uint8_t weighted_bipred_flag
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
#define DECLARE_ALIGNED(n, t, v)
int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s)
uint8_t seq_loop_filter_across_slices_enabled_flag
uint8_t cabac_init_present_flag
int chroma_loc_info_present_flag
int ff_hevc_frame_rps(HEVCContext *s)
Construct the reference picture sets for the current frame.
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps, int apply_defdispwin)
int * ctb_addr_ts_to_rs
CtbAddrTSToRS.
int explicit_rdpcm_enabled_flag
int num_ref_idx_l0_default_active
num_ref_idx_l0_default_active_minus1 + 1
struct HEVCFrame * ref[MAX_REFS]
AVBufferRef * vps_list[MAX_VPS_COUNT]
ShortTermRPS st_rps[MAX_SHORT_TERM_RPS_COUNT]
int chroma_sample_loc_type_top_field
int ff_hevc_sao_type_idx_decode(HEVCContext *s)
uint16_t seq_decode
Sequence counters for decoded and output frames, so that old frames are output first after a POC rese...
enum NALUnitType first_nal_type
uint8_t entropy_coding_sync_enabled_flag
uint32_t min_mastering_luminance
int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s)
int log2_parallel_merge_level
log2_parallel_merge_level_minus2 + 2
AVBufferPool * rpl_tab_pool
candidate references for the current frame
uint8_t log2_sao_offset_scale_chroma
int restricted_ref_pic_lists_flag
unsigned int log2_max_trafo_size
int ff_hevc_mpm_idx_decode(HEVCContext *s)
uint8_t profile_compatibility_flag[32]
unsigned int num_negative_pics
uint8_t sub_layer_profile_present_flag[MAX_SUB_LAYERS]
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
unsigned int vps_num_reorder_pics[MAX_SUB_LAYERS]
uint8_t log2_max_transform_skip_block_size
uint8_t ctb_up_right_flag
int overscan_info_present_flag
uint8_t vps_timing_info_present_flag
Multithreading support functions.
int num_ref_idx_l1_default_active
num_ref_idx_l1_default_active_minus1 + 1
unsigned int log2_min_pcm_cb_size
int vps_max_sub_layers
vps_max_temporal_layers_minus1 + 1
int frame_field_info_present_flag
uint8_t scaling_list_data_present_flag
int ff_hevc_decode_nal_sei(HEVCContext *s)
bitstream reader API header.
uint8_t loop_filter_disable_flag
int sei_anticlockwise_rotation
void ff_hevc_flush_dpb(HEVCContext *s)
Drop all frames currently in DPB.
uint8_t cu_transquant_bypass_flag
int16_t tmp[MAX_PB_SIZE *MAX_PB_SIZE]
int bitstream_restriction_flag
uint8_t transquant_bypass_enable_flag
int ff_hevc_sao_offset_sign_decode(HEVCContext *s)
int temporal_id
temporal_id_plus1 - 1
HEVCLocalContext * HEVClcList[MAX_NB_THREADS]
int8_t cr_qp_offset_list[5]
int slice_idx
number of the slice being currently decoded
uint8_t intra_pred_mode[4]
uint8_t frame_only_constraint_flag
int ff_hevc_cu_chroma_qp_offset_flag(HEVCContext *s)
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size)
uint8_t slice_initialized
1 if the independent slice segment header was successfully parsed
unsigned int log2_max_poc_lsb
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
int persistent_rice_adaptation_enabled_flag
coded frame dimension in various units
void ff_hevc_reset_sei(HEVCContext *s)
Reset SEI values that are stored on the Context.
AVBufferRef * rpl_tab_buf
int vui_timing_info_present_flag
#define MAX_SHORT_TERM_RPS_COUNT
uint16_t display_primaries[3][2]
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
Compute POC of the current frame and return it.
unsigned int log2_ctb_size
uint8_t * sao_pixel_buffer_h[3]
int vui_poc_proportional_to_timing_flag
void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts)
uint8_t vps_temporal_id_nesting_flag
int ff_hevc_cu_chroma_qp_offset_idx(HEVCContext *s)
uint8_t edge_emu_buffer2[(MAX_PB_SIZE+7)*EDGE_EMU_BUFFER_STRIDE *2]
uint8_t max_trafo_depth
MaxTrafoDepth.
uint16_t sequence
A sequence counter, so that old frames are output first after a POC reset.
int motion_vectors_over_pic_boundaries_flag
uint8_t tiles_enabled_flag
uint32_t vps_num_units_in_tick
struct HEVCContext * sList[MAX_NB_THREADS]
int ff_hevc_mvp_lx_flag_decode(HEVCContext *s)
int vps_num_layer_sets
vps_num_layer_sets_minus1 + 1
uint8_t lists_modification_present_flag
int * min_tb_addr_zs_tab
MinTbAddrZS.
AVBufferRef * tab_mvf_buf
int max_transform_hierarchy_depth_inter
uint8_t cabac_state[HEVC_CONTEXTS]
uint8_t * sao_pixel_buffer_v[3]
uint8_t vps_poc_proportional_to_timing_flag
int num_tile_columns
num_tile_columns_minus1 + 1
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.
void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
AVBufferRef * pps_list[MAX_PPS_COUNT]
int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
int max_bits_per_min_cu_denom
uint8_t cu_qp_delta_enabled_flag
uint8_t used_by_curr_pic_lt_sps_flag[32]
int sei_mastering_display_info_present
mastering display
struct HEVCFrame * collocated_ref
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0, int nPbW, int nPbH)
uint8_t sign_data_hiding_flag
uint8_t output_flag_present_flag
int log2_max_mv_length_vertical
void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
uint32_t max_mastering_luminance
int max_bytes_per_pic_denom
int overscan_appropriate_flag
int implicit_rdpcm_enabled_flag
uint8_t constrained_intra_pred_flag
uint8_t pic_slice_level_chroma_qp_offsets_present_flag
int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0, int y0)
int colour_description_present_flag
static const int8_t mv[256][2]
uint8_t sub_layer_level_present_flag[MAX_SUB_LAYERS]
enum AVPixelFormat pix_fmt
void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
int sei_display_orientation_present
display orientation
int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx)
uint8_t transform_skip_enabled_flag
Libavcodec external API header.
uint8_t uniform_spacing_flag
uint8_t is_nalff
this flag is != 0 if bitstream is encapsulated as a format defined in 14496-15
int * ctb_addr_rs_to_ts
CtbAddrRSToTS.
unsigned int log2_min_pu_size
unsigned int sps_id
seq_parameter_set_id
main external API structure.
int log2_max_mv_length_horizontal
enum PredMode pred_mode
PredMode.
AVBufferRef * hwaccel_priv_buf
int num_extra_slice_header_bits
int16_t y
vertical component of motion vector
uint8_t loop_filter_across_tiles_enabled_flag
void ff_hevc_clear_refs(HEVCContext *s)
Mark all frames in DPB as unused for reference.
uint8_t num_long_term_ref_pics_sps
uint8_t cross_component_prediction_enabled_flag
uint32_t vui_num_units_in_tick
uint8_t deblocking_filter_control_present_flag
int transform_skip_context_enabled_flag
uint8_t * checksum_buf
used on BE to byteswap the lines for checksumming
uint8_t sps_temporal_mvp_enabled_flag
int chroma_sample_loc_type_bottom_field
Describe the class of an AVClass context structure.
int num_tile_rows
num_tile_rows_minus1 + 1
int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx)
uint8_t chroma_qp_offset_list_enabled_flag
const uint8_t ff_hevc_diag_scan8x8_y[64]
rational number numerator/denominator
int vps_num_hrd_parameters
#define MAX_SUB_LAYERS
7.4.2.1
int enable_parallel_tiles
int ff_hevc_sao_eo_class_decode(HEVCContext *s)
int last_eos
last packet contains an EOS/EOB NAL
unsigned int log2_min_tb_size
refcounted data buffer API
enum PartMode part_mode
PartMode.
uint16_t lt_ref_pic_poc_lsb_sps[32]
const uint8_t ff_hevc_qpel_extra_after[4]
int ff_hevc_slice_rpl(HEVCContext *s)
Construct the reference picture list(s) for the current slice.
uint8_t intra_pred_mode_c[4]
enum NALUnitType nal_unit_type
uint8_t scaling_list_enable_flag
struct HEVCSPS::@52 temporal_layer[MAX_SUB_LAYERS]
int tc_offset
tc_offset_div2 * 2
uint8_t transfer_characteristic
uint8_t flags
A combination of HEVC_FRAME_FLAG_*.
HEVCLocalContext * HEVClc
int default_display_window_flag
int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH)
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
unsigned int log2_diff_max_min_coding_block_size
int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth)
void ff_hevc_bump_frame(HEVCContext *s)
int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx)
unsigned int log2_max_pcm_cb_size
void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size)
int eos
current packet contains an EOS/EOB NAL
int neutra_chroma_indication_flag
int * tile_pos_rs
TilePosRS.
NALUnitType
Table 7-3: NAL unit type codes.
RefPicList * ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame, int x0, int y0)
A reference to a data buffer.
int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s)
int max_transform_hierarchy_depth_intra
int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s)
const uint8_t ff_hevc_qpel_extra_before[4]
common internal api header.
unsigned int * row_bd
RowBd.
uint8_t weighted_pred_flag
int32_t * tab_slice_address
unsigned int * col_bd
ColBd.
unsigned int * column_width
ColumnWidth.
uint8_t * filter_slice_edges
uint8_t slice_header_extension_present_flag
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, 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)
AVBufferPool * tab_mvf_pool
Core video DSP helper functions.
int video_full_range_flag
PTLCommon sub_layer_ptl[MAX_SUB_LAYERS]
int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
uint8_t chroma_qp_offset_list_len_minus1
void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
uint8_t sps_strong_intra_smoothing_enable_flag
int rps_idx_num_delta_pocs
int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size)
Decoded Picture Buffer (DPB).
int ff_hevc_pred_mode_decode(HEVCContext *s)
int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s)
unsigned int vps_max_dec_pic_buffering[MAX_SUB_LAYERS]
int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s)
uint8_t long_term_ref_pics_present_flag
unsigned int vps_max_latency_increase[MAX_SUB_LAYERS]
int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx)
Parse the SPS from the bitstream into the provided HEVCSPS struct.
int vui_hrd_parameters_present_flag
unsigned int right_offset
int diff_cu_qp_delta_depth
int ff_hevc_sao_offset_abs_decode(HEVCContext *s)
int ff_hevc_pcm_flag_decode(HEVCContext *s)
const uint8_t ff_hevc_diag_scan8x8_x[64]
uint8_t progressive_source_flag
uint8_t context_initialized
int video_signal_type_present_flag
uint8_t deblocking_filter_override_enabled_flag
int beta_offset
beta_offset_div2 * 2
int * min_tb_addr_zs
MinTbAddrZS.
int ff_hevc_sao_merge_flag_decode(HEVCContext *s)
int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header)
uint8_t non_packed_constraint_flag
int intra_smoothing_disabled_flag
void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0, int log2_trafo_size, enum ScanType scan_idx, int c_idx)
AVPixelFormat
Pixel format.
int tiles_fixed_structure_flag
uint8_t interlaced_source_flag
AVBufferRef * sps_list[MAX_SPS_COUNT]
uint8_t separate_colour_plane_flag
output (i.e. cropped) values
const uint8_t ff_hevc_diag_scan4x4_y[16]
unsigned int bottom_offset
int vps_sub_layer_ordering_info_present_flag
Context Adaptive Binary Arithmetic Coder.
uint8_t dependent_slice_segments_enabled_flag