[x265-commits] [x265] Clean up SEI::write function

Aarthi Thirumalai aarthi at multicorewareinc.com
Sat Mar 24 01:03:03 CET 2018


details:   http://hg.videolan.org/x265/rev/5be53f09eee6
branches:  
changeset: 12007:5be53f09eee6
user:      Aarthi Thirumalai <aarthi at multicorewareinc.com>
date:      Wed Mar 14 17:24:34 2018 +0530
description:
Clean up SEI::write function

define another SEI function to count the payload size and return count in bits.
Set the payload size before calling SEI::write() to avoid clutter of if conditions in
write function. Write payloadtype and payload size in bitstream for all SEI in same way
as it is the syntax defined in the spec for any SEI.
Subject: [x265] SEI: fix build error

details:   http://hg.videolan.org/x265/rev/2e370d98c806
branches:  
changeset: 12008:2e370d98c806
user:      Ashok Kumar Mishra <ashok at multicorewareinc.com>
date:      Fri Mar 23 15:51:41 2018 +0530
description:
SEI: fix build error
Subject: [x265] Deprecate support for refine inter 0 for scaled encodes.

details:   http://hg.videolan.org/x265/rev/9086c8a3e76d
branches:  stable
changeset: 12009:9086c8a3e76d
user:      Bhavna Hariharan <bhavna at multicorewareinc.com>
date:      Thu Mar 22 10:07:18 2018 +0530
description:
Deprecate support for refine inter 0 for scaled encodes.

diffstat:

 doc/reST/cli.rst                |   18 +-
 source/CMakeLists.txt           |    2 +-
 source/common/cudata.cpp        |   24 +--
 source/common/cudata.h          |    5 -
 source/common/frame.cpp         |   16 -
 source/common/frame.h           |    8 -
 source/common/lowres.cpp        |   11 +-
 source/common/param.cpp         |   15 +-
 source/common/slice.h           |    6 +-
 source/encoder/analysis.cpp     |  178 +++-----------------
 source/encoder/analysis.h       |   25 --
 source/encoder/api.cpp          |    1 -
 source/encoder/dpb.cpp          |   11 +-
 source/encoder/dpb.h            |    2 -
 source/encoder/encoder.cpp      |  341 +++++----------------------------------
 source/encoder/encoder.h        |   48 -----
 source/encoder/frameencoder.cpp |   93 +----------
 source/encoder/frameencoder.h   |    1 -
 source/encoder/ratecontrol.cpp  |    1 -
 source/encoder/search.cpp       |   64 ++-----
 source/encoder/search.h         |    3 +-
 source/encoder/sei.h            |    5 -
 source/encoder/slicetype.cpp    |   22 +-
 source/x265.h                   |   19 --
 source/x265cli.h                |   12 +-
 25 files changed, 123 insertions(+), 808 deletions(-)

diffs (truncated from 1787 to 300 lines):

diff -r b9f5b5d7bf95 -r 9086c8a3e76d doc/reST/cli.rst
--- a/doc/reST/cli.rst	Thu Mar 15 10:52:52 2018 +0530
+++ b/doc/reST/cli.rst	Thu Mar 22 10:07:18 2018 +0530
@@ -915,7 +915,7 @@ will not reuse analysis if slice type pa
        This option should be coupled with analysis-reuse-mode option, --analysis-reuse-level 10.
        The ctu size of load should be double the size of save. Default 0.
 
-.. option:: --refine-intra <0..4>
+.. option:: --refine-intra <0..3>
 	
 	Enables refinement of intra blocks in current encode. 
 	
@@ -931,8 +931,6 @@ will not reuse analysis if slice type pa
 	
 	Level 3 - Perform analysis of intra modes for depth reused from first encode.
 	
-	Level 4 - Does not reuse any analysis information - redo analysis for the intra block.
-	
 	Default 0.
 	
 .. option:: --refine-inter <0..3>
@@ -955,12 +953,6 @@ will not reuse analysis if slice type pa
 	Level 3 - Perform analysis of inter modes while reusing depths from the save encode.
 	
 	Default 0.
-	
-.. option:: --dynamic-refine, --no-dynamic-refine
-
-	Dynamically switches :option:`--refine-inter` levels 0-3 based on the content and 
-	the encoder settings. It is recommended to use :option:`--refine-intra` 4 with dynamic 
-	refinement. Default disabled.
 
 .. option:: --refine-mv
 	
