[x265] [PATCH] fix conditions for single-sei NAL

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu Apr 12 11:42:40 CEST 2018


# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1523526059 -19800
#      Thu Apr 12 15:10:59 2018 +0530
# Node ID ad37e53f78dcdd600f7ad31095db490b2a93a8c6
# Parent  593e63cda903370af926711c0ba05ce37d045c90
fix conditions for single-sei NAL

diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -696,7 +696,7 @@
         sei->write(m_bs, *slice->m_sps);
         sei->alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
     }
-
+    bool isSei = false;
     /* Write user SEI */
     for (int i = 0; i < m_frame->m_userSEI.numPayloads; i++)
     {
@@ -710,6 +710,7 @@
             sei.setSize(payload->payloadSize);
             sei.write(m_bs, *slice->m_sps);
             sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+            isSei = true;
         }
         else if (payload->payloadType == USER_DATA_REGISTERED_ITU_T_T35)
         {
@@ -717,18 +718,19 @@
             {
                 SEICreativeIntentMeta sei;
                 sei.m_payload = payload->payload;
-                m_bs.resetBits();
+                if (!m_param->bSingleSeiNal)
+                    m_bs.resetBits();
                 sei.setSize(payload->payloadSize);
                 sei.write(m_bs, *slice->m_sps);
-                sei.alignAndSerialize(m_bs, true, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+                sei.alignAndSerialize(m_bs, false, m_param->bSingleSeiNal, NAL_UNIT_PREFIX_SEI, m_nalList);
+                isSei = true;
             }
         }
         else
             x265_log(m_param, X265_LOG_ERROR, "Unrecognized SEI type\n");
     }
-    bool isSei = (m_frame->m_lowres.bKeyframe && 
-            (m_param->bRepeatHeaders || m_param->bEmitHRDSEI 
-            || !!m_param->interlaceMode || m_param->bEmitIDRRecoverySEI));
+    isSei |= ((m_frame->m_lowres.bKeyframe && m_param->bRepeatHeaders) || m_param->bEmitHRDSEI 
+        || !!m_param->interlaceMode || (m_frame->m_lowres.sliceType == X265_TYPE_IDR && m_param->bEmitIDRRecoverySEI));
 
     if (isSei && m_param->bSingleSeiNal)
     {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 2252 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180412/cae5bfcf/attachment.bin>


More information about the x265-devel mailing list