<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 30, 2018 at 9:14 AM,  <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"># HG changeset patch<br>
# User Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.<wbr>com</a>><br>
# Date 1522314350 -19800<br>
#      Thu Mar 29 14:35:50 2018 +0530<br>
# Node ID 22aa607166e0a9917b923b6b21b775<wbr>055fc708fd<br>
# Parent  1fafca24a3990106ecf203afc4e900<wbr>fa0eddfbe1<br>
fix bug in SEI::write clean up<br>
<br>
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp<br>
+++ b/source/encoder/encoder.cpp<br>
@@ -2332,7 +2332,7 @@<br>
                 bs.resetBits();<br>
                 SEIuserDataUnregistered idsei;<br>
                 idsei.m_userData = (uint8_t*)buffer;<br>
-                idsei.setSize((uint32_t)<wbr>strlen(buffer) + 16);<br>
+                idsei.setSize((uint32_t)<wbr>strlen(buffer));<br>
                 idsei.write(bs, m_sps);<br>
                 bs.writeByteAlignment();<br>
                 list.serialize(NAL_UNIT_<wbr>PREFIX_SEI, bs);<br>
@@ -2350,9 +2350,9 @@<br>
         SEIActiveParameterSets sei;<br>
         sei.m_selfContainedCvsFlag = true;<br>
         sei.m_noParamSetUpdateFlag = true;<br>
+        bs.resetBits();<br>
         int payloadSize = sei.countPayloadSize(m_sps);<br>
         sei.setSize(payloadSize);<br>
-        bs.resetBits();<br>
         sei.write(bs, m_sps);<br>
         bs.writeByteAlignment();<br>
         list.serialize(NAL_UNIT_<wbr>PREFIX_SEI, bs);<br>
diff --git a/source/encoder/frameencoder.<wbr>cpp b/source/encoder/frameencoder.<wbr>cpp<br>
--- a/source/encoder/frameencoder.<wbr>cpp<br>
+++ b/source/encoder/frameencoder.<wbr>cpp<br>
@@ -633,9 +633,9 @@<br>
             bpSei->m_dpbDelayOffset = 0;<br>
             // hrdFullness() calculates the initial CPB removal delay and offset<br>
             m_top->m_rateControl-><wbr>hrdFullness(bpSei);<br>
+            m_bs.resetBits();<br>
             int payloadSize = bpSei->countPayloadSize(*<wbr>slice->m_sps);<br>
             bpSei->setSize(payloadSize);<br>
-            m_bs.resetBits();<br>
             bpSei->write(m_bs, *slice->m_sps);<br>
             m_bs.writeByteAlignment();<br>
<br>
@@ -651,8 +651,8 @@<br>
             sei.m_recoveryPocCnt = 0;<br>
             sei.m_exactMatchingFlag = true;<br>
             sei.m_brokenLinkFlag = false;<br>
+            m_bs.resetBits();<br>
             sei.setSize(sei.<wbr>countPayloadSize(*slice->m_<wbr>sps));<br>
-            m_bs.resetBits();<br>
             sei.write(m_bs, *slice->m_sps);<br>
             m_bs.writeByteAlignment();<br>
             m_nalList.serialize(NAL_UNIT_<wbr>PREFIX_SEI, m_bs);<br>
@@ -704,7 +704,7 @@<br>
             SEIuserDataUnregistered sei;<br>
             sei.m_userData = payload->payload;<br>
             m_bs.resetBits();<br>
-            sei.setSize(payload-><wbr>payloadSize + 16);<br>
+            sei.setSize(payload-><wbr>payloadSize);<br>
             sei.write(m_bs, *slice->m_sps);<br>
             m_bs.writeByteAlignment();<br>
             m_nalList.serialize(NAL_UNIT_<wbr>PREFIX_SEI, m_bs);<br>
diff --git a/source/encoder/sei.cpp b/source/encoder/sei.cpp<br>
--- a/source/encoder/sei.cpp<br>
+++ b/source/encoder/sei.cpp<br>
@@ -51,6 +51,8 @@<br>
     uint32_t type = m_payloadType;<br>
     m_bitIf = &bs;<br>
     uint32_t payloadSize = m_payloadSize;<br>
</div></div><div class="HOEnZb"><div class="h5">+    if (m_payloadType == USER_DATA_UNREGISTERED)<br>
+        payloadSize = m_payloadSize + 16;<br>
     uint32_t payloadType = m_payloadType;<br>
     for (; payloadType >= 0xff; payloadType -= 0xff)<br>
         WRITE_CODE(0xff, 8, "payload_type");<br>
</div></div><br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Thanks. Pushed.</div></div>