@@ -1863,11 +1855,6 @@ other levels.
 	the more bits it will try to spend on signaling information (motion
 	vectors and splits) and less on residual. This feature is intended
 	for experimentation.
-	
-.. option:: --max-ausize-factor <float>
-
-        It controls the maximum AU size defined in specification. It represents
-        the percentage of maximum AU size used. Default is 1. Range is 0.5 to 1.
 
 Loop filters
 ============
@@ -2218,9 +2205,6 @@ Bitstream options
 
 	Only effective at RD levels 5 and 6
 
-.. option:: --idr-recovery-sei, --no-idr-recoveery-sei
-    Emit RecoveryPoint info as sei in bitstream for each IDR frame. Default disabled.
-
 DCT Approximations
 =================
 
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/CMakeLists.txt	Thu Mar 22 10:07:18 2018 +0530
@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CP
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 156)
+set(X265_BUILD 151)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/cudata.cpp
--- a/source/common/cudata.cpp	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/cudata.cpp	Thu Mar 22 10:07:18 2018 +0530
@@ -317,16 +317,6 @@ void CUData::initCTU(const Frame& frame,
     m_cuAboveLeft = (m_cuLeft && m_cuAbove) ? m_encData->getPicCTU(m_cuAddr - widthInCU - 1) : NULL;
     m_cuAboveRight = (m_cuAbove && ((m_cuAddr % widthInCU) < (widthInCU - 1))) ? m_encData->getPicCTU(m_cuAddr - widthInCU + 1) : NULL;
     memset(m_distortion, 0, m_numPartitions * sizeof(sse_t));
-
-    if (m_encData->m_param->bDynamicRefine)
-    {
-        int size = m_encData->m_param->maxCUDepth * X265_REFINE_INTER_LEVELS;
-        CHECKED_MALLOC_ZERO(m_collectCURd, uint64_t, size);
-        CHECKED_MALLOC_ZERO(m_collectCUVariance, uint32_t, size);
-        CHECKED_MALLOC_ZERO(m_collectCUCount, uint32_t, size);
-    }
-fail:
-    return;
 }
 
 // initialize Sub partition
@@ -1636,11 +1626,6 @@ uint32_t CUData::getInterMergeCandidates
                 dir |= (1 << list);
                 candMvField[count][list].mv = colmv;
                 candMvField[count][list].refIdx = refIdx;
-                if (m_encData->m_param->scaleFactor && m_encData->m_param->analysisSave && m_log2CUSize[0] < 4)
-                {
-                    MV dist(MAX_MV, MAX_MV);
-                    candMvField[count][list].mv = dist;
-                }
             }
         }
 
@@ -1800,14 +1785,7 @@ int CUData::getPMV(InterNeighbourMV *nei
 
             int curRefPOC = m_slice->m_refPOCList[picList][refIdx];
             int curPOC = m_slice->m_poc;
-
-            if (m_encData->m_param->scaleFactor && m_encData->m_param->analysisSave && (m_log2CUSize[0] < 4))
-            {
-                MV dist(MAX_MV, MAX_MV);
-                pmv[numMvc++] = amvpCand[num++] = dist;
-            }
-            else
-                pmv[numMvc++] = amvpCand[num++] = scaleMvByPOCDist(neighbours[MD_COLLOCATED].mv[picList], curPOC, curRefPOC, colPOC, colRefPOC);
+            pmv[numMvc++] = amvpCand[num++] = scaleMvByPOCDist(neighbours[MD_COLLOCATED].mv[picList], curPOC, curRefPOC, colPOC, colRefPOC);
         }
     }
 
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/cudata.h
--- a/source/common/cudata.h	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/cudata.h	Thu Mar 22 10:07:18 2018 +0530
@@ -224,11 +224,6 @@ public:
     uint64_t      m_fAc_den[3];
     uint64_t      m_fDc_den[3];
 
