[x265-commits] [x265] Quant: fix for decoding hash mismatch in lossless mode

Ashok Kumar Mishra ashok at multicorewareinc.com
Wed Aug 12 13:05:49 CEST 2015


details:   http://hg.videolan.org/x265/rev/a68dff2b203c
branches:  stable
changeset: 10878:a68dff2b203c
user:      Ashok Kumar Mishra<ashok at multicorewareinc.com>
date:      Tue Aug 11 14:30:27 2015 +0530
description:
Quant: fix for decoding hash mismatch in lossless mode
Subject: [x265] api: add options max-luma and min-luma to set luma range of source pictures

details:   http://hg.videolan.org/x265/rev/60bd2b1236bb
branches:  
changeset: 10879:60bd2b1236bb
user:      Kavitha Sampath <kavitha at multicorewareinc.com>
date:      Tue Aug 11 17:55:11 2015 +0530
description:
api: add options max-luma and min-luma to set luma range of source pictures
Subject: [x265] asm: AVX2 asm for intra_ang_32 mode 4, improved over 45% than SSE asm

details:   http://hg.videolan.org/x265/rev/f923b04894ed
branches:  
changeset: 10880:f923b04894ed
user:      Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
date:      Mon Aug 10 17:48:19 2015 +0530
description:
asm: AVX2 asm for intra_ang_32 mode 4, improved over 45% than SSE asm

updated intra_ang_32 mode 32 AVX2 asm code, improved over 32% than previous AVX2 code
Subject: [x265] asm: replace LEA by ADD in macro TRANSPOSE_STORE_8x32

details:   http://hg.videolan.org/x265/rev/6d852c7fb788
branches:  
changeset: 10881:6d852c7fb788
user:      Min Chen <chenm003 at 163.com>
date:      Mon Aug 10 16:51:31 2015 -0700
description:
asm: replace LEA by ADD in macro TRANSPOSE_STORE_8x32
Subject: [x265] asm: new avx2 algorithm on intra_pred_ang[11], 730c -> 481c

details:   http://hg.videolan.org/x265/rev/dd3d926fe2f4
branches:  
changeset: 10882:dd3d926fe2f4
user:      Min Chen <chenm003 at 163.com>
date:      Mon Aug 10 16:51:34 2015 -0700
description:
asm: new avx2 algorithm on intra_pred_ang[11], 730c -> 481c
Subject: [x265] add API and implementation for Region of Interest(ROI)

details:   http://hg.videolan.org/x265/rev/a3a99fa18cbc
branches:  
changeset: 10883:a3a99fa18cbc
user:      Santhoshini Sekar<santhoshini at multicorewareinc.com>
date:      Thu Aug 06 11:11:44 2015 +0530
description:
add API and implementation for Region of Interest(ROI)
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/9aab14e821f9
branches:  
changeset: 10884:9aab14e821f9
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Tue Aug 11 18:37:39 2015 +0530
description:
Merge with stable
Subject: [x265] doc: edit min-luma and max-luma descriptions

details:   http://hg.videolan.org/x265/rev/c4d75c9585e4
branches:  
changeset: 10885:c4d75c9585e4
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Aug 12 08:52:12 2015 +0530
description:
doc: edit min-luma and max-luma descriptions
Subject: [x265] cleanup: simplify slice ref lists; moving shared offset buffers into SPS

details:   http://hg.videolan.org/x265/rev/bc5a7c2ac38b
branches:  
changeset: 10886:bc5a7c2ac38b
user:      Pradeep Ramachandran <pradeep at multicorewareinc.com>
date:      Wed Aug 12 15:13:51 2015 +0530
description:
cleanup: simplify slice ref lists; moving shared offset buffers into SPS

