[x265-commits] [x265] search: fix non-det when an AMVP candidate is discarded b...

Steve Borho steve at borho.org
Fri May 1 23:19:57 CEST 2015


details:   http://hg.videolan.org/x265/rev/62a43374399f
branches:  
changeset: 10349:62a43374399f
user:      Steve Borho <steve at borho.org>
date:      Fri May 01 15:42:18 2015 -0500
description:
search: fix non-det when an AMVP candidate is discarded by frame parallelism
Subject: [x265] search: use selectMVP() helper function for --pme

details:   http://hg.videolan.org/x265/rev/3be4bc06072f
branches:  
changeset: 10350:3be4bc06072f
user:      Steve Borho <steve at borho.org>
date:      Fri May 01 12:34:09 2015 -0500
description:
search: use selectMVP() helper function for --pme

addresses an oversight in acf4ede2ca53
Subject: [x265] sei: the mastering display color primaries will typically be RGB

details:   http://hg.videolan.org/x265/rev/94e9c3464c49
branches:  
changeset: 10351:94e9c3464c49
user:      Steve Borho <steve at borho.org>
date:      Fri May 01 14:56:01 2015 -0500
description:
sei: the mastering display color primaries will typically be RGB

The HEVCv2 spec doesn't say what color space the three channels must be, but it
does say that if they are RGB they should be in GBR order. Since RGB seems most
likely, I've changed the format and help to make the order more clear

  display_primaries_x[ c ] and display_primaries_y[ c ] specify the
  normalized x and y chromaticity coordinates, respectively, of the
  colour primary component c of the mastering display in increments of
  0.00002, according to the CIE 1931 definition of x and y as specified
  in ISO 11664-1 (see also ISO 11664-3 and CIE 15). For describing
  mastering displays that use red, green and blue colour primaries, it
  is suggested that index value c equal to 0 should correspond to the
  green primary, c equal to 1 should correspond to the blue primary and
  c equal to 2 should correspond to the red colour primary (see also
  Annex E and Table E.3).  The values of display_primaries_x[ c ] and
  display_primaries_y[ c ] shall be in the range of 0 to 50 000,
  inclusive.

diffstat:

 doc/reST/cli.rst          |   6 ++--
 source/encoder/search.cpp |  62 ++++++++++++++--------------------------------
 source/encoder/search.h   |   2 +-
 3 files changed, 23 insertions(+), 47 deletions(-)

diffs (133 lines):

diff -r bca33880585a -r 94e9c3464c49 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Sat Apr 25 00:41:25 2015 -0500
+++ b/doc/reST/cli.rst	Fri May 01 14:56:01 2015 -0500
@@ -1493,12 +1493,12 @@ VUI fields must be manually specified.
 
 	SMPTE ST 2086 mastering display color volume SEI info, specified as
 	a string which is parsed when the stream header SEI are emitted. The
-	string format is "Y(%hu,%hu)U(%hu,%hu)V(%hu,%hu)WP(%hu,%hu)L(%u,%u)"
+	string format is "G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)"
 	where %hu are unsigned 16bit integers and %u are unsigned 32bit
-	integers. The SEI includes X,Y display primaries for YUV channels,
+	integers. The SEI includes X,Y display primaries for RGB channels,
 	white point X,Y and max,min luminance values.
 
-	Example: Y(10,12)U(5,13)V(5,13)WP(100,100)L(1000,100)
+	Example: G(10,12)B(5,13)R(5,13)WP(100,100)L(1000,100)
 
 	Note that this string value will need to be escaped or quoted to
 	protect against shell expansion on many platforms
