[x265-commits] [x265] pull SAO code into encoder/ and begin cleanup

Steve Borho steve at borho.org
Fri Aug 22 07:04:40 CEST 2014


details:   http://hg.videolan.org/x265/rev/6a8df5dcb412
branches:  
changeset: 7849:6a8df5dcb412
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 15:37:36 2014 -0500
description:
pull SAO code into encoder/ and begin cleanup
Subject: [x265] sao: cleanup member prefixes, remove createPicSaoInfo and endSaoEnc

details:   http://hg.videolan.org/x265/rev/a2e74591f674
branches:  
changeset: 7850:a2e74591f674
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 15:51:35 2014 -0500
description:
sao: cleanup member prefixes, remove createPicSaoInfo and endSaoEnc
Subject: [x265] sao: use m_param directly for user-configurables

details:   http://hg.videolan.org/x265/rev/11d427f9ef26
branches:  
changeset: 7851:11d427f9ef26
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:22:03 2014 -0500
description:
sao: use m_param directly for user-configurables
Subject: [x265] sao: merge create/destroy methods

details:   http://hg.videolan.org/x265/rev/ed9d78aa312a
branches:  
changeset: 7852:ed9d78aa312a
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:29:27 2014 -0500
description:
sao: merge create/destroy methods
Subject: [x265] sao: convertLevelRowCol2Idx did not need to be a member function

details:   http://hg.videolan.org/x265/rev/577e65afdb8d
branches:  
changeset: 7853:577e65afdb8d
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:30:10 2014 -0500
description:
sao: convertLevelRowCol2Idx did not need to be a member function
Subject: [x265] nits

details:   http://hg.videolan.org/x265/rev/9cb0dfeac129
branches:  
changeset: 7854:9cb0dfeac129
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:30:32 2014 -0500
description:
nits
Subject: [x265] search: nit

details:   http://hg.videolan.org/x265/rev/282c2c6f5ed1
branches:  
changeset: 7855:282c2c6f5ed1
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:36:18 2014 -0500
description:
search: nit
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/2e17cb106b17
branches:  
changeset: 7856:2e17cb106b17
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 16:51:06 2014 -0500
description:
Merge with stable
Subject: [x265] sao: fix warnings

details:   http://hg.videolan.org/x265/rev/02ec546246ad
branches:  
changeset: 7857:02ec546246ad
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 18:23:10 2014 -0500
description:
sao: fix warnings
Subject: [x265] sao: remove vars which are dups of params

details:   http://hg.videolan.org/x265/rev/5d67f4e4a351
branches:  
changeset: 7858:5d67f4e4a351
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 18:35:18 2014 -0500
description:
sao: remove vars which are dups of params
Subject: [x265] sao: we don't support different bit depths between luma and chroma

details:   http://hg.videolan.org/x265/rev/d36617a8512d
branches:  
changeset: 7859:d36617a8512d
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 18:39:07 2014 -0500
description:
sao: we don't support different bit depths between luma and chroma
Subject: [x265] sao: use more compile-time values

details:   http://hg.videolan.org/x265/rev/7fc8855656e2
branches:  
changeset: 7860:7fc8855656e2
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 18:49:23 2014 -0500
description:
sao: use more compile-time values
Subject: [x265] sao: unify signOf

details:   http://hg.videolan.org/x265/rev/d70e2bac56b5
branches:  
changeset: 7861:d70e2bac56b5
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 19:07:30 2014 -0500
description:
sao: unify signOf
Subject: [x265] sao: luma and chroma can share a clip table

details:   http://hg.videolan.org/x265/rev/50542271caba
branches:  
changeset: 7862:50542271caba
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 19:10:40 2014 -0500
description:
sao: luma and chroma can share a clip table
Subject: [x265] sao: remove unused m_tmpYuv and an obsolete comment

details:   http://hg.videolan.org/x265/rev/87c08d2aaf56
branches:  
changeset: 7863:87c08d2aaf56
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 19:35:21 2014 -0500
description:
sao: remove unused m_tmpYuv and an obsolete comment
Subject: [x265] sao: move getPicYuvAddr() to TComPicYuv and simplify

details:   http://hg.videolan.org/x265/rev/eaf5eb7ae2d6
branches:  
changeset: 7864:eaf5eb7ae2d6
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 19:48:29 2014 -0500
description:
sao: move getPicYuvAddr() to TComPicYuv and simplify
Subject: [x265] common: define a CHECKED_MALLOC_ZERO method to auto-reset allocated memory

