[x265-commits] [x265] common: add --ref to the tool list so it is visible in th...
Steve Borho
steve at borho.org
Tue Oct 22 05:47:34 CEST 2013
details: http://hg.videolan.org/x265/rev/40eb6be35caa
branches: stable
changeset: 4591:40eb6be35caa
user: Steve Borho <steve at borho.org>
date: Mon Oct 21 22:45:24 2013 -0500
description:
common: add --ref to the tool list so it is visible in the log
Subject: [x265] Merge with stable
details: http://hg.videolan.org/x265/rev/9245a882ccee
branches:
changeset: 4592:9245a882ccee
user: Steve Borho <steve at borho.org>
date: Mon Oct 21 22:45:55 2013 -0500
description:
Merge with stable
diffstat:
source/Lib/TLibCommon/TComPic.cpp | 11 +----------
source/Lib/TLibCommon/TComPic.h | 1 -
source/Lib/TLibCommon/TComRom.cpp | 8 ++++++++
source/Lib/TLibCommon/TComRom.h | 1 +
source/common/common.cpp | 10 ++++++++++
source/common/common.h | 2 +-
source/common/lowres.cpp | 15 ++++++++++++++-
source/common/lowres.h | 5 ++++-
source/encoder/ratecontrol.cpp | 2 +-
source/encoder/slicetype.cpp | 2 ++
source/encoder/slicetype.h | 2 ++
11 files changed, 44 insertions(+), 15 deletions(-)
diffs (225 lines):
diff -r f2fcda06d76a -r 9245a882ccee source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -62,7 +62,6 @@ TComPic::TComPic()
memset(&m_lowres, 0, sizeof(m_lowres));
m_next = NULL;
m_prev = NULL;
- m_qpAqOffset = NULL;
m_SSDY = 0;
m_SSDU = 0;
m_SSDV = 0;
@@ -89,14 +88,7 @@ void TComPic::create(TEncCfg* cfg)
m_defaultDisplayWindow = cfg->getDefaultDisplayWindow();
/* configure lowres dimensions */
- m_lowres.create(this, cfg->param.bframes);
-
- if (cfg->param.rc.aqMode)
- {
- m_qpAqOffset = (double*)x265_malloc(sizeof(double) * getPicSym()->getNumberOfCUsInFrame());
- if (!m_qpAqOffset)
- cfg->param.rc.aqMode = 0;
- }
+ m_lowres.create(this, cfg->param.bframes, &cfg->param.rc.aqMode);
}
void TComPic::destroy(int bframes)
@@ -123,7 +115,6 @@ void TComPic::destroy(int bframes)
}
m_lowres.destroy(bframes);
- X265_FREE(m_qpAqOffset);
}
//! \}
diff -r f2fcda06d76a -r 9245a882ccee source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h Mon Oct 21 21:42:23 2013 -0500
+++ b/source/Lib/TLibCommon/TComPic.h Mon Oct 21 22:45:55 2013 -0500
@@ -86,7 +86,6 @@ public:
TComPic* m_next;
TComPic* m_prev;
- double* m_qpAqOffset;
UInt64 m_SSDY;
UInt64 m_SSDU;
UInt64 m_SSDV;
diff -r f2fcda06d76a -r 9245a882ccee source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/Lib/TLibCommon/TComRom.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -613,5 +613,13 @@ const UChar g_renormTable[32] =
1, 1, 1, 1,
1, 1, 1, 1
};
+
+const UChar x265_exp2_lut[64] =
+{
+ 0, 3, 6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 36, 39, 42, 45,
+ 48, 52, 55, 58, 62, 65, 69, 72, 76, 80, 83, 87, 91, 94, 98, 102,
+ 106, 110, 114, 118, 122, 126, 130, 135, 139, 143, 147, 152, 156, 161, 165, 170,
+ 175, 179, 184, 189, 194, 198, 203, 208, 214, 219, 224, 229, 234, 240, 245, 250
+};
}
//! \}
diff -r f2fcda06d76a -r 9245a882ccee source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h Mon Oct 21 21:42:23 2013 -0500
+++ b/source/Lib/TLibCommon/TComRom.h Mon Oct 21 22:45:55 2013 -0500
@@ -298,6 +298,7 @@ extern const double x265_lambda2_non_I[M
// CABAC tables
extern const UChar g_lpsTable[64][4];
extern const UChar g_renormTable[32];
+extern const UChar x265_exp2_lut[64];
}
#endif //ifndef X265_TCOMROM_H
diff -r f2fcda06d76a -r 9245a882ccee source/common/common.cpp
--- a/source/common/common.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/common/common.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -71,6 +71,15 @@ void x265_free(void *ptr)
#endif // if _WIN32
+/* Not a general-purpose function; multiplies input by -1/6 to convert
+ * qp to qscale. */
+int x265_exp2fix8(double x)
+{
+ int i =(int) x * (-64.f / 6.f) + 512.5f;
+ if (i < 0) return 0;
+ if (i > 1023) return 0xffff;
+ return (x265_exp2_lut[i & 63] + 256) << (i >> 6) >> 8;
+}
void x265_log(x265_param_t *param, int level, const char *fmt, ...)
{
if (param && level > param->logLevel)
@@ -395,6 +404,7 @@ void x265_print_params(x265_param_t *par
TOOLOPT(param->bEnableConstrainedIntra, "cip");
TOOLOPT(param->bEnableEarlySkip, "esd");
fprintf(stderr, "rd=%d ", param->rdLevel);
+ fprintf(stderr, "ref=%d ", param->maxNumReferences);
TOOLOPT(param->bEnableLoopFilter, "lft");
if (param->bEnableSAO)
diff -r f2fcda06d76a -r 9245a882ccee source/common/common.h
--- a/source/common/common.h Mon Oct 21 21:42:23 2013 -0500
+++ b/source/common/common.h Mon Oct 21 22:45:55 2013 -0500
@@ -115,5 +115,5 @@ int x265_check_params(x265_param_t *par
void x265_print_params(x265_param_t *param);
int x265_set_globals(x265_param_t *param);
char *x265_param2string(x265_param_t *p);
-
+int x265_exp2fix8(double x);
#endif // ifndef X265_COMMON_H
diff -r f2fcda06d76a -r 9245a882ccee source/common/lowres.cpp
--- a/source/common/lowres.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/common/lowres.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -27,7 +27,7 @@
using namespace x265;
-void Lowres::create(TComPic *pic, int bframes)
+void Lowres::create(TComPic *pic, int bframes, int *aqMode)
{
TComPicYuv *orig = pic->getPicYuvOrg();
@@ -45,6 +45,13 @@ void Lowres::create(TComPic *pic, int bf
width = cuWidth * X265_LOWRES_CU_SIZE;
lines = cuHeight * X265_LOWRES_CU_SIZE;
+ if (*aqMode)
+ {
+ m_qpAqOffset = (double*)x265_malloc(sizeof(double) * cuCount);
+ if (!m_qpAqOffset)
+ *aqMode = 0;
+ }
+
/* allocate lowres buffers */
for (int i = 0; i < 4; i++)
{
@@ -102,6 +109,7 @@ void Lowres::destroy(int bframes)
X265_FREE(lowresMvCosts[0][i]);
X265_FREE(lowresMvCosts[1][i]);
}
+ X265_FREE(m_qpAqOffset);
}
// (re) initialize lowres state
@@ -114,7 +122,12 @@ void Lowres::init(TComPicYuv *orig, int
sliceType = type;
frameNum = poc;
leadingBframes = 0;
+ satdCost = -1;
memset(costEst, -1, sizeof(costEst));
+
+ if (m_qpAqOffset)
+ memset(costEstAq, -1, sizeof(costEstAq));
+
for (int y = 0; y < bframes + 2; y++)
{
for (int x = 0; x < bframes + 2; x++)
diff -r f2fcda06d76a -r 9245a882ccee source/common/lowres.h
--- a/source/common/lowres.h Mon Oct 21 21:42:23 2013 -0500
+++ b/source/common/lowres.h Mon Oct 21 22:45:55 2013 -0500
@@ -36,6 +36,7 @@ struct Lowres : public ReferencePlanes
{
/* lowres buffers, sizes and strides */
pixel *buffer[4];
+ double *m_qpAqOffset; // qp Aq offset values for each Cu
int width; // width of lowres frame in pixels
int lines; // height of lowres frame in pixel lines
int frameNum; // Presentation frame number
@@ -49,14 +50,16 @@ struct Lowres : public ReferencePlanes
/* lookahead output data */
int costEst[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
+ int costEstAq[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
int *rowSatds[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
int intraMbs[X265_BFRAME_MAX + 2];
int *intraCost;
+ int satdCost;
uint16_t(*lowresCosts[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2]);
int *lowresMvCosts[2][X265_BFRAME_MAX + 1];
MV *lowresMvs[2][X265_BFRAME_MAX + 1];
- void create(TComPic *pic, int bframes);
+ void create(TComPic *pic, int bframes, int *aqMode);
void destroy(int bframes);
void init(TComPicYuv *orig, int poc, int sliceType, int bframes);
};
diff -r f2fcda06d76a -r 9245a882ccee source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/encoder/ratecontrol.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -120,7 +120,7 @@ void RateControl::calcAdaptiveQuantFrame
double qp_adj;
int cu_xy = maxCols * cu_y + cu_x;
qp_adj = acEnergyCu(pic, cu_xy);
- pic->m_qpAqOffset[cu_xy] = qp_adj;
+ pic->m_lowres.m_qpAqOffset[cu_xy] = qp_adj;
}
}
}
diff -r f2fcda06d76a -r 9245a882ccee source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp Mon Oct 21 21:42:23 2013 -0500
+++ b/source/encoder/slicetype.cpp Mon Oct 21 22:45:55 2013 -0500
@@ -257,7 +257,9 @@ int Lookahead::estimateFrameCost(int p0,
void LookaheadRow::init()
{
costEst = 0;
+ costEstAq = 0;
costIntra = 0;
+ costIntraAq = 0;
intraMbs = 0;
active = false;
completed = 0;
diff -r f2fcda06d76a -r 9245a882ccee source/encoder/slicetype.h
--- a/source/encoder/slicetype.h Mon Oct 21 21:42:23 2013 -0500
+++ b/source/encoder/slicetype.h Mon Oct 21 22:45:55 2013 -0500
@@ -43,7 +43,9 @@ struct LookaheadRow
pixel* predictions; // buffer for 35 intra predictions
MotionEstimate me;
int costEst; // Estimated cost for all CUs in a row
+ int costEstAq; // Estimated weight Aq cost for all CUs in a row
int costIntra; // Estimated Intra cost for all CUs in a row
+ int costIntraAq; // Estimated weighted Aq Intra cost for all CUs in a row
int intraMbs; // Number of Intra CUs
Lowres** frames;
More information about the x265-commits
mailing list