[x265-commits] [x265] move param fixups to Encoder::configure()
Steve Borho
steve at borho.org
Sat Jan 18 20:43:59 CET 2014
details: http://hg.videolan.org/x265/rev/7855cee45b8c
branches:
changeset: 5837:7855cee45b8c
user: Steve Borho <steve at borho.org>
date: Fri Jan 17 13:23:57 2014 -0600
description:
move param fixups to Encoder::configure()
Subject: [x265] update/fix comments
details: http://hg.videolan.org/x265/rev/c8c8a0273eff
branches:
changeset: 5838:c8c8a0273eff
user: Steve Borho <steve at borho.org>
date: Fri Jan 17 13:25:28 2014 -0600
description:
update/fix comments
Subject: [x265] white-space fixes, reorder for clarity
details: http://hg.videolan.org/x265/rev/838e485c6365
branches:
changeset: 5839:838e485c6365
user: Steve Borho <steve at borho.org>
date: Fri Jan 17 13:27:06 2014 -0600
description:
white-space fixes, reorder for clarity
Subject: [x265] common: remove trailing white-space
details: http://hg.videolan.org/x265/rev/299bbf5f06c2
branches:
changeset: 5840:299bbf5f06c2
user: Steve Borho <steve at borho.org>
date: Fri Jan 17 13:38:23 2014 -0600
description:
common: remove trailing white-space
Subject: [x265] common: do not report ssim costs by default
details: http://hg.videolan.org/x265/rev/385560ac328d
branches:
changeset: 5841:385560ac328d
user: Steve Borho <steve at borho.org>
date: Fri Jan 17 13:40:59 2014 -0600
description:
common: do not report ssim costs by default
It costs CPU cycles to measure SSIM, do not do this unless the user asks for
them with --ssim
Subject: [x265] Re-enabling new weightp
details: http://hg.videolan.org/x265/rev/e90e39c3a035
branches:
changeset: 5842:e90e39c3a035
user: Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
date: Thu Jan 09 18:59:22 2014 +0530
description:
Re-enabling new weightp
Subject: [x265] primitive function for luma and chroma for loops in addAvg().
details: http://hg.videolan.org/x265/rev/c88314c4a1a1
branches:
changeset: 5843:c88314c4a1a1
user: Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
date: Fri Jan 17 12:18:25 2014 +0530
description:
primitive function for luma and chroma for loops in addAvg().
diffstat:
source/Lib/TLibCommon/TComYuv.cpp | 49 ++--------------------
source/common/common.cpp | 28 +-----------
source/common/pixel.cpp | 23 ++++++++++
source/common/primitives.h | 5 ++
source/encoder/encoder.cpp | 85 ++++++++++++++++++++++++--------------
source/encoder/frameencoder.cpp | 19 ++++----
source/encoder/frameencoder.h | 1 +
7 files changed, 99 insertions(+), 111 deletions(-)
diffs (truncated from 407 to 300 lines):
diff -r 1d7ea03e1a38 -r c88314c4a1a1 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Wed Jan 15 19:18:53 2014 +0530
+++ b/source/Lib/TLibCommon/TComYuv.cpp Fri Jan 17 12:18:25 2014 +0530
@@ -572,9 +572,7 @@ void TComYuv::addAvg(TComYuv* srcYuv0, T
void TComYuv::addAvg(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
{
- int x, y;
uint32_t src0Stride, src1Stride, dststride;
- int shiftNum, offset;
int16_t* srcY0 = srcYuv0->getLumaAddr(partUnitIdx);
int16_t* srcU0 = srcYuv0->getCbAddr(partUnitIdx);
@@ -588,61 +586,24 @@ void TComYuv::addAvg(TShortYUV* srcYuv0,
Pel* dstU = getCbAddr(partUnitIdx);
Pel* dstV = getCrAddr(partUnitIdx);
+ int part = partitionFromSizes(width, height);
+
if (bLuma)
{
src0Stride = srcYuv0->m_width;
src1Stride = srcYuv1->m_width;
dststride = getStride();
- shiftNum = IF_INTERNAL_PREC + 1 - X265_DEPTH;
- offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x += 4)
- {
- dstY[x + 0] = ClipY((srcY0[x + 0] + srcY1[x + 0] + offset) >> shiftNum);
- dstY[x + 1] = ClipY((srcY0[x + 1] + srcY1[x + 1] + offset) >> shiftNum);
- dstY[x + 2] = ClipY((srcY0[x + 2] + srcY1[x + 2] + offset) >> shiftNum);
- dstY[x + 3] = ClipY((srcY0[x + 3] + srcY1[x + 3] + offset) >> shiftNum);
- }
-
- srcY0 += src0Stride;
- srcY1 += src1Stride;
- dstY += dststride;
- }
+ primitives.luma_addAvg[part](dstY, dststride, srcY0, src0Stride, srcY1, src1Stride);
}
if (bChroma)
{
- shiftNum = IF_INTERNAL_PREC + 1 - X265_DEPTH;
- offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;
-
src0Stride = srcYuv0->m_cwidth;
src1Stride = srcYuv1->m_cwidth;
dststride = getCStride();
- width >>= m_hChromaShift;
- height >>= m_vChromaShift;
-
- for (y = height - 1; y >= 0; y--)
- {
- for (x = width - 1; x >= 0; )
- {
- // note: chroma min width is 2
- dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);
- dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);
- x--;
- dstU[x] = ClipC((srcU0[x] + srcU1[x] + offset) >> shiftNum);
- dstV[x] = ClipC((srcV0[x] + srcV1[x] + offset) >> shiftNum);
- x--;
- }
-
- srcU0 += src0Stride;
- srcU1 += src1Stride;
- srcV0 += src0Stride;
- srcV1 += src1Stride;
- dstU += dststride;
- dstV += dststride;
- }
+ primitives.chroma_addAvg[part](dstU, dststride, srcU0, src0Stride, srcU1, src1Stride);
+ primitives.chroma_addAvg[part](dstV, dststride, srcV0, src0Stride, srcV1, src1Stride);
}
}
diff -r 1d7ea03e1a38 -r c88314c4a1a1 source/common/common.cpp
--- a/source/common/common.cpp Wed Jan 15 19:18:53 2014 +0530
+++ b/source/common/common.cpp Fri Jan 17 12:18:25 2014 +0530
@@ -219,7 +219,7 @@ void x265_param_default(x265_param *para
/* Quality Measurement Metrics */
param->bEnablePsnr = 0;
- param->bEnableSsim = 1;
+ param->bEnableSsim = 0;
}
extern "C"
@@ -399,7 +399,7 @@ int x265_param_default_preset(x265_param
{
if (!strcmp(tune, "psnr"))
{
- param->rc.aqStrength = 0.0;
+ param->rc.aqStrength = 0.0;
}
else if (!strcmp(tune, "ssim"))
{
@@ -514,30 +514,6 @@ int x265_check_params(x265_param *param)
}
CHECK(param->bEnableWavefront < 0, "WaveFrontSynchro cannot be negative");
- if (param->rc.rateControlMode == X265_RC_CQP)
- {
- param->rc.aqMode = X265_AQ_NONE;
- param->rc.bitrate = 0;
- param->rc.cuTree = 0;
- }
-
- if (param->rc.aqMode == 0 && param->rc.cuTree)
- {
- param->rc.aqMode = X265_AQ_VARIANCE;
- param->rc.aqStrength = 0.0;
- }
-
- if(param->bFrameAdaptive == 0 && param->rc.cuTree)
- {
- x265_log(NULL, X265_LOG_WARNING, "cuTree disabled, requires lookahead to be enabled\n");
- param->rc.cuTree = 0;
- }
-
- if (param->rc.aqStrength == 0 && param->rc.cuTree == 0)
- {
- param->rc.aqMode = X265_AQ_NONE;
- }
-
return check_failed;
}
diff -r 1d7ea03e1a38 -r c88314c4a1a1 source/common/pixel.cpp
--- a/source/common/pixel.cpp Wed Jan 15 19:18:53 2014 +0530
+++ b/source/common/pixel.cpp Fri Jan 17 12:18:25 2014 +0530
@@ -800,6 +800,27 @@ void pixel_add_ps_c(pixel *a, intptr_t d
a += dstride;
}
}
+
+template<int bx, int by>
+void addAvg(pixel* dst, intptr_t dstStride, int16_t* src0, intptr_t src0Stride, int16_t* src1, intptr_t src1Stride)
+{
+ int shiftNum, offset;
+ shiftNum = IF_INTERNAL_PREC + 1 - X265_DEPTH;
+ offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;
+
+ for (int y = 0; y < by; y++)
+ {
+ for (int x = 0; x < bx; x += 2)
+ {
+ dst[x + 0] = (pixel)ClipY((src0[x + 0] + src1[x + 0] + offset) >> shiftNum);
+ dst[x + 1] = (pixel)ClipY((src0[x + 1] + src1[x + 1] + offset) >> shiftNum);
+ }
+
+ src0 += src0Stride;
+ src1 += src1Stride;
+ dst += dstStride;
+ }
+}
} // end anonymous namespace
namespace x265 {
@@ -841,6 +862,7 @@ void Setup_C_PixelPrimitives(EncoderPrim
p.satd[LUMA_16x64] = satd8<16, 64>;
#define CHROMA(W, H) \
+ p.chroma_addAvg[CHROMA_ ## W ## x ## H] = addAvg<W, H>; \
p.chroma[X265_CSP_I420].copy_pp[CHROMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>; \
p.chroma[X265_CSP_I420].copy_sp[CHROMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>; \
p.chroma[X265_CSP_I420].copy_ps[CHROMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>; \
@@ -848,6 +870,7 @@ void Setup_C_PixelPrimitives(EncoderPrim
p.chroma[X265_CSP_I420].add_ps[CHROMA_ ## W ## x ## H] = pixel_add_ps_c<W, H>;
#define LUMA(W, H) \
+ p.luma_addAvg[LUMA_ ## W ## x ## H] = addAvg<W, H>; \
p.luma_copy_pp[LUMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>; \
p.luma_copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>; \
p.luma_copy_ps[LUMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>; \
diff -r 1d7ea03e1a38 -r c88314c4a1a1 source/common/primitives.h
--- a/source/common/primitives.h Wed Jan 15 19:18:53 2014 +0530
+++ b/source/common/primitives.h Fri Jan 17 12:18:25 2014 +0530
@@ -203,6 +203,8 @@ typedef void (*copy_ps_t)(int16_t *dst,
typedef void (*pixel_sub_ps_t)(int16_t *dst, intptr_t dstride, pixel *src0, pixel *src1, intptr_t sstride0, intptr_t sstride1);
typedef void (*pixel_add_ps_t)(pixel *a, intptr_t dstride, pixel *b0, int16_t *b1, intptr_t sstride0, intptr_t sstride1);
+typedef void (*addAvg_t)(pixel* dst, intptr_t dstStride, int16_t* src0, intptr_t src0Stride, int16_t* src1, intptr_t src1Stride);
+
/* Define a structure containing function pointers to optimized encoder
* primitives. Each pointer can reference either an assembly routine,
* a vectorized primitive, or a C function. */
@@ -271,6 +273,9 @@ struct EncoderPrimitives
plane_copy_deinterleave_t plane_copy_deinterleave_c;
extendCURowBorder_t extendRowBorder;
+ addAvg_t luma_addAvg[NUM_LUMA_PARTITIONS];
+ addAvg_t chroma_addAvg[NUM_CHROMA_PARTITIONS];
+
struct
{
filter_pp_t filter_vpp[NUM_LUMA_PARTITIONS];
diff -r 1d7ea03e1a38 -r c88314c4a1a1 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Jan 15 19:18:53 2014 +0530
+++ b/source/encoder/encoder.cpp Fri Jan 17 12:18:25 2014 +0530
@@ -244,8 +244,8 @@ int Encoder::encode(bool flush, const x2
if (m_pocLast == 0)
m_firstPts = pic->m_pts;
- if (m_bframeDelay && m_pocLast == m_bframeDelay)
- m_bframeDelayTime = pic->m_pts - m_firstPts;
+ if (m_bframeDelay && m_pocLast == m_bframeDelay)
+ m_bframeDelayTime = pic->m_pts - m_firstPts;
// Encoder holds a reference count until collecting stats
ATOMIC_INC(&pic->m_countRefEncoders);
@@ -1311,6 +1311,33 @@ void Encoder::configure(x265_param *_par
bEnableRDOQTS = 0;
}
+ if (_param->rc.rateControlMode == X265_RC_CQP)
+ {
+ _param->rc.aqMode = X265_AQ_NONE;
+ _param->rc.bitrate = 0;
+ _param->rc.cuTree = 0;
+ }
+
+ if (_param->rc.aqMode == 0 && _param->rc.cuTree)
+ {
+ _param->rc.aqMode = X265_AQ_VARIANCE;
+ _param->rc.aqStrength = 0.0;
+ }
+
+ if (_param->bFrameAdaptive == 0 && _param->rc.cuTree)
+ {
+ x265_log(_param, X265_LOG_WARNING, "cuTree disabled, requires lookahead to be enabled\n");
+ _param->rc.cuTree = 0;
+ }
+
+ if (_param->rc.aqStrength == 0 && _param->rc.cuTree == 0)
+ {
+ _param->rc.aqMode = X265_AQ_NONE;
+ }
+
+
+ m_bframeDelay = _param->bframes ? (_param->bBPyramid ? 2 : 1) : 0;
+
//====== Coding Tools ========
uint32_t tuQTMaxLog2Size = g_convertToBit[_param->maxCUSize] + 2 - 1;
@@ -1318,33 +1345,6 @@ void Encoder::configure(x265_param *_par
uint32_t tuQTMinLog2Size = 2; //log2(4)
m_quadtreeTULog2MinSize = tuQTMinLog2Size;
- //====== Enforce these hard coded settings before initializeGOP() to
- // avoid a valgrind warning
- m_loopFilterOffsetInPPS = 0;
- m_loopFilterBetaOffsetDiv2 = 0;
- m_loopFilterTcOffsetDiv2 = 0;
- m_loopFilterAcrossTilesEnabledFlag = 1;
-
- //====== HM Settings not exposed for configuration ======
- TComVPS vps;
- vps.setMaxTLayers(1);
- vps.setTemporalNestingFlag(true);
- vps.setMaxLayers(1);
- for (int i = 0; i < MAX_TLAYER; i++)
- {
- /* Increase the DPB size and reorderpicture if enabled the bpyramid */
- m_numReorderPics[i] = (_param->bBPyramid && _param->bframes > 1) ? 2 : 1;
- m_maxDecPicBuffering[i] = X265_MIN(MAX_NUM_REF, X265_MAX(m_numReorderPics[i] + 1, _param->maxNumReferences) + m_numReorderPics[i]);
-
- vps.setNumReorderPics(m_numReorderPics[i], i);
- vps.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i);
- }
-
- m_vps = vps;
- m_maxCuDQPDepth = 0;
- m_maxNumOffsetsPerPic = 2048;
- m_log2ParallelMergeLevelMinus2 = 0;
-
//========= set default display window ==================================
m_defaultDisplayWindow.m_enabledFlag = true;
m_defaultDisplayWindow.m_winRightOffset = 0;
@@ -1383,6 +1383,31 @@ void Encoder::configure(x265_param *_par
m_conformanceWindow.m_winBottomOffset = m_pad[1];
}
+ //====== HM Settings not exposed for configuration ======
+ m_loopFilterOffsetInPPS = 0;
+ m_loopFilterBetaOffsetDiv2 = 0;
+ m_loopFilterTcOffsetDiv2 = 0;
+ m_loopFilterAcrossTilesEnabledFlag = 1;
+
+ TComVPS vps;
+ vps.setMaxTLayers(1);
+ vps.setTemporalNestingFlag(true);
+ vps.setMaxLayers(1);
+ for (int i = 0; i < MAX_TLAYER; i++)
+ {
+ /* Increase the DPB size and reorder picture if bpyramid is enabled */
More information about the x265-commits
mailing list