[x265-commits] [x265] predict: predict.cpp/.h defined, hungarian function names...

Deepthi Nandakumar deepthi at multicorewareinc.com
Thu Jul 31 09:11:20 CEST 2014


details:   http://hg.videolan.org/x265/rev/c32a86702b68
branches:  
changeset: 7642:c32a86702b68
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Jul 30 15:50:03 2014 +0530
description:
predict: predict.cpp/.h defined, hungarian function names cleaned up, warnings removed
Subject: [x265] scaling: use anonymous enums for class constants

details:   http://hg.videolan.org/x265/rev/0b0d398f35ca
branches:  
changeset: 7643:0b0d398f35ca
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 15:00:32 2014 -0500
description:
scaling: use anonymous enums for class constants

these didn't need to be integers, they didn't need storage.  They're
only used to declare arrays and enforce loop bounds.  This fixes a link
error in debug compiles on Linux.  While I was at it I improved the
comments and moved one definition to entropy.cpp since that was the only
place it was used.
Subject: [x265] TComTrQuant to Quant

details:   http://hg.videolan.org/x265/rev/3c659845e4dc
branches:  
changeset: 7644:3c659845e4dc
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 20:50:17 2014 -0500
description:
TComTrQuant to Quant
Subject: [x265] quant: use bIsLuma args instead of using a subset of TextType

details:   http://hg.videolan.org/x265/rev/32bc57acf918
branches:  
changeset: 7645:32bc57acf918
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:08:31 2014 -0500
description:
quant: use bIsLuma args instead of using a subset of TextType
Subject: [x265] slice: allow loop filter boundary flag to be analyzed

details:   http://hg.videolan.org/x265/rev/89316a3d04b6
branches:  
changeset: 7646:89316a3d04b6
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 23:09:58 2014 -0500
description:
slice: allow loop filter boundary flag to be analyzed
Subject: [x265] entropy: use bIsLuma in codeCoeffNxN()

details:   http://hg.videolan.org/x265/rev/a800a5ca5db7
branches:  
changeset: 7647:a800a5ca5db7
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:12:56 2014 -0500
description:
entropy: use bIsLuma in codeCoeffNxN()
Subject: [x265] entropy: nits

details:   http://hg.videolan.org/x265/rev/667a38aaccff
branches:  
changeset: 7648:667a38aaccff
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:13:06 2014 -0500
description:
entropy: nits
Subject: [x265] TComRom: nits

details:   http://hg.videolan.org/x265/rev/cbf7a9c4be88
branches:  
changeset: 7649:cbf7a9c4be88
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 31 00:33:01 2014 -0500
description:
TComRom: nits
Subject: [x265] common: remove unused SCALING_LIST_PARAMETER enum

details:   http://hg.videolan.org/x265/rev/5d6c2ddd5620
branches:  
changeset: 7650:5d6c2ddd5620
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 31 00:33:19 2014 -0500
description:
common: remove unused SCALING_LIST_PARAMETER enum
Subject: [x265] rdcost: keep psy-rd scale factor as an int (0..512), remove psyRdEnabled()

details:   http://hg.videolan.org/x265/rev/fdb6bb3b2763
branches:  
changeset: 7651:fdb6bb3b2763
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:39:00 2014 -0500
description:
rdcost: keep psy-rd scale factor as an int (0..512), remove psyRdEnabled()
Subject: [x265] rdcost: move zeroPel buffer to TEncSearch, its only user

details:   http://hg.videolan.org/x265/rev/79d976fdc263
branches:  
changeset: 7652:79d976fdc263
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:41:03 2014 -0500
description:
rdcost: move zeroPel buffer to TEncSearch, its only user
Subject: [x265] rdcost: change input type of setC*DistortionWeight to uint16_t

details:   http://hg.videolan.org/x265/rev/5e7a5c1c3446
branches:  
changeset: 7653:5e7a5c1c3446
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 21:56:14 2014 -0500
description:
rdcost: change input type of setC*DistortionWeight to uint16_t

