[x265] [PATCH] api: Introduce param options to toggle PPS bitstream optimizations
Pradeep Ramachandran
pradeep at multicorewareinc.com
Mon Oct 17 10:30:16 CEST 2016
# HG changeset patch
# User Pradeep Ramachandran <pradeep at multicorewareinc.com>
# Date 1476693005 -19800
# Mon Oct 17 14:00:05 2016 +0530
# Node ID 304116f4cd41bc4fd610d5b16c6f447a50b8df02
# Parent c97805dad9148ad3cddba10a67ed5596508e8f86
api: Introduce param options to toggle PPS bitstream optimizations
diff -r c97805dad914 -r 304116f4cd41 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Oct 13 17:53:48 2016 +0800
+++ b/source/CMakeLists.txt Mon Oct 17 14:00:05 2016 +0530
@@ -30,7 +30,7 @@
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 97)
+set(X265_BUILD 98)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r c97805dad914 -r 304116f4cd41 source/common/param.cpp
--- a/source/common/param.cpp Thu Oct 13 17:53:48 2016 +0800
+++ b/source/common/param.cpp Mon Oct 17 14:00:05 2016 +0530
@@ -230,9 +230,6 @@
param->rc.qpMin = 0;
param->rc.qpMax = QP_MAX_MAX;
- param->bEmitVUITimingInfo = 1;
- param->bEmitVUIHRDInfo = 1;
-
/* Video Usability Information (VUI) */
param->vui.aspectRatioIdc = 0;
param->vui.sarWidth = 0;
@@ -259,6 +256,12 @@
param->maxLuma = PIXEL_MAX;
param->log2MaxPocLsb = 8;
param->maxSlices = 1;
+
+ param->bEmitVUITimingInfo = 1;
+ param->bEmitVUIHRDInfo = 1;
+ param->bOptQpPPS = 1;
+ param->bOptRefListLengthPPS = 1;
+
}
int x265_param_default_preset(x265_param* param, const char* preset, const char* tune)
@@ -910,6 +913,8 @@
OPT("vui-hrd-info") p->bEmitVUIHRDInfo = atobool(value);
OPT("slices") p->maxSlices = atoi(value);
OPT("limit-tu") p->limitTU = atoi(value);
+ OPT("opt-qp-pps") p->bOptQpPPS = atobool(value);
+ OPT("opt-ref-list-length-pps") p->bOptRefListLengthPPS = atobool(value);
else
return X265_PARAM_BAD_NAME;
}
diff -r c97805dad914 -r 304116f4cd41 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Oct 13 17:53:48 2016 +0800
+++ b/source/encoder/encoder.cpp Mon Oct 17 14:00:05 2016 +0530
@@ -874,7 +874,7 @@
slice->m_endCUAddr = slice->realEndAddress(m_sps.numCUsInFrame * NUM_4x4_PARTITIONS);
}
- if( frameEnc->m_lowres.bKeyframe && m_param->bRepeatHeaders )
+ if( m_param->bOptQpPPS && frameEnc->m_lowres.bKeyframe && m_param->bRepeatHeaders )
{
ScopedLock qpLock( m_sliceQpLock );
if( m_iFrameNum > 0 )
diff -r c97805dad914 -r 304116f4cd41 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Thu Oct 13 17:53:48 2016 +0800
+++ b/source/encoder/frameencoder.cpp Mon Oct 17 14:00:05 2016 +0530
@@ -354,6 +354,7 @@
}
if (m_frame->m_lowres.bKeyframe && m_param->bRepeatHeaders)
{
+ if (m_param->bOptRefListLengthPPS)
{
ScopedLock refIdxLock(m_top->m_sliceRefIdxLock);
m_top->updateRefIdx();
@@ -467,7 +468,7 @@
/* Clip slice QP to 0-51 spec range before encoding */
slice->m_sliceQp = x265_clip3(-QP_BD_OFFSET, QP_MAX_SPEC, qp);
- if( m_param->bRepeatHeaders )
+ if( m_param->bOptQpPPS && m_param->bRepeatHeaders )
{
ScopedLock qpLock( m_top->m_sliceQpLock );
for( int i = 0; i < (QP_MAX_MAX + 1); i++ )
@@ -861,6 +862,7 @@
const uint32_t sliceAddr = nextSliceRow * m_numCols;
//CUData* ctu = m_frame->m_encData->getPicCTU(sliceAddr);
//const int sliceQp = ctu->m_qp[0];
+ if (m_param->bOptRefListLengthPPS)
{
ScopedLock refIdxLock(m_top->m_sliceRefIdxLock);
m_top->analyseRefIdx(slice->m_numRefIdx);
@@ -888,6 +890,7 @@
}
else
{
+ if (m_param->bOptRefListLengthPPS)
{
ScopedLock refIdxLock(m_top->m_sliceRefIdxLock);
m_top->analyseRefIdx(slice->m_numRefIdx);
diff -r c97805dad914 -r 304116f4cd41 source/x265.h
--- a/source/x265.h Thu Oct 13 17:53:48 2016 +0800
+++ b/source/x265.h Mon Oct 17 14:00:05 2016 +0530
@@ -1317,6 +1317,12 @@
/* Maximum count of Slices of picture, the value range is [1, maximum rows] */
unsigned int maxSlices;
+ /* Optimize QP in PPS based on statistics from prevvious GOP*/
+ int bOptQpPPS;
+
+ /* Opitmize ref list length in PPS based on stats from previous GOP*/
+ int bOptRefListLengthPPS;
+
} x265_param;
/* x265_param_alloc:
diff -r c97805dad914 -r 304116f4cd41 source/x265cli.h
--- a/source/x265cli.h Thu Oct 13 17:53:48 2016 +0800
+++ b/source/x265cli.h Mon Oct 17 14:00:05 2016 +0530
@@ -213,6 +213,10 @@
{ "no-vui-timing-info", no_argument, NULL, 0 },
{ "vui-hrd-info", no_argument, NULL, 0 },
{ "no-vui-hrd-info", no_argument, NULL, 0 },
+ { "opt-qp-pps", no_argument, NULL, 0 },
+ { "no-opt-qp-pps", no_argument, NULL, 0 },
+ { "opt-ref-list-length-pps", no_argument, NULL, 0 },
+ { "no-opt-ref-list-length-pps", no_argument, NULL, 0 },
{ "no-dither", no_argument, NULL, 0 },
{ "dither", no_argument, NULL, 0 },
{ "no-repeat-headers", no_argument, NULL, 0 },
@@ -452,8 +456,10 @@
H0(" --[no-]aud Emit access unit delimiters at the start of each access unit. Default %s\n", OPT(param->bEnableAccessUnitDelimiters));
H1(" --hash <integer> Decoded Picture Hash SEI 0: disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n", param->decodedPictureHashSEI);
H0(" --log2-max-poc-lsb <integer> Maximum of the picture order count\n");
- H0(" --[no]-vui-timing-info Discard optional VUI timing information from the bistream. Default %s\n", OPT(param->bEmitVUITimingInfo));
- H0(" --[no]-vui-hrd-info Discard optional HRD timing information from the bistream. Default %s\n", OPT(param->bEmitVUIHRDInfo));
+ H0(" --[no-]vui-timing-info Discard optional VUI timing information from the bistream. Default %s\n", OPT(param->bEmitVUITimingInfo));
+ H0(" --[no-]vui-hrd-info Discard optional HRD timing information from the bistream. Default %s\n", OPT(param->bEmitVUIHRDInfo));
+ H0(" --[no-]opt-qp-pps Discard optional HRD timing information from the bistream. Default %s\n", OPT(param->bOptQpPPS));
+ H0(" --[no-]opt-ref-list-length-pps Discard optional HRD timing information from the bistream. Default %s\n", OPT(param->bOptRefListLengthPPS));
H1("\nReconstructed video options (debugging):\n");
H1("-r/--recon <filename> Reconstructed raw image YUV or Y4M output file name\n");
H1(" --recon-depth <integer> Bit-depth of reconstructed raw image file. Defaults to input bit depth, or 8 if Y4M\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: repo.patch
Type: text/x-patch
Size: 6947 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161017/4416f93a/attachment.bin>
More information about the x265-devel
mailing list