[x265-commits] [x265] pic: move timing structures to RateControlEntry

Steve Borho steve at borho.org
Wed Jun 18 07:40:41 CEST 2014


details:   http://hg.videolan.org/x265/rev/cb4d408c048e
branches:  
changeset: 7096:cb4d408c048e
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 20:08:03 2014 -0500
description:
pic: move timing structures to RateControlEntry

This saves a bit of memory, since this data only needs to exist when the picture
is being encoded.
Subject: [x265] pic: move SSIM, PSNR and hash to frame encoder

details:   http://hg.videolan.org/x265/rev/bf112abf087c
branches:  
changeset: 7097:bf112abf087c
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 20:33:18 2014 -0500
description:
pic: move SSIM, PSNR and hash to frame encoder

This data only needs to exist when the picture is being encoded. This changes
the SSIM scores slightly, even though the bitstream and recon does not change,
because it is resetting the SSIM sum and counter each frame.  When these fields
were on the TComPic, they were never cleared.
Subject: [x265] pic: move m_elapsedCompressTime and m_frameTime to frame encoder

details:   http://hg.videolan.org/x265/rev/f73c1d866741
branches:  
changeset: 7098:f73c1d866741
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 20:41:18 2014 -0500
description:
pic: move m_elapsedCompressTime and m_frameTime to frame encoder

This data only needs to exist when the picture is being encoded
Subject: [x265] sym: do not return pointer reference from getCU()

details:   http://hg.videolan.org/x265/rev/bf0aa61ceaab
branches:  
changeset: 7099:bf0aa61ceaab
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 20:51:17 2014 -0500
description:
sym: do not return pointer reference from getCU()
Subject: [x265] TComDataCU: remove hungarian prefixes from CU vars

details:   http://hg.videolan.org/x265/rev/ca032ae0fd67
branches:  
changeset: 7100:ca032ae0fd67
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 20:54:56 2014 -0500
description:
TComDataCU: remove hungarian prefixes from CU vars
Subject: [x265] frameencoder: remove unused bitcounter

details:   http://hg.videolan.org/x265/rev/785e2b88c134
branches:  
changeset: 7101:785e2b88c134
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 21:20:40 2014 -0500
description:
frameencoder: remove unused bitcounter
Subject: [x265] frameencoder: replace m_cfg with m_param pointer, use m_top for leftovers

details:   http://hg.videolan.org/x265/rev/c53f4e4669c2
branches:  
changeset: 7102:c53f4e4669c2
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 21:29:25 2014 -0500
description:
frameencoder: replace m_cfg with m_param pointer, use m_top for leftovers
Subject: [x265] framefilter: replace top pointer with param pointer

details:   http://hg.videolan.org/x265/rev/7259c8a2d1b1
branches:  
changeset: 7103:7259c8a2d1b1
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 21:46:39 2014 -0500
description:
framefilter: replace top pointer with param pointer
Subject: [x265] TEncSearch: nits

details:   http://hg.videolan.org/x265/rev/9a0dde9e5fa6
branches:  
changeset: 7104:9a0dde9e5fa6
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 21:48:34 2014 -0500
description:
TEncSearch: nits
Subject: [x265] TEncSearch: keep param pointer instead of top encoder pointer

details:   http://hg.videolan.org/x265/rev/5a0f8d5377da
branches:  
changeset: 7105:5a0f8d5377da
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:07:53 2014 -0500
description:
TEncSearch: keep param pointer instead of top encoder pointer

This required cacheing some top encoder fields in TEncSearch
Subject: [x265] pic: remove unread m_bUsedByCurr

details:   http://hg.videolan.org/x265/rev/3a458e3f674e
branches:  
changeset: 7106:3a458e3f674e
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:35:05 2014 -0500
description:
pic: remove unread m_bUsedByCurr
Subject: [x265] pic: remove unread m_bCheckLTMSB

details:   http://hg.videolan.org/x265/rev/8fb41a7f4301
branches:  
changeset: 7107:8fb41a7f4301
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:38:24 2014 -0500
description:
pic: remove unread m_bCheckLTMSB
Subject: [x265] pic: improve comments

details:   http://hg.videolan.org/x265/rev/7a5bec950123
branches:  
changeset: 7108:7a5bec950123
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:39:23 2014 -0500
description:
pic: improve comments
Subject: [x265] pic: destroy() no longer needs to be virtual, compress white-space

