[x265-commits] [x265] move TComRdCost.h to encoder/rdcost.h, cleanup refactor

Steve Borho steve at borho.org
Thu May 22 15:08:58 CEST 2014


details:   http://hg.videolan.org/x265/rev/0c9e5ebbb636
branches:  
changeset: 6895:0c9e5ebbb636
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 10:21:08 2014 -0500
description:
move TComRdCost.h to encoder/rdcost.h, cleanup refactor

The RDCost class has no resemblance to the original TComRdCost class.
Subject: [x265] cmake: merge TLibCommon source groups

details:   http://hg.videolan.org/x265/rev/163ea3a0388b
branches:  
changeset: 6896:163ea3a0388b
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 10:28:24 2014 -0500
description:
cmake: merge TLibCommon source groups
Subject: [x265] lowres: use a better name for cuTree offset buffer

details:   http://hg.videolan.org/x265/rev/7e92e9718b37
branches:  
changeset: 6897:7e92e9718b37
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 10:35:09 2014 -0500
description:
lowres: use a better name for cuTree offset buffer
Subject: [x265] frameencoder: fixup comment following variable rename

details:   http://hg.videolan.org/x265/rev/2ed0de7f2ea7
branches:  
changeset: 6898:2ed0de7f2ea7
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 11:03:23 2014 -0500
description:
frameencoder: fixup comment following variable rename
Subject: [x265] cmake: re-enable wd4800 for TLibCommon, fix remaining warnings

details:   http://hg.videolan.org/x265/rev/5bfeba9f7ae2
branches:  
changeset: 6899:5bfeba9f7ae2
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 11:13:20 2014 -0500
description:
cmake: re-enable wd4800 for TLibCommon, fix remaining warnings
Subject: [x265] cmake: re-enable wd4244 and wd4127 in common/vec

details:   http://hg.videolan.org/x265/rev/8a26aa7f81e3
branches:  
changeset: 6900:8a26aa7f81e3
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 11:18:18 2014 -0500
description:
cmake: re-enable wd4244 and wd4127 in common/vec
Subject: [x265] cmake: further cleanups

details:   http://hg.videolan.org/x265/rev/bc26992efaff
branches:  
changeset: 6901:bc26992efaff
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 11:19:59 2014 -0500
description:
cmake: further cleanups
Subject: [x265] cmake: re-enable wd4800 for TLibEncoder

details:   http://hg.videolan.org/x265/rev/dadb646a7266
branches:  
changeset: 6902:dadb646a7266
user:      Steve Borho <steve at borho.org>
date:      Wed May 21 11:23:29 2014 -0500
description:
cmake: re-enable wd4800 for TLibEncoder
Subject: [x265] fix: segmentation fault --tune zerolatency

details:   http://hg.videolan.org/x265/rev/6a3a53543a89
branches:  
changeset: 6903:6a3a53543a89
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Thu May 22 11:18:01 2014 +0900
description:
fix: segmentation fault --tune zerolatency
Subject: [x265] rc: rename variable vbvMinRate to isCbr

details:   http://hg.videolan.org/x265/rev/8f097477d74c
branches:  
changeset: 6904:8f097477d74c
user:      Santhoshini Sekar <santhoshini at multicorewareinc.com>
date:      Thu May 22 11:37:29 2014 +0530
description:
rc: rename variable vbvMinRate to isCbr
Subject: [x265] rc: always use frameSizeEstimted for bits in updateVbvPlan

details:   http://hg.videolan.org/x265/rev/9cf0134982f8
branches:  
changeset: 6905:9cf0134982f8
user:      Santhoshini Sekar <santhoshini at multicorewareinc.com>
date:      Thu May 22 14:17:04 2014 +0530
description:
rc: always use frameSizeEstimted for bits in updateVbvPlan
Subject: [x265] psyrd: is enabled only at rdLevels 5 and 6.

details:   http://hg.videolan.org/x265/rev/ceb4ff55f0e8
branches:  
changeset: 6906:ceb4ff55f0e8
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu May 22 16:40:46 2014 +0530
description:
psyrd: is enabled only at rdLevels 5 and 6.

Only rdLevels 5 and 6 use full-RDO based decisions. These are used in presets slower, veryslow and placebo.
Subject: [x265] rest: refine rdLevels description.

details:   http://hg.videolan.org/x265/rev/5548d3e6915d
branches:  
changeset: 6907:5548d3e6915d
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu May 22 16:48:38 2014 +0530
description:
rest: refine rdLevels description.
Subject: [x265] rc: simplify updateVbvPlan()

