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

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Thu May 8 07:33:14 CEST 2014


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1399527064 -19800
#      Thu May 08 11:01:04 2014 +0530
# Node ID 8e64aa56d6352a1a8cfb6fb57cb547607bcec9b1
# Parent  fdce542171cb60c16df16b4965c504ba4b60e924
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. Pictures encoded after the CRA but precede it in
display order(leading) are ignored by the decoder and pictures following CRA in
POC order(trailing) do not reference pictures prior to the recent CRA and are
guaranteed to be displayable. Hence recovery_poc_cnt is zero.

diff -r fdce542171cb -r 8e64aa56d635 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu May 08 00:29:21 2014 -0500
+++ b/source/encoder/encoder.cpp	Thu May 08 11:01:04 2014 +0530
@@ -1420,7 +1420,6 @@
 
     m_nonPackedConstraintFlag = false;
     m_frameOnlyConstraintFlag = false;
-    m_recoveryPointSEIEnabled = 0;
     m_bufferingPeriodSEIEnabled = 0;
     m_displayOrientationSEIAngle = 0;
     m_gradualDecodingRefreshInfoEnabled = 0;
diff -r fdce542171cb -r 8e64aa56d635 source/encoder/encoder.h
--- a/source/encoder/encoder.h	Thu May 08 00:29:21 2014 -0500
+++ b/source/encoder/encoder.h	Thu May 08 11:01:04 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 fdce542171cb -r 8e64aa56d635 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Thu May 08 00:29:21 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Thu May 08 11:01:04 2014 +0530
@@ -473,7 +473,7 @@
         slice->setNextSlice(true);
     }
 
-    if ((m_cfg->m_recoveryPointSEIEnabled) && (slice->getSliceType() == I_SLICE))
+    if (slice->getPic()->m_lowres.bKeyframe)
     {
         if (m_cfg->m_gradualDecodingRefreshInfoEnabled && !slice->getRapPicFlag())
         {
@@ -492,12 +492,19 @@
                 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 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());


More information about the x265-devel mailing list