x264 struct学习 1
x264_t 结构体维护着CODEC的诸多重要信息
其中成员frames是一个指示和控制帧编码过程的结构。其中current是已经准备就绪可以编码的帧,其类型已经确定;next是尚未确定类型的帧;unused用于回收不使用的frame结构体以备今后再次使用。
struct x264_t
{
/* cpu capabilities */
unsigned int cpu;
/* bitstream output */
struct
{
int i_nal; //定义一个网络提取层//
x264_nal_t nal[3]; /* for now 3 is enought */
int i_bitstream; /* size of p_bitstream */
uint8_t *p_bitstream; /* will hold data for all nal */
bs_t bs;
} out;
/* encoder parameters */
x264_param_t param;
/* frame number/poc (TODO: rework that for B-frame) */
int i_frame; //一个指示和控制帧编码过程的结构
int i_poc;
int i_frame_offset; /* decoding only */
int i_frame_num; /* decoding only*/
int i_poc_msb; /* decoding only */
int i_poc_lsb; /* decoding only */
/* We use only one SPS and one PPS */
x264_sps_t sps_array[32];
x264_sps_t *sps;
x264_pps_t pps_array[256];
x264_pps_t *pps;
int i_idr_pic_id;
/* Slice header */
x264_slice_header_t sh;
/*cabac context */
x264_cabac_t cabac;
/*current picture being encoded */
x264_picture_t *picture;
/*bframe handling (only encoding for now) */
x264_frame_t *bframe_current[X264_BFRAME_MAX]; /* store the sequence of b frame being encoded */
x264_frame_t *frame_next[X264_BFRAME_MAX+1]; /* store the next sequence of frames to be encoded */这个是定义下一个帧,但不一定是B帧
x264_frame_t *frame_unused[X264_BFRAME_MAX+1]; /* store unused frames */
/*frame being reconstructed */
x264_frame_t *fdec;
/*Current MB DCT coeffs */
struct
{
DECLARE_ALIGNED( int, luma16×16_dc[16], 16 );
DECLARE_ALIGNED( int, chroma_dc[2][4], 16 );//色度
struct
{
DECLARE_ALIGNED( int, residual_ac[15], 16 );
DECLARE_ALIGNED( int, luma4×4[16], 16 );
} block[16+8];16*8的宏快的取用情况
} dct;离散余弦变换
/* MBtable and cache for current frame/mb */
struct
{
/*Strides */
int i_mb_stride;
/*Current index */
int i_mb_x;
int i_mb_y;
int i_mb_xy;
unsigned int i_neighbour;
/* mb table */
int8_t *type; /*mb type */
int8_t *qp; /* mb qp */
int16_t *cbp; ? /* mbcbp: 0×0?: luma, 0x?0: chroma, 0×100: luma dc, 0×0200 and 0×0400: chroma
dc (all set for PCM)*/
int8_t (*intra4×4_pred_mode)[7]; /* intra4×4 predmode. for non I4×4 set to I_PRED_4×4_DC(2) */
uint8_t (*non_zero_count)[16+4+4]; /* nzc. for I_PCMset to 16 */
int8_t *chroma_pred_mode; /*chroma_pred_mode. cabac only. for non intra I_PRED_CHROMA_DC(0) */
int16_t (*mv[2])[2]; /* mb mv. set to 0 for intra mb */
int16_t (*mvd[2])[2]; /* mb mv difference with predict. set to 0 if intra. cabac only */
int8_t *ref[2]; /*mb ref. set to -1 if non used (intra or Lx only */
/*current value */
int i_type;
int i_partition;
int i_sub_partition[4];
int i_cbp_luma;
int i_cbp_chroma;
int i_intra16×16_pred_mode;
int i_chroma_pred_mode;
struct
{
/*pointer over mb of the frame to be compressed */
uint8_t *p_img[3];
int i_img[3];
/*pointers over mb of references and reconstrucated frame */
uint8_t *p_fdec[3];
uint8_t*p_fref[2][16][3];
int i_fdec[3]; /* same strides for p_fdec/p_fref */
} pic;
/*cache */
struct
{
/*real intra4×4_pred_mode if I_4X4, I_PRED_4×4_DC if mb available, -1 if not */
int intra4×4_pred_mode[X264_SCAN8_SIZE];色度预测模式
/*i_non_zero_count if availble else 0×80 */
int non_zero_count[X264_SCAN8_SIZE];
/*-1 if unused, -2 if unavaible */
int8_t ref[2][X264_SCAN8_SIZE];
/*0 if non avaible */
int16_t mv[2][X264_SCAN8_SIZE][2];
int16_t mvd[2][X264_SCAN8_SIZE][2];运动矢量与真实值之间的差
} cache;
/**/
int i_last_qp; /* last qp */
int i_last_dqp; /*last delta qp */
} mb;宏快的预测以及运动补偿和运动估计
/*frames used for reference */
x264_frame_t *freference[16+1]; /* all references frames plus current */
int i_ref0; 参考帧列表一(定义为lsit0意为向前预测编码)
x264_frame_t *fref0[16]; /* ref list 0*/
int i_ref1;参考帧列表二(定义为lsit1意为向后预测编码)
x264_frame_t *fref1[16]; /* ref list 1*/
/*rate control encoding only */
x264_ratecontrol_t *rc;
/*stats */
struct
{
/*per slice info */
int i_slice_count[5];
int i_slice_size[5];
float f_psnr_y[5];
float f_psnr_u[5];
float f_psnr_v[5];
int i_mb_count[5][18];
} stat;声明每一片的参数变量
/* CPU functions dependants */
x264_predict_t predict_16×16[4+3];
x264_predict_t predict_8×8[4+3];
x264_predict_t predict_4×4[9+3];
x264_pixel_function_t pixf;
x264_mc_function_t mc[2];
x264_dct_function_t dctf;
/* vlc table for decoding purpose only */
x264_vlc_table_t *x264_coeff_token_lookup[5];
x264_vlc_table_t *x264_level_prefix_lookup;
x264_vlc_table_t *x264_total_zeros_lookup[15];
x264_vlc_table_t *x264_total_zeros_dc_lookup[3];
x264_vlc_table_t *x264_run_before_lookup[7];
};
#endif
给出编码过程中的各个参数的初始化
x264_param_t
typedef struct
{
/* CPU flags */
unsigned int cpu;
/* Video Properties */
int i_width;
int i_height;
struct
{
/*they will be reduced to be 0 < x <= 65535 and prime */
int i_sar_height;
int i_sar_width;
} vui;?
float f_fps;
/* Used for rate control only */
/*Bitstream parameters */
int i_frame_reference; /* Maximum number of reference frames */
int i_idrframe; /*every i_idrframe I frame are marked as IDR */
int i_iframe; /* every i_iframe are intra */
int i_bframe; /* how many b-frame between 2 references pictures */
int b_deblocking_filter;
int b_cabac;
int i_cabac_init_idc;给出熵编码初始化时表格的选择
int i_qp_constant; /* 1-51 */
int i_bitrate; /* not working yet */
/* Encoder analyser parameters */
struct
{
unsigned int intra; /* intra flags */
unsigned int inter; /* inter flags */
} analyse;
}
x264_param_t给出编码过程中的各个参数的初始化
sps序列参数集
typedef struct
{
int i_id;
int i_profile_idc;指明所用profile
int i_level_idc; 指明所用level
int b_constraint_set0;
int b_constraint_set1;
int b_constraint_set2; 当他们值等于1时,表示必须遵守某些制约条件
int i_log2_max_frame_num;表示图像解码顺序的最大取值
int i_poc_type; /* poc 0 */
int i_log2_max_poc_lsb; /* poc 1 */
int b_delta_pic_order_always_zero;其值等于一时句法元素delta_pic_order_cnt[0]和 delta_pic_order_cnt[1]不再片头出现,且他们的默认值都为0。为0时上述则出现。
int i_offset_for_non_ref_pic;用来计算非参考帧或场的picture order count ,其值应在[-2e31,2e31-1]
int i_offset_for_top_to_bottom_field; 用来计算帧的底场的picture order count 其值应在[-2e31,2e31-1]
int i_num_ref_frames_in_poc_cycle;用来解码picture order count 取值应在[0,255]之间
int i_offset_for_ref_frame[256]; 当picture order count type=1时用来解码poc,这句语法对循环num_ref_frames_in_poc_cycle中的每一个元素指定了一个偏移
int i_num_ref_frames;指定参考帧队列的最大长度 h264规定最多可为16个参考帧
int b_gaps_in_frame_num_value_allowed;值为1时表示允许句法frame_num可以不连续
int i_mb_width;
int i_mb_height;
int b_frame_mbs_only;
int b_mb_adaptive_frame_field;
int b_direct8×8_inference;指明b片的直接和skip模式下运动矢量的预测方法
int b_crop;
struct
{
int i_left;
int i_right;
int i_top;
int i_bottom;
} crop;图像剪彩后输出的参数
int b_vui;
struct
{
int i_sar_width;
int i_sar_height;
/* FIXME to complete */
} vui;
}
x264_sps_t定义序列参考队列的参数以及初始化
pps图像参数集
typedef struct
{
int i_id;
int i_sps_id;
int b_cabac;
int b_pic_order;
int i_num_slice_groups; 加一表示图像中片组的个数
int i_slice_group_map_type;片组分割类型 /*i_slice_group_map_type == 0 */
int i_run_length[256]; 指明片组类型为2时每个片组连续的map_units的个数 /* FIXME */
/*i_slice_group_map_type == 2 */
int i_top_left[256]; /* FIXME */
int i_bottom_right[256]; /* FIXME */
/*i_slice_group_map_type == 3, 4, 5 */
int b_slice_group_change_direction; 当类型为345时与下句语法一起指明片组分割方法
int i_slice_group_change_rate; /*i_slice_group_map_type == 6 */
int i_pic_size_in_map_units;类型为6时指明图像以map_units为单位的大小
int i_slice_group_id[256]; /* FIXME */指明map_units属于哪个片组
int i_num_ref_idx_l0_active;加1为参考帧队列的长度 此为list0
int i_num_ref_idx_l1_active;此为list1
int b_weighted_pred;用以指明是否允许P和SP片的加权预测
int b_weighted_bipred; 用以指明是否允许B片的加权预测
int i_pic_init_qp;加26后用以指明亮度分量的量化参数的初始值
int i_pic_init_qs;同上只是用于SP和SI
int i_chroma_qp_index_offset;指明计算使用时用到的参数
int b_deblocking_filter_control;
int b_constrained_intra_pred;控制PB帧的帧内编码
int b_redundant_pic_cnt;是否出现redundant_pic_cnt句法元素
} x264_pps_t
x264 struct学习 1相关推荐
- x264 struct 学习
x264_t结构体维护着CODEC的诸多重要信息 其中成员frames是一个指示和控制帧编码过程的结构.其中current是已经准备就绪可以编码的帧,其类型已经确定:next是尚未确定类型的帧:unu ...
- MATLAB中的结构体数组(struct)学习笔记
不要失却热情,不要丢掉冠军的心! MALAB中的结构体(struct)数组学习笔记 前言 1. 版本 2. 关键词 一.Struct结构体数组概述 二.Struct结构体数组基本用法 1. 结构体的创 ...
- x264代码学习笔记(二):x264_encoder_encode函数
encode()函数中循环调用encode_frame()函数进行逐帧编码: 调用x264_encoder_encode()函数完成一帧编码: 将编码后的码流载入码流文件中. static int e ...
- x264代码学习笔记(五):x264_slicetype_analyse函数
x264_slicetype_decide函数(代码所在位置为"x264-snapshot-20171128-2245-stable\encoder\slicetype.c")的主 ...
- Head First Servlet JSP读书笔记
Head First Servlet && JSP 引子 Sun 考试-SCJP->SWCCD,$200 学习原则 图胜于文 采用交谈式学习风格 Keep Attention,T ...
- python中使用modbus_tk操作浮点数
前言: 自己学习python的过程中,偶然接触到 modbus_tk 这个库,以前学习过modbus,在新的python语言环境下学习,权当复习了,记录下过程,感谢各位道友的分享,让我也少走了很多弯路 ...
- X264学习笔记(1)
X264学习笔记(1) X264编码流程 参数的初始化 1.opt,param根据输入的参数和标准的规定,进行初始化设置. Opt的说明如下: Opt->hin用于给出读入的yuv文件的指针地址 ...
- x264学习----x264.h结构体
x264.h结构体学习,还在持续更新中 /****************************************************************************** ...
- 流媒体-H264协议-编码-x264学习-主要结构体(二)
流媒体-H264协议-编码-x264学习-相关概念x264编译及文件解析(一) 流媒体-H264协议-编码-x264学习-主要结构体(二) 流媒体-H264协议-编码-x264学习-主要函数(三) 流 ...
最新文章
- 消控中心人员配置_物业公司(项目)各岗位员工配置人数及标准(供参考)
- 【Zookeeper】源码分析之Leader选举(一)
- Spring Boot 2.x基础教程:使用Elastic Job实现定时任务
- ruby的module与Java的interface以及C++的friend
- vue 对象里面放数组刷新问题_Vue 数组和对象更新,但是页面没有刷新的解决方式...
- Windows异常学习笔记(五)—— 未处理异常
- 微信公众号发多个消息php,微擎系统微信公众号关键字触发回复多条消息实现
- cambridge ifm strategic roadmapping takecontrol in times of uncerntainty
- git clone failed. Could not read from remote repository
- 413 Request Entity Too Large
- python中的classmethod_面试题:python 中 staticmethod 和 classmethod有什么区别
- 仿网易云音乐html代码,HTML作业-仿网易云音乐项目
- FBI也没辙?超强加密软件TrueCrypt全教程
- kux2mp4(优酷kux转换为mp4软件) v2021
- html中将字体设置成透明的,解决css设置背景透明,文字不透明_html/css_WEB-ITnose
- ram与flash你知道多少?
- 阿里云APP产品功能及使用介绍
- EVE:[globbing] unmatched close brace/bracket in column 6
- python日期推算
- 有史以来影响世界的颠覆性技术 | 未来的高附加值颠覆性技术产业
热门文章
- Python3 爬虫实战 — 豆瓣电影TOP250【requests、Xpath、正则表达式、CSV、二进制数据储存】
- python 3.8 新特性 video_1分钟了解:Python3.8 新特性:仅位置参数
- CCNA-第十四篇-NAT-下+链路聚合(LACP)+DHCP
- 6.Strings and Dictionaries
- java data jpa_Spring Data JPA(一)简介
- unsigned int mysql_mysql 中int类型字段unsigned和signed的探索
- oracle按照指定顺序读取,oracle按照指定顺序进行排序
- java二分查找递归_java学习之—递归实现二分查找法
- 计算页数_中级会计师计算题、综合题的审题注意事项与解题思路
- java 线程执行结束_Java_如何等待子线程执行结束