[x265] [PATCH] default weightP: fix crash due to access of lowres array of references with invalid mvs in weightCost

Kavitha Sampath kavitha at multicorewareinc.com
Tue Jan 28 13:27:33 CET 2014


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1390911442 -19800
#      Tue Jan 28 17:47:22 2014 +0530
# Node ID 50916775f873c07477da1c3b0dfaef0c19c0d564
# Parent  3568c1b19947f8641504c69bca6ab859ed11825e
default weightP: fix crash due to access of lowres array of references with
invalid mvs in weightCost

diff -r 3568c1b19947 -r 50916775f873 source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp Tue Jan 28 01:49:03 2014 -0600
+++ b/source/encoder/weightPrediction.cpp Tue Jan 28 17:47:22 2014 +0530
@@ -119,7 +119,7 @@
             nonBorderCU = (x > 0) && (x < m_frmWidth - 8 - 1) && (y > 0)
&& (y < m_frmHeight - 8 - 1);
             if (nonBorderCU)
             {
-                if (m_mvs)
+                if (m_mcFlag)
                 {
                     if (m_mvCost[mb] < m_intraCost[mb])
                     {
@@ -188,7 +188,7 @@
     {
         for (int refIdxTemp = 0; (refIdxTemp <
m_slice->getNumRefIdx(list)) && (numWeighted < 8); refIdxTemp++)
         {
-            bool mcFlag = false;
+            m_mcFlag = false;
             check = 0;
             fw = m_wp[list][refIdxTemp];
             ref  = &m_slice->getRefPic(list, refIdxTemp)->m_lowres;
@@ -200,7 +200,7 @@
                 if (m_mvs[0].x != 0x7FFF)
                 {
                     m_mvCost = fenc->lowresMvCosts[0][difPoc - 1];
-                    mcFlag = true;
+                    m_mcFlag = true;
                 }
             }
             const float epsilon = 1.f / 128.f;
@@ -220,7 +220,6 @@
                     log2denom[1] = X265_MIN(log2denom[1],
(int)fw[yuv].log2WeightDenom);
                 }
             }
-
             log2denom[2] = log2denom[1];
             for (int yuv = 0; yuv < 3; yuv++)
             {
@@ -247,7 +246,7 @@
                 case 0:
                     m_mcbuf = ref->fpelPlane;
                     m_inbuf = fenc->lowresPlane[0];
-                    if(mcFlag)
+                    if(m_mcFlag)
                     {
                         pixel *tempm_buf;
                         pixel m_buf8[8 * 8];
@@ -271,7 +270,7 @@
                                 primitives.blockcpy_pp(8, 8, m_buf + (y *
m_refStride) + x, m_refStride, tempm_buf, strd);
                             }
                         }
-                        m_mcbuf = m_buf;
+                        m_mcbuf = m_buf;
                     }
                     break;
                 case 1:
@@ -279,7 +278,7 @@
                     m_mcbuf = m_slice->getRefPic(list,
refIdxTemp)->getPicYuvOrg()->getCbAddr();
                     m_inbuf =
m_slice->getPic()->getPicYuvOrg()->getCbAddr();
                     m_blockSize = 8;
-                    if(mcFlag) mcChroma();
+                    if(m_mcFlag) mcChroma();
                     break;

                 case 2:
@@ -287,7 +286,7 @@
                     m_mcbuf = m_slice->getRefPic(list,
refIdxTemp)->getPicYuvOrg()->getCrAddr();
                     m_inbuf =
m_slice->getPic()->getPicYuvOrg()->getCrAddr();
                     m_blockSize = 8;
-                    if(mcFlag) mcChroma();
+                    if(m_mcFlag) mcChroma();
                     break;
                 }

diff -r 3568c1b19947 -r 50916775f873 source/encoder/weightPrediction.h
--- a/source/encoder/weightPrediction.h Tue Jan 28 01:49:03 2014 -0600
+++ b/source/encoder/weightPrediction.h Tue Jan 28 17:47:22 2014 +0530
@@ -43,6 +43,7 @@
     int32_t *m_intraCost;
     MV *m_mvs;
     int m_bframes;
+    bool m_mcFlag;

 public:

@@ -58,6 +59,7 @@
         m_refStride = m_slice->getPic()->m_lowres.lumaStride;
         m_intraCost = m_slice->getPic()->m_lowres.intraCost;
         m_bframes = param.bframes;
+        m_mcFlag = false;

         m_mcbuf = NULL;
         m_inbuf = NULL;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/e69b70f5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: weightcost_crash.patch
Type: application/octet-stream
Size: 3840 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/e69b70f5/attachment.obj>


More information about the x265-devel mailing list