[x265-commits] [x265] consolidate param functionality into param.cpp

Sagar Kotecha sagar at multicorewareinc.com
Wed Feb 26 01:07:40 CET 2014


details:   http://hg.videolan.org/x265/rev/6d584320108c
branches:  
changeset: 6273:6d584320108c
user:      Sagar Kotecha <sagar at multicorewareinc.com>
date:      Mon Feb 24 19:13:20 2014 +0530
description:
consolidate param functionality into param.cpp
Subject: [x265] Remove g_bitDepth; internal bit depth is always known at compile time

details:   http://hg.videolan.org/x265/rev/e0af601defb0
branches:  
changeset: 6274:e0af601defb0
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 17:56:50 2014 -0600
description:
Remove g_bitDepth; internal bit depth is always known at compile time

Simplify param->internalBitDepth checks, remove test bench hacks
Subject: [x265] cli: remove undocumented and unimplemented --depth CLI option

details:   http://hg.videolan.org/x265/rev/18894c99e1a7
branches:  
changeset: 6275:18894c99e1a7
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 19:19:27 2014 -0600
description:
cli: remove undocumented and unimplemented --depth CLI option
Subject: [x265] threading: include process id in name passed to sem_open() and sem_unlink()

details:   http://hg.videolan.org/x265/rev/1a93191f0c23
branches:  
changeset: 6276:1a93191f0c23
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 20:07:44 2014 -0600
description:
threading: include process id in name passed to sem_open() and sem_unlink()

This should prevent race conditions between x265 processes spinning up on the
same CPUs, and generally make name conflicts very rare.
Subject: [x265] param: simplify checks of max ctu size, improve abort message

details:   http://hg.videolan.org/x265/rev/b8dab8ef744c
branches:  
changeset: 6277:b8dab8ef744c
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 20:18:53 2014 -0600
description:
param: simplify checks of max ctu size, improve abort message
Subject: [x265] TComSlice: nits

details:   http://hg.videolan.org/x265/rev/6214d2609ea8
branches:  
changeset: 6278:6214d2609ea8
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 22:45:15 2014 -0600
description:
TComSlice: nits
Subject: [x265] threading: recover include of unistd.h within #if __GNUC__ section

details:   http://hg.videolan.org/x265/rev/a36a669d09e8
branches:  
changeset: 6279:a36a669d09e8
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 02:22:06 2014 -0600
description:
threading: recover include of unistd.h within #if __GNUC__ section

Fixes MinGW build
Subject: [x265] Updated x265_param_parse to use parseName & a few nit fixes

details:   http://hg.videolan.org/x265/rev/1f6311b0b2a7
branches:  
changeset: 6280:1f6311b0b2a7
user:      David T Yuen <dtyx265 at gmail.com>
date:      Mon Feb 24 21:17:11 2014 -0800
description:
Updated x265_param_parse to use parseName & a few nit fixes
Subject: [x265] asm: fixed invalid testbench input for addAvg primitive, fixed addition overflow for some block sizes.

details:   http://hg.videolan.org/x265/rev/7d009bc2953b
branches:  
changeset: 6281:7d009bc2953b
user:      Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
date:      Tue Feb 25 10:39:07 2014 +0530
description:
asm: fixed invalid testbench input for addAvg primitive, fixed addition overflow for some block sizes.
Subject: [x265] encoder: enable timing info in VPS

details:   http://hg.videolan.org/x265/rev/5e375c097de4
branches:  
changeset: 6282:5e375c097de4
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 23:22:55 2014 -0600
description:
encoder: enable timing info in VPS
Subject: [x265] cli: refactor handling of input file parameters

details:   http://hg.videolan.org/x265/rev/651c0bc9e280
branches:  
changeset: 6283:651c0bc9e280
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 24 22:44:59 2014 -0600
description:
cli: refactor handling of input file parameters

* allow y4m header to provide aspect ratio
* allow user to override Y4M aspect ratio or frame rate
* allow user to provide data possibly missing from Y4M header
* do not clamp framesToBeEncoded to predicted file size (stop at EOF)
Subject: [x265] rc: store qp in TComPic::avgQpRc in CQP.