details:   http://hg.videolan.org/x265/rev/0e9a74223938
branches:  
changeset: 7109:0e9a74223938
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:42:18 2014 -0500
description:
pic: destroy() no longer needs to be virtual, compress white-space
Subject: [x265] pic: split picsym allocation from main create function, rename reinit()

details:   http://hg.videolan.org/x265/rev/526d79dabf1a
branches:  
changeset: 7110:526d79dabf1a
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:52:55 2014 -0500
description:
pic: split picsym allocation from main create function, rename reinit()
Subject: [x265] pic: nit

details:   http://hg.videolan.org/x265/rev/da81f3741282
branches:  
changeset: 7111:da81f3741282
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 22:52:59 2014 -0500
description:
pic: nit
Subject: [x265] pic: keep a pool of TComPicSym, allocate only for encode process

details:   http://hg.videolan.org/x265/rev/cbed0913df50
branches:  
changeset: 7112:cbed0913df50
user:      Steve Borho <steve at borho.org>
date:      Tue Jun 17 23:53:57 2014 -0500
description:
pic: keep a pool of TComPicSym, allocate only for encode process

This commit moves the picture freelist to the DPB, it seemed to belong there.
This change reduced memory in a medium encode by more than 40%.
Subject: [x265] encoder: move EncStats into x265 namespace

details:   http://hg.videolan.org/x265/rev/a43a223a1294
branches:  
changeset: 7113:a43a223a1294
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 18 00:04:09 2014 -0500
description:
encoder: move EncStats into x265 namespace

diffstat:

 source/Lib/TLibCommon/TComDataCU.cpp  |  114 ++++++++++++------------
 source/Lib/TLibCommon/TComPic.cpp     |   62 ++++++-------
 source/Lib/TLibCommon/TComPic.h       |  153 +++++++++++++--------------------
 source/Lib/TLibCommon/TComPicSym.cpp  |   19 +--
 source/Lib/TLibCommon/TComPicSym.h    |    8 +-
 source/Lib/TLibCommon/TComSlice.cpp   |    3 -
 source/Lib/TLibEncoder/TEncCu.cpp     |    4 +-
 source/Lib/TLibEncoder/TEncSearch.cpp |   90 ++++++++++----------
 source/Lib/TLibEncoder/TEncSearch.h   |   17 +--
 source/encoder/compress.cpp           |    2 +-
 source/encoder/dpb.cpp                |   26 ++++-
 source/encoder/dpb.h                  |   17 ++-
 source/encoder/encoder.cpp            |   53 ++++++-----
 source/encoder/encoder.h              |    7 +-
 source/encoder/frameencoder.cpp       |  123 +++++++++++++-------------
 source/encoder/frameencoder.h         |   16 ++-
 source/encoder/framefilter.cpp        |   82 +++++++++--------
 source/encoder/framefilter.h          |    8 +-
 source/encoder/ratecontrol.cpp        |   18 ++--
 source/encoder/ratecontrol.h          |    5 +-
 source/encoder/slicetype.cpp          |    2 +-
 21 files changed, 409 insertions(+), 420 deletions(-)

diffs (truncated from 2026 to 300 lines):