(this is part 1 of Steve's experimental patches)

Rename slice.m_refPicList to m_refFrameList since it is an array of Frame
pointers, and make a new slice.m_refReconPicList array which points directly
to the motion reference PicYuv buffers (bypassing the Frame structure)

The shared offset buffers were moved from the top-level encoder into the SPS
structure so the FrameData functions could use them directly (avoiding a major
layering violations). The offset buffers are computed based on SPS values, so it
seems minimally ugly to keep them there.

diffstat:

 doc/reST/cli.rst                     |   10 +
 source/CMakeLists.txt                |    2 +-
 source/common/cudata.cpp             |    6 +-
 source/common/deblock.cpp            |    8 +-
 source/common/frame.cpp              |   14 +-
 source/common/frame.h                |    2 +
 source/common/framedata.cpp          |    8 +-
 source/common/framedata.h            |    6 +-
 source/common/param.cpp              |    4 +
 source/common/picyuv.cpp             |    6 +-
 source/common/picyuv.h               |    2 +-
 source/common/predict.cpp            |   42 +-
 source/common/quant.cpp              |    3 -
 source/common/slice.cpp              |   12 +-
 source/common/slice.h                |   37 +-
 source/common/x86/asm-primitives.cpp |    1 +
 source/common/x86/intrapred8.asm     |  932 ++++++++++++++++------------------
 source/encoder/analysis.cpp          |   13 +-
 source/encoder/api.cpp               |    1 +
 source/encoder/dpb.cpp               |   20 +-
 source/encoder/dpb.h                 |    4 +-
 source/encoder/encoder.cpp           |   47 +-
 source/encoder/encoder.h             |    7 -
 source/encoder/frameencoder.cpp      |   11 +-
 source/encoder/framefilter.cpp       |    6 +-
 source/encoder/ratecontrol.cpp       |   18 +-
 source/encoder/sao.cpp               |   30 +-
 source/encoder/search.cpp            |   54 +-
 source/encoder/slicetype.cpp         |   28 +-
 source/encoder/weightPrediction.cpp  |    2 +-
 source/test/intrapredharness.cpp     |    2 +
 source/x265.h                        |   17 +
 source/x265cli.h                     |    4 +
 33 files changed, 697 insertions(+), 662 deletions(-)

diffs (truncated from 2307 to 300 lines):

diff -r 4781e6cef251 -r bc5a7c2ac38b doc/reST/cli.rst
--- a/doc/reST/cli.rst	Fri Aug 07 12:29:40 2015 +0530
+++ b/doc/reST/cli.rst	Wed Aug 12 15:13:51 2015 +0530
@@ -1638,6 +1638,16 @@ VUI fields must be manually specified.
 	Note that this string value will need to be escaped or quoted to
 	protect against shell expansion on many platforms. No default.
 
+.. option:: --min-luma <integer>
+
+	Minimum luma value allowed for input pictures. Any values below min-luma
+	are clipped. Experimental. No default.
+
+.. option:: --max-luma <integer>
+
+	Maximum luma value allowed for input pictures. Any values above max-luma
+	are clipped. Experimental. No default.
+
 Bitstream options
 =================
 
diff -r 4781e6cef251 -r bc5a7c2ac38b source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/CMakeLists.txt	Wed Aug 12 15:13:51 2015 +0530
@@ -30,7 +30,7 @@ option(STATIC_LINK_CRT "Statically link 
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 68)
+set(X265_BUILD 70)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/cudata.cpp
--- a/source/common/cudata.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/cudata.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -1676,7 +1676,7 @@ int CUData::getPMV(InterNeighbourMV *nei
         if (tempRefIdx != -1)
         {
             uint32_t cuAddr = neighbours[MD_COLLOCATED].cuAddr[picList];
-            const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
+            const Frame* colPic = m_slice->m_refFrameList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
             const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
 
             // Scale the vector
@@ -1857,7 +1857,7 @@ bool CUData::getIndirectPMV(MV& outMV, I
 
 bool CUData::getColMVP(MV& outMV, int& outRefIdx, int picList, int cuAddr, int partUnitIdx) const
 {
-    const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
+    const Frame* colPic = m_slice->m_refFrameList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
     const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
 
     uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
@@ -1892,7 +1892,7 @@ bool CUData::getColMVP(MV& outMV, int& o
 // Cache the collocated MV.
 bool CUData::getCollocatedMV(int cuAddr, int partUnitIdx, InterNeighbourMV *neighbour) const
 {
-    const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
+    const Frame* colPic = m_slice->m_refFrameList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
     const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
 
     uint32_t absPartAddr = partUnitIdx & TMVP_UNIT_MASK;
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/deblock.cpp
--- a/source/common/deblock.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/deblock.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -209,8 +209,8 @@ uint8_t Deblock::getBoundaryStrength(con
     const Slice* const sliceQ = cuQ->m_slice;
     const Slice* const sliceP = cuP->m_slice;
 
-    const Frame* refP0 = sliceP->getRefPic(0, cuP->m_refIdx[0][partP]);
-    const Frame* refQ0 = sliceQ->getRefPic(0, cuQ->m_refIdx[0][partQ]);
+    const Frame* refP0 = sliceP->m_refFrameList[0][cuP->m_refIdx[0][partP]];
+    const Frame* refQ0 = sliceQ->m_refFrameList[0][cuQ->m_refIdx[0][partQ]];
     const MV& mvP0 = refP0 ? cuP->m_mv[0][partP] : zeroMv;
     const MV& mvQ0 = refQ0 ? cuQ->m_mv[0][partQ] : zeroMv;
 
@@ -221,8 +221,8 @@ uint8_t Deblock::getBoundaryStrength(con
     }
 
     // (sliceQ->isInterB() || sliceP->isInterB())
-    const Frame* refP1 = sliceP->getRefPic(1, cuP->m_refIdx[1][partP]);
-    const Frame* refQ1 = sliceQ->getRefPic(1, cuQ->m_refIdx[1][partQ]);
+    const Frame* refP1 = sliceP->m_refFrameList[1][cuP->m_refIdx[1][partP]];
+    const Frame* refQ1 = sliceQ->m_refFrameList[1][cuQ->m_refIdx[1][partQ]];
     const MV& mvP1 = refP1 ? cuP->m_mv[1][partP] : zeroMv;
     const MV& mvQ1 = refQ1 ? cuQ->m_mv[1][partQ] : zeroMv;
 
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/frame.cpp
--- a/source/common/frame.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/frame.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -36,6 +36,7 @@ Frame::Frame()
     m_countRefEncoders = 0;
     m_encData = NULL;
     m_reconPic = NULL;
+    m_quantOffsets = NULL;
     m_next = NULL;
     m_prev = NULL;
     m_param = NULL;
@@ -56,7 +57,7 @@ bool Frame::allocEncodeData(x265_param *
     m_encData = new FrameData;
     m_reconPic = new PicYuv;
     m_encData->m_reconPic = m_reconPic;
-    bool ok = m_encData->create(param, sps) && m_reconPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
+    bool ok = m_encData->create(*param, sps) && m_reconPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp);
     if (ok)
     {
         /* initialize right border of m_reconpicYuv as SAO may read beyond the
@@ -65,6 +66,12 @@ bool Frame::allocEncodeData(x265_param *
         memset(m_reconPic->m_picOrg[0], 0, sizeof(pixel) * m_reconPic->m_stride * maxHeight);
         memset(m_reconPic->m_picOrg[1], 0, sizeof(pixel) * m_reconPic->m_strideC * (maxHeight >> m_reconPic->m_vChromaShift));
         memset(m_reconPic->m_picOrg[2], 0, sizeof(pixel) * m_reconPic->m_strideC * (maxHeight >> m_reconPic->m_vChromaShift));
+
+        /* use pre-calculated cu/pu offsets cached in the SPS structure */
+        m_reconPic->m_cuOffsetC = sps.cuOffsetC;
+        m_reconPic->m_cuOffsetY = sps.cuOffsetY;
+        m_reconPic->m_buOffsetC = sps.buOffsetC;
+        m_reconPic->m_buOffsetY = sps.buOffsetY;
     }
     return ok;
 }
@@ -100,5 +107,10 @@ void Frame::destroy()
         m_reconPic = NULL;
     }
 
+    if (m_quantOffsets)
+    {
+        delete[] m_quantOffsets;
+    }
+
     m_lowres.destroy();
 }
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/frame.h
--- a/source/common/frame.h	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/frame.h	Wed Aug 12 15:13:51 2015 +0530
@@ -59,6 +59,8 @@ public:
     bool                   m_lowresInit;         // lowres init complete (pre-analysis)
     bool                   m_bChromaExtended;    // orig chroma planes motion extended for weight analysis
 
+    float*                 m_quantOffsets;       // points to quantOffsets in x265_picture
+
     /* Frame Parallelism - notification between FrameEncoders of available motion reference rows */
     ThreadSafeInteger      m_reconRowCount;      // count of CTU rows completely reconstructed and extended for motion reference
     volatile uint32_t      m_countRefEncoders;   // count of FrameEncoder threads monitoring m_reconRowCount
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/framedata.cpp
--- a/source/common/framedata.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/framedata.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -31,15 +31,15 @@ FrameData::FrameData()
     memset(this, 0, sizeof(*this));
 }
 
-bool FrameData::create(x265_param *param, const SPS& sps)
+bool FrameData::create(const x265_param& param, const SPS& sps)
 {
-    m_param = param;
+    m_param = ¶m;
     m_slice  = new Slice;
     m_picCTU = new CUData[sps.numCUsInFrame];
 
-    m_cuMemPool.create(0, param->internalCsp, sps.numCUsInFrame);
+    m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame);
     for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)
-        m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param->internalCsp, ctuAddr);
+        m_picCTU[ctuAddr].initialize(m_cuMemPool, 0, param.internalCsp, ctuAddr);
 
     CHECKED_MALLOC(m_cuStat, RCStatCU, sps.numCUsInFrame);
     CHECKED_MALLOC(m_rowStat, RCStatRow, sps.numCuInHeight);
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/framedata.h
--- a/source/common/framedata.h	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/framedata.h	Wed Aug 12 15:13:51 2015 +0530
@@ -96,7 +96,7 @@ public:
 
     Slice*         m_slice;
     SAOParam*      m_saoParam;
-    x265_param*    m_param;
+    const x265_param* m_param;
 
     FrameData*     m_freeListNext;
     PicYuv*        m_reconPic;
@@ -142,11 +142,11 @@ public:
 
     FrameData();
 
-    bool create(x265_param *param, const SPS& sps);
+    bool create(const x265_param& param, const SPS& sps);
     void reinit(const SPS& sps);
     void destroy();
 
-    CUData* getPicCTU(uint32_t ctuAddr) { return &m_picCTU[ctuAddr]; }
+    inline CUData* getPicCTU(uint32_t ctuAddr) { return &m_picCTU[ctuAddr]; }
 };
 }
 
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/param.cpp
--- a/source/common/param.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/param.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -241,6 +241,8 @@ void x265_param_default(x265_param* para
     param->vui.defDispWinRightOffset = 0;
     param->vui.defDispWinTopOffset = 0;
     param->vui.defDispWinBottomOffset = 0;
+    param->minLuma = 0;
+    param->maxLuma = (1 << X265_DEPTH) - 1;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const char* tune)
@@ -855,6 +857,8 @@ int x265_param_parse(x265_param* p, cons
     OPT("qg-size") p->rc.qgSize = atoi(value);
     OPT("master-display") p->masteringDisplayColorVolume = strdup(value);
     OPT("max-cll") p->contentLightLevelInfo = strdup(value);
+    OPT("min-luma") p->minLuma = (uint16_t)atoi(value);
+    OPT("max-luma") p->maxLuma = (uint16_t)atoi(value);
     else
         return X265_PARAM_BAD_NAME;
 #undef OPT
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/picyuv.cpp
--- a/source/common/picyuv.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/picyuv.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -121,7 +121,7 @@ void PicYuv::destroy()
 
 /* Copy pixels from an x265_picture into internal PicYuv instance.
  * Shift pixels as necessary, mask off bits above X265_DEPTH for safety. */
-void PicYuv::copyFromPicture(const x265_picture& pic, int padx, int pady)
+void PicYuv::copyFromPicture(const x265_picture& pic, const x265_param& param, int padx, int pady)
 {
     /* m_picWidth is the width that is being encoded, padx indicates how many
      * of those pixels are padding to reach multiple of MinCU(4) size.
@@ -237,6 +237,10 @@ void PicYuv::copyFromPicture(const x265_
 
         for (int r = 0; r < height; r++)
         {
+            /* Clip luma of source picture to max and min values before extending edges of picYuv */
+            for (int c = 0; c < m_stride; c++)
+                Y[c] = x265_clip3((pixel)param.minLuma, (pixel)param.maxLuma, Y[c]);
+
             for (int x = 0; x < padx; x++)
                 Y[width + x] = Y[width - 1];
 
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/picyuv.h
--- a/source/common/picyuv.h	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/picyuv.h	Wed Aug 12 15:13:51 2015 +0530
@@ -66,7 +66,7 @@ public:
     bool  createOffsets(const SPS& sps);
     void  destroy();
 
-    void  copyFromPicture(const x265_picture&, int padx, int pady);
+    void  copyFromPicture(const x265_picture&, const x265_param& param, int padx, int pady);
 
     intptr_t getChromaAddrOffset(uint32_t ctuAddr, uint32_t absPartIdx) const { return m_cuOffsetC[ctuAddr] + m_buOffsetC[absPartIdx]; }
 
diff -r 4781e6cef251 -r bc5a7c2ac38b source/common/predict.cpp
--- a/source/common/predict.cpp	Fri Aug 07 12:29:40 2015 +0530
+++ b/source/common/predict.cpp	Wed Aug 12 15:13:51 2015 +0530
@@ -109,18 +109,18 @@ void Predict::motionCompensation(const C
             ShortYuv& shortYuv = m_predShortYuv[0];
 
             if (bLuma)
-                predInterLumaShort(pu, shortYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
+                predInterLumaShort(pu, shortYuv, *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
             if (bChroma)
-                predInterChromaShort(pu, shortYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
+                predInterChromaShort(pu, shortYuv, *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
 
             addWeightUni(pu, predYuv, shortYuv, wv0, bLuma, bChroma);
         }
         else
         {
             if (bLuma)
-                predInterLumaPixel(pu, predYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
+                predInterLumaPixel(pu, predYuv, *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
             if (bChroma)
-                predInterChromaPixel(pu, predYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
+                predInterChromaPixel(pu, predYuv, *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
         }
     }
     else
@@ -179,13 +179,13 @@ void Predict::motionCompensation(const C
 
             if (bLuma)
             {
-                predInterLumaShort(pu, m_predShortYuv[0], *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
-                predInterLumaShort(pu, m_predShortYuv[1], *cu.m_slice->m_refPicList[1][refIdx1]->m_reconPic, mv1);
+                predInterLumaShort(pu, m_predShortYuv[0], *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
+                predInterLumaShort(pu, m_predShortYuv[1], *cu.m_slice->m_refReconPicList[1][refIdx1], mv1);
             }
             if (bChroma)
             {
-                predInterChromaShort(pu, m_predShortYuv[0], *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
-                predInterChromaShort(pu, m_predShortYuv[1], *cu.m_slice->m_refPicList[1][refIdx1]->m_reconPic, mv1);
+                predInterChromaShort(pu, m_predShortYuv[0], *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
+                predInterChromaShort(pu, m_predShortYuv[1], *cu.m_slice->m_refReconPicList[1][refIdx1], mv1);
             }
 
             if (pwp0 && pwp1 && (pwp0->bPresentFlag || pwp1->bPresentFlag))
@@ -203,18 +203,18 @@ void Predict::motionCompensation(const C
                 ShortYuv& shortYuv = m_predShortYuv[0];
 
                 if (bLuma)
-                    predInterLumaShort(pu, shortYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);
+                    predInterLumaShort(pu, shortYuv, *cu.m_slice->m_refReconPicList[0][refIdx0], mv0);
                 if (bChroma)
-                    predInterChromaShort(pu, shortYuv, *cu.m_slice->m_refPicList[0][refIdx0]->m_reconPic, mv0);


More information about the x265-commits mailing list