details:   http://hg.videolan.org/x265/rev/b86a5ccd3474
branches:  
changeset: 6284:b86a5ccd3474
user:      Aarthi Thirumalai
date:      Tue Feb 25 11:50:15 2014 +0530
description:
rc: store qp in TComPic::avgQpRc in CQP.
Subject: [x265] testbench: remove redundant casts of X265_MALLOC() output

details:   http://hg.videolan.org/x265/rev/62da491b8b22
branches:  
changeset: 6285:62da491b8b22
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 01:20:46 2014 -0600
description:
testbench: remove redundant casts of X265_MALLOC() output
Subject: [x265] mbdstharness: nits

details:   http://hg.videolan.org/x265/rev/9b48a2847d97
branches:  
changeset: 6286:9b48a2847d97
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 01:20:54 2014 -0600
description:
mbdstharness: nits
Subject: [x265] encoder: rename _param parameter to p for readability

details:   http://hg.videolan.org/x265/rev/cfc5647635e0
branches:  
changeset: 6287:cfc5647635e0
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 01:23:16 2014 -0600
description:
encoder: rename _param parameter to p for readability
Subject: [x265] encoder: log the average QP used per frame, per I slices, P, and B slices

details:   http://hg.videolan.org/x265/rev/a41b6a5491ed
branches:  
changeset: 6288:a41b6a5491ed
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 02:03:11 2014 -0600
description:
encoder: log the average QP used per frame, per I slices, P, and B slices
Subject: [x265] weight: bump weight analysis logging to --log 4, reduce spew

