[x265] [PATCH] Removed Encoder* as member of DPB and replaced it with field m_bOpenGOP
dtyx265 at gmail.com
dtyx265 at gmail.com
Fri Mar 7 23:51:58 CET 2014
# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1394232547 28800
# Node ID 9f3515756d0fc0a5496f722ae208341ee2e8d61c
# Parent 2bf727dca27d6f69e96d4412850661cbe036cbef
Removed Encoder* as member of DPB and replaced it with field m_bOpenGOP
Also added int bframes to Lowres since only param->bframes is passed to its methods thus eliminating one of DPB's uses of Encoder*
diff -r 2bf727dca27d -r 9f3515756d0f source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Fri Mar 07 15:11:13 2014 +0530
+++ b/source/Lib/TLibCommon/TComPic.cpp Fri Mar 07 14:49:07 2014 -0800
@@ -154,7 +154,7 @@
memset(m_qpaAq, 0, m_picSym->getFrameHeightInCU() * sizeof(double));
}
-void TComPic::destroy(int bframes)
+void TComPic::destroy()
{
if (m_picSym)
{
@@ -176,7 +176,7 @@
delete m_reconPicYuv;
m_reconPicYuv = NULL;
}
- m_lowres.destroy(bframes);
+ m_lowres.destroy();
X265_FREE(m_rowDiagQp);
X265_FREE(m_rowDiagQScale);
diff -r 2bf727dca27d -r 9f3515756d0f source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h Fri Mar 07 15:11:13 2014 +0530
+++ b/source/Lib/TLibCommon/TComPic.h Fri Mar 07 14:49:07 2014 -0800
@@ -119,7 +119,7 @@
virtual ~TComPic();
bool create(Encoder* cfg);
- virtual void destroy(int bframes);
+ virtual void destroy();
void reInit(Encoder* cfg);
bool getUsedByCurr() { return m_bUsedByCurr; }
diff -r 2bf727dca27d -r 9f3515756d0f source/common/lowres.cpp
--- a/source/common/lowres.cpp Fri Mar 07 15:11:13 2014 +0530
+++ b/source/common/lowres.cpp Fri Mar 07 14:49:07 2014 -0800
@@ -27,9 +27,10 @@
using namespace x265;
-bool Lowres::create(TComPicYuv *orig, int bframes, bool bAQEnabled)
+bool Lowres::create(TComPicYuv *orig, int _bframes, bool bAQEnabled)
{
isLowres = true;
+ bframes = _bframes;
width = orig->getWidth() / 2;
lines = orig->getHeight() / 2;
lumaStride = width + 2 * orig->getLumaMarginX();
@@ -92,7 +93,7 @@
return false;
}
-void Lowres::destroy(int bframes)
+void Lowres::destroy()
{
for (int i = 0; i < 4; i++)
{
@@ -125,7 +126,7 @@
}
// (re) initialize lowres state
-void Lowres::init(TComPicYuv *orig, int poc, int type, int bframes)
+void Lowres::init(TComPicYuv *orig, int poc, int type)
{
bIntraCalculated = false;
bLastMiniGopBFrame = false;
diff -r 2bf727dca27d -r 9f3515756d0f source/common/lowres.h
--- a/source/common/lowres.h Fri Mar 07 15:11:13 2014 +0530
+++ b/source/common/lowres.h Fri Mar 07 14:49:07 2014 -0800
@@ -123,6 +123,7 @@
MV* lowresMvs[2][X265_BFRAME_MAX + 1];
int plannedType[X265_LOOKAHEAD_MAX + 1];
int64_t plannedSatd[X265_LOOKAHEAD_MAX + 1];
+ int bframes;
/* rate control / adaptive quant data */
double* qpAqOffset; // qp Aq offset values for each Cu
@@ -134,9 +135,9 @@
uint16_t* propagateCost;
double weightedCostDelta[X265_BFRAME_MAX + 2];
- bool create(TComPicYuv *orig, int bframes, bool bAqEnabled);
- void destroy(int bframes);
- void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
+ bool create(TComPicYuv *orig, int _bframes, bool bAqEnabled);
+ void destroy();
+ void init(TComPicYuv *orig, int poc, int sliceType);
};
}
diff -r 2bf727dca27d -r 9f3515756d0f source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp Fri Mar 07 15:11:13 2014 +0530
+++ b/source/encoder/dpb.cpp Fri Mar 07 14:49:07 2014 -0800
@@ -36,7 +36,7 @@
while (!m_picList.empty())
{
TComPic* pic = m_picList.popFront();
- pic->destroy(m_cfg->param->bframes);
+ pic->destroy();
delete pic;
}
}
@@ -373,7 +373,7 @@
}
if (pic->m_lowres.bKeyframe)
{
- if (m_cfg->param->bOpenGOP)
+ if (m_bOpenGOP)
{
return NAL_UNIT_CODED_SLICE_CRA;
}
diff -r 2bf727dca27d -r 9f3515756d0f source/encoder/dpb.h
--- a/source/encoder/dpb.h Fri Mar 07 15:11:13 2014 +0530
+++ b/source/encoder/dpb.h Fri Mar 07 14:49:07 2014 -0800
@@ -41,19 +41,19 @@
int m_lastIDR;
int m_pocCRA;
bool m_bRefreshPending;
- Encoder* m_cfg;
PicList m_picList;
int m_maxRefL0;
int m_maxRefL1;
+ int m_bOpenGOP;
DPB(Encoder *cfg)
- : m_cfg(cfg)
{
m_lastIDR = 0;
m_pocCRA = 0;
m_bRefreshPending = false;
m_maxRefL0 = cfg->param->maxNumReferences;
m_maxRefL1 = 1;
+ m_bOpenGOP = cfg->param->bOpenGOP;
}
~DPB();
diff -r 2bf727dca27d -r 9f3515756d0f source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Fri Mar 07 15:11:13 2014 +0530
+++ b/source/encoder/encoder.cpp Fri Mar 07 14:49:07 2014 -0800
@@ -145,7 +145,7 @@
while (!m_freeList.empty())
{
TComPic* pic = m_freeList.popFront();
- pic->destroy(param->bframes);
+ pic->destroy();
delete pic;
}
@@ -296,7 +296,7 @@
x265_log(param, X265_LOG_ERROR, "memory allocation failure, aborting encode\n");
if (pic)
{
- pic->destroy(param->bframes);
+ pic->destroy();
delete pic;
}
return -1;
diff -r 2bf727dca27d -r 9f3515756d0f source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp Fri Mar 07 15:11:13 2014 +0530
+++ b/source/encoder/slicetype.cpp Fri Mar 07 14:49:07 2014 -0800
@@ -78,14 +78,14 @@
while (!inputQueue.empty())
{
TComPic* pic = inputQueue.popFront();
- pic->destroy(cfg->param->bframes);
+ pic->destroy();
delete pic;
}
while (!outputQueue.empty())
{
TComPic* pic = outputQueue.popFront();
- pic->destroy(cfg->param->bframes);
+ pic->destroy();
delete pic;
}
@@ -96,7 +96,7 @@
{
TComPicYuv *orig = pic->getPicYuvOrg();
- pic->m_lowres.init(orig, pic->getSlice()->getPOC(), sliceType, cfg->param->bframes);
+ pic->m_lowres.init(orig, pic->getSlice()->getPOC(), sliceType);
inputQueue.pushBack(*pic);
if (inputQueue.size() >= cfg->param->lookaheadDepth)
More information about the x265-devel
mailing list