[x265-commits] [x265] weightPrediction: remove unused member variables, fix sha...

Steve Borho steve at borho.org
Mon Jan 6 17:39:46 CET 2014


details:   http://hg.videolan.org/x265/rev/0715d03808f3
branches:  
changeset: 5794:0715d03808f3
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 13:02:32 2014 -0600
description:
weightPrediction: remove unused member variables, fix shadow warning
Subject: [x265] weight: use m_ prefix consistently for all member variables

details:   http://hg.videolan.org/x265/rev/d809090f70ad
branches:  
changeset: 5795:d809090f70ad
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 13:26:23 2014 -0600
description:
weight: use m_ prefix consistently for all member variables
Subject: [x265] weight: alloc intermediate weight buffer once per plane

details:   http://hg.videolan.org/x265/rev/c35d653ab515
branches:  
changeset: 5796:c35d653ab515
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 13:35:46 2014 -0600
description:
weight: alloc intermediate weight buffer once per plane
Subject: [x265] weight: nits

details:   http://hg.videolan.org/x265/rev/89e57c446a81
branches:  
changeset: 5797:89e57c446a81
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 13:35:51 2014 -0600
description:
weight: nits
Subject: [x265] weight: clarify max denom adjustments

details:   http://hg.videolan.org/x265/rev/75f7a9434289
branches:  
changeset: 5798:75f7a9434289
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 13:38:39 2014 -0600
description:
weight: clarify max denom adjustments
Subject: [x265] slice: nits

details:   http://hg.videolan.org/x265/rev/abd4da45823c
branches:  
changeset: 5799:abd4da45823c
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 01 15:52:11 2014 -0600
description:
slice: nits

diffstat:

 source/Lib/TLibCommon/TComSlice.h   |   87 +++++++++++-----------
 source/encoder/weightPrediction.cpp |  137 +++++++++++++++++------------------
 source/encoder/weightPrediction.h   |   42 ++++------
 3 files changed, 130 insertions(+), 136 deletions(-)

diffs (truncated from 540 to 300 lines):