details:   http://hg.videolan.org/x265/rev/36079a3dce67
branches:  
changeset: 7865:36079a3dce67
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 20:28:23 2014 -0500
description:
common: define a CHECKED_MALLOC_ZERO method to auto-reset allocated memory

This is mostly useful when allocating buffers containing pointers, to ensure
the pointers are safe to free regardless of later malloc failures
Subject: [x265] sao: use checked mallocs, disable SAO if any mallocs fail

details:   http://hg.videolan.org/x265/rev/e93cf3c94bc4
branches:  
changeset: 7866:e93cf3c94bc4
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 20:29:10 2014 -0500
description:
sao: use checked mallocs, disable SAO if any mallocs fail
Subject: [x265] sao: share m_lumaTableBo with chroma

details:   http://hg.videolan.org/x265/rev/47ab66abd2f2
branches:  
changeset: 7867:47ab66abd2f2
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 20:33:21 2014 -0500
description:
sao: share m_lumaTableBo with chroma
Subject: [x265] sao: rename shared table to m_tableBo

details:   http://hg.videolan.org/x265/rev/e02ad51211b6
branches:  
changeset: 7868:e02ad51211b6
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 20:35:00 2014 -0500
description:
sao: rename shared table to m_tableBo
Subject: [x265] sao: handle malloc failures more cleanly

details:   http://hg.videolan.org/x265/rev/e95ae26c6afa
branches:  
changeset: 7869:e95ae26c6afa
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 21:28:41 2014 -0500
description:
sao: handle malloc failures more cleanly
Subject: [x265] sao: sChroma should have been isChroma

details:   http://hg.videolan.org/x265/rev/ff799bffbaef
branches:  
changeset: 7870:ff799bffbaef
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 21:29:34 2014 -0500
description:
sao: sChroma should have been isChroma
Subject: [x265] sao: use typedefs to simplify multi-dimensional mallocs

details:   http://hg.videolan.org/x265/rev/3881d3af896f
branches:  
changeset: 7871:3881d3af896f
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 22:26:48 2014 -0500
description:
sao: use typedefs to simplify multi-dimensional mallocs
Subject: [x265] sao: minor logic simplifications and cleanups

details:   http://hg.videolan.org/x265/rev/bad70432b1d3
branches:  
changeset: 7872:bad70432b1d3
user:      Steve Borho <steve at borho.org>
date:      Thu Aug 21 22:42:58 2014 -0500
description:
sao: minor logic simplifications and cleanups

diffstat:

 .hgtags                                             |     1 +
 source/Lib/TLibCommon/TComPicSym.cpp                |    31 +-
 source/Lib/TLibCommon/TComPicSym.h                  |    21 +-
 source/Lib/TLibCommon/TComPicYuv.h                  |     2 +
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  |  1328 ---------
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.h    |   233 -
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |  1729 ------------
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h   |   119 -
 source/Lib/TLibEncoder/TEncSearch.cpp               |     2 +-
 source/common/CMakeLists.txt                        |     2 -
 source/common/common.h                              |    93 +
 source/encoder/CMakeLists.txt                       |     3 +-
 source/encoder/dpb.cpp                              |     2 +
 source/encoder/encoder.cpp                          |     5 +
 source/encoder/entropy.cpp                          |     4 +-
 source/encoder/frameencoder.cpp                     |    16 +-
 source/encoder/frameencoder.h                       |     4 +-
 source/encoder/framefilter.cpp                      |   117 +-
 source/encoder/framefilter.h                        |    30 +-
 source/encoder/sao.cpp                              |  2614 +++++++++++++++++++
 source/encoder/sao.h                                |   181 +
 21 files changed, 2989 insertions(+), 3548 deletions(-)

diffs (truncated from 6997 to 300 lines):

diff -r 97ea21754381 -r bad70432b1d3 .hgtags
--- a/.hgtags	Thu Aug 21 18:34:53 2014 +0900
+++ b/.hgtags	Thu Aug 21 22:42:58 2014 -0500
@@ -14,3 +14,4 @@ 82bbd2bf3b49ba086be0f0922f91fe0084896351
 cea97c4d79456842e00ade6be6fd5ec34610e5f8 1.0
 ae9609aeebdc3271114168ece003679e9b1dca1b 1.1
 d6257335c5370ee54317a0426a12c1f0724b18b9 1.2
+c1e4fc0162c14fdb84f5c3bd404fb28cfe10a17f 1.3
diff -r 97ea21754381 -r bad70432b1d3 source/Lib/TLibCommon/TComPicSym.cpp
--- a/source/Lib/TLibCommon/TComPicSym.cpp	Thu Aug 21 18:34:53 2014 +0900
+++ b/source/Lib/TLibCommon/TComPicSym.cpp	Thu Aug 21 22:42:58 2014 -0500
@@ -36,17 +36,10 @@
 */
 
 #include "TComPicSym.h"
