[x265] [PATCH] SEI: enable generation of recovery point SEI message for keyframes

Steve Borho steve at borho.org
Wed May 7 20:21:58 CEST 2014


On Wed, May 7, 2014 at 2:10 AM,  <kavitha at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Kavitha Sampath <kavitha at multicorewareinc.com>
> # Date 1399446578 -19800
> #      Wed May 07 12:39:38 2014 +0530
> # Node ID 54b2c9e2add4f4ff334c894aa89ad6c4fd378c2b
> # Parent  7773ee321539810625636bb0a163004225040707
> SEI: enable generation of recovery point SEI message for keyframes
>
> SEI recovery points are inserted for every keyframe 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 zero in x265 which says "you can seek here".
>
> diff -r 7773ee321539 -r 54b2c9e2add4 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp        Wed May 07 10:49:02 2014 +0530
> +++ b/source/encoder/encoder.cpp        Wed May 07 12:39:38 2014 +0530
> @@ -1414,7 +1414,7 @@
>
>      m_nonPackedConstraintFlag = false;
>      m_frameOnlyConstraintFlag = false;
> -    m_recoveryPointSEIEnabled = 0;
> +    m_recoveryPointSEIEnabled = 1;

let's remove this field entirely from the Encoder class

>      m_bufferingPeriodSEIEnabled = 0;
>      m_displayOrientationSEIAngle = 0;
>      m_gradualDecodingRefreshInfoEnabled = 0;
> diff -r 7773ee321539 -r 54b2c9e2add4 source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp   Wed May 07 10:49:02 2014 +0530
> +++ b/source/encoder/frameencoder.cpp   Wed May 07 12:39:38 2014 +0530
> @@ -473,7 +473,7 @@
>          slice->setNextSlice(true);
>      }
>
> -    if ((m_cfg->m_recoveryPointSEIEnabled) && (slice->getSliceType() == I_SLICE))
> +    if ((m_cfg->m_recoveryPointSEIEnabled) && (slice->getPic()->m_lowres.bKeyframe))

for the record, this is an over-abundance of parens.  I know you
didn't write this line of code.

>      {
>          if (m_cfg->m_gradualDecodingRefreshInfoEnabled && !slice->getRapPicFlag())
>          {
> @@ -492,12 +492,17 @@
>                  m_nalCount++;
>              }
>          }
> -        // Recovery point SEI
> +        // The recovery point SEI message assists a decoder in determining when the decoding
> +        // process will produce acceptable pictures for display after the decoder initiates
> +        // random access.

> The SEI specifies recovery_poc_cnt that counts the number of frames
> +        // after which acceptable pictures can be displayed to the user. Since the leading
> +        // pictures are usually ignored by the decoder and trailing pictures do not refer
> +        // pictures that precede the random access point, the recovery_poc_cnt is zero.

I think I can improve these last two last sentences.

m_recoveryPocCnt is in units of POC (picture order count) which means
pictures encoded after the CRA but precede it in display order
(leading) are implicitly discarded after a random access seek
regardless of the value of m_recoveryPocCnt. Our encoder does not use
references prior to the most recent CRA, so all pictures following the
CRA in POC order are guaranteed to be displayable, so m_recoveryPocCnt
is always 0.

>          OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
>
>          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());
> _______________________________________________
> 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