details:   http://hg.videolan.org/x265/rev/34187fb932d3
branches:  
changeset: 6908:34187fb932d3
user:      Steve Borho <steve at borho.org>
date:      Thu May 22 08:08:14 2014 -0500
description:
rc: simplify updateVbvPlan()

diffstat:

 doc/reST/cli.rst                                    |   37 ++--
 source/Lib/TLibCommon/TComDataCU.h                  |    1 -
 source/Lib/TLibCommon/TComRdCost.h                  |  164 --------------------
 source/Lib/TLibCommon/TComSlice.cpp                 |    2 +-
 source/Lib/TLibCommon/TComSlice.h                   |    2 +-
 source/Lib/TLibCommon/TComTrQuant.cpp               |    2 +-
 source/Lib/TLibCommon/TComTrQuant.h                 |    2 +-
 source/Lib/TLibEncoder/TEncCu.cpp                   |    4 +-
 source/Lib/TLibEncoder/TEncCu.h                     |    4 +-
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |    8 +-
 source/Lib/TLibEncoder/TEncSearch.cpp               |   17 +-
 source/Lib/TLibEncoder/TEncSearch.h                 |    5 +-
 source/common/CMakeLists.txt                        |   69 ++-----
 source/common/lowres.cpp                            |    4 +-
 source/common/lowres.h                              |    4 +-
 source/encoder/CMakeLists.txt                       |    5 +-
 source/encoder/compress.cpp                         |    4 +-
 source/encoder/cturow.cpp                           |    4 +-
 source/encoder/cturow.h                             |    4 +-
 source/encoder/encoder.cpp                          |   15 +-
 source/encoder/encoder.h                            |    4 +-
 source/encoder/frameencoder.cpp                     |    5 +-
 source/encoder/ratecontrol.cpp                      |   20 +-
 source/encoder/ratecontrol.h                        |    2 +-
 source/encoder/rdcost.h                             |  143 +++++++++++++++++
 source/encoder/slicetype.cpp                        |   10 +-
 26 files changed, 249 insertions(+), 292 deletions(-)

diffs (truncated from 1038 to 300 lines):

diff -r 5d0658f9c539 -r 34187fb932d3 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Wed May 21 18:32:28 2014 +0530
+++ b/doc/reST/cli.rst	Thu May 22 08:08:14 2014 -0500
@@ -641,23 +641,23 @@ Quality, rate control and rate distortio
 	Note that this table aims for accuracy, but is not necessarily our
 	final target behavior for each mode.
 
-	+-------+-------------------------------------------------------+
-	| Level | Description                                           |
-	+=======+=======================================================+
-	| 0     | sa8d mode and split decisions, intra w/ source pixels |
-	+-------+-------------------------------------------------------+
-	| 1     | recon generated (better intra), RDO merge residual    |
-	+-------+-------------------------------------------------------+
-	| 2     | RDO splits and merge residual choice                  |
-	+-------+-------------------------------------------------------+
-	| 3     | RDO mode decision and splits                          |
-	+-------+-------------------------------------------------------+
-	| 4     | Adds RDO Quant                                        |
-	+-------+-------------------------------------------------------+
-	| 5     | Enables intra modes in B slices                       |
-	+-------+-------------------------------------------------------+
-	| 6     | Currently same as 5                                   |
-	+-------+-------------------------------------------------------+
+	+-------+---------------------------------------------------------------+
+	| Level | Description                                                   |
+	+=======+===============================================================+
+	| 0     | sa8d mode and split decisions, intra w/ source pixels         |
+	+-------+---------------------------------------------------------------+
+	| 1     | recon generated (better intra), RDO merge residual            |
+	+-------+---------------------------------------------------------------+
+	| 2     | RDO splits and merge residual choice                          |
+	+-------+---------------------------------------------------------------+
+	| 3     | RDO mode and split decisions                                  |
+	+-------+---------------------------------------------------------------+
+	| 4     | Adds RDO Quant                                                |
+	+-------+---------------------------------------------------------------+
+	| 5     | Adds RDO prediction decisions, enables intra modes in B slices|
+	+-------+---------------------------------------------------------------+
+	| 6     | Currently same as 5                                           |
+	+-------+---------------------------------------------------------------+
 
 	**Range of values:** 0: least .. 6: full RDO analysis
 
@@ -666,7 +666,8 @@ Quality, rate control and rate distortio
 	Influence rate distortion optimizations to try to preserve the
 	energy of the source image in the encoded image, at the expense of
 	compression efficiency. 1.0 is a typical value. Default disabled. It
