[x265] [PATCH] Bidir: fix for hash mismatch with B-frames

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Wed Oct 16 13:41:06 CEST 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1381922390 -19800
# Node ID 0de261c32f33f278bfaf61a43580545d53738a92
# Parent  4b1716b232e56399cdc11abf5abb3c0b37d1c9ee
Bidir: fix for hash mismatch with B-frames

Use seperate variables for mvp and mvpidx used for zero mv candidates. Also copy the corresponding AMVPinfo for each reflist/refIdx.

diff -r 4b1716b232e5 -r 0de261c32f33 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Oct 16 02:35:57 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Oct 16 16:49:50 2013 +0530
@@ -2362,15 +2362,28 @@
                     m_me.setMVP(mvPredBi[1][refIdxBidir[1]]);
                     bitsZero1 = bits[1] - m_me.bitcost(mv[1]) + m_me.bitcost(mvzero);
 
-                    xCheckBestMVP(cu, REF_PIC_LIST_0, mvzero, mvPredBi[0][refIdxBidir[0]], mvpIdxBi[0][refIdxBidir[0]], bitsZero0, costTemp);
-                    xCheckBestMVP(cu, REF_PIC_LIST_1, mvzero, mvPredBi[1][refIdxBidir[1]], mvpIdxBi[1][refIdxBidir[1]], bitsZero1, costTemp);
-
-                    int costZero = satdCost + m_rdCost->getCost(bitsZero0) + m_rdCost->getCost(bitsZero1);
+                    UInt costZero = satdCost + m_rdCost->getCost(bitsZero0) + m_rdCost->getCost(bitsZero1);
+
+                    MV mvpZero[2];
+                    int mvpidxZero[2];
+                    mvpZero[0] = mvPredBi[0][refIdxBidir[0]];
+                    mvpidxZero[0] = mvpIdxBi[0][refIdxBidir[0]];
+                    xCopyAMVPInfo(&amvpInfo[0][refIdxBidir[0]], cu->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo());
+                    xCheckBestMVP(cu, REF_PIC_LIST_0, mvzero, mvpZero[0], mvpidxZero[0], bitsZero0, costZero);
+                    mvpZero[1] = mvPredBi[1][refIdxBidir[1]];
+                    mvpidxZero[1] = mvpIdxBi[1][refIdxBidir[1]];
+                    xCopyAMVPInfo(&amvpInfo[1][refIdxBidir[1]], cu->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo());
+                    xCheckBestMVP(cu, REF_PIC_LIST_1, mvzero, mvpZero[1], mvpidxZero[1], bitsZero1, costZero);
+
                     if (costZero < costbi)
                     {
                         costbi = costZero;
                         mvBidir[0].x = mvBidir[0].y = 0;
                         mvBidir[1].x = mvBidir[1].y = 0;
+                        mvPredBi[0][refIdxBidir[0]] = mvpZero[0];
+                        mvPredBi[1][refIdxBidir[1]] = mvpZero[1];
+                        mvpIdxBi[0][refIdxBidir[0]] = mvpidxZero[0];
+                        mvpIdxBi[1][refIdxBidir[1]] = mvpidxZero[1];
                         bits[2] = bitsZero0 + bitsZero1 - mbBits[0] - mbBits[1] + mbBits[2];
                     }
                 }


More information about the x265-devel mailing list