x264帧内预测-mb_analyse_intra

34 篇文章 12 订阅

static void mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter )

//大致分为几个阶段

predict_16x16

mbcmp 比较残差

predict_8x8

mbcmp 比较残差

predict_4x4

mbcmp 比较残差

{

const int8_t *predict_mode = predict_16x16_mode_available( h->mb.i_neighbour_intra );

获得可用的帧内预测模式-针对帧内16x16

 

/* Not heavily tuned */

static const uint8_t i16x16_thresh_lut[11] = { 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4 };

int i16x16_thresh = a->b_fast_intra ? (i16x16_thresh_lut[h->mb.i_subpel_refine]*i_satd_inter)>>1 : COST_MAX;

for( ; *predict_mode >= 0; predict_mode++ )//遍历4种预测模式,计算代价

{

    int i_satd;

    int i_mode = *predict_mode;

 

   if( h->mb.b_lossless )

       x264_predict_lossless_16x16( h, 0, i_mode );

   else

       h->predict_16x16[i_mode]( p_dst );

   i_satd = h->pixf.mbcmp[PIXEL_16x16]( p_src, FENC_STRIDE, p_dst, FDEC_STRIDE ) + lambda * bs_size_ue( x264_mb_pred_mode16x16_fix[i_mode] );

  COPY2_IF_LT( a->i_satd_i16x16, i_satd, a->i_predict16x16, i_mode );

  a->i_satd_i16x16_dir[i_mode] = i_satd;//存储帧内16x16预测代价

}

 

const int8_t *predict_mode = predict_8x8_mode_available( a->b_avoid_topright, h->mb.i_neighbour8[idx], idx );//获取8x8模式,

遍历并存储代价

for( ; *predict_mode >= 0 && (i_best >= 0 || a->i_mbrd >= 2); predict_mode++ )

{

    int i_satd;

    int i_mode = *predict_mode;

    if( h->mb.b_lossless )

         x264_predict_lossless_8x8( h, p_dst_by, 0, idx, i_mode, edge );

   else

        h->predict_8x8[i_mode]( p_dst_by, edge );

   i_satd = sa8d( p_dst_by, FDEC_STRIDE, p_src_by, FENC_STRIDE );

   if( i_pred_mode == x264_mb_pred_mode4x4_fix(i_mode) )

       i_satd -= 3 * lambda;

   COPY2_IF_LT( i_best, i_satd, a->i_predict8x8[idx], i_mode );

   a->i_satd_i8x8_dir[idx][i_mode] = i_satd + 4 * lambda; //存储8x8预测的代价

}

const int8_t *predict_mode = predict_4x4_mode_available( a->b_avoid_topright, h->mb.i_neighbour4[idx], idx );

遍历模式,并存储代价

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值