[x265] [PATCH 2 of 2] use one 32bit operation instead of two 16bit in MV union

Ma0 mateuszb at poczta.onet.pl
Sun Sep 9 15:30:07 CEST 2018


# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1536497834 -7200
#      Sun Sep 09 14:57:14 2018 +0200
# Node ID fa57fa584898fa3036e6748c0d7d348a9ce55b54
# Parent  deb35c64bdc56e4c9405d34bff516dc5bdaae5ae
use one 32bit operation instead of two 16bit in MV union

diff -r deb35c64bdc5 -r fa57fa584898 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Sun Sep 09 14:47:59 2018 +0200
+++ b/source/encoder/analysis.cpp	Sun Sep 09 14:57:14 2018 +0200
@@ -70,12 +70,6 @@
  * rd-level 5,6 does RDO for each inter mode
  */
 
-#define COPY_TO_MV(s1, s2, d1, d2)\
-    {\
-        d1 = s1; \
-        d2 = s2; \
-    }
-
 Analysis::Analysis()
 {
     m_reuseInterDataCTU = NULL;
@@ -2467,9 +2461,7 @@
                     mode.cu.setPUInterDir(interDataCTU->interDir[cuIdx + part], pu.puAbsPartIdx, part);
                     for (int list = 0; list < m_slice->isInterB() + 1; list++)
                     {
-                        MV dst; x265_analysis_MV src = interDataCTU->mv[list][cuIdx + part];
-                        COPY_TO_MV(src.x, src.y, dst.x, dst.y);
-                        mode.cu.setPUMv(list, dst, pu.puAbsPartIdx, part);
+                        mode.cu.setPUMv(list, interDataCTU->mv[list][cuIdx + part].word, pu.puAbsPartIdx, part);
                         mode.cu.setPURefIdx(list, interDataCTU->refIdx[list][cuIdx + part], pu.puAbsPartIdx, part);
                         mode.cu.m_mvpIdx[list][pu.puAbsPartIdx] = interDataCTU->mvpIdx[list][cuIdx + part];
                     }
@@ -2491,10 +2483,7 @@
                             if (m_param->interRefine != 1)
                                 mvp = mode.amvpCand[list][ref][mode.cu.m_mvpIdx[list][pu.puAbsPartIdx]];
                             else
-                            {
-                                x265_analysis_MV src = interDataCTU->mv[list][cuIdx + part];
-                                COPY_TO_MV(src.x, src.y, mvp.x, mvp.y);
-                            }
+                                mvp = interDataCTU->mv[list][cuIdx + part].word;
                             if (m_param->mvRefine || m_param->interRefine == 1)
                             {
                                 MV outmv;
@@ -3032,9 +3021,8 @@
             for (int32_t i = 0; i < numPredDir; i++)
             {
                 int* ref = &m_reuseRef[i * m_frame->m_analysisData.numPartitions * m_frame->m_analysisData.numCUsInFrame];
-                x265_analysis_MV src = m_reuseMv[i][cuGeom.absPartIdx];
                 bestME[i].ref = ref[cuGeom.absPartIdx];
-                COPY_TO_MV(src.x, src.y, bestME[i].mv.x, bestME[i].mv.y);
+                bestME[i].mv = m_reuseMv[i][cuGeom.absPartIdx].word;
                 bestME[i].mvpIdx = m_reuseMvpIdx[i][cuGeom.absPartIdx];
             }
         }
@@ -3097,10 +3085,9 @@
             MotionData* bestME = interMode.bestME[part];
             for (int32_t i = 0; i < numPredDir; i++)
             {
-                x265_analysis_MV src = m_reuseMv[i][cuGeom.absPartIdx];
                 int* ref = &m_reuseRef[i * m_frame->m_analysisData.numPartitions * m_frame->m_analysisData.numCUsInFrame];
                 bestME[i].ref = ref[cuGeom.absPartIdx];
-                COPY_TO_MV(src.x, src.y, bestME[i].mv.x, bestME[i].mv.y);
+                bestME[i].mv = m_reuseMv[i][cuGeom.absPartIdx].word;
                 bestME[i].mvpIdx = m_reuseMvpIdx[i][cuGeom.absPartIdx];
             }
         }
diff -r deb35c64bdc5 -r fa57fa584898 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Sun Sep 09 14:47:59 2018 +0200
+++ b/source/encoder/encoder.cpp	Sun Sep 09 14:57:14 2018 +0200
@@ -4281,8 +4281,6 @@
                                 {
                                     interDataCTU->mvpIdx[dir][depthBytes] = ctu->m_mvpIdx[dir][puabsPartIdx];
                                     interDataCTU->refIdx[dir][depthBytes] = ctu->m_refIdx[dir][puabsPartIdx];
-                                    interDataCTU->mv[dir][depthBytes].x = ctu->m_mv[dir][puabsPartIdx].x;
-                                    interDataCTU->mv[dir][depthBytes].y = ctu->m_mv[dir][puabsPartIdx].y;
                                     interDataCTU->mv[dir][depthBytes].word = ctu->m_mv[dir][puabsPartIdx].word;
                                 }
                             }
@@ -4425,16 +4423,12 @@
             for (uint32_t absPartIdx = 0; absPartIdx < ctu->m_numPartitions; depthBytes++)
             {
                 depth = ctu->m_cuDepth[absPartIdx];
-                interData->mv[0][depthBytes].x = ctu->m_mv[0][absPartIdx].x;
-                interData->mv[0][depthBytes].y = ctu->m_mv[0][absPartIdx].y;
                 interData->mv[0][depthBytes].word = ctu->m_mv[0][absPartIdx].word;
                 interData->mvpIdx[0][depthBytes] = ctu->m_mvpIdx[0][absPartIdx];
                 ref[0][depthBytes] = ctu->m_refIdx[0][absPartIdx];
                 predMode = ctu->m_predMode[absPartIdx];
                 if (ctu->m_refIdx[1][absPartIdx] != -1)
                 {
-                    interData->mv[1][depthBytes].x = ctu->m_mv[1][absPartIdx].x;
-                    interData->mv[1][depthBytes].y = ctu->m_mv[1][absPartIdx].y;
                     interData->mv[1][depthBytes].word = ctu->m_mv[1][absPartIdx].word;
                     interData->mvpIdx[1][depthBytes] = ctu->m_mvpIdx[1][absPartIdx];
                     ref[1][depthBytes] = ctu->m_refIdx[1][absPartIdx];
diff -r deb35c64bdc5 -r fa57fa584898 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Sun Sep 09 14:47:59 2018 +0200
+++ b/source/encoder/search.cpp	Sun Sep 09 14:57:14 2018 +0200
@@ -2225,9 +2225,7 @@
                 MV mvmin, mvmax, outmv, mvp;
                 if (useAsMVP)
                 {
-                    mvp.x = interDataCTU->mv[list][cuIdx + puIdx].x;
-                    mvp.y = interDataCTU->mv[list][cuIdx + puIdx].y;
-                    mvp.word = interDataCTU->mv[list][cuIdx + puIdx].word;
+                    mvp = interDataCTU->mv[list][cuIdx + puIdx].word;
                     mvpIdx = interDataCTU->mvpIdx[list][cuIdx + puIdx];
                 }
                 else


More information about the x265-devel mailing list