-    /* Feature values per CTU for dynamic refinement */
-    uint64_t*       m_collectCURd;
-    uint32_t*       m_collectCUVariance;
-    uint32_t*       m_collectCUCount;
-
     CUData();
 
     void     initialize(const CUDataMemPool& dataPool, uint32_t depth, const x265_param& param, int instance);
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/frame.cpp
--- a/source/common/frame.cpp	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/frame.cpp	Thu Mar 22 10:07:18 2018 +0530
@@ -53,7 +53,6 @@ Frame::Frame()
     m_addOnDepth = NULL;
     m_addOnCtuInfo = NULL;
     m_addOnPrevChange = NULL;
-    m_classifyFrame = false;
 }
 
 bool Frame::create(x265_param *param, float* quantOffsets)
@@ -86,14 +85,6 @@ bool Frame::create(x265_param *param, fl
         m_analysis2Pass.analysisFramedata = NULL;
     }
 
-    if (param->bDynamicRefine)
-    {
-        int size = m_param->maxCUDepth * X265_REFINE_INTER_LEVELS;
-        CHECKED_MALLOC_ZERO(m_classifyRd, uint64_t, size);
-        CHECKED_MALLOC_ZERO(m_classifyVariance, uint64_t, size);
-        CHECKED_MALLOC_ZERO(m_classifyCount, uint32_t, size);
-    }
-
     if (m_fencPic->create(param, !!m_param->bCopyPicToFrame) && m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode || !!param->bAQMotion, param->rc.qgSize))
     {
         X265_CHECK((m_reconColCount == NULL), "m_reconColCount was initialized");
@@ -235,11 +226,4 @@ void Frame::destroy()
     }
     m_lowres.destroy();
     X265_FREE(m_rcData);
-
-    if (m_param->bDynamicRefine)
-    {
-        X265_FREE_ZERO(m_classifyRd);
-        X265_FREE_ZERO(m_classifyVariance);
-        X265_FREE_ZERO(m_classifyCount);
-    }
 }
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/frame.h
--- a/source/common/frame.h	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/frame.h	Thu Mar 22 10:07:18 2018 +0530
@@ -122,14 +122,6 @@ public:
     uint8_t**              m_addOnDepth;
     uint8_t**              m_addOnCtuInfo;
     int**                  m_addOnPrevChange;
-
-    /* Average feature values of frames being considered for classification */
-    uint64_t*              m_classifyRd;
-    uint64_t*              m_classifyVariance;
-    uint32_t*              m_classifyCount;
-
-    bool                   m_classifyFrame;
-
     Frame();
 
     bool create(x265_param *param, float* quantOffsets);
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/lowres.cpp
--- a/source/common/lowres.cpp	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/lowres.cpp	Thu Mar 22 10:07:18 2018 +0530
@@ -56,15 +56,13 @@ bool Lowres::create(PicYuv *origPic, int
     if (bAQEnabled)
     {
         CHECKED_MALLOC_ZERO(qpAqOffset, double, cuCountFullRes);
+        CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes);
         CHECKED_MALLOC_ZERO(invQscaleFactor, int, cuCountFullRes);
         CHECKED_MALLOC_ZERO(qpCuTreeOffset, double, cuCountFullRes);
+        CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes);
         if (qgSize == 8)
             CHECKED_MALLOC_ZERO(invQscaleFactor8x8, int, cuCount);
     }
-       if (origPic->m_param->bAQMotion)
-               CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes);
-    if (origPic->m_param->bDynamicRefine)
-        CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes);
     CHECKED_MALLOC(propagateCost, uint16_t, cuCount);
 
     /* allocate lowres buffers */
@@ -128,13 +126,14 @@ void Lowres::destroy()
         X265_FREE(lowresMvCosts[1][i]);
     }
     X265_FREE(qpAqOffset);
+    X265_FREE(qpAqMotionOffset);
     X265_FREE(invQscaleFactor);
     X265_FREE(qpCuTreeOffset);
     X265_FREE(propagateCost);
-       X265_FREE(invQscaleFactor8x8);
-       X265_FREE(qpAqMotionOffset);
     X265_FREE(blockVariance);
+    X265_FREE(invQscaleFactor8x8);
 }