-#include "TComSampleAdaptiveOffset.h"
+#include "TComPicYuv.h"
 
 using namespace x265;
 
-//! \ingroup TLibCommon
-//! \{
-
-// ====================================================================================================================
-// Constructor / destructor / create / destroy
-// ====================================================================================================================
-
 TComPicSym::TComPicSym()
     : m_widthInCU(0)
     , m_heightInCU(0)
@@ -93,27 +86,13 @@ bool TComPicSym::create(x265_param *para
 void TComPicSym::destroy()
 {
     delete m_slice;
-    m_slice = NULL;
 
     if (m_cuData)
+    {
         for (int i = 0; i < m_numCUsInFrame; i++)
             m_cuData[i].destroy();
+        delete[] m_cuData;
+    }
 
-    delete [] m_cuData;
-    m_cuData = NULL;
-
-    if (m_saoParam)
-    {
-        TComSampleAdaptiveOffset::freeSaoParam(m_saoParam);
-        delete m_saoParam;
-        m_saoParam = NULL;
-    }
+    delete m_saoParam;
 }
-
-void TComPicSym::allocSaoParam(TComSampleAdaptiveOffset *sao)
-{
-    m_saoParam = new SAOParam;
-    sao->allocSaoParam(m_saoParam);
-}
-
-//! \}
diff -r 97ea21754381 -r bad70432b1d3 source/Lib/TLibCommon/TComPicSym.h
--- a/source/Lib/TLibCommon/TComPicSym.h	Thu Aug 21 18:34:53 2014 +0900
+++ b/source/Lib/TLibCommon/TComPicSym.h	Thu Aug 21 22:42:58 2014 -0500
@@ -46,18 +46,8 @@
 namespace x265 {
 // private namespace
 
-struct SAOParam;
-class TComSampleAdaptiveOffset;
 class TComPicYuv;
 
-//! \ingroup TLibCommon
-//! \{
-
-// ====================================================================================================================
-// Class definition
-// ====================================================================================================================
-
-/// picture symbol class
 class TComPicSym
 {
 public:
@@ -79,11 +69,11 @@ public:
 
     bool          m_bHasReferences; // used during DPB/RPS updates
 
+    TComPicSym();
+
     bool        create(x265_param *param);
     void        destroy();
 
-    TComPicSym();
-
     uint32_t    getFrameWidthInCU() const { return m_widthInCU; }
 
     uint32_t    getFrameHeightInCU() const { return m_heightInCU; }
@@ -95,12 +85,7 @@ public:
     uint32_t    getNumPartition() const   { return m_numPartitions; }
 
     uint32_t    getNumPartInCUSize() const { return m_numPartInCUSize; }
-
-    void allocSaoParam(TComSampleAdaptiveOffset *sao);
-
-    SAOParam *getSaoParam()               { return m_saoParam; }
-}; // END CLASS DEFINITION TComPicSym
+};
 }
-//! \}
 
 #endif // ifndef X265_TCOMPICSYM_H
diff -r 97ea21754381 -r bad70432b1d3 source/Lib/TLibCommon/TComPicYuv.h
--- a/source/Lib/TLibCommon/TComPicYuv.h	Thu Aug 21 18:34:53 2014 +0900
+++ b/source/Lib/TLibCommon/TComPicYuv.h	Thu Aug 21 22:42:58 2014 -0500
@@ -139,6 +139,8 @@ public:
     //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
     pixel*  getLumaAddr(int cuAddr) { return m_picOrg[0] + m_cuOffsetY[cuAddr]; }
 
+    pixel*  getPlaneAddr(int plane, int cuAddr) { return m_picOrg[plane] + (plane ? m_cuOffsetC[cuAddr] : m_cuOffsetY[cuAddr]); }
+
     pixel*  getCbAddr(int cuAddr) { return m_picOrg[1] + m_cuOffsetC[cuAddr]; }
 
     pixel*  getCrAddr(int cuAddr) { return m_picOrg[2] + m_cuOffsetC[cuAddr]; }
