您的位置:首页 > 编程语言

homerHEVC代码阅读(8)——基础结构之henc_thread_t

2015-11-29 22:23 134 查看
henc_thread_t是编码器线程类

// 编码器线程类
// 还有一些属性的含义还不清楚,以后补充
struct henc_thread_t
{
// 所属的编码器引擎
hvenc_engine_t	*enc_engine;

// 索引
uint		index;

// 是否启用wfpp宫内
int			wfpp_enable;

// wfpp线程的数量
int			wfpp_num_threads;

// 信号量,用于通知有一个帧到来了,synchro_sem[0]表示I帧,synchro_sem[1]表示B或P帧
hmr_sem_t	synchro_sem[2];// 0 for intra_frame synchronization, 1 for inter frame synchronization
hmr_sem_ptr	synchro_signal[2];// 0 for intra_frame synchronization, 1 for inter frame synchronization
hmr_sem_ptr	synchro_wait[2];// 0 for intra_frame synchronization, 1 for inter frame synchronization
int			num_wait_sem;
int			dbg_sem_post_cnt;

// 比特流
bitstream_t	*bs;

//header info

// 视频参数集
vps_t	*vps;

// 序列参数集
sps_t	*sps;

// 图像参数集
pps_t	*pps;

// 编码器的配置,不再赘述
//Encoder Cfg
//Encoding layer
int				pict_width[3], pict_height[3];
int				pict_width_in_ctu, pict_height_in_ctu;
int				pict_total_ctu;
int				ctu_width[3], ctu_height[3];
//	int				ctu_group_size;

//cfg
int				max_cu_size;
int				max_cu_size_shift;//log2 of max cu size
int				max_cu_size_shift_chroma;
int				max_intra_tr_depth;
int				max_inter_tr_depth;
int				max_pred_partition_depth;//, max_inter_pred_depth;//max depth for prediction
int				motion_estimation_precision;

// 当前CU的分割数
int				num_partitions_in_cu;

int				num_partitions_in_cu_shift;
int				mincu_mintr_shift_diff;//log2		//g_uiAddCUDepth

// 最大cu的深度
int				max_cu_depth;							//m_uiMaxCUDepth

// 最小cu的尺寸
int				min_cu_size;
int				min_cu_size_shift;//log2
int				min_tu_size_shift;//log2
int				max_tu_size_shift;//log2

// 档次
int				profile;

// 比特深度
int				bit_depth;

// 率失真模式
int				rd_mode;

// 性能模式
int				performance_mode;

// 帧内预测中CU的分割数
uint			num_intra_partitions;

// 帧间预测中CU的分割数
uint			num_total_partitions;

// 总的CTU的数量
uint			num_total_ctus;

int				*partition_depth_start;//start of depths in the partition_info list
//	cu_partition_info_t	*partition_info;//recursive structure list to store the state of the recursive computing stages
//current processing state and buffers

// 当前的cu和下一个cu
int				cu_current, cu_next;

// 当前cu的坐标
int				cu_current_x, cu_current_y;

// 这些窗口的含义暂时还不清楚
wnd_t			curr_mbs_wnd;									//original MBs to be coded
wnd_t			prediction_wnd;									//prediction applied to original MBs
wnd_t			residual_wnd;									//residual after substracting prediction
wnd_t			residual_dec_wnd;								//decoded residual. output of inverse transform
wnd_t			transform_quant_wnd_[NUM_QUANT_WNDS];			//windows to be used with pointers
wnd_t			*transform_quant_wnd[NUM_QUANT_WNDS];			//for transform coefficients and quantification
wnd_t			itransform_iquant_wnd;							//for itransform coefficients and iquantification
wnd_t			decoded_mbs_wnd_[NUM_DECODED_WNDS];				//windows to be used with pointers
wnd_t			*decoded_mbs_wnd[NUM_DECODED_WNDS];

//deblock filter
//	cu_partition_info_t* deblock_partition_info;//recursive structure list to store the state of the recursive computing stages
uint8_t			*deblock_edge_filter[2];
uint8_t			*deblock_filter_strength_bs[2];

//sao
int16_t			*sao_sign_line_buff1;//m_signLineBuf1;
int16_t			*sao_sign_line_buff2; //m_signLineBuf2;

//quarter precission buffers
// 量化器精度的缓冲区
wnd_t			filtered_block_wnd[4][4];
wnd_t			filtered_block_temp_wnd[4];

//intra predicition
// 下面的一些属性用于帧内预测

// 改变量用于存放当前cu左边一列和上边一行的数据
int16_t				(*adi_pred_buff);//this buffer holds the left column and top row for intra pred (bottom2top and left2right)
// 同上
int16_t				(*adi_filtered_pred_buff);//this buffer holds the left column and top row for intra pred (bottom2top and left2right)

// 用于帧内预测的中间buffer
int16_t				(*top_pred_buff);//intermediate buffer to calculate intra prediction samples
int16_t				(*left_pred_buff);//intermediate buffer to calculate intra prediction samples
int16_t				(*bottom_pred_buff);//intermediate buffer to calculate intra prediction samples
int16_t				(*right_pred_buff);//intermediate buffer to calculate intra prediction samples
int					adi_size;//size of adi buffer
int16_t				(*pred_aux_buff);
int					pred_aux_buff_size;//size of aux buffer
int16_t				(*aux_buff);
uint8_t				(*cabac_aux_buff);
int					cabac_aux_buff_size;
//	ctu_info_t			*curr_ctu_group_info;	//this is supposed to be a small window matching the processing grain
uint8_t				*cbf_buffs[NUM_PICT_COMPONENTS][MAX_PARTITION_DEPTH];
uint8_t				*cbf_buffs_chroma[NUM_PICT_COMPONENTS];//processing aux buffers
uint8_t				*intra_mode_buffs[NUM_PICT_COMPONENTS][MAX_PARTITION_DEPTH];
uint8_t				*tr_idx_buffs[MAX_PARTITION_DEPTH];

//inter 帧间预测

// amvp的候选列表
mv_candiate_list_t	amvp_candidates[2];

// merge模式的候选列表
mv_candiate_list_t	merge_mvp_candidates[2];

// 搜索mv的候选列表
mv_candiate_list_t	mv_search_candidates;//non normative candidate list for motion_search

//rd,率失真

// CTU信息
ctu_info_t			*ctu_rd;//[MAX_MB_GROUP_SIZE];

// enc_env_t实际就是sbac
enc_env_t			*ee;//encoding enviroment of the processing element

// 比特计数器
enc_env_t			*ec;//encoding counter  of the processing element

// 上下文模型
context_model_t		*aux_contexts;

// 二进制模型
binary_model_t		aux_bm;
//rate distortion
// 率失真
rate_distortion_t	rd;
uint32_t			acc_dist;

//rate control
// 速率控制

// 已经编码的CTU个数
uint				num_encoded_ctus;//num CABAC encoded ctus

// 比特数
uint				num_bits;

// 目标图像的大小
uint				target_pict_size;

int					acc_qp;
int					write_qp_flag;
int					curr_ref_qp;//for qp modification when cbf=0
int					found_zero_cbf;//for qp modification when cbf=0

// 底层函数对象
low_level_funcs_t	*funcs;
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: