1. void Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, uint32_t& zOrder)
  2. {
  3. uint32_t depth = cuGeom.depth;//geometric CU几何结构
  4. ModeDepth& md = m_modeDepth[depth];
  5. md.bestMode = NULL;
  6.  
  7. bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);//为ture非叶子节点,还需继续分裂
  8. bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);//
  9.  
  10. if (m_param->analysisMode == X265_ANALYSIS_LOAD)
  11. {
  12. uint8_t* reuseDepth = &m_reuseIntraDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
  13. uint8_t* reuseModes = &m_reuseIntraDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
  14. char* reusePartSizes = &m_reuseIntraDataCTU->partSizes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
  15.  
  16. if (mightNotSplit && depth == reuseDepth[zOrder] && zOrder == cuGeom.encodeIdx)
  17. {
  18. m_quant.setQPforQuant(parentCTU);
  19.  
  20. PartSize size = (PartSize)reusePartSizes[zOrder];
  21. Mode& mode = size == SIZE_2Nx2N ? md.pred[PRED_INTRA] : md.pred[PRED_INTRA_NxN];
  22. mode.cu.initSubCU(parentCTU, cuGeom);
  23. checkIntra(mode, cuGeom, size, &reuseModes[zOrder]);
  24. checkBestMode(mode, depth);
  25.  
  26. if (m_bTryLossless)
  27. tryLossless(cuGeom);
  28.  
  29. if (mightSplit)
  30. addSplitFlagCost(*md.bestMode, cuGeom.depth);
  31.  
  32. // increment zOrder offset to point to next best depth in sharedDepth buffer
  33. zOrder += g_depthInc[g_maxCUDepth - ][reuseDepth[zOrder]];
  34. mightSplit = false;
  35. }
  36. }
  37. else if (mightNotSplit)
  38. {
  39. m_quant.setQPforQuant(parentCTU);
  40.  
  41. md.pred[PRED_INTRA].cu.initSubCU(parentCTU, cuGeom);
  42. checkIntra(md.pred[PRED_INTRA], cuGeom, SIZE_2Nx2N, NULL);//intra2Nx2N 模式
  43. checkBestMode(md.pred[PRED_INTRA], depth);
  44.  
  45. if (depth == g_maxCUDepth)
  46. {
  47. md.pred[PRED_INTRA_NxN].cu.initSubCU(parentCTU, cuGeom);
  48. checkIntra(md.pred[PRED_INTRA_NxN], cuGeom, SIZE_NxN, NULL);//INTRA_NxN 模式
  49. checkBestMode(md.pred[PRED_INTRA_NxN], depth);
  50. }
  51.  
  52. if (m_bTryLossless)
  53. tryLossless(cuGeom);
  54.  
  55. if (mightSplit)
  56. addSplitFlagCost(*md.bestMode, cuGeom.depth);
  57. }
  58.  
  59. if (mightSplit)
  60. {
  61. Mode* splitPred = &md.pred[PRED_SPLIT];
  62. splitPred->initCosts();
  63. CUData* splitCU = &splitPred->cu;
  64. splitCU->initSubCU(parentCTU, cuGeom);//分裂成4四subCU
  65.  
  66. uint32_t nextDepth = depth + ;
  67. ModeDepth& nd = m_modeDepth[nextDepth];
  68. invalidateContexts(nextDepth);
  69. Entropy* nextContext = &m_rqt[depth].cur;
  70.  
  71. for (uint32_t subPartIdx = ; subPartIdx < ; subPartIdx++)
  72. {
  73. const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
  74. if (childGeom.flags & CUGeom::PRESENT)
  75. {
  76. m_modeDepth[].fencYuv.copyPartToYuv(nd.fencYuv, childGeom.encodeIdx);
  77. m_rqt[nextDepth].cur.load(*nextContext);
  78. compressIntraCU(parentCTU, childGeom, zOrder);//递归
  79.  
  80. // Save best CU and pred data for this sub CU
  81. splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);
  82. splitPred->addSubCosts(*nd.bestMode);
  83. nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childGeom.numPartitions * subPartIdx);
  84. nextContext = &nd.bestMode->contexts;
  85. }
  86. else
  87. {
  88. /* record the depth of this non-present sub-CU */
  89. splitCU->setEmptyPart(childGeom, subPartIdx);
  90. zOrder += g_depthInc[g_maxCUDepth - ][nextDepth];
  91. }
  92. }
  93. nextContext->store(splitPred->contexts);
  94. if (mightNotSplit)
  95. addSplitFlagCost(*splitPred, cuGeom.depth);
  96. else
  97. updateModeCost(*splitPred);
  98. checkBestMode(*splitPred, depth);
  99. }
  100.  
  101. checkDQP(md.bestMode->cu, cuGeom);
  102.  
  103. /* Copy best data to encData CTU and recon */
  104. md.bestMode->cu.copyToPic(depth);
  105. if (md.bestMode != &md.pred[PRED_SPLIT])
  106. md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.encodeIdx);
  107. }

