HM16.0之帧间Merge模式——xCheckRDCostMerge2Nx2N
参考:https://blog.csdn.net/nb_vol_1/article/details/51163625
1、源代码:
/** check RD costs for a CU block encoded with merge
* \param rpcBestCU
* \param rpcTempCU
* \returns Void
*/
Void TEncCu::xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU DEBUG_STRING_FN_DECLARE(sDebug), Bool *earlyDetectionSkipMode )
{
assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE ); // 确定该片是P Slice或者B Slice
TComMvField cMvFieldNeighbours[ * MRG_MAX_NUM_CANDS]; // double length for mv of both lists
UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
Int numValidMergeCand = ;
const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(); for( UInt ui = ; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
{
uhInterDirNeighbours[ui] = ;
}
UChar uhDepth = rpcTempCU->getDepth( ); // 获取当前深度
// 给PU中相应的partition写入分割模式
rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, , uhDepth ); // interprets depth relative to LCU level
// 取出Merge候选列表
rpcTempCU->getInterMergeCandidates( , , cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
// 构造候选列表
Int mergeCandBuffer[MRG_MAX_NUM_CANDS];
for( UInt ui = ; ui < numValidMergeCand; ++ui )
{
mergeCandBuffer[ui] = ;
} Bool bestIsSkip = false; UInt iteration;
// 默认为false,iteration = 2
if ( rpcTempCU->isLosslessCoded())
{
iteration = ;
}
else
{
iteration = ;
}
DEBUG_STRING_NEW(bestStr)
//代码结构分析
//第一次不理skip模式,bestIsSkip的初始值为false;
//第二次不处理mergeCandBuffer[uiMergeCand]为1的情况.
// 遍历两次:第一次无残差编码,第二次对残差编码
for( UInt uiNoResidual = ; uiNoResidual < iteration; ++uiNoResidual )
{
// 遍历所有Merge候选成员
for( UInt uiMergeCand = ; uiMergeCand < numValidMergeCand; ++uiMergeCand )
{
if(!(uiNoResidual== && mergeCandBuffer[uiMergeCand]==))
{
if( !(bestIsSkip && uiNoResidual == ) )
{
DEBUG_STRING_NEW(tmpStr)
// set MC parameters 设置运动补偿参数
rpcTempCU->setPredModeSubParts( MODE_INTER, , uhDepth ); // interprets depth relative to LCU level
rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, , uhDepth );
rpcTempCU->setChromaQpAdjSubParts( bTransquantBypassFlag ? : m_ChromaQpAdjIdc, , uhDepth );
rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, , uhDepth ); // interprets depth relative to LCU level
rpcTempCU->setMergeFlagSubParts( true, , , uhDepth ); // interprets depth relative to LCU level
rpcTempCU->setMergeIndexSubParts( uiMergeCand, , , uhDepth ); // interprets depth relative to LCU level
rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], , , uhDepth ); // interprets depth relative to LCU level
rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[ + *uiMergeCand], SIZE_2Nx2N, , ); // interprets depth relative to rpcTempCU level
rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[ + *uiMergeCand], SIZE_2Nx2N, , ); // interprets depth relative to rpcTempCU level // do MC 进行运动补偿
m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
// estimate residual and encode everything 计算残差和RDCost,并进行编码
m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
m_ppcOrigYuv [uhDepth],
m_ppcPredYuvTemp[uhDepth],
m_ppcResiYuvTemp[uhDepth],
m_ppcResiYuvBest[uhDepth],
m_ppcRecoYuvTemp[uhDepth],
(uiNoResidual != ) DEBUG_STRING_PASS_INTO(tmpStr) ); #ifdef DEBUG_STRING
DebugInterPredResiReco(tmpStr, *(m_ppcPredYuvTemp[uhDepth]), *(m_ppcResiYuvBest[uhDepth]), *(m_ppcRecoYuvTemp[uhDepth]), DebugStringGetPredModeMask(rpcTempCU->getPredictionMode()));
#endif
// 第一次迭代时进行
if ((uiNoResidual == ) && (rpcTempCU->getQtRootCbf() == ))
{
// If no residual when allowing for one, then set mark to not try case where residual is forced to 0
mergeCandBuffer[uiMergeCand] = ;
} rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf() == , , uhDepth );
Int orgQP = rpcTempCU->getQP( );
xCheckDQP( rpcTempCU );
// 更新最优模式
xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr));
// 重新初始化预测参数,为下一次预测做准备
rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
{
bestIsSkip = rpcBestCU->getQtRootCbf() == ;
}
}
}
}
// 如果开启earlyDetectionSkip时,第一次迭代执行
if(uiNoResidual == && m_pcEncCfg->getUseEarlySkipDetection())
{
if(rpcBestCU->getQtRootCbf( ) == )
{
if( rpcBestCU->getMergeFlag( ))
{
*earlyDetectionSkipMode = true;
}
else if(m_pcEncCfg->getFastSearch() != SELECTIVE)
{
Int absoulte_MV=;
for ( UInt uiRefListIdx = ; uiRefListIdx < ; uiRefListIdx++ )
{
if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > )
{
TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));
Int iHor = pcCUMvField->getMvd( ).getAbsHor();
Int iVer = pcCUMvField->getMvd( ).getAbsVer();
absoulte_MV+=iHor+iVer;
}
} if(absoulte_MV == )
{
*earlyDetectionSkipMode = true;
}
}
}
}
}
DEBUG_STRING_APPEND(sDebug, bestStr)
}
HM16.0之帧间Merge模式——xCheckRDCostMerge2Nx2N的更多相关文章
- HM16.0之帧间预测——xCheckRDCostInter()函数
参考:https://blog.csdn.net/nb_vol_1/article/category/6179825/1? 1.源代码: #if AMP_MRG Void TEncCu::xCheck ...
- HM16.0之帧内模式——xCheckRDCostIntra()函数
参考:https://blog.csdn.net/nb_vol_1/article/category/6179825/1? 1.源代码: Void TEncCu::xCheckRDCostIntra( ...
- HM16.0 TAppEncoder
参考: https://www.cnblogs.com/tiansha/p/6458573.html https://blog.csdn.net/liangjiubujiu/article/deta ...
- x264源代码简单分析:宏块分析(Analysis)部分-帧间宏块(Inter)
===================================================== H.264源代码分析文章列表: [编码 - x264] x264源代码简单分析:概述 x26 ...
- Paper | 帧间相关性 + 压缩视频质量增强(MFQE)
目录 1. ABSTRACT 2. INTRODUCTION 3. RELATED WORKS 3.1. Quality Enhancement 3.2. Multi-frame Super-reso ...
- x264代码剖析(十三):核心算法之帧间预測函数x264_mb_analyse_inter_*()
x264代码剖析(十三):核心算法之帧间预測函数x264_mb_analyse_inter_*() 帧间预測是指利用视频时间域相关性,使用临近已编码图像像素预測当前图像的像素,以达到有效去除视频时域冗 ...
- 【HEVC帧间预测论文】P1.7 Content Based Hierarchical Fast Coding Unit Decision Algorithm
Content Based Hierarchical Fast Coding Unit Decision Algorithm For HEVC <HEVC标准介绍.HEVC帧间预测论文笔记> ...
- 【HEVC帧间预测论文】P1.4 Motion Vectors Merging: Low Complexity Prediction Unit Decision
Motion Vectors Merging: Low Complexity Prediction Unit Decision Heuristic for the inter-Prediction o ...
- 【HEVC帧间预测论文】P1.3 Fast Inter-Frame Prediction Algorithm of HEVC Based on Graphic Information
基于图形信息的HEVC帧间预测快速算法/Fast Inter-Frame Prediction Algorithm of HEVC Based on Graphic Information <H ...
随机推荐
- 3. 懂了这些,方敢在简历上说会用Jackson写JSON
你必须非常努力,才能看起来毫不费力.本文已被 https://www.yourbatman.cn 收录,里面一并有Spring技术栈.MyBatis.JVM.中间件等小而美的专栏供以免费学习.关注公众 ...
- Python 字典(Dictionary) clear()方法
Python 字典(Dictionary) clear()方法 描述 Python 字典(Dictionary) clear() 函数用于删除字典内所有元素.高佣联盟 www.cgewang.com ...
- PHP curl_unescape函数
(PHP 5 >= 5.5.0) curl_unescape — 解码经过URL编码的字符串. 说明 string curl_unescape ( resource $ch , string $ ...
- PHP gmmktime() 函数
------------恢复内容开始------------ 实例 返回 GMT 日期的 UNIX 时间戳,然后使用它来查找该日期的天: <?php// Prints: October 3, 1 ...
- Canal简介
以下内容主要摘自Canal 官方wiki和网友博客:https://www.jianshu.com/p/6299048fad66 一.背景 早期,阿里巴巴B2B公司因为存在杭州和美国双机房部署,存在跨 ...
- .Net小白的第一篇博文
说起来也比较惭愧,5个月之前,我早已创建了博客园账号,那时候的我雄心壮志,给自己定下了 很多目标.现在回想起来,除了体重的增长,头发的稀疏,似乎这段时间的消逝并没有带给我什么见识上的成长.哈哈,想必大 ...
- day16.内置方法与模块
一.内置方法 1.abs 绝对值函数 res = abs(-100) print(res) 2.round 四舍五入 (n.5 n为偶数则舍去 n.5 n为奇数,则进一!) ""& ...
- kubernetes监控prometheus配置项解读
前言 文中解决两个问题: 1. kubernetes官方推荐的监控 prometheus 的配置文件, 各项是什么含义 2. 配置好面板之后, 如换去配置 grafana 面板 当然这两个问题网上都有 ...
- 小谢第50问:vuex的五个属性-使用-介绍
一.Vuex 是什么? 官网:Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化. 关键词:状态 ...
- 论文结果图:matplotlib和seaborn实现
在论文中,可视化结果往往很重要,毕竟文字太抽象,需要图片向审稿人直观的展现出我们的结果.我也写了俩篇论文和一篇专利的申请,其中也有一些画图的程序,因此记录,防止以后忘了.由于篇幅原因,文章就不贴代码, ...