diff -r 97ea21754381 -r bad70432b1d3 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Thu Aug 21 18:34:53 2014 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1328 +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     TComSampleAdaptiveOffset.cpp
-    \brief    sample adaptive offset class
-*/
-
-#include "TComSampleAdaptiveOffset.h"
-#include "common.h"
-
-namespace x265 {
-//! \ingroup TLibCommon
-//! \{
-SAOParam::~SAOParam()
-{
-    for (int i = 0; i < 3; i++)
-    {
-        delete [] saoPart[i];
-    }
-}
-
-// ====================================================================================================================
-// Tables
-// ====================================================================================================================
-
-TComSampleAdaptiveOffset::TComSampleAdaptiveOffset()
-{
-    m_clipTable = NULL;
-    m_clipTableBase = NULL;
-    m_chromaClipTable = NULL;
-    m_chromaClipTableBase = NULL;
-    m_offsetBo = NULL;
-    m_chromaOffsetBo = NULL;
-    m_lumaTableBo = NULL;
-    m_chromaTableBo = NULL;
-    m_tmpU1[0] = NULL;
-    m_tmpU1[1] = NULL;
-    m_tmpU1[2] = NULL;
-    m_tmpU2[0] = NULL;
-    m_tmpU2[1] = NULL;
-    m_tmpU2[2] = NULL;
-    m_tmpL1 = NULL;
-    m_tmpL2 = NULL;
-}
-
-TComSampleAdaptiveOffset::~TComSampleAdaptiveOffset()
-{}
-
-const int TComSampleAdaptiveOffset::m_numCulPartsLevel[5] =
-{
-    1, //level 0
-    5, //level 1
-    21, //level 2
-    85, //level 3
-    341, //level 4
-};
-
-const uint32_t TComSampleAdaptiveOffset::m_eoTable[9] =
-{
-    1, //0
-    2, //1
-    0, //2
-    3, //3
-    4, //4
-    0, //5
-    0, //6
-    0, //7
-    0
-};
-
-const int TComSampleAdaptiveOffset::m_numClass[MAX_NUM_SAO_TYPE] =
-{
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_BO_LEN
-};
-
-const uint32_t TComSampleAdaptiveOffset::m_maxDepth = SAO_MAX_DEPTH;
-
-/** convert Level Row Col to Idx
- * \param   level,  row,  col
- */
-int  TComSampleAdaptiveOffset::convertLevelRowCol2Idx(int level, int row, int col) const
-{
-    int idx;
-
-    if (level == 0)
-    {
-        idx = 0;
-    }
-    else if (level == 1)
-    {
-        idx = 1 + row * 2 + col;
-    }
-    else if (level == 2)
-    {
-        idx = 5 + row * 4 + col;
-    }
-    else if (level == 3)
-    {
-        idx = 21 + row * 8 + col;
-    }
-    else // (level == 4)
-    {
-        idx = 85 + row * 16 + col;
-    }
-    return idx;
-}
-
-/** create SampleAdaptiveOffset memory.
- * \param
- */
-void TComSampleAdaptiveOffset::create(uint32_t sourceWidth, uint32_t sourceHeight, uint32_t maxCUWidth, uint32_t maxCUHeight, int csp)
-{
-    m_hChromaShift = CHROMA_H_SHIFT(csp);
-    m_vChromaShift = CHROMA_V_SHIFT(csp);
-
-    m_picWidth  = sourceWidth;
-    m_picHeight = sourceHeight;
-
-    m_maxCUWidth  = maxCUWidth;
-    m_maxCUHeight = maxCUHeight;
-
-    m_numCuInWidth  = m_picWidth / m_maxCUWidth;
-    m_numCuInWidth += (m_picWidth % m_maxCUWidth) ? 1 : 0;
-
-    m_numCuInHeight  = m_picHeight / m_maxCUHeight;
-    m_numCuInHeight += (m_picHeight % m_maxCUHeight) ? 1 : 0;
-
-    int maxSplitLevelHeight = (int)(logf((float)m_numCuInHeight) / logf(2.0));
-    int maxSplitLevelWidth  = (int)(logf((float)m_numCuInWidth) / logf(2.0));
-
-    m_maxSplitLevel = (maxSplitLevelHeight < maxSplitLevelWidth) ? (maxSplitLevelHeight) : (maxSplitLevelWidth);
-    m_maxSplitLevel = (m_maxSplitLevel < m_maxDepth) ? (m_maxSplitLevel) : (m_maxDepth);
-
-    /* various structures are overloaded to store per component data.
-     * m_iNumTotalParts must allow for sufficient storage in any allocated arrays */
-    m_numTotalParts  = X265_MAX(3, m_numCulPartsLevel[m_maxSplitLevel]);
-
-    uint32_t pixelRangeY = 1 << X265_DEPTH;


More information about the x265-commits mailing list