diff -r 51aa9d1542ef -r a43a223a1294 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Jun 17 21:15:59 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Jun 18 00:04:09 2014 -0500
@@ -534,18 +534,18 @@ void TComDataCU::copyToSubCU(TComDataCU*
     m_totalBits        = 0;
     m_numPartitions    = cu->getTotalNumPart() >> 2;
 
-    TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+    TComDataCU* otherCU = m_pic->getCU(m_cuAddr);
     int sizeInChar  = sizeof(char) * m_numPartitions;
 
-    memcpy(m_skipFlag, rpcCU->getSkipFlag() + m_absIdxInLCU, sizeof(*m_skipFlag) * m_numPartitions);
-    memcpy(m_qp, rpcCU->getQP() + m_absIdxInLCU, sizeInChar);
+    memcpy(m_skipFlag, otherCU->getSkipFlag() + m_absIdxInLCU, sizeof(*m_skipFlag) * m_numPartitions);
+    memcpy(m_qp, otherCU->getQP() + m_absIdxInLCU, sizeInChar);
 
-    memcpy(m_partSizes, rpcCU->getPartitionSize() + m_absIdxInLCU, sizeof(*m_partSizes) * m_numPartitions);
-    memcpy(m_predModes, rpcCU->getPredictionMode() + m_absIdxInLCU, sizeof(*m_predModes) * m_numPartitions);
+    memcpy(m_partSizes, otherCU->getPartitionSize() + m_absIdxInLCU, sizeof(*m_partSizes) * m_numPartitions);
+    memcpy(m_predModes, otherCU->getPredictionMode() + m_absIdxInLCU, sizeof(*m_predModes) * m_numPartitions);
 
-    memcpy(m_lumaIntraDir, rpcCU->getLumaIntraDir() + m_absIdxInLCU, sizeInChar);
-    memcpy(m_depth, rpcCU->getDepth() + m_absIdxInLCU, sizeInChar);
-    memcpy(m_cuSize, rpcCU->getCUSize() + m_absIdxInLCU, sizeInChar);
+    memcpy(m_lumaIntraDir, otherCU->getLumaIntraDir() + m_absIdxInLCU, sizeInChar);
+    memcpy(m_depth, otherCU->getDepth() + m_absIdxInLCU, sizeInChar);
+    memcpy(m_cuSize, otherCU->getCUSize() + m_absIdxInLCU, sizeInChar);
 }
 
 // --------------------------------------------------------------------------------------------------------------------
@@ -621,85 +621,85 @@ void TComDataCU::copyPartFrom(TComDataCU
 // It is used to predict for next part
 void TComDataCU::copyToPic(uint8_t depth)
 {
-    TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+    TComDataCU* cu = m_pic->getCU(m_cuAddr);
 
-    rpcCU->m_psyEnergy       = m_psyEnergy;
-    rpcCU->m_totalPsyCost    = m_totalPsyCost;
-    rpcCU->m_totalRDCost     = m_totalRDCost;
-    rpcCU->m_totalDistortion = m_totalDistortion;
-    rpcCU->m_totalBits       = m_totalBits;
+    cu->m_psyEnergy       = m_psyEnergy;
+    cu->m_totalPsyCost    = m_totalPsyCost;
+    cu->m_totalRDCost     = m_totalRDCost;
+    cu->m_totalDistortion = m_totalDistortion;
+    cu->m_totalBits       = m_totalBits;
 
     int sizeInBool  = sizeof(bool) * m_numPartitions;
     int sizeInChar  = sizeof(char) * m_numPartitions;
 
-    memcpy(rpcCU->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
+    memcpy(cu->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
 
-    memcpy(rpcCU->getQP() + m_absIdxInLCU, m_qp, sizeInChar);
+    memcpy(cu->getQP() + m_absIdxInLCU, m_qp, sizeInChar);
 
-    memcpy(rpcCU->getPartitionSize()  + m_absIdxInLCU, m_partSizes, sizeof(*m_partSizes) * m_numPartitions);
-    memcpy(rpcCU->getPredictionMode() + m_absIdxInLCU, m_predModes, sizeof(*m_predModes) * m_numPartitions);
-    memcpy(rpcCU->getCUTransquantBypass() + m_absIdxInLCU, m_cuTransquantBypass, sizeof(*m_cuTransquantBypass) * m_numPartitions);
-    memcpy(rpcCU->getMergeFlag()         + m_absIdxInLCU, m_bMergeFlags,      sizeInBool);
-    memcpy(rpcCU->getLumaIntraDir()      + m_absIdxInLCU, m_lumaIntraDir,     sizeInChar);
-    memcpy(rpcCU->getChromaIntraDir()    + m_absIdxInLCU, m_chromaIntraDir,   sizeInChar);
-    memcpy(rpcCU->getInterDir()          + m_absIdxInLCU, m_interDir,         sizeInChar);
-    memcpy(rpcCU->getTransformIdx()      + m_absIdxInLCU, m_trIdx,            sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_LUMA)     + m_absIdxInLCU, m_transformSkip[0], sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], sizeInChar);
+    memcpy(cu->getPartitionSize()  + m_absIdxInLCU, m_partSizes, sizeof(*m_partSizes) * m_numPartitions);
+    memcpy(cu->getPredictionMode() + m_absIdxInLCU, m_predModes, sizeof(*m_predModes) * m_numPartitions);
+    memcpy(cu->getCUTransquantBypass() + m_absIdxInLCU, m_cuTransquantBypass, sizeof(*m_cuTransquantBypass) * m_numPartitions);
+    memcpy(cu->getMergeFlag()         + m_absIdxInLCU, m_bMergeFlags,      sizeInBool);
+    memcpy(cu->getLumaIntraDir()      + m_absIdxInLCU, m_lumaIntraDir,     sizeInChar);
+    memcpy(cu->getChromaIntraDir()    + m_absIdxInLCU, m_chromaIntraDir,   sizeInChar);
+    memcpy(cu->getInterDir()          + m_absIdxInLCU, m_interDir,         sizeInChar);
+    memcpy(cu->getTransformIdx()      + m_absIdxInLCU, m_trIdx,            sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_LUMA)     + m_absIdxInLCU, m_transformSkip[0], sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], sizeInChar);
 