-	only has effect on presets which use RDO (slow and below)
+	only has effect on presets which use full RDO-based decisions (slower,
+	veryslow and placebo)
 
 	**Range of values:** 0 .. 2.0
 
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.h	Thu May 22 08:08:14 2014 -0500
@@ -42,7 +42,6 @@
 #include "CommonDef.h"
 #include "TComMotionInfo.h"
 #include "TComSlice.h"
-#include "TComRdCost.h"
 #include "TComPattern.h"
 
 namespace x265 {
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComRdCost.h
--- a/source/Lib/TLibCommon/TComRdCost.h	Wed May 21 18:32:28 2014 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +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.
- */
-
-/** \file     TComRdCost.h
-    \brief    RD cost computation classes (header)
-*/
-
-#ifndef X265_TCOMRDCOST_H
-#define X265_TCOMRDCOST_H
-
-#include "CommonDef.h"
-#include "common.h"
-
-//! \ingroup TLibCommon
-//! \{
-
-namespace x265 {
-// private namespace
-
-class TComPattern;
-
-/// RD cost computation class
-class TComRdCost
-{
-private:
-
-    uint64_t  m_lambdaMotionSSE;  // m_lambda2 w/ 8 bits of fraction
-
-    uint64_t  m_lambdaMotionSAD;  // m_lambda w/ 8 bits of fraction
-
-    uint64_t  m_cbDistortionWeight;
-
-    uint64_t  m_crDistortionWeight;
-
-    uint64_t  m_psyRdScale;            // Psy RD strength w/ 8 bits of fraction
-
-public:
-
-    static const pixel zeroPel[MAX_CU_SIZE * MAX_CU_SIZE];
-
-    void setLambda(double lambda2, double lambda)
-    {
-        m_lambdaMotionSSE = (uint64_t)floor(256.0 * lambda2);
-        m_lambdaMotionSAD = (uint64_t)floor(256.0 * lambda);
-    }
-
-    void setCbDistortionWeight(double cbDistortionWeight)
-    {
-        m_cbDistortionWeight = (uint64_t)floor(256.0 * cbDistortionWeight);
-    }
-
-    void setCrDistortionWeight(double crDistortionWeight)
-    {
-        m_crDistortionWeight = (uint64_t)floor(256.0 * crDistortionWeight);
-    }
-
-    void setPsyRdScale(double scale)
-    {
-        m_psyRdScale = (uint64_t)floor(256.0 * scale);
-    }
-
-    inline bool psyRdEnabled() const
-    {
-        return !!m_psyRdScale;
-    }
-
-    inline uint64_t calcRdCost(uint32_t distortion, uint32_t bits)
-    {
-        X265_CHECK(abs((float)((bits * m_lambdaMotionSSE + 128) >> 8) -
-                       (float)bits * m_lambdaMotionSSE / 256.0) < 2,
-                   "calcRdCost wrap detected dist: %d, bits %d, lambda: %d\n", distortion, bits, (int)m_lambdaMotionSSE);
-        return distortion + ((bits * m_lambdaMotionSSE + 128) >> 8);
-    }
-
-    /* return the difference in energy between the source block and the recon block */
-    inline uint32_t psyCost(int size, pixel *source, intptr_t sstride, pixel *recon, intptr_t rstride)
-    {
-        int pixelCountShift = (size + 2) * 2 - 1; // width * height / satd-scale(2)
-        int sdc = primitives.sad_square[size](source, sstride, (pixel*)zeroPel, MAX_CU_SIZE) >> pixelCountShift;
-        int sEnergy = primitives.sa8d[size](source, sstride, (pixel*)zeroPel, MAX_CU_SIZE) - sdc;
-
-        int rdc = primitives.sad_square[size](recon, rstride, (pixel*)zeroPel, MAX_CU_SIZE) >> pixelCountShift;
-        int rEnergy = primitives.sa8d[size](recon, rstride, (pixel*)zeroPel, MAX_CU_SIZE) - rdc;
-
-        X265_CHECK(sdc <= sEnergy && rdc <= rEnergy, "DC component of energy is more than total cost\n")
-        return abs(sEnergy - rEnergy);
-    }
-
-    /* return the RD cost of this prediction, including the effect of psy-rd */
-    inline uint64_t calcPsyRdCost(uint32_t distortion, uint32_t bits, uint32_t psycost)
-    {
-        uint64_t tot = bits + (((psycost * m_psyRdScale) + 128) >> 8);
-#if CHECKED_BUILD || _DEBUG
-        x265_emms();
-        X265_CHECK(abs((float)((tot * m_lambdaMotionSSE + 128) >> 8) -
-                       (float)tot * m_lambdaMotionSSE / 256.0) < 2,
-                   "calcPsyRdCost wrap detected tot: "X265_LL", lambda: "X265_LL"\n", tot, m_lambdaMotionSSE);
-#endif
-        return distortion + ((tot * m_lambdaMotionSSE + 128) >> 8);
-    }
-
-    inline uint64_t calcRdSADCost(uint32_t sadCost, uint32_t bits)
-    {
-        X265_CHECK(abs((float)((bits * m_lambdaMotionSAD + 128) >> 8) -
-                       (float)bits * m_lambdaMotionSAD / 256.0) < 2,
-                   "calcRdSADCost wrap detected dist: %d, bits %d, lambda: "X265_LL"\n", sadCost, bits, m_lambdaMotionSAD);
-        return sadCost + ((bits * m_lambdaMotionSAD + 128) >> 8);
-    }
-
-    inline uint32_t getCost(uint32_t bits)
-    {
-        return (uint32_t)((bits * m_lambdaMotionSAD + 128) >> 8);
-    }
-
-    inline uint32_t scaleChromaDistCb(uint32_t dist)
-    {
-        X265_CHECK(abs((float)((dist * m_cbDistortionWeight + 128) >> 8) -
-                       (float)dist * m_cbDistortionWeight / 256.0) < 2,
-                   "scaleChromaDistCb wrap detected dist: %d, lambda: "X265_LL"\n", dist, m_cbDistortionWeight);
-        return (uint32_t)(((dist * m_cbDistortionWeight) + 128) >> 8);
-    }
-
-    inline uint32_t scaleChromaDistCr(uint32_t dist)
-    {
-        X265_CHECK(abs((float)((dist * m_crDistortionWeight + 128) >> 8) -
-                       (float)dist * m_crDistortionWeight / 256.0) < 2,
-                   "scaleChromaDistCr wrap detected dist: %d, lambda: "X265_LL"\n", dist, m_crDistortionWeight);
-        return (uint32_t)(((dist * m_crDistortionWeight) + 128) >> 8);
-    }
-};
-}
-//! \}
-
-#endif // ifndef X265_TCOMRDCOST_H
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Thu May 22 08:08:14 2014 -0500
@@ -668,7 +668,7 @@ void TComReferencePictureSet::setDeltaPO
     m_deltaPOC[bufferNum] = deltaPOC;
 }
 
