X264-编码模块和NAL打包输出
在上一篇介绍了编码器的VCL编码操作,分析了函数x264_slice_write()。函数x264_slice_write()里有四个关键模块,分别是宏块分析模块、宏块编码模块、熵编码模块和滤波模块,再加上NAL打包输出部分,是我们这里要讲的内容。 1.编码模块 宏块分析模块:调用函数x264_macroblock_analyse()。分为两部分:帧内宏块和帧间宏块。帧内宏块用于分析帧内的预测模式,而帧间宏块进行运动估计,分析帧间的预测模式。 x264_macroblock_analyse(): void x264_macroblock_analyse( x264_t *h ) { x264_mb_analysis_t analysis; int i_cost = COST_MAX; //通过码率控制方法,获取本宏块QP h->mb.i_qp = x264_ratecontrol_mb_qp( h ); /* If the QP of this MB is within 1 of the previous MB, code the same QP as the previous MB, * to lower the bit cost of the qp_delta. Don't do this if QPRD is enabled. */ if( h->param.rc.i_aq