-    memcpy(rpcCU->getCbf(TEXT_LUMA)     + m_absIdxInLCU, m_cbf[0], sizeInChar);
-    memcpy(rpcCU->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], sizeInChar);
-    memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInChar);
+    memcpy(cu->getCbf(TEXT_LUMA)     + m_absIdxInLCU, m_cbf[0], sizeInChar);
+    memcpy(cu->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], sizeInChar);
+    memcpy(cu->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInChar);
 
-    memcpy(rpcCU->getDepth()  + m_absIdxInLCU, m_depth,  sizeInChar);
-    memcpy(rpcCU->getCUSize() + m_absIdxInLCU, m_cuSize, sizeInChar);
+    memcpy(cu->getDepth()  + m_absIdxInLCU, m_depth,  sizeInChar);
+    memcpy(cu->getCUSize() + m_absIdxInLCU, m_cuSize, sizeInChar);
 
-    memcpy(rpcCU->getMVPIdx(REF_PIC_LIST_0) + m_absIdxInLCU, m_mvpIdx[0], sizeInChar);
-    memcpy(rpcCU->getMVPIdx(REF_PIC_LIST_1) + m_absIdxInLCU, m_mvpIdx[1], sizeInChar);
+    memcpy(cu->getMVPIdx(REF_PIC_LIST_0) + m_absIdxInLCU, m_mvpIdx[0], sizeInChar);
+    memcpy(cu->getMVPIdx(REF_PIC_LIST_1) + m_absIdxInLCU, m_mvpIdx[1], sizeInChar);
 
-    m_cuMvField[0].copyTo(rpcCU->getCUMvField(REF_PIC_LIST_0), m_absIdxInLCU);
-    m_cuMvField[1].copyTo(rpcCU->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU);
+    m_cuMvField[0].copyTo(cu->getCUMvField(REF_PIC_LIST_0), m_absIdxInLCU);
+    m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU);
 
-    memcpy(rpcCU->getIPCMFlag() + m_absIdxInLCU, m_iPCMFlags, sizeInBool);
+    memcpy(cu->getIPCMFlag() + m_absIdxInLCU, m_iPCMFlags, sizeInBool);
 
     uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
     uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
