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

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed May 7 09:10:52 CEST 2014


# 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;
     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))
     {
         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.
         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