[x265] [PATCH] Bitstream: Modify API for VUI & HRD timing info removal; remove SEI discard
Pradeep Ramachandran
pradeep at multicorewareinc.com
Mon Oct 3 08:19:02 CEST 2016
# HG changeset patch
# User Pradeep Ramachandran <pradeep at multicorewareinc.com>
# Date 1475475521 -19800
# Mon Oct 03 11:48:41 2016 +0530
# Node ID af4036239bc38c2756f9aac26928ef1e8685af4e
# Parent 11bfa0ae971029fed69554e700185a8ef93a289c
Bitstream: Modify API for VUI & HRD timing info removal; remove SEI discard
Discard SEI messages can be achieved through a combination of other API calls.
diff -r 11bfa0ae9710 -r af4036239bc3 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Sep 28 15:18:23 2016 +0530
+++ b/doc/reST/cli.rst Mon Oct 03 11:48:41 2016 +0530
@@ -1824,7 +1824,7 @@
enhancement layer. A decoder may chose to drop the enhancement layer
and only decode and display the base layer slices.
- If used with a fixed GOP (:option:`b-adapt` 0) and :option:`bframes`
+ If used with a fixed GOP (:option:`--b-adapt` 0) and :option:`--bframes`
3 then the two layers evenly split the frame rate, with a cadence of
PbBbP. You probably also want :option:`--no-scenecut` and a keyframe
interval that is a multiple of 4.
@@ -1833,15 +1833,15 @@
Maximum of the picture order count. Default 8
-.. option:: --discard-sei
+.. option:: --[no]-vui-timing-info
- Discard SEI messages generated from the final bitstream. HDR-related SEI
- messages are always dumped, immaterial of this option. Default disabled.
-
-.. option:: --discard-vui
+ Discard optional VUI timing info from bitstream. Default enabled.
- Discard optional VUI information (timing, HRD info) from the
- bitstream. Default disabled.
+.. option:: --[no]-hrd-timing-info
+
+ Discard optional HRD timing info from bitstream. Default enabled when
+ :option:`--hrd` is enabled.
+
Debugging options
=================
diff -r 11bfa0ae9710 -r af4036239bc3 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Sep 28 15:18:23 2016 +0530
+++ b/source/CMakeLists.txt Mon Oct 03 11:48:41 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 95)
+set(X265_BUILD 96)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 11bfa0ae9710 -r af4036239bc3 source/common/param.cpp
--- a/source/common/param.cpp Wed Sep 28 15:18:23 2016 +0530
+++ b/source/common/param.cpp Mon Oct 03 11:48:41 2016 +0530
@@ -229,7 +229,8 @@
param->rc.qpMin = 0;
param->rc.qpMax = QP_MAX_MAX;
- param->bDiscardOptionalVUI = 0;
+ param->bEmitVUITimingInfo = 1;
+ param->bEmitHRDTimingInfo = 1;
/* Video Usability Information (VUI) */
param->vui.aspectRatioIdc = 0;
@@ -256,7 +257,6 @@
param->minLuma = 0;
param->maxLuma = PIXEL_MAX;
param->log2MaxPocLsb = 8;
- param->bDiscardSEI = false;
param->maxSlices = 1;
}
@@ -914,8 +914,8 @@
OPT("qpmin") p->rc.qpMin = atoi(value);
OPT("analyze-src-pics") p->bSourceReferenceEstimation = atobool(value);
OPT("log2-max-poc-lsb") p->log2MaxPocLsb = atoi(value);
- OPT("discard-sei") p->bDiscardSEI = atobool(value);
- OPT("discard-vui") p->bDiscardOptionalVUI = atobool(value);
+ OPT("hrd-timing-info") p->bEmitHRDTimingInfo = atobool(value);
+ OPT("vui-timing-info") p->bEmitVUITimingInfo = atobool(value);
else
return X265_PARAM_BAD_NAME;
}
diff -r 11bfa0ae9710 -r af4036239bc3 source/common/slice.h
--- a/source/common/slice.h Wed Sep 28 15:18:23 2016 +0530
+++ b/source/common/slice.h Mon Oct 03 11:48:41 2016 +0530
@@ -243,7 +243,8 @@
bool bUseAMP; // use param
bool bUseStrongIntraSmoothing; // use param
bool bTemporalMVPEnabled;
- bool bDiscardOptionalVUI;
+ bool bEmitHRDTimingInfo;
+ bool bEmitVUITimingInfo;
Window conformanceWindow;
VUI vuiParameters;
diff -r 11bfa0ae9710 -r af4036239bc3 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Sep 28 15:18:23 2016 +0530
+++ b/source/encoder/encoder.cpp Mon Oct 03 11:48:41 2016 +0530
@@ -1491,7 +1491,7 @@
list.serialize(NAL_UNIT_PREFIX_SEI, bs);
}
- if (!m_param->bDiscardSEI && m_param->bEmitInfoSEI)
+ if (m_param->bEmitInfoSEI)
{
char *opts = x265_param2string(m_param);
if (opts)
@@ -1521,7 +1521,7 @@
}
}
- if (!m_param->bDiscardSEI && (m_param->bEmitHRDSEI || !!m_param->interlaceMode))
+ if ((m_param->bEmitHRDSEI || !!m_param->interlaceMode))
{
/* Picture Timing and Buffering Period SEI require the SPS to be "activated" */
SEIActiveParameterSets sei;
@@ -1576,7 +1576,8 @@
sps->bUseStrongIntraSmoothing = m_param->bEnableStrongIntraSmoothing;
sps->bTemporalMVPEnabled = m_param->bEnableTemporalMvp;
- sps->bDiscardOptionalVUI = m_param->bDiscardOptionalVUI;
+ sps->bEmitVUITimingInfo = m_param->bEmitVUITimingInfo;
+ sps->bEmitHRDTimingInfo = m_param->bEmitHRDTimingInfo;
sps->log2MaxPocLsb = m_param->log2MaxPocLsb;
int maxDeltaPOC = (m_param->bframes + 2) * (!!m_param->bBPyramid + 1) * 2;
while ((1 << sps->log2MaxPocLsb) <= maxDeltaPOC * 2)
diff -r 11bfa0ae9710 -r af4036239bc3 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Wed Sep 28 15:18:23 2016 +0530
+++ b/source/encoder/entropy.cpp Mon Oct 03 11:48:41 2016 +0530
@@ -319,7 +319,7 @@
WRITE_FLAG(sps.bUseStrongIntraSmoothing, "sps_strong_intra_smoothing_enable_flag");
WRITE_FLAG(1, "vui_parameters_present_flag");
- codeVUI(sps.vuiParameters, sps.maxTempSubLayers, sps.bDiscardOptionalVUI);
+ codeVUI(sps.vuiParameters, sps.maxTempSubLayers, sps.bEmitVUITimingInfo, sps.bEmitHRDTimingInfo);
WRITE_FLAG(0, "sps_extension_flag");
}
@@ -422,7 +422,7 @@
}
}
-void Entropy::codeVUI(const VUI& vui, int maxSubTLayers, bool bDiscardOptionalVUI)
+void Entropy::codeVUI(const VUI& vui, int maxSubTLayers, bool bEmitVUITimingInfo, bool bEmitHRDTimingInfo)
{
WRITE_FLAG(vui.aspectRatioInfoPresentFlag, "aspect_ratio_info_present_flag");
if (vui.aspectRatioInfoPresentFlag)
@@ -473,7 +473,7 @@
WRITE_UVLC(vui.defaultDisplayWindow.bottomOffset, "def_disp_win_bottom_offset");
}
- if (bDiscardOptionalVUI)
+ if (!bEmitVUITimingInfo)
WRITE_FLAG(0, "vui_timing_info_present_flag");
else
{
@@ -483,7 +483,7 @@
WRITE_FLAG(0, "vui_poc_proportional_to_timing_flag");
}
- if (bDiscardOptionalVUI)
+ if (!bEmitHRDTimingInfo)
WRITE_FLAG(0, "vui_hrd_parameters_present_flag");
else
{
diff -r 11bfa0ae9710 -r af4036239bc3 source/encoder/entropy.h
--- a/source/encoder/entropy.h Wed Sep 28 15:18:23 2016 +0530
+++ b/source/encoder/entropy.h Mon Oct 03 11:48:41 2016 +0530
@@ -143,7 +143,7 @@
void codeVPS(const VPS& vps);
void codeSPS(const SPS& sps, const ScalingList& scalingList, const ProfileTierLevel& ptl);
void codePPS( const PPS& pps, bool filerAcross, int iPPSInitQpMinus26 );
- void codeVUI(const VUI& vui, int maxSubTLayers, bool discardOptionalVUI);
+ void codeVUI(const VUI& vui, int maxSubTLayers, bool bEmitVUITimingInfo, bool bEmitHRDTimingInfo);
void codeAUD(const Slice& slice);
void codeHrdParameters(const HRDInfo& hrd, int maxSubTLayers);
diff -r 11bfa0ae9710 -r af4036239bc3 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Wed Sep 28 15:18:23 2016 +0530
+++ b/source/encoder/frameencoder.cpp Mon Oct 03 11:48:41 2016 +0530
@@ -525,7 +525,7 @@
if (m_frame->m_lowres.bKeyframe)
{
- if (!m_param->bDiscardSEI && m_param->bEmitHRDSEI)
+ if (m_param->bEmitHRDSEI)
{
SEIBufferingPeriod* bpSei = &m_top->m_rateControl->m_bufPeriodSEI;
@@ -547,7 +547,7 @@
}
}
- if (!m_param->bDiscardSEI && (m_param->bEmitHRDSEI || !!m_param->interlaceMode))
+ if ((m_param->bEmitHRDSEI || !!m_param->interlaceMode))
{
SEIPictureTiming *sei = m_rce.picTimingSEI;
const VUI *vui = &slice->m_sps->vuiParameters;
@@ -583,22 +583,19 @@
}
/* Write user SEI */
- if (!m_param->bDiscardSEI)
+ for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
{
- for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
- {
- x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i];
- SEIuserDataUnregistered sei;
+ x265_sei_payload *payload = &m_frame->m_userSEI.payloads[i];
+ SEIuserDataUnregistered sei;
- sei.m_payloadType = payload->payloadType;
- sei.m_userDataLength = payload->payloadSize;
- sei.m_userData = payload->payload;
+ sei.m_payloadType = payload->payloadType;
+ sei.m_userDataLength = payload->payloadSize;
+ sei.m_userData = payload->payload;
- m_bs.resetBits();
- sei.write(m_bs, *slice->m_sps);
- m_bs.writeByteAlignment();
- m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
- }
+ m_bs.resetBits();
+ sei.write(m_bs, *slice->m_sps);
+ m_bs.writeByteAlignment();
+ m_nalList.serialize(NAL_UNIT_PREFIX_SEI, m_bs);
}
/* CQP and CRF (without capped VBV) doesn't use mid-frame statistics to
@@ -895,7 +892,7 @@
}
- if (!m_param->bDiscardSEI && m_param->decodedPictureHashSEI)
+ if (m_param->decodedPictureHashSEI)
{
int planes = (m_frame->m_param->internalCsp != X265_CSP_I400) ? 3 : 1;
if (m_param->decodedPictureHashSEI == 1)
diff -r 11bfa0ae9710 -r af4036239bc3 source/x265.h
--- a/source/x265.h Wed Sep 28 15:18:23 2016 +0530
+++ b/source/x265.h Mon Oct 03 11:48:41 2016 +0530
@@ -1301,11 +1301,11 @@
/* Maximum of the picture order count */
int log2MaxPocLsb;
- /* Dicard SEI messages when printing */
- int bDiscardSEI;
-
- /* Control removing optional vui information (timing, HRD info) to get low bitrate */
- int bDiscardOptionalVUI;
+ /* Emit VUI Timing info, an optional VUI field */
+ int bEmitVUITimingInfo;
+
+ /* Emit HRD Timing info */
+ int bEmitHRDTimingInfo;
/* Maximum count of Slices of picture, the value range is [1, maximum rows] */
unsigned int maxSlices;
diff -r 11bfa0ae9710 -r af4036239bc3 source/x265cli.h
--- a/source/x265cli.h Wed Sep 28 15:18:23 2016 +0530
+++ b/source/x265cli.h Mon Oct 03 11:48:41 2016 +0530
@@ -208,8 +208,10 @@
{ "min-luma", required_argument, NULL, 0 },
{ "max-luma", required_argument, NULL, 0 },
{ "log2-max-poc-lsb", required_argument, NULL, 8 },
- { "discard-sei", no_argument, NULL, 0 },
- { "discard-vui", no_argument, NULL, 0 },
+ { "vui-timing-info", no_argument, NULL, 0 },
+ { "no-vui-timing-info", no_argument, NULL, 0 },
+ { "hrd-timing-info", no_argument, NULL, 0 },
+ { "no-hrd-timing-info", no_argument, NULL, 0 },
{ "no-dither", no_argument, NULL, 0 },
{ "dither", no_argument, NULL, 0 },
{ "no-repeat-headers", no_argument, NULL, 0 },
@@ -448,8 +450,8 @@
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(" --discard-sei Discard SEI packets in bitstream. Default %s\n", OPT(param->bDiscardSEI));
- H0(" --discard-vui Discard optional VUI information from the bistream. Default %s\n", OPT(param->bDiscardOptionalVUI));
+ H0(" --[no]-vui-timing-info Discard optional VUI timing information from the bistream. Default %s\n", OPT(param->bEmitVUITimingInfo));
+ H0(" --[no]-hrd-timing-info Discard optional HRD timing information from the bistream. Default %s\n", OPT(param->bEmitHRDTimingInfo));
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: 12384 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161003/8b4cf9f2/attachment-0001.bin>
More information about the x265-devel
mailing list