-    memcpy(rpcCU->getCoeffY()     + tmp2, m_trCoeff[0],    sizeof(coeff_t) * tmp);
-    memcpy(rpcCU->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
+    memcpy(cu->getCoeffY()     + tmp2, m_trCoeff[0],    sizeof(coeff_t) * tmp);
+    memcpy(cu->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
     tmp  >>= m_hChromaShift + m_vChromaShift;
     tmp2 >>= m_hChromaShift + m_vChromaShift;
-    memcpy(rpcCU->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
-    memcpy(rpcCU->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
-    memcpy(rpcCU->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
-    memcpy(rpcCU->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(pixel) * tmp);
+    memcpy(cu->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
+    memcpy(cu->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
+    memcpy(cu->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
+    memcpy(cu->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(pixel) * tmp);
 }
 
 void TComDataCU::copyCodedToPic(uint8_t depth)
 {
-    TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+    TComDataCU* cu = m_pic->getCU(m_cuAddr);
 
     int sizeInChar  = sizeof(uint8_t) * m_numPartitions;
 
-    memcpy(rpcCU->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
-    memcpy(rpcCU->getTransformIdx() + m_absIdxInLCU, m_trIdx, sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_LUMA) + m_absIdxInLCU, m_transformSkip[0], sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], sizeInChar);
-    memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], sizeInChar);
-    memcpy(rpcCU->getChromaIntraDir() + m_absIdxInLCU, m_chromaIntraDir, sizeInChar);
-    memcpy(rpcCU->getQP() + m_absIdxInLCU, m_qp, sizeof(char) * m_numPartitions);
+    memcpy(cu->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
+    memcpy(cu->getTransformIdx() + m_absIdxInLCU, m_trIdx, sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_LUMA) + m_absIdxInLCU, m_transformSkip[0], sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], sizeInChar);
+    memcpy(cu->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], sizeInChar);
+    memcpy(cu->getChromaIntraDir() + m_absIdxInLCU, m_chromaIntraDir, sizeInChar);
+    memcpy(cu->getQP() + m_absIdxInLCU, m_qp, sizeof(char) * m_numPartitions);
 
-    memcpy(rpcCU->getCbf(TEXT_LUMA) + m_absIdxInLCU, m_cbf[0], sizeInChar);
-    memcpy(rpcCU->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], sizeInChar);
-    memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInChar);
+    memcpy(cu->getCbf(TEXT_LUMA) + m_absIdxInLCU, m_cbf[0], sizeInChar);
+    memcpy(cu->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], sizeInChar);
+    memcpy(cu->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInChar);
 
     uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
     uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
-    memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeff[0], sizeof(coeff_t) * tmp);
+    memcpy(cu->getCoeffY() + tmp2, m_trCoeff[0], sizeof(coeff_t) * tmp);
     tmp  >>= m_hChromaShift + m_vChromaShift;
     tmp2 >>= m_hChromaShift + m_vChromaShift;
