[x265-commits] [x265] TEncCU: more QP cleanup for subCUs, inter modes.

Deepthi Nandakumar deepthi at multicorewareinc.com
Thu Mar 20 22:02:06 CET 2014


details:   http://hg.videolan.org/x265/rev/27e0620327e5
branches:  
changeset: 6562:27e0620327e5
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 21:54:20 2014 +0530
description:
TEncCU: more QP cleanup for subCUs, inter modes.
Subject: [x265] vbv: fix race condition in processRowEncoder, store row qp directly in m_pic->m_rowDiagQp.

details:   http://hg.videolan.org/x265/rev/5638c2311653
branches:  
changeset: 6563:5638c2311653
user:      Aarthi Thirumalai
date:      Thu Mar 20 15:23:37 2014 +0530
description:
vbv: fix race condition in processRowEncoder, store row qp directly in m_pic->m_rowDiagQp.
Subject: [x265] add experimental support for interlaced content (field encoding) (refs #15)

details:   http://hg.videolan.org/x265/rev/e35c8c03ee9f
branches:  
changeset: 6564:e35c8c03ee9f
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 22:21:00 2014 -0500
description:
add experimental support for interlaced content (field encoding) (refs #15)

* adds param.interlaceMode
* removes VUI params that are now handled automatically
* adds --no-interlace --interlace=tff|bff|prog|false CLI options
* signals interlace source flag, clears progressive source flag

This initial implementation requires the user to provide fields (half-height) in
the correct temporal order; so not very useful for exisitng Y4M or YUV
interlaced input files.

When interlacing is enabled, the encoder emits PictureTiming SEI messages that
indicate top or bottom field for the decoder.
Subject: [x265] pkgconfig: allow user-supplied lib folder (closes #40)

details:   http://hg.videolan.org/x265/rev/8830c8bf15cb
branches:  
changeset: 6565:8830c8bf15cb
user:      Steve Borho <steve at borho.org>
date:      Thu Mar 20 16:01:49 2014 -0500
description:
pkgconfig: allow user-supplied lib folder (closes #40)

diffstat:

 source/CMakeLists.txt             |   2 +-
 source/Lib/TLibEncoder/TEncCu.cpp |  44 ++++++++++++++++-----------------
 source/common/common.h            |   2 +-
 source/common/param.cpp           |  31 +++++++++++++----------
 source/encoder/encoder.cpp        |  15 ++++++-----
 source/encoder/encoder.h          |   3 --
 source/encoder/frameencoder.cpp   |  51 +++++++++++++++++++++++++++++---------
 source/encoder/ratecontrol.cpp    |   5 +---
 source/x265.cpp                   |   6 ++--
 source/x265.h                     |  17 +++++-------
 source/x265.pc.in                 |   2 +-
 11 files changed, 99 insertions(+), 79 deletions(-)

diffs (truncated from 571 to 300 lines):

diff -r 221d8aee9aa1 -r 8830c8bf15cb source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Mar 19 18:26:14 2014 -0500
+++ b/source/CMakeLists.txt	Thu Mar 20 16:01:49 2014 -0500
@@ -18,7 +18,7 @@ include(CheckSymbolExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 9)
+set(X265_BUILD 10)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 221d8aee9aa1 -r 8830c8bf15cb source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Wed Mar 19 18:26:14 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu Mar 20 16:01:49 2014 -0500
@@ -740,8 +740,6 @@ void TEncCu::xCompressCU(TComDataCU*& ou
     uint32_t tpely = outBestCU->getCUPelY();
     uint32_t bpely = tpely + outBestCU->getCUSize(0) - 1;
 
-    int qp = outTempCU->getQP(0);
-
     // If slice start or slice end is within this cu...
     TComSlice* slice = outTempCU->getPic()->getSlice();
     bool bSliceEnd = (slice->getSliceCurEndCUAddr() > outTempCU->getSCUAddr() &&
@@ -752,7 +750,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
     // We need to split, so don't try these modes.
     if (!bSliceEnd && bInsidePicture)
     {
-        outTempCU->initEstData(depth, qp);
+        outTempCU->initEstData(depth);
 
         // do inter modes, SKIP and 2Nx2N
         if (outBestCU->getSlice()->getSliceType() != I_SLICE)
@@ -761,18 +759,18 @@ void TEncCu::xCompressCU(TComDataCU*& ou
             if (m_param->bEnableEarlySkip)
             {
                 xCheckRDCostInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth, qp); // by competition for inter_2Nx2N
+                outTempCU->initEstData(depth); // by competition for inter_2Nx2N
             }
             // by Merge for inter_2Nx2N
             xCheckRDCostMerge2Nx2N(outBestCU, outTempCU, &earlyDetectionSkipMode, m_bestPredYuv[depth], m_bestRecoYuv[depth]);
 
-            outTempCU->initEstData(depth, qp);
+            outTempCU->initEstData(depth);
 
             if (!m_param->bEnableEarlySkip)
             {
                 // 2Nx2N, NxN
                 xCheckRDCostInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth, qp);
+                outTempCU->initEstData(depth);
                 if (m_param->bEnableCbfFastMode)
                 {
                     doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -782,7 +780,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
 
         if (!earlyDetectionSkipMode)
         {
-            outTempCU->initEstData(depth, qp);
+            outTempCU->initEstData(depth);
 
             // do inter modes, NxN, 2NxN, and Nx2N
             if (outBestCU->getSlice()->getSliceType() != I_SLICE)
@@ -793,7 +791,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                     if (depth == g_maxCUDepth - g_addCUDepth && doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_NxN);
-                        outTempCU->initEstData(depth, qp);
+                        outTempCU->initEstData(depth);
                     }
                 }
 
@@ -803,7 +801,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                     if (doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_Nx2N);
-                        outTempCU->initEstData(depth, qp);
+                        outTempCU->initEstData(depth);
                         if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_Nx2N)
                         {
                             doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -812,7 +810,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                     if (doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxN);
-                        outTempCU->initEstData(depth, qp);
+                        outTempCU->initEstData(depth);
                         if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxN)
                         {
                             doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -834,7 +832,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -843,7 +841,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -855,7 +853,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU, true);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -864,7 +862,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD, true);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -878,7 +876,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -887,7 +885,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nRx2N);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                         }
                     }
                     else if (bTestMergeAMP_Ver)
@@ -895,7 +893,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N, true);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -904,7 +902,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nRx2N, true);
-                            outTempCU->initEstData(depth, qp);
+                            outTempCU->initEstData(depth);
                         }
                     }
                 }