details:   http://hg.videolan.org/x265/rev/1c467346ece8
branches:  
changeset: 6289:1c467346ece8
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 10:00:19 2014 -0600
description:
weight: bump weight analysis logging to --log 4, reduce spew
Subject: [x265] input: workaround MSVC runtime bugs in older compilers (fixes #27)

details:   http://hg.videolan.org/x265/rev/a4c676d671d6
branches:  
changeset: 6290:a4c676d671d6
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 11:16:21 2014 -0600
description:
input: workaround MSVC runtime bugs in older compilers (fixes #27)

Prior to VC11, ifstream::pos_type could not handle 64bit sizes correctly
Subject: [x265] all_angs_pred_32x32, asm code

details:   http://hg.videolan.org/x265/rev/ea1c03303b16
branches:  
changeset: 6291:ea1c03303b16
user:      Praveen Tiwari
date:      Tue Feb 25 18:48:08 2014 +0530
description:
all_angs_pred_32x32, asm code
Subject: [x265] vec: remove intra-sse41.cpp, full asm coverage for intra prediction

details:   http://hg.videolan.org/x265/rev/b456566376ad
branches:  
changeset: 6292:b456566376ad
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 11:20:47 2014 -0600
description:
vec: remove intra-sse41.cpp, full asm coverage for intra prediction
Subject: [x265] move public encoder and picture functions to api.cpp

details:   http://hg.videolan.org/x265/rev/5fde224bab34
branches:  
changeset: 6293:5fde224bab34
user:      Sagar Kotecha <sagar at multicorewareinc.com>
date:      Tue Feb 25 14:55:20 2014 +0530
description:
move public encoder and picture functions to api.cpp
Subject: [x265] api: check for NULL param pointer in x265_encoder_open

details:   http://hg.videolan.org/x265/rev/b7a1a636b77b
branches:  
changeset: 6294:b7a1a636b77b
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 25 12:18:56 2014 -0600
description:
api: check for NULL param pointer in x265_encoder_open
Subject: [x265] asm: add new file for 10bpp asm filter functions

details:   http://hg.videolan.org/x265/rev/a8e822a95fad
branches:  
changeset: 6295:a8e822a95fad
user:      Nabajit Deka
date:      Tue Feb 25 17:04:43 2014 +0530
description:
asm: add new file for 10bpp asm filter functions
Subject: [x265] asm: enable 10bit asm filter functions, fix test harness

details:   http://hg.videolan.org/x265/rev/0b63fa220e19
branches:  
changeset: 6296:0b63fa220e19
user:      Nabajit Deka
date:      Tue Feb 25 17:06:42 2014 +0530
description:
asm: enable 10bit asm filter functions, fix test harness
Subject: [x265] refine MC - cleanup unnecessary code paths, reduce copies for non-WP uni-pred

details:   http://hg.videolan.org/x265/rev/5241a8efb684
branches:  
changeset: 6297:5241a8efb684
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Mon Feb 24 18:55:20 2014 +0900
description:
refine MC - cleanup unnecessary code paths, reduce copies for non-WP uni-pred
Subject: [x265] reduce unnecessary CU data set/clear (no neighbor access)

details:   http://hg.videolan.org/x265/rev/f37c84ffe293
branches:  
changeset: 6298:f37c84ffe293
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Sun Feb 23 14:38:37 2014 +0900
description:
reduce unnecessary CU data set/clear (no neighbor access)

mvd, mvpIdx, mergeIndex
Subject: [x265] lookahead: bug fix for b-adapt 0 cost estimates (closes #26)

details:   http://hg.videolan.org/x265/rev/9eea995a2347
branches:  
changeset: 6299:9eea995a2347
user:      Aarthi Thirumalai
date:      Wed Feb 26 01:46:34 2014 +0530
description:
lookahead: bug fix for b-adapt 0 cost estimates (closes #26)

don't overwrite lastNonB reference with current frame, 'lastNonB' state was
already replaced with current frame's lowres at this point.

it mostly affected b-adapt=0 but could have affected any of the modes if they
had not already estimated this particular P frame cost before this point.
Subject: [x265] remove redundant state m_avgQpRc from TComSlice.

details:   http://hg.videolan.org/x265/rev/3bfd7b2a54ed
branches:  
changeset: 6300:3bfd7b2a54ed
user:      Aarthi Thirumalai
date:      Wed Feb 26 02:09:16 2014 +0530
description:
remove redundant state m_avgQpRc from TComSlice.

This has been moved to TComPic already.
Subject: [x265] TComPic: store average Qp (as decided by AQ) used per frame.

details:   http://hg.videolan.org/x265/rev/298133a7bd53
branches:  
changeset: 6301:298133a7bd53
user:      Aarthi Thirumalai
date:      Wed Feb 26 03:25:28 2014 +0530
description:
TComPic: store average Qp (as decided by AQ) used per frame.
Subject: [x265] encoder: log avg Qp decided by AQ for each slice type

details:   http://hg.videolan.org/x265/rev/b47fc23c75df
branches:  
changeset: 6302:b47fc23c75df
user:      Aarthi Thirumalai
date:      Wed Feb 26 03:26:00 2014 +0530
description:
encoder: log avg Qp decided by AQ for each slice type

diffstat:

 source/Lib/TLibCommon/TComDataCU.cpp     |     21 -
 source/Lib/TLibCommon/TComDataCU.h       |      7 +-
 source/Lib/TLibCommon/TComMotionInfo.cpp |      5 -
 source/Lib/TLibCommon/TComMotionInfo.h   |      2 +-
 source/Lib/TLibCommon/TComPic.cpp        |     30 +-
 source/Lib/TLibCommon/TComPic.h          |      6 +-
 source/Lib/TLibCommon/TComPicYuv.cpp     |      2 +-
 source/Lib/TLibCommon/TComPrediction.cpp |    123 +-
 source/Lib/TLibCommon/TComPrediction.h   |      3 +-
 source/Lib/TLibCommon/TComRom.cpp        |      1 -
 source/Lib/TLibCommon/TComRom.h          |      2 -
 source/Lib/TLibCommon/TComSlice.cpp      |      1 -
 source/Lib/TLibCommon/TComSlice.h        |      9 +-
 source/Lib/TLibCommon/TypeDef.h          |      3 +-
 source/Lib/TLibEncoder/TEncCu.cpp        |      6 +-
 source/Lib/TLibEncoder/TEncSearch.cpp    |     39 +-
 source/common/CMakeLists.txt             |      9 +-
 source/common/common.cpp                 |   1047 +-
 source/common/common.h                   |      4 -
 source/common/param.cpp                  |   1053 +
 source/common/param.h                    |     38 +
 source/common/threading.h                |      4 +-
 source/common/vec/intra-sse41.cpp        |   2672 ----
 source/common/vec/vec-primitives.cpp     |      3 -
 source/common/x86/asm-primitives.cpp     |      8 +
 source/common/x86/const-a.asm            |      2 +-
 source/common/x86/intrapred.h            |      1 +
 source/common/x86/intrapred8.asm         |  16105 +++++++++++++++++++++++++++++
 source/common/x86/ipfilter16.asm         |    723 +
 source/common/x86/mc-a.asm               |     97 +-
 source/encoder/CMakeLists.txt            |      1 +
 source/encoder/api.cpp                   |    191 +
 source/encoder/compress.cpp              |     12 +-
 source/encoder/encoder.cpp               |    493 +-
 source/encoder/encoder.h                 |      7 +-
 source/encoder/frameencoder.cpp          |     10 +-
 source/encoder/ratecontrol.cpp           |     23 +-
 source/encoder/slicetype.cpp             |      1 -
 source/encoder/weightPrediction.cpp      |      2 +-
 source/input/input.cpp                   |      8 +-
 source/input/input.h                     |     38 +-
 source/input/y4m.cpp                     |    165 +-
 source/input/y4m.h                       |     40 +-
 source/input/yuv.cpp                     |    140 +-
 source/input/yuv.h                       |     32 +-
 source/test/intrapredharness.cpp         |     10 -
 source/test/ipfilterharness.cpp          |      8 +-
 source/test/mbdstharness.cpp             |     48 +-
 source/test/pixelharness.cpp             |    121 +-
 source/test/pixelharness.h               |      5 +-
 source/test/testbench.cpp                |      4 -
 source/x265.cpp                          |    139 +-
 source/x265.h                            |     17 +-
 53 files changed, 18802 insertions(+), 4739 deletions(-)

diffs (truncated from 25202 to 300 lines):

diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Feb 26 03:26:00 2014 +0530
@@ -345,8 +345,6 @@ void TComDataCU::initEstData(uint32_t de
 
     for (uint32_t i = 0; i < m_numPartitions; i++)
     {
-        m_mvpIdx[0][i] = -1;
-        m_mvpIdx[1][i] = -1;
         m_depth[i] = depth;
         m_width[i] = width;
         m_height[i] = height;
@@ -361,7 +359,6 @@ void TComDataCU::initEstData(uint32_t de
         m_iPCMFlags[i] = 0;
         m_qp[i] = qp;
         m_bMergeFlags[i] = 0;
-        m_mergeIndex[i] = 0;
         m_lumaIntraDir[i] = DC_IDX;
         m_chromaIntraDir[i] = 0;
         m_interDir[i] = 0;
@@ -408,7 +405,6 @@ void TComDataCU::initSubCU(TComDataCU* c
     memset(m_qp, qp, sizeInChar);
 
     memset(m_bMergeFlags,     0, iSizeInBool);
-    memset(m_mergeIndex,      0, iSizeInUchar);
     memset(m_lumaIntraDir,    DC_IDX, iSizeInUchar);
     memset(m_chromaIntraDir,  0, iSizeInUchar);
     memset(m_interDir,        0, iSizeInUchar);
@@ -432,8 +428,6 @@ void TComDataCU::initSubCU(TComDataCU* c
         m_partSizes[i] = SIZE_NONE;
         m_predModes[i] = MODE_NONE;
         m_cuTransquantBypass[i] = false;
-        m_mvpIdx[0][i] = -1;
-        m_mvpIdx[1][i] = -1;
     }
 
     m_cuMvField[0].clearMvField();
@@ -1492,16 +1486,6 @@ void TComDataCU::setSubPart(T param, T* 
     }
 }
 
-void TComDataCU::setMergeFlagSubParts(bool bMergeFlag, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth)
-{
-    setSubPart(bMergeFlag, m_bMergeFlags, absPartIdx, depth, partIdx);
-}
-
-void TComDataCU::setMergeIndexSubParts(uint32_t mergeIndex, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth)
-{
-    setSubPart<UChar>(mergeIndex, m_mergeIndex, absPartIdx, depth, partIdx);
-}
-
 void TComDataCU::setChromIntraDirSubParts(uint32_t dir, uint32_t absPartIdx, uint32_t depth)
 {
     uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
@@ -1514,11 +1498,6 @@ void TComDataCU::setInterDirSubParts(uin
     setSubPart<UChar>(dir, m_interDir, absPartIdx, depth, partIdx);
 }
 
-void TComDataCU::setMVPIdxSubParts(int mvpIdx, int picList, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth)
-{
-    setSubPart<char>(mvpIdx, m_mvpIdx[picList], absPartIdx, depth, partIdx);
-}
-
 void TComDataCU::setTrIdxSubParts(uint32_t trIdx, uint32_t absPartIdx, uint32_t depth)
 {
     uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.h	Wed Feb 26 03:26:00 2014 +0530
@@ -326,13 +326,14 @@ public:
 
     bool          getMergeFlag(uint32_t idx)            { return m_bMergeFlags[idx]; }
 
-    void          setMergeFlagSubParts(bool bMergeFlag, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth);
+    void          setMergeFlag(uint32_t idx, bool bMergeFlag) { m_bMergeFlags[idx] = bMergeFlag; }
 
     UChar*        getMergeIndex()                   { return m_mergeIndex; }
 
     UChar         getMergeIndex(uint32_t idx)           { return m_mergeIndex[idx]; }
 
-    void          setMergeIndexSubParts(uint32_t mergeIndex, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth);
+    void          setMergeIndex(uint32_t idx, uint32_t mergeIndex) { m_mergeIndex[idx] = (UChar)mergeIndex; }
+
     template<typename T>
     void          setSubPart(T bParameter, T* pbBaseLCU, uint32_t cuAddr, uint32_t cuDepth, uint32_t puIdx);
 
@@ -384,8 +385,6 @@ public:
 
     char*         getMVPIdx(int picList)                       { return m_mvpIdx[picList]; }
 
-    void          setMVPIdxSubParts(int mvpIdx, int picList, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth);
-
     void          clipMv(MV& outMV);
 
     void          getMvPredLeft(MV& mvPred)       { mvPred = m_mvFieldA.mv; }
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComMotionInfo.cpp
--- a/source/Lib/TLibCommon/TComMotionInfo.cpp	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComMotionInfo.cpp	Wed Feb 26 03:26:00 2014 +0530
@@ -310,11 +310,6 @@ void TComCUMvField::setAllMv(const MV& m
     setAll(m_mv, mv, cuMode, partAddr, depth, partIdx);
 }
 
-void TComCUMvField::setAllMvd(const MV& mvd, PartSize cuMode, int partAddr, uint32_t depth, int partIdx)
-{
-    setAll(m_mvd, mvd, cuMode, partAddr, depth, partIdx);
-}
-
 void TComCUMvField::setAllRefIdx(int refIdx, PartSize cuMode, int partAddr, uint32_t depth, int partIdx)
 {
     setAll(m_refIdx, static_cast<char>(refIdx), cuMode, partAddr, depth, partIdx);
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComMotionInfo.h
--- a/source/Lib/TLibCommon/TComMotionInfo.h	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComMotionInfo.h	Wed Feb 26 03:26:00 2014 +0530
@@ -130,9 +130,9 @@ public:
     // ------------------------------------------------------------------------------------------------------------------
 
     void    setAllMv(const MV& mv,              PartSize cuMode, int partAddr, uint32_t depth, int partIdx = 0);
-    void    setAllMvd(const MV& mvd,            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; }
 
     void setNumPartition(int numPart)
     {
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComPic.cpp	Wed Feb 26 03:26:00 2014 +0530
@@ -79,6 +79,7 @@ TComPic::TComPic()
     m_qpaAq = 0;
     m_qpaRc = 0;
     m_avgQpRc = 0;
+    m_avgQpAq = 0;
     m_bChromaPlanesExtended = false;
 }
 
@@ -105,19 +106,25 @@ bool TComPic::create(TEncCfg* cfg)
     ok &= m_reconPicYuv->create(cfg->param.sourceWidth, cfg->param.sourceHeight, cfg->param.internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
     ok &= m_lowres.create(m_origPicYuv, cfg->param.bframes, !!cfg->param.rc.aqMode);
 
-    if (ok && cfg->param.rc.vbvBufferSize > 0 && cfg->param.rc.vbvMaxBitrate > 0)
+    bool isVbv = cfg->param.rc.vbvBufferSize > 0 && cfg->param.rc.vbvMaxBitrate > 0;
+    if (ok && (isVbv || cfg->param.rc.aqMode))
     {
         int numRows = m_picSym->getFrameHeightInCU();
         int numCols = m_picSym->getFrameWidthInCU();
-        CHECKED_MALLOC(m_rowDiagQp, double, numRows);
-        CHECKED_MALLOC(m_rowDiagQScale, double, numRows);
-        CHECKED_MALLOC(m_rowDiagSatd, uint32_t, numRows);
-        CHECKED_MALLOC(m_rowEncodedBits, uint32_t, numRows);
-        CHECKED_MALLOC(m_numEncodedCusPerRow, uint32_t, numRows);
-        CHECKED_MALLOC(m_rowSatdForVbv, uint32_t, numRows);
-        CHECKED_MALLOC(m_cuCostsForVbv, uint32_t, numRows * numCols);
-        CHECKED_MALLOC(m_qpaRc, double, numRows);
-        CHECKED_MALLOC(m_qpaAq, int, numRows);
+
+        if (cfg->param.rc.aqMode)
+            CHECKED_MALLOC(m_qpaAq, double, numRows);
+        if (isVbv)
+        {
+            CHECKED_MALLOC(m_rowDiagQp, double, numRows);
+            CHECKED_MALLOC(m_rowDiagQScale, double, numRows);
+            CHECKED_MALLOC(m_rowDiagSatd, uint32_t, numRows);
+            CHECKED_MALLOC(m_rowEncodedBits, uint32_t, numRows);
+            CHECKED_MALLOC(m_numEncodedCusPerRow, uint32_t, numRows);
+            CHECKED_MALLOC(m_rowSatdForVbv, uint32_t, numRows);
+            CHECKED_MALLOC(m_cuCostsForVbv, uint32_t, numRows * numCols);
+            CHECKED_MALLOC(m_qpaRc, double, numRows);
+        }
         reInit(cfg);
     }
 
@@ -142,8 +149,9 @@ void TComPic::reInit(TEncCfg* cfg)
         memset(m_rowSatdForVbv, 0, numRows * sizeof(uint32_t));
         memset(m_cuCostsForVbv, 0,  numRows * numCols * sizeof(uint32_t));
         memset(m_qpaRc, 0, numRows * sizeof(double));
-        memset(m_qpaAq, 0, numRows * sizeof(uint32_t));
     }
+    if (cfg->param.rc.aqMode)
+        memset(m_qpaAq, 0,  m_picSym->getFrameHeightInCU() * sizeof(double));
 }
 
 void TComPic::destroy(int bframes)
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComPic.h	Wed Feb 26 03:26:00 2014 +0530
@@ -110,9 +110,11 @@ public:
     uint32_t*             m_numEncodedCusPerRow;
     uint32_t*             m_rowSatdForVbv;
     uint32_t*             m_cuCostsForVbv;
-    int*                  m_qpaAq;
+    double*               m_qpaAq;
     double*               m_qpaRc;
-    double                m_avgQpRc;
+    double                m_avgQpRc; //avg QP as decided by ratecontrol
+    double                m_avgQpAq; //avg QP as decided by AQ in addition to ratecontrol
+
     TComPic();
     virtual ~TComPic();
 
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Wed Feb 26 03:26:00 2014 +0530
@@ -182,7 +182,7 @@ void TComPicYuv::copyFromPicture(const x
     if (pic.bitDepth < X265_DEPTH)
     {
         /* 8bit input, 10bit internal depth. Do a simple up-shift of 2 bits */
-        assert(g_bitDepth == 10);
+        assert(X265_DEPTH == 10);
 
         pixel *Y = getLumaAddr();
         pixel *U = getCbAddr();
diff -r ebaa34c8f651 -r b47fc23c75df source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Mon Feb 24 18:55:00 2014 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Wed Feb 26 03:26:00 2014 +0530
@@ -246,12 +246,15 @@ void TComPrediction::predIntraChromaAng(
  */
 bool TComPrediction::xCheckIdenticalMotion(TComDataCU* cu, uint32_t partAddr)
 {
-    if (cu->getSlice()->isInterB() && !cu->getSlice()->getPPS()->getWPBiPred())
+    assert(cu->getSlice()->isInterB());
+    if (!cu->getSlice()->getPPS()->getWPBiPred())
     {
-        if (cu->getCUMvField(REF_PIC_LIST_0)->getRefIdx(partAddr) >= 0 && cu->getCUMvField(REF_PIC_LIST_1)->getRefIdx(partAddr) >= 0)
+        int refIdxL0 = cu->getCUMvField(REF_PIC_LIST_0)->getRefIdx(partAddr);
+        int refIdxL1 = cu->getCUMvField(REF_PIC_LIST_1)->getRefIdx(partAddr);
+        if (refIdxL0 >= 0 && refIdxL1 >= 0)
         {
-            int refPOCL0 = cu->getSlice()->getRefPic(REF_PIC_LIST_0, cu->getCUMvField(REF_PIC_LIST_0)->getRefIdx(partAddr))->getPOC();
-            int refPOCL1 = cu->getSlice()->getRefPic(REF_PIC_LIST_1, cu->getCUMvField(REF_PIC_LIST_1)->getRefIdx(partAddr))->getPOC();
+            int refPOCL0 = cu->getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->getPOC();
+            int refPOCL1 = cu->getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->getPOC();
             if (refPOCL0 == refPOCL1 && cu->getCUMvField(REF_PIC_LIST_0)->getMv(partAddr) == cu->getCUMvField(REF_PIC_LIST_1)->getMv(partAddr))
             {
                 return true;
@@ -267,9 +270,11 @@ void TComPrediction::motionCompensation(
     int  height;
     uint32_t partAddr;
 
-    if (partIdx >= 0)
+    assert(partIdx >= 0);
     {
         cu->getPartIndexAndSize(partIdx, partAddr, width, height);
+        if (cu->getSlice()->isInterP())
+            list = REF_PIC_LIST_0;
         if (list != REF_PIC_LIST_X)
         {
             if (cu->getSlice()->getPPS()->getUseWP())
@@ -303,48 +308,6 @@ void TComPrediction::motionCompensation(
                 xPredInterBi(cu, partAddr, width, height, predYuv, bLuma, bChroma);
             }
         }
-        return;
-    }
-
-    for (partIdx = 0; partIdx < cu->getNumPartInter(); partIdx++)
-    {
-        cu->getPartIndexAndSize(partIdx, partAddr, width, height);
-
-        if (list != REF_PIC_LIST_X)
-        {
-            if (cu->getSlice()->getPPS()->getUseWP())
-            {
-                TShortYUV* shortYuv = &m_predShortYuv[0];
-
-                int refId = cu->getCUMvField(list)->getRefIdx(partAddr);
-                assert(refId >= 0);
-
-                MV mv = cu->getCUMvField(list)->getMv(partAddr);
-                cu->clipMv(mv);
-
-                if (bLuma)
-                    xPredInterLumaBlk(cu, cu->getSlice()->getRefPic(list, refId)->getPicYuvRec(), partAddr, &mv, width, height, shortYuv);
-                if (bChroma)
-                    xPredInterChromaBlk(cu, cu->getSlice()->getRefPic(list, refId)->getPicYuvRec(), partAddr, &mv, width, height, shortYuv);
-
-                xWeightedPredictionUni(cu, shortYuv, partAddr, width, height, list, predYuv, -1, bLuma, bChroma);
-            }
-            else
-            {
-                xPredInterUni(cu, partAddr, width, height, list, predYuv, bLuma, bChroma);
-            }
-        }
-        else
-        {
-            if (xCheckIdenticalMotion(cu, partAddr))
-            {
-                xPredInterUni(cu, partAddr, width, height, REF_PIC_LIST_0, predYuv, bLuma, bChroma);
-            }
-            else
-            {
-                xPredInterBi(cu, partAddr, width, height, predYuv, bLuma, bChroma);
-            }
-        }
     }
 }
 
@@ -379,22 +342,24 @@ void TComPrediction::xPredInterUni(TComD
         xPredInterChromaBlk(cu, cu->getSlice()->getRefPic(list, refIdx)->getPicYuvRec(), partAddr, &mv, width, height, outPredYuv);
 }
 


More information about the x265-commits mailing list