the inputs were shorts, converted to doubles, passed to the function, then
floor() and casted to uint64_t
Subject: [x265] rdcost: settle on x264 style lambda naming scheme

details:   http://hg.videolan.org/x265/rev/639bef366e3e
branches:  
changeset: 7654:639bef366e3e
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 22:01:13 2014 -0500
description:
rdcost: settle on x264 style lambda naming scheme
Subject: [x265] dpb: cleanup prepareEncode()

details:   http://hg.videolan.org/x265/rev/565603cfe031
branches:  
changeset: 7655:565603cfe031
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 31 00:20:15 2014 -0500
description:
dpb: cleanup prepareEncode()
Subject: [x265] quant: use x264 style lambda naming scheme

details:   http://hg.videolan.org/x265/rev/77655ea856fe
branches:  
changeset: 7656:77655ea856fe
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 22:04:49 2014 -0500
description:
quant: use x264 style lambda naming scheme
Subject: [x265] quant: use bisLuma

details:   http://hg.videolan.org/x265/rev/8587668cf279
branches:  
changeset: 7657:8587668cf279
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 22:08:53 2014 -0500
description:
quant: use bisLuma
Subject: [x265] entropy: remove redundant !isIntra() check

details:   http://hg.videolan.org/x265/rev/b21a9eeec1f8
branches:  
changeset: 7658:b21a9eeec1f8
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 23:10:27 2014 -0500
description:
entropy: remove redundant !isIntra() check
Subject: [x265] entropy: remove unused flush function

details:   http://hg.videolan.org/x265/rev/674fb6e4d24c
branches:  
changeset: 7659:674fb6e4d24c
user:      Steve Borho <steve at borho.org>
date:      Wed Jul 30 17:01:27 2014 -0500
description:
entropy: remove unused flush function
Subject: [x265] dpb: fix picture re-use bug introduced in bc53f6dcda7f

details:   http://hg.videolan.org/x265/rev/29ca05751777
branches:  
changeset: 7660:29ca05751777
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 31 02:06:50 2014 -0500
description:
dpb: fix picture re-use bug introduced in bc53f6dcda7f

diffstat:

 source/Lib/TLibCommon/TComDataCU.cpp           |    22 +
 source/Lib/TLibCommon/TComDataCU.h             |    11 +
 source/Lib/TLibCommon/TComPattern.cpp          |     4 +-
 source/Lib/TLibCommon/TComPrediction.cpp       |   527 ----------
 source/Lib/TLibCommon/TComPrediction.h         |   121 --
 source/Lib/TLibCommon/TComRom.cpp              |     4 +-
 source/Lib/TLibCommon/TComRom.h                |    27 +-
 source/Lib/TLibCommon/TComTrQuant.cpp          |  1177 ------------------------
 source/Lib/TLibCommon/TComTrQuant.h            |   216 ----
 source/Lib/TLibCommon/TComWeightPrediction.cpp |     2 +-
 source/Lib/TLibCommon/TComYuv.cpp              |     2 +-
 source/Lib/TLibEncoder/TEncSearch.cpp          |   182 +-
 source/Lib/TLibEncoder/TEncSearch.h            |    10 +-
 source/common/CMakeLists.txt                   |     5 +-
 source/common/common.h                         |     7 -
 source/common/intrapred.cpp                    |     2 +-
 source/common/quant.cpp                        |  1168 +++++++++++++++++++++++
 source/common/quant.h                          |   162 +++
 source/common/scalinglist.h                    |    11 +-
 source/common/slice.h                          |     2 +
 source/encoder/CMakeLists.txt                  |     1 +
 source/encoder/analysis.cpp                    |    62 +-
 source/encoder/analysis.h                      |     6 +-
 source/encoder/dpb.cpp                         |    74 +-
 source/encoder/dpb.h                           |     2 +-
 source/encoder/entropy.cpp                     |    77 +-
 source/encoder/entropy.h                       |     3 +-
 source/encoder/frameencoder.cpp                |     2 +-
 source/encoder/predict.cpp                     |   517 ++++++++++
 source/encoder/predict.h                       |    98 +
 source/encoder/rdcost.h                        |    75 +-
 31 files changed, 2218 insertions(+), 2361 deletions(-)

