[x265] [PATCH] vui: emit VUI w/ timing info unconditionally, remove timing info from VPS
Steve Borho
steve at borho.org
Tue Apr 15 06:25:19 CEST 2014
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1397535907 18000
# Mon Apr 14 23:25:07 2014 -0500
# Node ID e8962930ac7eeb11636ecd1edd4aa6b49161f6e0
# Parent 2f2137a970c3063a4c2d960df77bc80f3ca27246
vui: emit VUI w/ timing info unconditionally, remove timing info from VPS
Since many tools seem to only look in the VUI for timing info, it seems to be
best to output that info there, and remove it from the VPS (to avoid sending
redundant data in our headers)
diff -r 2f2137a970c3 -r e8962930ac7e doc/reST/cli.rst
--- a/doc/reST/cli.rst Sat Apr 12 20:37:13 2014 -0500
+++ b/doc/reST/cli.rst Mon Apr 14 23:25:07 2014 -0500
@@ -621,9 +621,9 @@
VUI (Video Usability Information) options
=========================================
-By default x265 does not emit a VUI in the SPS, but if you specify any
-of the VUI fields (:option:`--sar`, :option:`--range`, etc) the VUI is
-implicitly enabled.
+x265 emits a VUI with only the timing info by default. If the SAR is
+specified (or read from a Y4M header) it is also included. All other
+VUI fields must be manually specified.
.. option:: --sar <integer|w:h>
@@ -736,12 +736,6 @@
Specify chroma sample location for 4:2:0 inputs. Default undefined
Consult the HEVC specification for a description of these values.
-.. option:: --timinginfo, --no-timinginfo
-
- Add timing information to the VUI. This is identical to the timing
- info reported in the PPS header but is sometimes required. Default
- disabled
-
Bitstream options
=================
diff -r 2f2137a970c3 -r e8962930ac7e source/CMakeLists.txt
--- a/source/CMakeLists.txt Sat Apr 12 20:37:13 2014 -0500
+++ b/source/CMakeLists.txt Mon Apr 14 23:25:07 2014 -0500
@@ -19,7 +19,7 @@
include(CheckCXXCompilerFlag)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 15)
+set(X265_BUILD 16)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 2f2137a970c3 -r e8962930ac7e source/common/param.cpp
--- a/source/common/param.cpp Sat Apr 12 20:37:13 2014 -0500
+++ b/source/common/param.cpp Mon Apr 14 23:25:07 2014 -0500
@@ -197,7 +197,6 @@
param->vui.defDispWinRightOffset = 0;
param->vui.defDispWinTopOffset = 0;
param->vui.defDispWinBottomOffset = 0;
- param->vui.bEnableVuiTimingInfoPresentFlag = 0;
}
extern "C"
@@ -688,10 +687,6 @@
&p->vui.defDispWinRightOffset,
&p->vui.defDispWinBottomOffset) != 4;
}
- OPT("timinginfo")
- {
- p->vui.bEnableVuiTimingInfoPresentFlag = atobool(value);
- }
else
return X265_PARAM_BAD_NAME;
#undef OPT
diff -r 2f2137a970c3 -r e8962930ac7e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Sat Apr 12 20:37:13 2014 -0500
+++ b/source/encoder/encoder.cpp Mon Apr 14 23:25:07 2014 -0500
@@ -998,11 +998,15 @@
/* A Profile::MAIN10 decoder can always decode Profile::MAIN */
profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN10, 1);
}
+
/* XXX: should Main be marked as compatible with still picture? */
/* XXX: may be a good idea to refactor the above into a function
* that chooses the actual compatibility based upon options */
+ /* set the VPS profile information */
+ *m_vps.getPTL() = *sps->getPTL();
+
sps->setPicWidthInLumaSamples(param->sourceWidth);
sps->setPicHeightInLumaSamples(param->sourceHeight);
sps->setConformanceWindow(m_conformanceWindow);
@@ -1067,74 +1071,55 @@
// TODO: it is recommended for this to match the input bit depth
sps->setPCMBitDepthLuma(X265_DEPTH);
sps->setPCMBitDepthChroma(X265_DEPTH);
-
sps->setPCMFilterDisableFlag(m_bPCMFilterDisableFlag);
-
sps->setScalingListFlag((m_useScalingListId == 0) ? 0 : 1);
-
sps->setUseStrongIntraSmoothing(param->bEnableStrongIntraSmoothing);
- bool bVui = param->vui.aspectRatioIdc ||
- param->vui.bEnableVideoSignalTypePresentFlag ||
- param->vui.bEnableOverscanInfoPresentFlag ||
- param->vui.bEnableVuiTimingInfoPresentFlag ||
- param->interlaceMode;
- sps->setVuiParametersPresentFlag(bVui);
+ sps->setVuiParametersPresentFlag(true);
+ TComVUI* vui = sps->getVuiParameters();
+ vui->setAspectRatioInfoPresentFlag(!!param->vui.aspectRatioIdc);
+ vui->setAspectRatioIdc(param->vui.aspectRatioIdc);
+ vui->setSarWidth(param->vui.sarWidth);
+ vui->setSarHeight(param->vui.sarHeight);
- if (sps->getVuiParametersPresentFlag())
- {
- TComVUI* vui = sps->getVuiParameters();
- vui->setAspectRatioInfoPresentFlag(!!param->vui.aspectRatioIdc);
- vui->setAspectRatioIdc(param->vui.aspectRatioIdc);
- vui->setSarWidth(param->vui.sarWidth);
- vui->setSarHeight(param->vui.sarHeight);
+ vui->setOverscanInfoPresentFlag(param->vui.bEnableOverscanInfoPresentFlag);
+ vui->setOverscanAppropriateFlag(param->vui.bEnableOverscanAppropriateFlag);
- vui->setOverscanInfoPresentFlag(param->vui.bEnableOverscanInfoPresentFlag);
- vui->setOverscanAppropriateFlag(param->vui.bEnableOverscanAppropriateFlag);
+ vui->setVideoSignalTypePresentFlag(param->vui.bEnableVideoSignalTypePresentFlag);
+ vui->setVideoFormat(param->vui.videoFormat);
+ vui->setVideoFullRangeFlag(param->vui.bEnableVideoFullRangeFlag);
+ vui->setColourDescriptionPresentFlag(param->vui.bEnableColorDescriptionPresentFlag);
+ vui->setColourPrimaries(param->vui.colorPrimaries);
+ vui->setTransferCharacteristics(param->vui.transferCharacteristics);
+ vui->setMatrixCoefficients(param->vui.matrixCoeffs);
+ vui->setChromaLocInfoPresentFlag(param->vui.bEnableChromaLocInfoPresentFlag);
+ vui->setChromaSampleLocTypeTopField(param->vui.chromaSampleLocTypeTopField);
+ vui->setChromaSampleLocTypeBottomField(param->vui.chromaSampleLocTypeBottomField);
+ vui->setNeutralChromaIndicationFlag(m_neutralChromaIndicationFlag);
+ vui->setDefaultDisplayWindow(m_defaultDisplayWindow);
- vui->setVideoSignalTypePresentFlag(param->vui.bEnableVideoSignalTypePresentFlag);
- vui->setVideoFormat(param->vui.videoFormat);
- vui->setVideoFullRangeFlag(param->vui.bEnableVideoFullRangeFlag);
- vui->setColourDescriptionPresentFlag(param->vui.bEnableColorDescriptionPresentFlag);
- vui->setColourPrimaries(param->vui.colorPrimaries);
- vui->setTransferCharacteristics(param->vui.transferCharacteristics);
- vui->setMatrixCoefficients(param->vui.matrixCoeffs);
- vui->setChromaLocInfoPresentFlag(param->vui.bEnableChromaLocInfoPresentFlag);
- vui->setChromaSampleLocTypeTopField(param->vui.chromaSampleLocTypeTopField);
- vui->setChromaSampleLocTypeBottomField(param->vui.chromaSampleLocTypeBottomField);
- vui->setNeutralChromaIndicationFlag(m_neutralChromaIndicationFlag);
- vui->setDefaultDisplayWindow(m_defaultDisplayWindow);
+ vui->setFrameFieldInfoPresentFlag(!!param->interlaceMode);
+ vui->setFieldSeqFlag(!!param->interlaceMode);
- vui->setFrameFieldInfoPresentFlag(!!param->interlaceMode);
- vui->setFieldSeqFlag(!!param->interlaceMode);
+ vui->setHrdParametersPresentFlag(false);
+ vui->getHrdParameters()->setNalHrdParametersPresentFlag(false);
+ vui->getHrdParameters()->setSubPicHrdParamsPresentFlag(false);
- vui->setHrdParametersPresentFlag(false);
- vui->getHrdParameters()->setNalHrdParametersPresentFlag(false);
- vui->getHrdParameters()->setSubPicHrdParamsPresentFlag(false);
+ vui->getTimingInfo()->setTimingInfoPresentFlag(true);
+ vui->getTimingInfo()->setNumUnitsInTick(param->fpsDenom);
+ vui->getTimingInfo()->setTimeScale(param->fpsNum);
+ vui->getTimingInfo()->setPocProportionalToTimingFlag(m_pocProportionalToTimingFlag);
+ vui->getTimingInfo()->setNumTicksPocDiffOneMinus1(m_numTicksPocDiffOneMinus1);
- vui->getTimingInfo()->setTimingInfoPresentFlag(param->vui.bEnableVuiTimingInfoPresentFlag);
- vui->getTimingInfo()->setNumUnitsInTick(param->fpsDenom);
- vui->getTimingInfo()->setTimeScale(param->fpsNum);
- vui->getTimingInfo()->setPocProportionalToTimingFlag(m_pocProportionalToTimingFlag);
- vui->getTimingInfo()->setNumTicksPocDiffOneMinus1(m_numTicksPocDiffOneMinus1);
-
- vui->setBitstreamRestrictionFlag(false);
- vui->setTilesFixedStructureFlag(m_tilesFixedStructureFlag);
- vui->setMotionVectorsOverPicBoundariesFlag(m_motionVectorsOverPicBoundariesFlag);
- vui->setRestrictedRefPicListsFlag(m_restrictedRefPicListsFlag);
- vui->setMinSpatialSegmentationIdc(m_minSpatialSegmentationIdc);
- vui->setMaxBytesPerPicDenom(m_maxBytesPerPicDenom);
- vui->setMaxBitsPerMinCuDenom(m_maxBitsPerMinCuDenom);
- vui->setLog2MaxMvLengthHorizontal(m_log2MaxMvLengthHorizontal);
- vui->setLog2MaxMvLengthVertical(m_log2MaxMvLengthVertical);
- }
-
- /* set the VPS profile information */
- *m_vps.getPTL() = *sps->getPTL();
- TimingInfo *t = m_vps.getTimingInfo();
- t->setTimingInfoPresentFlag(true);
- t->setNumUnitsInTick(param->fpsDenom);
- t->setTimeScale(param->fpsNum);
+ vui->setBitstreamRestrictionFlag(false);
+ vui->setTilesFixedStructureFlag(m_tilesFixedStructureFlag);
+ vui->setMotionVectorsOverPicBoundariesFlag(m_motionVectorsOverPicBoundariesFlag);
+ vui->setRestrictedRefPicListsFlag(m_restrictedRefPicListsFlag);
+ vui->setMinSpatialSegmentationIdc(m_minSpatialSegmentationIdc);
+ vui->setMaxBytesPerPicDenom(m_maxBytesPerPicDenom);
+ vui->setMaxBitsPerMinCuDenom(m_maxBitsPerMinCuDenom);
+ vui->setLog2MaxMvLengthHorizontal(m_log2MaxMvLengthHorizontal);
+ vui->setLog2MaxMvLengthVertical(m_log2MaxMvLengthVertical);
}
void Encoder::initPPS(TComPPS *pps)
diff -r 2f2137a970c3 -r e8962930ac7e source/x265.cpp
--- a/source/x265.cpp Sat Apr 12 20:37:13 2014 -0500
+++ b/source/x265.cpp Mon Apr 14 23:25:07 2014 -0500
@@ -389,7 +389,6 @@
H0(" --colormatrix <string> Specify color matrix setting from undef, bt709, fcc, bt470bg, smpte170m,\n");
H0(" smpte240m, GBR, YCgCo, bt2020nc, bt2020c. Default undef\n");
H0(" --chromaloc <integer> Specify chroma sample location (0 to 5). Default of %d\n", param->vui.chromaSampleLocTypeTopField);
- H0(" --[no-]timinginfo Add timing information to the VUI. Defaut %s\n", OPT(param->vui.bEnableVuiTimingInfoPresentFlag));
H0("\nBitstream options:\n");
H0(" --[no-]aud Emit access unit delimiters at the start of each access unit. Default %s\n", OPT(param->bEnableAccessUnitDelimiters));
H0("\nReconstructed video options (debugging):\n");
diff -r 2f2137a970c3 -r e8962930ac7e source/x265.h
--- a/source/x265.h Sat Apr 12 20:37:13 2014 -0500
+++ b/source/x265.h Mon Apr 14 23:25:07 2014 -0500
@@ -794,13 +794,6 @@
/* Default display window bottom offset holds the bottom offset with the
* conformance cropping window to further crop the displayed window */
int defDispWinBottomOffset;
-
- /* VUI timing info present flag adds vui_num_units_in_tick,
- * vui_time_scale, vui_poc_proportional_to_timing_flag and
- * vui_hrd_parameters_present_flag to the VUI. vui_num_units_in_tick,
- * vui_time_scale and vui_poc_proportional_to_timing_flag are derived
- * from processing the input video. The default is false */
- int bEnableVuiTimingInfoPresentFlag;
} vui;
} x265_param;
More information about the x265-devel
mailing list