-    memcpy(rpcCU->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
-    memcpy(rpcCU->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
+    memcpy(cu->m_trCoeff[1] + tmp2, m_trCoeff[1], sizeof(coeff_t) * tmp);
+    memcpy(cu->m_trCoeff[2] + tmp2, m_trCoeff[2], sizeof(coeff_t) * tmp);
 }
 
 void TComDataCU::copyToPic(uint8_t depth, uint32_t partIdx, uint32_t partDepth)
diff -r 51aa9d1542ef -r a43a223a1294 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Tue Jun 17 21:15:59 2014 -0500
+++ b/source/Lib/TLibCommon/TComPic.cpp	Wed Jun 18 00:04:09 2014 -0500
@@ -49,12 +49,9 @@ using namespace x265;
 // ====================================================================================================================
 
 TComPic::TComPic()
-    : m_picSym(NULL)
-    , m_origPicYuv(NULL)
+    : m_origPicYuv(NULL)
     , m_reconPicYuv(NULL)
-    , m_bUsedByCurr(false)
     , m_bIsLongTerm(false)
-    , m_bCheckLTMSB(false)
     , m_rowDiagQp(NULL)
     , m_rowDiagQScale(NULL)
     , m_rowDiagSatd(NULL)
@@ -65,18 +62,12 @@ TComPic::TComPic()
     , m_cuCostsForVbv(NULL)
     , m_intraCuCostsForVbv(NULL)
 {
+    m_picSym = NULL;
     m_reconRowCount.set(0);
     m_countRefEncoders = 0;
     memset(&m_lowres, 0, sizeof(m_lowres));
     m_next = NULL;
     m_prev = NULL;
-    m_SSDY = 0;
-    m_SSDU = 0;
-    m_SSDV = 0;
-    m_ssim = 0;
-    m_ssimCnt = 0;
-    m_frameTime = 0.0;
-    m_elapsedCompressTime = 0.0;
     m_qpaAq = NULL;
     m_qpaRc = NULL;
     m_avgQpRc = 0;
@@ -87,33 +78,31 @@ TComPic::TComPic()
 TComPic::~TComPic()
 {}
 
-bool TComPic::create(Encoder* cfg)
+bool TComPic::create(Encoder* top)
 {
     /* store conformance window parameters with picture */
-    m_conformanceWindow = cfg->m_conformanceWindow;
+    m_conformanceWindow = top->m_conformanceWindow;
 
     /* store display window parameters with picture */
-    m_defaultDisplayWindow = cfg->m_defaultDisplayWindow;
+    m_defaultDisplayWindow = top->m_defaultDisplayWindow;
 
-    m_picSym = new TComPicSym;
     m_origPicYuv = new TComPicYuv;
     m_reconPicYuv = new TComPicYuv;
-    if (!m_picSym || !m_origPicYuv || !m_reconPicYuv)
+    if (!m_origPicYuv || !m_reconPicYuv)
         return false;
 
     bool ok = true;
-    ok &= m_picSym->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_origPicYuv->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_reconPicYuv->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_lowres.create(m_origPicYuv, cfg->m_param->bframes, !!cfg->m_param->rc.aqMode);
+    ok &= m_origPicYuv->create(top->m_param->sourceWidth, top->m_param->sourceHeight, top->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_reconPicYuv->create(top->m_param->sourceWidth, top->m_param->sourceHeight, top->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_lowres.create(m_origPicYuv, top->m_param->bframes, !!top->m_param->rc.aqMode);
 
-    bool isVbv = cfg->m_param->rc.vbvBufferSize > 0 && cfg->m_param->rc.vbvMaxBitrate > 0;
-    if (ok && (isVbv || cfg->m_param->rc.aqMode))
+    bool isVbv = top->m_param->rc.vbvBufferSize > 0 && top->m_param->rc.vbvMaxBitrate > 0;
+    if (ok && (isVbv || top->m_param->rc.aqMode))
     {
-        int numRows = m_picSym->getFrameHeightInCU();
-        int numCols = m_picSym->getFrameWidthInCU();
+        int numCols = (top->m_param->sourceWidth  + g_maxCUSize - 1) / g_maxCUSize;
+        int numRows = (top->m_param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
 
-        if (cfg->m_param->rc.aqMode)
+        if (top->m_param->rc.aqMode)
             CHECKED_MALLOC(m_qpaAq, double, numRows);
         if (isVbv)
         {
@@ -128,7 +117,7 @@ bool TComPic::create(Encoder* cfg)
             CHECKED_MALLOC(m_intraCuCostsForVbv, uint32_t, numRows * numCols);
             CHECKED_MALLOC(m_qpaRc, double, numRows);
         }
-        reInit(cfg);
+        reinit(top);
     }
 
     return ok;
@@ -138,12 +127,21 @@ fail:
     return ok;
 }
 
-void TComPic::reInit(Encoder* cfg)
+bool TComPic::allocPicSym(Encoder* top)
 {
-    if (cfg->m_param->rc.vbvBufferSize > 0 && cfg->m_param->rc.vbvMaxBitrate > 0)
+    m_picSym = new TComPicSym;
+    if (m_picSym)
+        return m_picSym->create(top->m_param->sourceWidth, top->m_param->sourceHeight, top->m_param->internalCsp);
+    else
+        return false;
+}
+
+void TComPic::reinit(Encoder* top)
+{
+    int numCols = (top->m_param->sourceWidth  + g_maxCUSize - 1) / g_maxCUSize;
+    int numRows = (top->m_param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
+    if (top->m_param->rc.vbvBufferSize > 0 && top->m_param->rc.vbvMaxBitrate > 0)
     {
-        int numRows = m_picSym->getFrameHeightInCU();
-        int numCols = m_picSym->getFrameWidthInCU();
         memset(m_rowDiagQp, 0, numRows * sizeof(double));
         memset(m_rowDiagQScale, 0, numRows * sizeof(double));
         memset(m_rowDiagSatd, 0, numRows * sizeof(uint32_t));
@@ -155,8 +153,8 @@ void TComPic::reInit(Encoder* cfg)
         memset(m_intraCuCostsForVbv, 0, numRows * numCols * sizeof(uint32_t));
         memset(m_qpaRc, 0, numRows * sizeof(double));
     }
-    if (cfg->m_param->rc.aqMode)
-        memset(m_qpaAq, 0,  m_picSym->getFrameHeightInCU() * sizeof(double));
+    if (top->m_param->rc.aqMode)
+        memset(m_qpaAq, 0, numRows * sizeof(double));
 }
 
 void TComPic::destroy()
diff -r 51aa9d1542ef -r a43a223a1294 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Tue Jun 17 21:15:59 2014 -0500
+++ b/source/Lib/TLibCommon/TComPic.h	Wed Jun 18 00:04:09 2014 -0500
@@ -31,14 +31,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */


More information about the x265-commits mailing list