[x265] [PATCH] SEI: add CLI --recovery to enable generation of recovery point SEI messages
Steve Borho
steve at borho.org
Wed Apr 30 00:18:23 CEST 2014
On Tue, Apr 29, 2014 at 3:50 PM, <kavitha at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Kavitha Sampath <kavitha at multicorewareinc.com>
> # Date 1398804202 -19800
> # Wed Apr 30 02:13:22 2014 +0530
> # Branch stable
> # Node ID 8bcbdbef4adfe94a79fa7aeffc00297040c13983
> # Parent c6ca14a4f2faff3d305f3ab2c4f7736693f54fbd
> SEI: add CLI --recovery to enable generation of recovery point SEI messages
>
> SEI recovery points are inserted at I-frames which tells the decoder an
> identifier of the recovery point from which perfectly valid pictures can be
> displayed no matter what the starting point of decoding is. The SEI specifies
> recovery_poc_cnt that counts the number of frames after which perfect video can
> be displayed to the user. Since the leading pictures are usually ignored by the
> decoder and trailing pictures do not refer pictures preceding IRAP,
> the recovery_poc_cnt is usually zero in h.265 which means "you can seek here".
This last statement might be true of x265; but I don't know if it
applies generally to H.265
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/common/param.cpp
> --- a/source/common/param.cpp Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/common/param.cpp Wed Apr 30 02:13:22 2014 +0530
> @@ -596,6 +596,7 @@
> OPT("ssim") p->bEnableSsim = atobool(value);
> OPT("psnr") p->bEnablePsnr = atobool(value);
> OPT("hash") p->decodedPictureHashSEI = atoi(value);
> + OPT("recovery") p->bEnableRecoveryPointSEI = atobool(value);
> OPT("aud") p->bEnableAccessUnitDelimiters = atobool(value);
> OPT("b-pyramid") p->bBPyramid = atobool(value);
> OPT("aq-mode") p->rc.aqMode = atoi(value);
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/encoder/encoder.cpp Wed Apr 30 02:13:22 2014 +0530
> @@ -1408,7 +1408,6 @@
>
> m_nonPackedConstraintFlag = false;
> m_frameOnlyConstraintFlag = false;
> - m_recoveryPointSEIEnabled = 0;
> m_bufferingPeriodSEIEnabled = 0;
> m_displayOrientationSEIAngle = 0;
> m_gradualDecodingRefreshInfoEnabled = 0;
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/encoder/encoder.h
> --- a/source/encoder/encoder.h Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/encoder/encoder.h Wed Apr 30 02:13:22 2014 +0530
> @@ -157,7 +157,6 @@
> bool m_loopFilterAcrossTilesEnabledFlag;
>
> int m_bufferingPeriodSEIEnabled;
> - int m_recoveryPointSEIEnabled;
> int m_displayOrientationSEIAngle;
> int m_gradualDecodingRefreshInfoEnabled;
> int m_decodingUnitInfoSEIEnabled;
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/encoder/frameencoder.cpp Wed Apr 30 02:13:22 2014 +0530
> @@ -473,7 +473,7 @@
> slice->setNextSlice(true);
> }
>
> - if ((m_cfg->m_recoveryPointSEIEnabled) && (slice->getSliceType() == I_SLICE))
> + if ((m_cfg->param->bEnableRecoveryPointSEI) && (slice->getSliceType() == I_SLICE))
I believe these SEI are only required for keyframes, and not all I
slices are necessarily keyframes
> {
> if (m_cfg->m_gradualDecodingRefreshInfoEnabled && !slice->getRapPicFlag())
> {
> @@ -497,7 +497,7 @@
it probably deserves a comment here on why you believe
m_recoveryPocCnt should always be zero
> SEIRecoveryPoint sei_recovery_point;
> sei_recovery_point.m_recoveryPocCnt = 0;
> - sei_recovery_point.m_exactMatchingFlag = (slice->getPOC() == 0) ? (true) : (false);
> + sei_recovery_point.m_exactMatchingFlag = true;
> sei_recovery_point.m_brokenLinkFlag = false;
>
> m_seiWriter.writeSEImessage(nalu.m_bitstream, sei_recovery_point, slice->getSPS());
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/x265.cpp
> --- a/source/x265.cpp Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/x265.cpp Wed Apr 30 02:13:22 2014 +0530
> @@ -151,6 +151,8 @@
> { "ssim", no_argument, NULL, 0 },
> { "no-psnr", no_argument, NULL, 0 },
> { "psnr", no_argument, NULL, 0 },
there are two directions we could take here:
1 - make the feature enabled unconditionally as x264 handles it, in
which case most of these changes are necessary or
2 - make it opt-in as you've done here, in which case you must update
the reST docs and bump X265_BUILD
I think I lean towards making them unconditional
> + { "no-recovery", no_argument, NULL, 0 },
> + { "recovery", no_argument, NULL, 0 },
> { "hash", required_argument, NULL, 0 },
> { "no-strong-intra-smoothing", no_argument, NULL, 0 },
> { "strong-intra-smoothing", no_argument, NULL, 0 },
> @@ -393,6 +395,7 @@
> H0(" --recon-depth <integer> Bit-depth of reconstructed raw image file. Defaults to input bit depth, or 8 if Y4M\n");
> H0("\nSEI options:\n");
> H0(" --hash <integer> Decoded Picture Hash SEI 0: disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n", param->decodedPictureHashSEI);
> + H0(" --[no-]recovery Enable recovery point SEI. Default %s\n", OPT(param->bEnableRecoveryPointSEI));
> #undef OPT
> #undef H0
> printf("\n\nFull documentation may be found at http://x265.readthedocs.org/en/default/cli.html\n");
> diff -r c6ca14a4f2fa -r 8bcbdbef4adf source/x265.h
> --- a/source/x265.h Tue Apr 29 14:05:50 2014 -0500
> +++ b/source/x265.h Wed Apr 30 02:13:22 2014 +0530
> @@ -355,6 +355,12 @@
> * types are MD5(1), CRC(2), Checksum(3). Default is 0, none */
> int decodedPictureHashSEI;
>
> + /* Enable generation of SEI messages for every keyframe. The recovery point SEI
> + * assists a decoder in determining when the decoding process will produce
> + * acceptable pictures for display after the decoder initiates random access
> + * or indicates a broken link. Default is disabled */
> + int bEnableRecoveryPointSEI;
> +
> /*== Internal Picture Specification ==*/
>
> /* Internal encoder bit depth. If x265 was compiled to use 8bit pixels
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list