+
 // (re) initialize lowres state
 void Lowres::init(PicYuv *origPic, int poc)
 {
diff -r b9f5b5d7bf95 -r 9086c8a3e76d source/common/param.cpp
--- a/source/common/param.cpp	Thu Mar 15 10:52:52 2018 +0530
+++ b/source/common/param.cpp	Thu Mar 22 10:07:18 2018 +0530
@@ -133,7 +133,7 @@ void x265_param_default(x265_param* para
     param->bEmitHRDSEI = 0;
     param->bEmitInfoSEI = 1;
     param->bEmitHDRSEI = 0;
-    param->bEmitIDRRecoverySEI = 0;
+
     /* CU definitions */
     param->maxCUSize = 64;
     param->minCUSize = 8;
@@ -289,14 +289,12 @@ void x265_param_default(x265_param* para
     param->scaleFactor = 0;
     param->intraRefine = 0;
     param->interRefine = 0;
-    param->bDynamicRefine = 0;
     param->mvRefine = 0;
     param->bUseAnalysisFile = 1;
     param->csvfpt = NULL;
     param->forceFlush = 0;
     param->bDisableLookahead = 0;
     param->bCopyPicToFrame = 1;
-    param->maxAUSizeFactor = 1;
 
     /* DCT Approximations */
     param->bLowPassDct = 0;
@@ -983,7 +981,6 @@ int x265_param_parse(x265_param* p, cons
         OPT("limit-sao") p->bLimitSAO = atobool(value);
         OPT("dhdr10-info") p->toneMapFile = strdup(value);
         OPT("dhdr10-opt") p->bDhdr10opt = atobool(value);
-        OPT("idr-recovery-sei") p->bEmitIDRRecoverySEI = atobool(value);
         OPT("const-vbv") p->rc.bEnableConstVbv = atobool(value);
         OPT("ctu-info") p->bCTUInfo = atoi(value);
         OPT("scale-factor") p->scaleFactor = atoi(value);
@@ -1015,8 +1012,6 @@ int x265_param_parse(x265_param* p, cons
         OPT("analysis-save") p->analysisSave = strdup(value);
         OPT("analysis-load") p->analysisLoad = strdup(value);
         OPT("radl") p->radl = atoi(value);
-        OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);
-        OPT("dynamic-refine") p->bDynamicRefine = atobool(value);
         else
             return X265_PARAM_BAD_NAME;
     }
@@ -1370,10 +1365,8 @@ int x265_check_params(x265_param* param)
         "Supported values for bCTUInfo are 0, 1, 2, 4, 6");
     CHECK(param->interRefine > 3 || param->interRefine < 0,
         "Invalid refine-inter value, refine-inter levels 0 to 3 supported");
-    CHECK(param->intraRefine > 4 || param->intraRefine < 0,
+    CHECK(param->intraRefine > 3 || param->intraRefine < 0,
         "Invalid refine-intra value, refine-intra levels 0 to 3 supported");
-    CHECK(param->maxAUSizeFactor < 0.5 || param->maxAUSizeFactor > 1.0,
-        "Supported factor for controlling max AU size is from 0.5 to 1");
 #if !X86_64
     CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 || param->sourceHeight > 480),
         "SEA motion search does not support resolutions greater than 480p in 32 bit build");
@@ -1511,7 +1504,6 @@ void x265_print_params(x265_param* param
     TOOLVAL(param->bCTUInfo, "ctu-info=%d");
     if (param->bMVType == AVC_INFO)
         TOOLOPT(param->bMVType, "refine-mv-type=avc");
-    TOOLOPT(param->bDynamicRefine, "dynamic-refine");
     if (param->maxSlices > 1)
         TOOLVAL(param->maxSlices, "slices=%d");
     if (param->bEnableLoopFilter)
@@ -1734,7 +1726,6 @@ char *x265_param2string(x265_param* p, i
     BOOL(p->bEmitHDRSEI, "hdr");
     BOOL(p->bHDROpt, "hdr-opt");
     BOOL(p->bDhdr10opt, "dhdr10-opt");
-    BOOL(p->bEmitIDRRecoverySEI, "idr-recovery-sei");
     if (p->analysisSave)
         s += sprintf(s, " analysis-save");
     if (p->analysisLoad)
@@ -1749,8 +1740,6 @@ char *x265_param2string(x265_param* p, i
     BOOL(p->bLowPassDct, "lowpass-dct");
     s += sprintf(s, " refine-mv-type=%d", p->bMVType);


More information about the x265-commits mailing list