@@ -918,14 +916,14 @@ void TEncCu::xCompressCU(TComDataCU*& ou
                 outBestCU->getCbf(0, TEXT_CHROMA_V) != 0) // avoid very complex intra if it is unlikely
             {
                 xCheckRDCostIntraInInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth, qp);
+                outTempCU->initEstData(depth);
 
                 if (depth == g_maxCUDepth - g_addCUDepth)
                 {
                     if (outTempCU->getCUSize(0) > (1 << outTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize()))
                     {
                         xCheckRDCostIntraInInter(outBestCU, outTempCU, SIZE_NxN);
-                        outTempCU->initEstData(depth, qp);
+                        outTempCU->initEstData(depth);
                     }
                 }
             }
@@ -965,7 +963,7 @@ void TEncCu::xCompressCU(TComDataCU*& ou
         xFillPCMBuffer(outBestCU, m_origYuv[depth]);
     }
 
-    outTempCU->initEstData(depth, qp);
+    outTempCU->initEstData(depth);
 
     // further split
     if (bSubBranch && depth < g_maxCUDepth - g_addCUDepth)
@@ -976,8 +974,8 @@ void TEncCu::xCompressCU(TComDataCU*& ou
         uint32_t partUnitIdx = 0;
         for (; partUnitIdx < 4; partUnitIdx++)
         {
-            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
-            subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
+            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
+            subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
 
             bool bInSlice = subBestPartCU->getSCUAddr() < slice->getSliceCurEndCUAddr();
             if (bInSlice && (subBestPartCU->getCUPelX() < slice->getSPS()->getPicWidthInLumaSamples()) &&
diff -r 221d8aee9aa1 -r 8830c8bf15cb source/common/common.h
--- a/source/common/common.h	Wed Mar 19 18:26:14 2014 -0500
+++ b/source/common/common.h	Thu Mar 20 16:01:49 2014 -0500
@@ -104,7 +104,7 @@ typedef uint32_t pixel4;
 #define X265_LOWRES_CU_SIZE   8
 #define X265_LOWRES_CU_BITS   3
 
-#define MAX_NAL_UNITS 5
+#define MAX_NAL_UNITS 6
 #define MIN_FIFO_SIZE 1000
 
 #define X265_MALLOC(type, count)    (type*)x265_malloc(sizeof(type) * (count))
diff -r 221d8aee9aa1 -r 8830c8bf15cb source/common/param.cpp
--- a/source/common/param.cpp	Wed Mar 19 18:26:14 2014 -0500
+++ b/source/common/param.cpp	Thu Mar 20 16:01:49 2014 -0500
@@ -193,8 +193,6 @@ void x265_param_default(x265_param *para
     param->vui.bEnableChromaLocInfoPresentFlag = 0;
     param->vui.chromaSampleLocTypeTopField = 0;
     param->vui.chromaSampleLocTypeBottomField = 0;
-    param->vui.bEnableFieldSeqFlag = 0;
-    param->vui.bEnableFrameFieldInfoPresentFlag = 0;
     param->vui.bEnableDefaultDisplayWindowFlag = 0;
     param->vui.defDispWinLeftOffset = 0;
     param->vui.defDispWinRightOffset = 0;
@@ -572,6 +570,16 @@ int x265_param_parse(x265_param *p, cons
             p->bFrameAdaptive = atoi(value);
         }
     }
+    OPT("interlace")
+    {
+        p->interlaceMode = atobool(value);
+        if (bError || p->interlaceMode)
+        {
+            bError = false;
+            p->interlaceMode = parseName(value, x265_interlace_names, bError);
+        }
+        p->vui.bEnableVuiParametersPresentFlag |= !!p->interlaceMode;
+    }
     OPT("ref") p->maxNumReferences = atoi(value);
     OPT("weightp") p->bEnableWeightedPred = atobool(value);
     OPT("cbqpoffs") p->cbQpOffset = atoi(value);
@@ -620,8 +628,6 @@ int x265_param_parse(x265_param *p, cons
         p->vui.bEnableVideoSignalTypePresentFlag = bvalue;
         p->vui.bEnableColorDescriptionPresentFlag = bvalue;
         p->vui.bEnableChromaLocInfoPresentFlag = bvalue;
-        p->vui.bEnableFieldSeqFlag = bvalue;
-        p->vui.bEnableFrameFieldInfoPresentFlag = bvalue;
         p->vui.bEnableDefaultDisplayWindowFlag = bvalue;
         p->vui.bEnableVuiTimingInfoPresentFlag = bvalue;
         p->vui.bEnableVuiHrdParametersPresentFlag = bvalue;
@@ -694,16 +700,6 @@ int x265_param_parse(x265_param *p, cons
         p->vui.chromaSampleLocTypeTopField = atoi(value);
         p->vui.chromaSampleLocTypeBottomField = p->vui.chromaSampleLocTypeTopField;
     }
-    OPT("fieldseq")
-    {
-        p->vui.bEnableVuiParametersPresentFlag = 1;
-        p->vui.bEnableFieldSeqFlag = atobool(value);
-    }
-    OPT("framefieldinfo")
-    {
-        p->vui.bEnableVuiParametersPresentFlag = 1;
-        p->vui.bEnableFrameFieldInfoPresentFlag = atobool(value);
-    }
     OPT("crop-rect")
     {
         p->vui.bEnableVuiParametersPresentFlag = 1;
@@ -909,6 +905,8 @@ int x265_check_params(x265_param *param)
           "QP exceeds supported range (-QpBDOffsety to 51)");
     CHECK(param->fpsNum == 0 || param->fpsDenom == 0,
           "Frame rate numerator and denominator must be specified");
+    CHECK(param->interlaceMode < 0 || param->interlaceMode > 2,
+          "Interlace mode must be 0 (progressive) 1 (top-field first) or 2 (bottom field first)");
     CHECK(param->searchMethod<0 || param->searchMethod> X265_FULL_SEARCH,
           "Search method is not supported value (0:DIA 1:HEX 2:UMH 3:HM 5:FULL)");
     CHECK(param->searchRange < 0,
@@ -1086,6 +1084,10 @@ void x265_print_params(x265_param *param
 #if HIGH_BIT_DEPTH
     x265_log(param, X265_LOG_INFO, "Internal bit depth                  : %d\n", param->internalBitDepth);
 #endif
+    if (param->interlaceMode)
+    {
+        x265_log(param, X265_LOG_INFO, "Interlaced field inputs             : %s\n", x265_interlace_names[param->interlaceMode]);
+    }
     x265_log(param, X265_LOG_INFO, "CU size                             : %d\n", param->maxCUSize);
     x265_log(param, X265_LOG_INFO, "Max RQT depth inter / intra         : %d / %d\n", param->tuQTMaxInterDepth, param->tuQTMaxIntraDepth);
 
@@ -1190,6 +1192,7 @@ char *x265_param2string(x265_param *p)
     BOOL(p->bEnableStrongIntraSmoothing, "strong-intra-smoothing");
     BOOL(p->bEnableConstrainedIntra, "constrained-intra");
     BOOL(p->bOpenGOP, "open-gop");
+    s += sprintf(s, " interlace=%d", p->interlaceMode);
     s += sprintf(s, " keyint=%d", p->keyframeMax);
     s += sprintf(s, " min-keyint=%d", p->keyframeMin);
     s += sprintf(s, " scenecut=%d", p->scenecutThreshold);
diff -r 221d8aee9aa1 -r 8830c8bf15cb source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Mar 19 18:26:14 2014 -0500
+++ b/source/encoder/encoder.cpp	Thu Mar 20 16:01:49 2014 -0500
@@ -959,8 +959,8 @@ void Encoder::initSPS(TComSPS *sps)
     profileTierLevel.setTierFlag(m_levelTier ? true : false);


More information about the x265-commits mailing list