diffs (truncated from 5714 to 300 lines):

diff -r 3d814fd1268b -r 29ca05751777 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Wed Jul 30 03:44:24 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Thu Jul 31 02:06:50 2014 -0500
@@ -2466,6 +2466,28 @@ ScanType TComDataCU::getCoefScanIdx(uint
         return SCAN_DIAG;
 }
 
+void TComDataCU::getTUEntropyCodingParameters(TUEntropyCodingParameters &result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma)
+{
+    // set the group layout
+    result.log2TrSizeCG = log2TrSize - 2;
+
+    // set the scan orders
+    result.scanType = getCoefScanIdx(absPartIdx, log2TrSize, bIsLuma, isIntra(absPartIdx));
+    result.scan     = g_scanOrder[result.scanType][log2TrSize - 2];
+    result.scanCG   = g_scanOrderCG[result.scanType][result.log2TrSizeCG];
+
+    if (log2TrSize == 2)
+        result.firstSignificanceMapContext = 0;
+    else if (log2TrSize == 3)
+    {
+        result.firstSignificanceMapContext = 9;
+        if (result.scanType != SCAN_DIAG && bIsLuma)
+            result.firstSignificanceMapContext += 6;
+    }
+    else
+        result.firstSignificanceMapContext = bIsLuma ? 21 : 12;
+}
+
 uint32_t TComDataCU::getSCUAddr()
 {
     return (m_cuAddr) * (1 << (g_maxCUDepth << 1)) + m_absIdxInLCU;
diff -r 3d814fd1268b -r 29ca05751777 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Wed Jul 30 03:44:24 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h	Thu Jul 31 02:06:50 2014 -0500
@@ -47,6 +47,16 @@
 namespace x265 {
 // private namespace
 
+// TU settings for entropy encoding
+struct TUEntropyCodingParameters
+{
+    const uint16_t *scan;
+    const uint16_t *scanCG;
+    ScanType        scanType;
+    uint32_t        log2TrSizeCG;
+    uint32_t        firstSignificanceMapContext;
+};
+
 class Frame;
 class Slice;
 
@@ -489,6 +499,7 @@ public:
     uint32_t&     getTotalNumPart()     { return m_numPartitions; }
 
     ScanType      getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma, bool bIsIntra);
+    void          getTUEntropyCodingParameters(TUEntropyCodingParameters &result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma);
 
     // -------------------------------------------------------------------------------------------------------------------
     // member functions to support multiple color space formats
diff -r 3d814fd1268b -r 29ca05751777 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Wed Jul 30 03:44:24 2014 -0500
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Thu Jul 31 02:06:50 2014 -0500
@@ -38,7 +38,7 @@
 #include "frame.h"
 #include "TComPattern.h"
 #include "TComDataCU.h"
-#include "TComPrediction.h"
+#include "predict.h"
 
 using namespace x265;
 
@@ -68,7 +68,7 @@ void TComPattern::initAdiPattern(TComDat
 
     fillReferenceSamples(roiOrigin, picStride, adiTemp, intraNeighbors);
 
-    bool bUseFilteredPredictions = (dirMode == ALL_IDX || TComPrediction::filteringIntraReferenceSamples(dirMode, intraNeighbors.log2TrSize));
+    bool bUseFilteredPredictions = (dirMode == ALL_IDX || Predict::filteringIntraReferenceSamples(dirMode, intraNeighbors.log2TrSize));
 
     if (bUseFilteredPredictions && 8 <= tuSize && tuSize <= 32)
     {
diff -r 3d814fd1268b -r 29ca05751777 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Wed Jul 30 03:44:24 2014 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,527 +0,0 @@
-/* The copyright in this software is being made available under the BSD
- * License, included below. This software may be subject to other third party
- * and contributor rights, including patent rights, and no such rights are
- * granted under this license.
- *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
- *    be used to endorse or promote products derived from this software without
- *    specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "TComPrediction.h"
-#include "primitives.h"
-#include "common.h"
-
-using namespace x265;
-
-static const uint8_t intraFilterThreshold[5] =
-{
-    10, //4x4
-    7,  //8x8
-    1,  //16x16
-    0,  //32x32
-    10, //64x64
-};
-
-TComPrediction::TComPrediction()
-{
-    m_predBuf = NULL;
-    m_refAbove = NULL;
-    m_refAboveFlt = NULL;
-    m_refLeft = NULL;
-    m_refLeftFlt = NULL;
-    m_immedVals = NULL;
-}
-
-TComPrediction::~TComPrediction()
-{
-    X265_FREE(m_predBuf);
-    X265_FREE(m_refAbove);
-    X265_FREE(m_refAboveFlt);
-    X265_FREE(m_refLeft);
-    X265_FREE(m_refLeftFlt);
-    X265_FREE(m_immedVals);
-
-    m_predYuv[0].destroy();
-    m_predYuv[1].destroy();
-    m_predShortYuv[0].destroy();
-    m_predShortYuv[1].destroy();
-    m_predTempYuv.destroy();
-}
-
-void TComPrediction::initTempBuff(int csp)
-{
-    m_csp = csp;
-
-    if (m_predBuf == NULL)
-    {
-        int predBufHeight = ((MAX_CU_SIZE + 2) << 4);
-        int predBufStride = ((MAX_CU_SIZE + 8) << 4);
-        m_predBuf = X265_MALLOC(pixel, predBufStride * predBufHeight);
-
-        m_refAbove = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
-        m_refAboveFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
-        m_refLeft = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
-        m_refLeftFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
-
-        m_predYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predShortYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predShortYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-        m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
-
-        m_immedVals = X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
-    }
-}
-
-bool TComPrediction::filteringIntraReferenceSamples(uint32_t dirMode, uint32_t log2TrSize)
-{
-    bool bFilter;
-
-    if (dirMode == DC_IDX || log2TrSize <= 2)
-    {
-        bFilter = false; // no smoothing for DC
-    }
-    else
-    {
-        int diff = std::min<int>(abs((int)dirMode - HOR_IDX), abs((int)dirMode - VER_IDX));
-        uint32_t sizeIdx = log2TrSize - 2;
-        bFilter = diff > intraFilterThreshold[sizeIdx];
-    }
-
-    return bFilter;
-}
-
-void TComPrediction::predIntraLumaAng(uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSize)
-{
-    int tuSize = 1 << log2TrSize;
-    bool bUseFilteredPredictions = filteringIntraReferenceSamples(dirMode, log2TrSize);
-
-    pixel *refLft, *refAbv;
-    refLft = m_refLeft + tuSize - 1;
-    refAbv = m_refAbove + tuSize - 1;
-
-    if (bUseFilteredPredictions)
-    {
-        refLft = m_refLeftFlt + tuSize - 1;
-        refAbv = m_refAboveFlt + tuSize - 1;
-    }
-
-    bool bFilter = log2TrSize <= 4 && dirMode != PLANAR_IDX;
-    int sizeIdx = log2TrSize - 2;
-    X265_CHECK(sizeIdx >= 0 && sizeIdx < 4, "intra block size is out of range\n");
-    primitives.intra_pred[sizeIdx][dirMode](dst, stride, refLft, refAbv, dirMode, bFilter);
-}
-
-void TComPrediction::predIntraChromaAng(pixel* src, uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSizeC, int chFmt)
-{
-    int tuSize = 1 << log2TrSizeC;
-    uint32_t tuSize2 = tuSize << 1;
-
-    // Create the prediction
-    pixel refAbv[3 * MAX_CU_SIZE];
-    pixel refLft[3 * MAX_CU_SIZE];
-
-    bool bUseFilteredPredictions = (chFmt == X265_CSP_I444 && filteringIntraReferenceSamples(dirMode, log2TrSizeC));
-
-    if (bUseFilteredPredictions)
-    {
-        // generate filtered intra prediction samples
-        // left and left above border + above and above right border + top left corner = length of 3. filter buffer
-        int bufSize = tuSize2 + tuSize2 + 1;
-        uint32_t wh = ADI_BUF_STRIDE * (tuSize2 + 1);         // number of elements in one buffer
-
-        pixel* filterBuf  = src + wh;            // buffer for 2. filtering (sequential)
-        pixel* filterBufN = filterBuf + bufSize; // buffer for 1. filtering (sequential)
-
-        int l = 0;
-        // left border from bottom to top
-        for (int i = 0; i < tuSize2; i++)
-        {
-            filterBuf[l++] = src[ADI_BUF_STRIDE * (tuSize2 - i)];
-        }
-
-        // top left corner
-        filterBuf[l++] = src[0];
-
-        // above border from left to right
-        memcpy(&filterBuf[l], &src[1], tuSize2 * sizeof(*filterBuf));
-
-        // 1. filtering with [1 2 1]
-        filterBufN[0] = filterBuf[0];
-        filterBufN[bufSize - 1] = filterBuf[bufSize - 1];
-        for (int i = 1; i < bufSize - 1; i++)
-        {
-            filterBufN[i] = (filterBuf[i - 1] + 2 * filterBuf[i] + filterBuf[i + 1] + 2) >> 2;
-        }
-
-        // initialization of ADI buffers
-        int limit = tuSize2 + 1;
-        memcpy(refAbv + tuSize - 1, filterBufN + tuSize2, limit * sizeof(pixel));
-        for (int k = 0; k < limit; k++)
-        {
-            refLft[k + tuSize - 1] = filterBufN[tuSize2 - k];   // Smoothened
-        }
-    }
-    else
-    {
-        int limit = (dirMode <= 25 && dirMode >= 11) ? (tuSize + 1 + 1) : (tuSize2 + 1);
-        memcpy(refAbv + tuSize - 1, src, (limit) * sizeof(pixel));
-        for (int k = 0; k < limit; k++)
-        {
-            refLft[k + tuSize - 1] = src[k * ADI_BUF_STRIDE];
-        }
-    }
-
-    int sizeIdx = log2TrSizeC - 2;
-    X265_CHECK(sizeIdx >= 0 && sizeIdx < 4, "intra block size is out of range\n");
-    primitives.intra_pred[sizeIdx][dirMode](dst, stride, refLft + tuSize - 1, refAbv + tuSize - 1, dirMode, 0);
-}
-
-bool TComPrediction::xCheckIdenticalMotion(TComDataCU* cu)
-{
-    X265_CHECK(cu->m_slice->isInterB(), "identical motion check in P frame\n");
-    if (!cu->m_slice->m_pps->bUseWeightedBiPred)
-    {
-        int refIdxL0 = cu->getCUMvField(0)->getRefIdx(m_partAddr);
-        int refIdxL1 = cu->getCUMvField(1)->getRefIdx(m_partAddr);
-        if (refIdxL0 >= 0 && refIdxL1 >= 0)
-        {
-            int refPOCL0 = cu->m_slice->m_refPOCList[0][refIdxL0];
-            int refPOCL1 = cu->m_slice->m_refPOCList[1][refIdxL1];
-            if (refPOCL0 == refPOCL1 && cu->getCUMvField(0)->getMv(m_partAddr) == cu->getCUMvField(1)->getMv(m_partAddr))


More information about the x265-commits mailing list