x265,帧内预测代码分析的更多相关文章

  1. x264 亮度信号8x8帧内预测模式

    1 该模式的8个预测方向与4x4帧内预测模式一样. 2 该模式只有High profile及更高的Profile的才有可能使用,Baseline.Main Profile.Preset为ultrafa ...

  2. H.264 White Paper学习笔记(二)帧内预测

    为什么要有帧内预测?因为一般来说,对于一幅图像,相邻的两个像素的亮度和色度值之间经常是比较接近的,也就是颜色是逐渐变化的,不会一下子突变成完全不一样的颜色.而进行视频编码,目的就是利用这个相关性,来进 ...

  3. 【HEVC】2、HM-16.7编码一个CU(帧内部分) 1.帧内预测相邻参考像素获取

    HEVC帧内预测的35中预测模式是在PU基础上定义的,实际帧内预测的过程则以TU为单位.PU以四叉树划分TU,一个PU内所有TU共享同一种预测模式.帧内预测分3个步骤: (1) 判断当前TU相邻像素点 ...

  4. 【HEVC】4、HM-16.7编码一个CU(帧内部分) 3.帧内预测各种模式实现

    HEVC中一共定义了35中帧内编码预测模式,编号分别以0-34定义.其中模式0定义为平面模式(INTRA_PLANAR),模式1定义为均值模式(INTRA_DC),模式2~34定义为角度预测模式(IN ...

  5. [原]H264帧内预测

    帧内预测模块大小 说明 4x4(亮度) 预测方式9种 8x8(亮度) 预测方式9种.只有high profile才有 16x16(亮度) 预测方式4种,只依赖左,上数据. 8x8(色度) 预测方式4种 ...

  6. H264提供了哪些帧内预测?

    H.264/AVC 提供了四种帧内预测方式:4x4 亮度块的帧内预测(Intra_4x4).16x16 亮度块的帧内预测(Intra_16x16).8x8 色度块的帧内预测(Intra_chroma) ...

  7. HM16.0帧内预测重要函数笔记

    Void TEncSearch::estIntraPredQT   亮度块的帧内预测入口函数 Void TComPrediction::initAdiPatternChType 获取参考样本点并滤波 ...

  8. H.264学习笔记2——帧内预测

    帧内预测:根据经过反量化和反变换(没有进行去块效应)之后的同一条带内的块进行预测. A.4x4亮度块预测: 用到的像素和预测方向如图: a~f是4x4块中要预测的像素值,A~Q是临块中解码后的参考值. ...

  9. H264帧内预测模式编号的编码过程

    1 本文词汇约定 宏块:H264编码基本单元,16x16像素(或采样)构成 块:   由8x8像素(或采样)构成的单位 子块:   由4x4像素(或采样)构成的单位 2 帧内亮度预测模式 H264规范 ...

随机推荐

  1. Java总结——文件&流

    最近学习了Java的输入输出,脑子里有两点乱,不过比之前的思路好像清晰了很多.脑子刚刚接收这些信息的时候,整个就是懵逼的,又是文件又是流的,文件到底干嘛的,流到底干嘛的?恩,后来,想了想,其实也不难理 ...

  2. 【原创】我所理解的自动更新-APP发布与后台发布

    发布后台 创建渠道:添加新的渠道,设置渠道名称,自动生成渠道id.    查看渠道:查看渠道基本信息,渠道app版本号,资源版本号,是否开启更新.    创建/更新APP:选择打包ios,androi ...

  3. powerDesigner生成excel版本的数据库文件

    今天收到一个需求,要把数据库设计给一个excel版本的,百度出来一个脚本文件,很好用发现,留个纪念 在pd中,shift+ctrl+X,打开脚本运行,脚本如下,附件也留了一份: '********** ...

  4. Makefile使用库

    这篇文章演示了Makefile使用mysqlpp库和lua库的写法. test.cpp: #include <iostream> #include <stdint.h> #in ...

  5. MySQL乱码问题

      JSP的request 默认为ISO8859_1,所以在处理中文的时候, 要显示中文的话,必须转成GBK的,如下 String str=new String(request.getParamete ...

  6. make phpexcel working with XAMPP7.0.9

    Environment XAMPP 7.0.9 (PHP 7.0.9) PHPExcel 1.7.6-1.8.1 not lib_zip.dll Windows 10.1 thinkPHP 5.0.1 ...

  7. HTTP请求 GET与POST是怎么实现?

    1.HTTP请求格式: <request line> <headers> <blank line> [<request-body>] 在HTTP请求中, ...

  8. web项目开发规范整理总结

    一.类.函数.变量名命名: 1.定义类时,全部拼音的首字母必须大写:如Person,ClassDemo:(帕斯卡命名法):也可以用带下斜杆的匈牙利命名法进行命名,如    head_navigatio ...

  9. jQuery 增加 删除 修改select option .

    jQuery获取Select选择的Text和Value: 1. var checkText=jQuery("#select_id").find("option:selec ...

  10. 20160712001 SQL server R2 更名

    use mastergoselect @@servername;select serverproperty('servername') sp_dropserver 'BPM-SERVER'gosp_a ...