diff -r bca33880585a -r 94e9c3464c49 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Sat Apr 25 00:41:25 2015 -0500
+++ b/source/encoder/search.cpp	Fri May 01 14:56:01 2015 -0500
@@ -1901,9 +1901,9 @@ void Search::processPME(PME& pme, Search
     do
     {
         if (meId < m_slice->m_numRefIdx[0])
-            slave.singleMotionEstimation(*this, pme.mode, pme.cuGeom, pme.pu, pme.puIdx, 0, meId);
+            slave.singleMotionEstimation(*this, pme.mode, pme.pu, pme.puIdx, 0, meId);
         else
-            slave.singleMotionEstimation(*this, pme.mode, pme.cuGeom, pme.pu, pme.puIdx, 1, meId - m_slice->m_numRefIdx[0]);
+            slave.singleMotionEstimation(*this, pme.mode, pme.pu, pme.puIdx, 1, meId - m_slice->m_numRefIdx[0]);
 
         meId = -1;
         pme.m_lock.acquire();
@@ -1914,49 +1914,23 @@ void Search::processPME(PME& pme, Search
     while (meId >= 0);
 }
 
-void Search::singleMotionEstimation(Search& master, Mode& interMode, const CUGeom& cuGeom, const PredictionUnit& pu,
-                                    int part, int list, int ref)
+void Search::singleMotionEstimation(Search& master, Mode& interMode, const PredictionUnit& pu, int part, int list, int ref)
 {
     uint32_t bits = master.m_listSelBits[list] + MVP_IDX_BITS;
     bits += getTUBits(ref, m_slice->m_numRefIdx[list]);
 
-    MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 1];
+    MotionData* bestME = interMode.bestME[part];
+
+    MV  mvc[(MD_ABOVE_LEFT + 1) * 2 + 1];
     int numMvc = interMode.cu.getPMV(interMode.interNeighbours, list, ref, interMode.amvpCand[list][ref], mvc);
 
-    int merange = m_param->searchRange;
-    MotionData* bestME = interMode.bestME[part];
     const MV* amvp = interMode.amvpCand[list][ref];
-    int mvpIdx = 0;
-
-    if (amvp[0] != amvp[1])
-    {
-        uint32_t bestCost = MAX_INT;
-        for (int i = 0; i < AMVP_NUM_CANDS; i++)
-        {
-            MV mvCand = amvp[i];
-
-            // NOTE: skip mvCand if Y is > merange and -FN>1
-            if (m_bFrameParallel && (mvCand.y >= (merange + 1) * 4))
-                continue;
-
-            interMode.cu.clipMv(mvCand);
-
-            Yuv& tmpPredYuv = m_rqt[cuGeom.depth].tmpPredYuv;
-            predInterLumaPixel(pu, tmpPredYuv, *m_slice->m_refPicList[list][ref]->m_reconPic, mvCand);
-            uint32_t cost = m_me.bufSAD(tmpPredYuv.getLumaAddr(pu.puAbsPartIdx), tmpPredYuv.m_size);
-
-            if (bestCost > cost)
-            {
-                bestCost = cost;
-                mvpIdx = i;
-            }
-        }
-    }
-
+    int mvpIdx = selectMVP(interMode.cu, pu, amvp, list, ref);
     MV mvmin, mvmax, outmv, mvp = amvp[mvpIdx];
-    setSearchRange(interMode.cu, mvp, merange, mvmin, mvmax);
-
-    int satdCost = m_me.motionEstimate(&m_slice->m_mref[list][ref], mvmin, mvmax, mvp, numMvc, mvc, merange, outmv);
+
+    setSearchRange(interMode.cu, mvp, m_param->searchRange, mvmin, mvmax);
+
+    int satdCost = m_me.motionEstimate(&m_slice->m_mref[list][ref], mvmin, mvmax, mvp, numMvc, mvc, m_param->searchRange, outmv);
 
     /* Get total cost of partition, but only include MV bit cost once */
     bits += m_me.bitcost(outmv);
@@ -1995,11 +1969,13 @@ int Search::selectMVP(const CUData& cu, 
 
         // NOTE: skip mvCand if Y is > merange and -FN>1
         if (m_bFrameParallel && (mvCand.y >= (m_param->searchRange + 1) * 4))
-            continue;
-
-        cu.clipMv(mvCand);
-        predInterLumaPixel(pu, tmpPredYuv, *m_slice->m_refPicList[list][ref]->m_reconPic, mvCand);
-        costs[i] = m_me.bufSAD(tmpPredYuv.getLumaAddr(pu.puAbsPartIdx), tmpPredYuv.m_size);
+            costs[i] = m_me.COST_MAX;
+        else
+        {
+            cu.clipMv(mvCand);
+            predInterLumaPixel(pu, tmpPredYuv, *m_slice->m_refPicList[list][ref]->m_reconPic, mvCand);
+            costs[i] = m_me.bufSAD(tmpPredYuv.getLumaAddr(pu.puAbsPartIdx), tmpPredYuv.m_size);
+        }
     }
 
     return costs[0] <= costs[1] ? 0 : 1;
@@ -2093,7 +2069,7 @@ void Search::predInterSearch(Mode& inter
             {
                 processPME(pme, *this);
 
-                singleMotionEstimation(*this, interMode, cuGeom, pu, puIdx, 0, 0); /* L0-0 */
+                singleMotionEstimation(*this, interMode, pu, puIdx, 0, 0); /* L0-0 */
 
                 bDoUnidir = false;
 
diff -r bca33880585a -r 94e9c3464c49 source/encoder/search.h
--- a/source/encoder/search.h	Sat Apr 25 00:41:25 2015 -0500
+++ b/source/encoder/search.h	Fri May 01 14:56:01 2015 -0500
@@ -339,7 +339,7 @@ public:
     };
 
     void     processPME(PME& pme, Search& slave);
-    void     singleMotionEstimation(Search& master, Mode& interMode, const CUGeom& cuGeom, const PredictionUnit& pu, int part, int list, int ref);
+    void     singleMotionEstimation(Search& master, Mode& interMode, const PredictionUnit& pu, int part, int list, int ref);
 
 protected:
 


More information about the x265-commits mailing list