x264中的decimate_score

 为了减少残差系数使用的编码比特,x264中使用了一种方法--decimation。原话是这样子的:

Writing the 16 CBFs in an i16x16 block is quite costly, so decimation can save many bits. More useful with CAVLC, but still useful with CABAC. 中心思想是如果一个16x16块的非零残差系数个数很少且最大绝对值不超过1(用一个score来衡量),直接将其所有4x4块的残差系数置为0,这样子就不要为该16x16块发送16个cbf;

对于亮度,如果是8x8块,则score<4时,将残差系数全置为0;

                    如果是16x16块,则score<6时,将残差系数全置为0;

对于色度,则score<7时,将残差系数全置为0;

该技术一般用于帧间宏块,总共在下面几个函数应用:

x264_mb_encode_i16x16;

x264_macroblock_encode_p8x8_internal;

x264_macroblock_probe_skip_internal;

x264_macroblock_encode_internal;

x264_mb_encode_chroma_internal;

以x264_mb_encode_i16x16为例来看看:

static void x264_mb_encode_i16x16( x264_t *h, int p, int i_qp )

{

    pixel *p_src = h->mb.pic.p_fenc[p];

    pixel *p_dst = h->mb.pic.p_fdec[p];

 

    ALIGNED_ARRAY_N( dctcoef, dct4x4,[16],[16] );

    ALIGNED_ARRAY_N( dctcoef, dct_dc4x4,[16] );

 

    int nz, block_cbp = 0;

    int decimate_score = h->mb.b_dct_decimate ? 0 : 9;//I帧设置为9,p帧设置为0;

    int i_quant_cat = p ? CQM_4IC : CQM_4IY;

    int i_mode = h->mb.i_intra16x16_pred_mode;

 

    if( h->mb.b_lossless )

        x264_predict_lossless_16x16( h, p, i_mode );

    else

        h->predict_16x16[i_mode]( h->mb.</

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值