[x265-commits] [x265] sao: minor cleanups, no behavior change
Steve Borho
steve at borho.org
Mon Sep 8 20:49:41 CEST 2014
details: http://hg.videolan.org/x265/rev/b9ed1dcacf9e
branches:
changeset: 8001:b9ed1dcacf9e
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 16:41:56 2014 +0200
description:
sao: minor cleanups, no behavior change
Subject: [x265] sao: move frame/slice initialization into SAO::startSlice
details: http://hg.videolan.org/x265/rev/80b2e91156d3
branches:
changeset: 8002:80b2e91156d3
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 17:18:23 2014 +0200
description:
sao: move frame/slice initialization into SAO::startSlice
Subject: [x265] Analysis: compressIntraCU clean up
details: http://hg.videolan.org/x265/rev/5b377a411463
branches:
changeset: 8003:5b377a411463
user: Ashok Kumar Mishra<ashok at multicorewareinc.com>
date: Mon Sep 08 13:21:40 2014 +0530
description:
Analysis: compressIntraCU clean up
Subject: [x265] analysis: modified compressInterCU_rd5_6() with CU-specific information
details: http://hg.videolan.org/x265/rev/27581134f442
branches:
changeset: 8004:27581134f442
user: Ashok Kumar Mishra<ashok at multicorewareinc.com>
date: Mon Sep 08 16:24:00 2014 +0530
description:
analysis: modified compressInterCU_rd5_6() with CU-specific information
Subject: [x265] nits
details: http://hg.videolan.org/x265/rev/f2da9f3db824
branches:
changeset: 8005:f2da9f3db824
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 19:07:36 2014 +0200
description:
nits
Subject: [x265] api: remove include of frameencoder
details: http://hg.videolan.org/x265/rev/796cc966e2fe
branches:
changeset: 8006:796cc966e2fe
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 20:30:00 2014 +0200
description:
api: remove include of frameencoder
Subject: [x265] pull search class into encoder/ (TLibEncoder is no more)
details: http://hg.videolan.org/x265/rev/f2688d840261
branches:
changeset: 8007:f2688d840261
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 19:07:27 2014 +0200
description:
pull search class into encoder/ (TLibEncoder is no more)
TEncSearch -> Search
use consistent comment style and argument lists
make destructor no longer virtual (no more vtable)
moving StatisticLog into x265 namespace came for free
Subject: [x265] search: remove m_qtTempTrIdx
details: http://hg.videolan.org/x265/rev/00b86119f0ad
branches:
changeset: 8008:00b86119f0ad
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 20:17:35 2014 +0200
description:
search: remove m_qtTempTrIdx
Subject: [x265] search: remove some redundant work from estIntraPredQT
details: http://hg.videolan.org/x265/rev/033299d2bd00
branches:
changeset: 8009:033299d2bd00
user: Steve Borho <steve at borho.org>
date: Mon Sep 08 20:48:40 2014 +0200
description:
search: remove some redundant work from estIntraPredQT
diffstat:
source/Lib/TLibCommon/TComMotionInfo.h | 2 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 3712 --------------------------------
source/Lib/TLibEncoder/TEncSearch.h | 240 --
source/encoder/CMakeLists.txt | 3 +-
source/encoder/analysis.cpp | 67 +-
source/encoder/analysis.h | 15 +-
source/encoder/api.cpp | 5 +-
source/encoder/framefilter.cpp | 46 +-
source/encoder/sao.cpp | 101 +-
source/encoder/sao.h | 7 +-
source/encoder/search.cpp | 3589 ++++++++++++++++++++++++++++++
source/encoder/search.h | 184 +
12 files changed, 3884 insertions(+), 4087 deletions(-)
diffs (truncated from 8291 to 300 lines):
diff -r cfe197e3044d -r 033299d2bd00 source/Lib/TLibCommon/TComMotionInfo.h
--- a/source/Lib/TLibCommon/TComMotionInfo.h Mon Sep 08 15:12:20 2014 +0200
+++ b/source/Lib/TLibCommon/TComMotionInfo.h Mon Sep 08 20:48:40 2014 +0200
@@ -131,7 +131,7 @@ public:
// set
// ------------------------------------------------------------------------------------------------------------------
- void setAllMv(const MV& mv, PartSize cuMode, int partAddr, uint32_t depth, int partIdx = 0);
+ void setAllMv(const MV& mv, PartSize cuMode, int partAddr, uint32_t depth, int partIdx = 0);
void setAllRefIdx(int refIdx, PartSize mbMode, int partAddr, uint32_t depth, int partIdx = 0);
void setAllMvField(const TComMvField& mvField, PartSize mbMode, int partAddr, uint32_t depth, int partIdx = 0);
void setMvd(int idx, const MV& mvd) { m_mvd[idx] = mvd; }
diff -r cfe197e3044d -r 033299d2bd00 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Mon Sep 08 15:12:20 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3712 +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 TEncSearch.cpp
- \brief encoder search class
- */
-
-#include "TLibCommon/TypeDef.h"
-#include "TLibCommon/TComRom.h"
-#include "TLibCommon/TComMotionInfo.h"
-#include "TEncSearch.h"
-#include "rdcost.h"
-#include "encoder.h"
-
-#include "common.h"
-#include "primitives.h"
-
-using namespace x265;
-
-ALIGN_VAR_32(const pixel, TEncSearch::zeroPel[MAX_CU_SIZE]) = { 0 };
-
-TEncSearch::TEncSearch()
-{
- memset(m_qtTempCoeff, 0, sizeof(m_qtTempCoeff));
- m_qtTempTrIdx = NULL;
- m_qtTempShortYuv = NULL;
- for (int i = 0; i < 3; i++)
- {
- m_qtTempTransformSkipFlag[i] = NULL;
- m_qtTempCbf[i] = NULL;
- }
-
- m_numLayers = 0;
- m_param = NULL;
- m_entropyCoder = NULL;
- m_rdEntropyCoders = NULL;
-}
-
-TEncSearch::~TEncSearch()
-{
- for (int i = 0; i < m_numLayers; ++i)
- {
- X265_FREE(m_qtTempCoeff[0][i]);
- m_qtTempShortYuv[i].destroy();
- }
-
- X265_FREE(m_qtTempTrIdx);
- X265_FREE(m_qtTempCbf[0]);
- X265_FREE(m_qtTempTransformSkipFlag[0]);
- m_predTempYuv.destroy();
-
- delete[] m_qtTempShortYuv;
-}
-
-bool TEncSearch::initSearch(Encoder& top)
-{
- m_param = top.m_param;
- bool ok = m_quant.init(top.m_bEnableRDOQ, m_param->psyRdoq, top.m_scalingList);
-
- m_rdCost.setPsyRdScale(m_param->psyRd);
- m_bEnableRDOQ = top.m_bEnableRDOQ;
- m_bFrameParallel = m_param->frameNumThreads > 1;
- m_numLayers = top.m_quadtreeTULog2MaxSize - 2 + 1;
-
- initTempBuff(m_param->internalCsp);
- ok &= m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, m_param->internalCsp);
- m_me.setSearchMethod(m_param->searchMethod);
- m_me.setSubpelRefine(m_param->subpelRefine);
-
- /* When frame parallelism is active, only 'refLagPixels' of reference frames will be guaranteed
- * available for motion reference. See refLagRows in FrameEncoder::compressCTURows() */
- m_refLagPixels = m_bFrameParallel ? m_param->searchRange : m_param->sourceHeight;
-
- m_qtTempShortYuv = new ShortYuv[m_numLayers];
- uint32_t sizeL = 1 << (g_maxLog2CUSize * 2);
- uint32_t sizeC = sizeL >> (CHROMA_H_SHIFT(m_csp) + CHROMA_V_SHIFT(m_csp));
- for (int i = 0; i < m_numLayers; ++i)
- {
- m_qtTempCoeff[0][i] = X265_MALLOC(coeff_t, sizeL + sizeC * 2);
- m_qtTempCoeff[1][i] = m_qtTempCoeff[0][i] + sizeL;
- m_qtTempCoeff[2][i] = m_qtTempCoeff[0][i] + sizeL + sizeC;
- ok &= m_qtTempShortYuv[i].create(MAX_CU_SIZE, MAX_CU_SIZE, m_param->internalCsp);
- }
-
- const uint32_t numPartitions = 1 << g_maxFullDepth * 2;
- CHECKED_MALLOC(m_qtTempTrIdx, uint8_t, numPartitions);
- CHECKED_MALLOC(m_qtTempCbf[0], uint8_t, numPartitions * 3);
- m_qtTempCbf[1] = m_qtTempCbf[0] + numPartitions;
- m_qtTempCbf[2] = m_qtTempCbf[0] + numPartitions * 2;
- CHECKED_MALLOC(m_qtTempTransformSkipFlag[0], uint8_t, numPartitions * 3);
- m_qtTempTransformSkipFlag[1] = m_qtTempTransformSkipFlag[0] + numPartitions;
- m_qtTempTransformSkipFlag[2] = m_qtTempTransformSkipFlag[0] + numPartitions * 2;
-
- return ok;
-
-fail:
- return false;
-}
-
-void TEncSearch::xEncSubdivCbfQTLuma(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, uint32_t* depthRange)
-{
- uint32_t fullDepth = cu->getDepth(0) + trDepth;
- uint32_t trMode = cu->getTransformIdx(absPartIdx);
- uint32_t subdiv = (trMode > trDepth ? 1 : 0);
- uint32_t log2TrSize = g_maxLog2CUSize - fullDepth;
-
- if (cu->getPredictionMode(0) == MODE_INTRA && cu->getPartitionSize(0) == SIZE_NxN && trDepth == 0)
- {
- X265_CHECK(subdiv, "subdivision not present\n");
- }
- else if (log2TrSize > *(depthRange + 1))
- {
- X265_CHECK(subdiv, "subdivision not present\n");
- }
- else if (log2TrSize == cu->m_slice->m_sps->quadtreeTULog2MinSize)
- {
- X265_CHECK(!subdiv, "subdivision present\n");
- }
- else if (log2TrSize == *depthRange)
- {
- X265_CHECK(!subdiv, "subdivision present\n");
- }
- else
- {
- X265_CHECK(log2TrSize > *depthRange, "transform size too small\n");
- m_entropyCoder->codeTransformSubdivFlag(subdiv, 5 - log2TrSize);
- }
-
- if (subdiv)
- {
- uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth + 1) << 1);
- for (uint32_t part = 0; part < 4; part++)
- xEncSubdivCbfQTLuma(cu, trDepth + 1, absPartIdx + part * qtPartNum, depthRange);
-
- return;
- }
-
- //===== Cbfs =====
- m_entropyCoder->codeQtCbf(cu, absPartIdx, TEXT_LUMA, trMode);
-}
-
-void TEncSearch::xEncSubdivCbfQTChroma(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, uint32_t absPartIdxStep, uint32_t width, uint32_t height)
-{
- uint32_t fullDepth = cu->getDepth(0) + trDepth;
- uint32_t trMode = cu->getTransformIdx(absPartIdx);
- uint32_t subdiv = (trMode > trDepth ? 1 : 0);
- uint32_t log2TrSize = g_maxLog2CUSize - fullDepth;
-
- int hChromaShift = CHROMA_H_SHIFT(m_csp);
- int vChromaShift = CHROMA_V_SHIFT(m_csp);
-
- if ((log2TrSize > 2) && !(m_csp == X265_CSP_I444))
- {
- if (trDepth == 0 || cu->getCbf(absPartIdx, TEXT_CHROMA_U, trDepth - 1))
- m_entropyCoder->codeQtCbf(cu, absPartIdx, absPartIdxStep, (width >> hChromaShift), (height >> vChromaShift), TEXT_CHROMA_U, trDepth, (subdiv == 0));
-
- if (trDepth == 0 || cu->getCbf(absPartIdx, TEXT_CHROMA_V, trDepth - 1))
- m_entropyCoder->codeQtCbf(cu, absPartIdx, absPartIdxStep, (width >> hChromaShift), (height >> vChromaShift), TEXT_CHROMA_V, trDepth, (subdiv == 0));
- }
-
- if (subdiv)
- {
- absPartIdxStep >>= 2;
- width >>= 1;
- height >>= 1;
-
- uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth + 1) << 1);
- for (uint32_t part = 0; part < 4; part++)
- xEncSubdivCbfQTChroma(cu, trDepth + 1, absPartIdx + part * qtPartNum, absPartIdxStep, width, height);
- }
-}
-
-void TEncSearch::xEncCoeffQTLuma(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx)
-{
- const TextType ttype = TEXT_LUMA;
-
- if (!cu->getCbf(absPartIdx, ttype, trDepth))
- return;
-
- uint32_t fullDepth = cu->getDepth(0) + trDepth;
- uint32_t trMode = cu->getTransformIdx(absPartIdx);
-
- if (trMode > trDepth)
- {
- uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth + 1) << 1);
- for (uint32_t part = 0; part < 4; part++)
- xEncCoeffQTLuma(cu, trDepth + 1, absPartIdx + part * qtPartNum);
-
- return;
- }
-
- uint32_t log2TrSize = g_maxLog2CUSize - fullDepth;
- uint32_t qtLayer = log2TrSize - 2;
- uint32_t coeffOffset = absPartIdx << LOG2_UNIT_SIZE * 2;
- coeff_t* coeff = m_qtTempCoeff[ttype][qtLayer] + coeffOffset;
- m_entropyCoder->codeCoeffNxN(cu, coeff, absPartIdx, log2TrSize, ttype);
-}
-
-void TEncSearch::xEncCoeffQTChroma(TComDataCU* cu, uint32_t trDepth, uint32_t absPartIdx, TextType ttype)
-{
- if (!cu->getCbf(absPartIdx, ttype, trDepth))
- return;
-
- uint32_t fullDepth = cu->getDepth(0) + trDepth;
- uint32_t trMode = cu->getTransformIdx(absPartIdx);
-
- if (trMode > trDepth)
- {
- uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth + 1) << 1);
- for (uint32_t part = 0; part < 4; part++)
- xEncCoeffQTChroma(cu, trDepth + 1, absPartIdx + part * qtPartNum, ttype);
-
- return;
- }
-
- uint32_t log2TrSize = g_maxLog2CUSize - fullDepth;
-
- uint32_t trDepthC = trDepth;
- int hChromaShift = CHROMA_H_SHIFT(m_csp);
- uint32_t log2TrSizeC = log2TrSize - hChromaShift;
-
- if ((log2TrSize == 2) && !(m_csp == X265_CSP_I444))
- {
- X265_CHECK(trDepth > 0, "transform size too small\n");
- trDepthC--;
- log2TrSizeC++;
- uint32_t qpdiv = cu->m_pic->getNumPartInCU() >> ((cu->getDepth(0) + trDepthC) << 1);
- bool bFirstQ = ((absPartIdx & (qpdiv - 1)) == 0);
- if (!bFirstQ)
- return;
- }
-
- uint32_t qtLayer = log2TrSize - 2;
-
- if (m_csp != X265_CSP_I422)
- {
- uint32_t shift = (m_csp == X265_CSP_I420) ? 2 : 0;
- uint32_t coeffOffset = absPartIdx << (LOG2_UNIT_SIZE * 2 - shift);
- coeff_t* coeff = m_qtTempCoeff[ttype][qtLayer] + coeffOffset;
- m_entropyCoder->codeCoeffNxN(cu, coeff, absPartIdx, log2TrSizeC, ttype);
- }
- else
- {
- uint32_t coeffOffset = absPartIdx << (LOG2_UNIT_SIZE * 2 - 1);
- coeff_t* coeff = m_qtTempCoeff[ttype][qtLayer] + coeffOffset;
- uint32_t subTUSize = 1 << (log2TrSizeC * 2);
- uint32_t partIdxesPerSubTU = cu->m_pic->getNumPartInCU() >> (((cu->getDepth(absPartIdx) + trDepthC) << 1) + 1);
- if (cu->getCbf(absPartIdx, ttype, trDepth + 1))
- m_entropyCoder->codeCoeffNxN(cu, coeff, absPartIdx, log2TrSizeC, ttype);
- if (cu->getCbf(absPartIdx + partIdxesPerSubTU, ttype, trDepth + 1))
- m_entropyCoder->codeCoeffNxN(cu, coeff + subTUSize, absPartIdx + partIdxesPerSubTU, log2TrSizeC, ttype);
- }
-}
-
More information about the x265-commits
mailing list