-int TComReferencePictureSet::getUsed(int bufferNum) const
+bool TComReferencePictureSet::getUsed(int bufferNum) const
 {
     return m_used[bufferNum];
 }
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h	Thu May 22 08:08:14 2014 -0500
@@ -111,7 +111,7 @@ public:
     void setCheckLTMSBPresent(int bufferNum, bool b);
     bool getCheckLTMSBPresent(int bufferNum);
 
-    int  getUsed(int bufferNum) const;
+    bool getUsed(int bufferNum) const;
     int  getDeltaPOC(int bufferNum) const;
     int  getPOC(int bufferNum) const;
     int  getNumberOfPictures() const;
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Thu May 22 08:08:14 2014 -0500
@@ -305,7 +305,7 @@ uint32_t TComTrQuant::xQuant(TComDataCU*
     return acSum;
 }
 
-void TComTrQuant::init(uint32_t maxTrSize, int useRDOQ, int useRDOQTS, int useTransformSkipFast)
+void TComTrQuant::init(uint32_t maxTrSize, bool useRDOQ, bool useRDOQTS, bool useTransformSkipFast)
 {
     m_maxTrSize            = maxTrSize;
     m_useRDOQ              = useRDOQ;
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibCommon/TComTrQuant.h
--- a/source/Lib/TLibCommon/TComTrQuant.h	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.h	Thu May 22 08:08:14 2014 -0500
@@ -124,7 +124,7 @@ public:
     ~TComTrQuant();
 
     // initialize class
-    void init(uint32_t maxTrSize, int useRDOQ, int useRDOQTS, int useTransformSkipFast);
+    void init(uint32_t maxTrSize, bool useRDOQ, bool useRDOQTS, bool useTransformSkipFast);
 
     // transform & inverse transform functions
     uint32_t transformNxN(TComDataCU* cu, int16_t* residual, uint32_t stride, coeff_t* coeff, uint32_t trSize,
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu May 22 08:08:14 2014 -0500
@@ -38,8 +38,10 @@
 #include "TEncCu.h"
 
 #include "primitives.h"
+#include "common.h"
+
+#include "rdcost.h"
 #include "encoder.h"
-#include "common.h"
 
 #include "PPA/ppa.h"
 
diff -r 5d0658f9c539 -r 34187fb932d3 source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Wed May 21 18:32:28 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncCu.h	Thu May 22 08:08:14 2014 -0500
@@ -114,7 +114,7 @@ private:


More information about the x265-commits mailing list