diff -r 99f28c405b5c -r abd4da45823c source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Mon Jan 06 13:41:18 2014 +0800
+++ b/source/Lib/TLibCommon/TComSlice.h	Wed Jan 01 15:52:11 2014 -0600
@@ -1059,38 +1059,38 @@ class TComPPS
 {
 private:
 
-    int         m_PPSId;                  // pic_parameter_set_id
-    int         m_SPSId;                  // seq_parameter_set_id
-    int         m_picInitQPMinus26;
-    bool        m_useDQP;
-    bool        m_bConstrainedIntraPred;  // constrained_intra_pred_flag
-    bool        m_bSliceChromaQpFlag;     // slicelevel_chroma_qp_flag
+    int      m_PPSId;                  // pic_parameter_set_id
+    int      m_SPSId;                  // seq_parameter_set_id
+    int      m_picInitQPMinus26;
+    bool     m_useDQP;
+    bool     m_bConstrainedIntraPred;  // constrained_intra_pred_flag
+    bool     m_bSliceChromaQpFlag;     // slicelevel_chroma_qp_flag
 
     // access channel
-    TComSPS*    m_sps;
-    uint32_t        m_maxCuDQPDepth;
-    uint32_t        m_minCuDQPSize;
+    TComSPS* m_sps;
+    uint32_t m_maxCuDQPDepth;
+    uint32_t m_minCuDQPSize;
 
-    int         m_chromaCbQpOffset;
-    int         m_chromaCrQpOffset;
+    int      m_chromaCbQpOffset;
+    int      m_chromaCrQpOffset;
 
-    uint32_t        m_numRefIdxL0DefaultActive;
-    uint32_t        m_numRefIdxL1DefaultActive;
+    uint32_t m_numRefIdxL0DefaultActive;
+    uint32_t m_numRefIdxL1DefaultActive;
 
-    bool        m_bUseWeightPred;         // Use of Weighting Prediction (P_SLICE)
-    bool        m_useWeightedBiPred;      // Use of Weighting Bi-Prediction (B_SLICE)
-    bool        m_outputFlagPresentFlag; // Indicates the presence of output_flag in slice header
+    bool     m_bUseWeightPred;         // Use of Weighting Prediction (P_SLICE)
+    bool     m_useWeightedBiPred;      // Use of Weighting Bi-Prediction (B_SLICE)
+    bool     m_outputFlagPresentFlag; // Indicates the presence of output_flag in slice header
 
-    bool        m_transquantBypassEnableFlag; // Indicates presence of cu_transquant_bypass_flag in CUs.
-    bool        m_useTransformSkip;
-    bool        m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts
+    bool     m_transquantBypassEnableFlag; // Indicates presence of cu_transquant_bypass_flag in CUs.
+    bool     m_useTransformSkip;
+    bool     m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts
 
     bool     m_loopFilterAcrossTilesEnabledFlag;
 
     int      m_signHideFlag;
 
     bool     m_cabacInitPresentFlag;
-    uint32_t     m_encCABACTableIdx;         // Used to transmit table selection across slices
+    uint32_t m_encCABACTableIdx;         // Used to transmit table selection across slices
 
     bool     m_sliceHeaderExtensionPresentFlag;
     bool     m_deblockingFilterControlPresentFlag;
@@ -1100,9 +1100,10 @@ private:
     int      m_deblockingFilterTcOffsetDiv2;    //< tc offset for deblocking filter
     bool     m_scalingListPresentFlag;
     TComScalingList* m_scalingList; //!< ScalingList class pointer
-    bool m_listsModificationPresentFlag;
+
+    bool     m_listsModificationPresentFlag;
     uint32_t m_log2ParallelMergeLevelMinus2;
-    int m_numExtraSliceHeaderBits;
+    int      m_numExtraSliceHeaderBits;
 
 public:
 
@@ -1139,11 +1140,11 @@ public:
 
     void      setMaxCuDQPDepth(uint32_t u) { m_maxCuDQPDepth = u; }
 
-    uint32_t      getMaxCuDQPDepth() const { return m_maxCuDQPDepth; }
+    uint32_t  getMaxCuDQPDepth() const { return m_maxCuDQPDepth; }
 
     void      setMinCuDQPSize(uint32_t u) { m_minCuDQPSize = u; }
 
-    uint32_t      getMinCuDQPSize() const { return m_minCuDQPSize; }
+    uint32_t  getMinCuDQPSize() const { return m_minCuDQPSize; }
 
     void      setChromaCbQpOffset(int i) { m_chromaCbQpOffset = i; }
 
@@ -1327,22 +1328,22 @@ private:
     TComPPS*    m_pps;
     TComVPS*    m_vps;
     TComPic*    m_pic;
-    uint32_t        m_colFromL0Flag; // collocated picture from List0 flag
+    uint32_t    m_colFromL0Flag; // collocated picture from List0 flag
 
-    uint32_t        m_colRefIdx;
-    uint32_t        m_maxNumMergeCand;
+    uint32_t    m_colRefIdx;
+    uint32_t    m_maxNumMergeCand;
 
-    uint32_t        m_sliceCurEndCUAddr;
+    uint32_t    m_sliceCurEndCUAddr;
     bool        m_nextSlice;
-    uint32_t        m_sliceBits;
-    uint32_t        m_sliceSegmentBits;
+    uint32_t    m_sliceBits;
+    uint32_t    m_sliceSegmentBits;
     bool        m_bFinalized;
 
-    wpACDCParam     m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
+    wpACDCParam m_weightACDCParam[3];                 // [0:Y, 1:U, 2:V]
 
-    uint32_t        m_tileOffstForMultES;
+    uint32_t    m_tileOffstForMultES;
 
-    uint32_t*       m_substreamSizes;
+    uint32_t*   m_substreamSizes;
     TComScalingList* m_scalingList; //!< pointer of quantization matrix
     bool        m_cabacInitFlag;
 
@@ -1438,9 +1439,9 @@ public:
 
     int       getRefPOC(int e, int refIdx) { return m_refPOCList[e][refIdx]; }
 
-    uint32_t      getColFromL0Flag()                  { return m_colFromL0Flag; }
+    uint32_t  getColFromL0Flag()                  { return m_colFromL0Flag; }
 
-    uint32_t      getColRefIdx()                      { return m_colRefIdx; }
+    uint32_t  getColRefIdx()                      { return m_colRefIdx; }
 
     bool      getIsUsedAsLongTerm(int i, int j)   { return m_bIsUsedAsLongTerm[i][j]; }
 
@@ -1531,13 +1532,13 @@ public:
 
     bool isNextSlice()                         { return m_nextSlice; }
 
-    void setSliceBits(uint32_t val)                { m_sliceBits = val; }
+    void setSliceBits(uint32_t val)            { m_sliceBits = val; }
 
-    uint32_t getSliceBits()                        { return m_sliceBits; }
+    uint32_t getSliceBits()                    { return m_sliceBits; }
 
-    void setSliceSegmentBits(uint32_t val)         { m_sliceSegmentBits = val; }
+    void setSliceSegmentBits(uint32_t val)     { m_sliceSegmentBits = val; }
 
-    uint32_t getSliceSegmentBits()                 { return m_sliceSegmentBits; }
+    uint32_t getSliceSegmentBits()             { return m_sliceSegmentBits; }
 
     void setFinalized(bool val)                { m_bFinalized = val; }
 
@@ -1556,16 +1557,16 @@ public:
     void  getWpAcDcParam(wpACDCParam *&wp);
     void  initWpAcDcParam();
 
-    void setTileOffstForMultES(uint32_t offset)      { m_tileOffstForMultES = offset; }
+    void setTileOffstForMultES(uint32_t offset){ m_tileOffstForMultES = offset; }
 
-    uint32_t getTileOffstForMultES()                 { return m_tileOffstForMultES; }
+    uint32_t getTileOffstForMultES()           { return m_tileOffstForMultES; }
 
     void allocSubstreamSizes(uint32_t uiNumSubstreams);
-    uint32_t* getSubstreamSizes()                    { return m_substreamSizes; }
+    uint32_t* getSubstreamSizes()              { return m_substreamSizes; }
 
     void  setScalingList(TComScalingList* scalingList) { m_scalingList = scalingList; }
 
-    TComScalingList*   getScalingList()          { return m_scalingList; }
+    TComScalingList*   getScalingList()        { return m_scalingList; }
 
     void  setDefaultScalingList();
     bool  checkDefaultScalingList();
diff -r 99f28c405b5c -r abd4da45823c source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp	Mon Jan 06 13:41:18 2014 +0800
+++ b/source/encoder/weightPrediction.cpp	Wed Jan 01 15:52:11 2014 -0600
@@ -31,68 +31,65 @@ using namespace x265;
 
 void WeightPrediction::mcChroma()
 {
-    intptr_t strd = 8;
-
-    strd = m_refStride;
+    intptr_t strd = m_refStride;
     int pixoff = 0;
     int cu = 0;
+    int partEnum = CHROMA_8x8;
+    int16_t *immedVal = (int16_t*)X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
     pixel *temp;
-    int partEnum = CHROMA_8x8;
 
-    for (int y = 0; y < frmHeight; y += blockSize, pixoff = y * m_refStride)
+    for (int y = 0; y < m_frmHeight; y += m_blockSize, pixoff = y * m_refStride)
     {
-        for (int x = 0; x < frmWidth; x += blockSize, pixoff += blockSize, cu++)
+        for (int x = 0; x < m_frmWidth; x += m_blockSize, pixoff += m_blockSize, cu++)
         {
             if (m_mvCost[cu] < m_intraCost[cu])
             {
-                MV mv(mvs[cu]);
+                MV mv(m_mvs[cu]);
                 int refOffset = (mv.x >> (3 - m_csp444)) + (mv.y >> (3 - m_csp444)) * (int)m_refStride;
-                temp = mcbuf + refOffset + pixoff;
+                temp = m_mcbuf + refOffset + pixoff;
 
                 int xFrac = mv.x & 0x7;
                 int yFrac = mv.y & 0x7;
 
                 if ((yFrac | xFrac) == 0)
                 {
-                    primitives.chroma[m_csp].copy_pp[partEnum](buf + pixoff, m_refStride, temp, strd);
+                    primitives.chroma[m_csp].copy_pp[partEnum](m_buf + pixoff, m_refStride, temp, strd);
                 }
                 else if (yFrac == 0)
                 {
-                    primitives.chroma[m_csp].filter_hpp[partEnum](temp, strd, buf + pixoff, m_refStride, xFrac);
+                    primitives.chroma[m_csp].filter_hpp[partEnum](temp, strd, m_buf + pixoff, m_refStride, xFrac);
                 }
                 else if (xFrac == 0)
                 {
-                    primitives.chroma[m_csp].filter_vpp[partEnum](temp, strd, buf + pixoff, m_refStride, yFrac);
+                    primitives.chroma[m_csp].filter_vpp[partEnum](temp, strd, m_buf + pixoff, m_refStride, yFrac);
                 }
                 else
                 {
-                    uint32_t cxWidth = blockSize;
-                    uint32_t cxHeight = blockSize;
-                    int16_t *immedVal = (int16_t*)X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
+                    uint32_t cxWidth = m_blockSize;
+                    uint32_t cxHeight = m_blockSize;
                     int extStride = cxWidth;
                     int filterSize = NTAPS_CHROMA;
                     int halfFilterSize = (filterSize >> 1);
 
                     primitives.chroma[m_csp].filter_hps[partEnum](temp, strd, immedVal, extStride, xFrac, 1);
-                    primitives.chroma_vsp(immedVal + (halfFilterSize - 1) * extStride, extStride, buf + pixoff, m_refStride, cxWidth, cxHeight, yFrac);
-
-                    X265_FREE(immedVal);
+                    primitives.chroma_vsp(immedVal + (halfFilterSize - 1) * extStride, extStride, m_buf + pixoff, m_refStride, cxWidth, cxHeight, yFrac);
                 }
             }
             else
             {
-                primitives.chroma[m_csp].copy_pp[partEnum](buf + pixoff, m_refStride, mcbuf + pixoff, m_refStride);
+                primitives.chroma[m_csp].copy_pp[partEnum](m_buf + pixoff, m_refStride, m_mcbuf + pixoff, m_refStride);
             }
         }
     }
 
-    mcbuf = buf;
+    X265_FREE(immedVal);
+    m_mcbuf = m_buf;
 }
 
 uint32_t WeightPrediction::weightCost(pixel *cur, pixel *ref, wpScalingParam *w)
 {
     int stride = m_refStride;
-    pixel *temp = (pixel*)X265_MALLOC(pixel, frmWidth * frmHeight);
+    pixel *temp = (pixel*)X265_MALLOC(pixel, m_frmWidth * m_frmHeight);
     bool nonBorderCU;
 
     if (w)
@@ -103,7 +100,7 @@ uint32_t WeightPrediction::weightCost(pi
         int correction = IF_INTERNAL_PREC - X265_DEPTH;
 
         // Adding (IF_INTERNAL_PREC - X265_DEPTH) to cancel effect of pixel to short conversion inside the primitive
-        primitives.weight_pp(ref, temp, m_refStride, m_dstStride, frmWidth, frmHeight,
+        primitives.weight_pp(ref, temp, m_refStride, m_dstStride, m_frmWidth, m_frmHeight,
                              scale, (1 << (denom - 1 + correction)), denom + correction, offset);
         ref = temp;
         stride = m_dstStride;
@@ -113,14 +110,14 @@ uint32_t WeightPrediction::weightCost(pi
     int pixoff = 0;
     int mb = 0;
     int count = 0;
-    for (int y = 0; y < frmHeight; y += 8, pixoff = y * m_refStride)
+    for (int y = 0; y < m_frmHeight; y += 8, pixoff = y * m_refStride)
     {
-        for (int x = 0; x < frmWidth; x += 8, mb++, pixoff += 8)
+        for (int x = 0; x < m_frmWidth; x += 8, mb++, pixoff += 8)
         {
-            nonBorderCU = (x > 0) && (x < frmWidth - 8 - 1) && (y > 0) && (y < frmHeight - 8 - 1);
+            nonBorderCU = (x > 0) && (x < m_frmWidth - 8 - 1) && (y > 0) && (y < m_frmHeight - 8 - 1);
             if (nonBorderCU)
             {
-                if (mvs)
+                if (m_mvs)
                 {
                     if (m_mvCost[mb] < m_intraCost[mb])
                     {
@@ -147,33 +144,34 @@ void WeightPrediction::weightAnalyseEnc(
 {
     wpScalingParam w, *fw;
     Lowres *fenc, *ref;
-
-    fenc = &slice->getPic()->m_lowres;
-    int numPredDir = slice->isInterP() ? 1 : 2;
+    int numPredDir = m_slice->isInterP() ? 1 : 2;
     int curPoc, refPoc, difPoc;
-    curPoc = slice->getPOC();
     int check;


More information about the x265-commits mailing list