<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 12, 2017 at 1:11 PM,  <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1499842927 -19800<br>
#      Wed Jul 12 12:32:07 2017 +0530<br>
# Node ID 3872cba7827fd6fdc2db62140cc4d1<wbr>08e97bc6bf<br>
# Parent  06217c0e0f5f7fb126deb05ffb875a<wbr>4f4bae8f68<br>
fix payload write of USER_DATA_REGISTERED_ITU_T_T35 SEI message.<br>
<br>
inserts missing initial payload byte into the bitstream and removes<br>
extra byte appended at the end of bitstream while passing user SEI data<br>
(bitbucket issue #353)<br></blockquote><div><br></div><div>Pushed to stable branch. Should be part of the imminent 2.5 version that I will be tagging. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Thu Jul 06 14:39:02 2017 +0530<br>
+++ b/source/encoder/encoder.cpp        Wed Jul 12 12:32:07 2017 +0530<br>
@@ -615,12 +615,12 @@<br>
                 int32_t i = 0;<br>
                 toneMap.payloadSize = 0;<br>
                 while (cim[pic_in->poc][i] == 0xFF)<br>
-                    toneMap.payloadSize += cim[pic_in->poc][i++] + 1;<br>
-                toneMap.payloadSize += cim[pic_in->poc][i] + 1;<br>
+                    toneMap.payloadSize += cim[pic_in->poc][i++];<br>
+                toneMap.payloadSize += cim[pic_in->poc][i++];<br>
<br>
                 toneMap.payload = (uint8_t*)x265_malloc(sizeof(<wbr>uint8_t) * toneMap.payloadSize);<br>
                 toneMap.payloadType = USER_DATA_REGISTERED_ITU_T_<wbr>T35;<br>
-                memcpy(toneMap.payload, cim[pic_in->poc], toneMap.payloadSize);<br>
+                memcpy(toneMap.payload, cim[pic_in->poc] + i, toneMap.payloadSize);<br>
             }<br>
         }<br>
 #endif<br>
diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/frameencoder.<wbr>cpp<br>
--- a/source/encoder/frameencoder.<wbr>cpp   Thu Jul 06 14:39:02 2017 +0530<br>
+++ b/source/encoder/frameencoder.<wbr>cpp   Wed Jul 12 12:32:07 2017 +0530<br>
@@ -669,7 +669,7 @@<br>
             if (writeSei)<br>
             {<br>
                 SEICreativeIntentMeta sei;<br>
-                sei.cim = payload->payload;<br>
+                sei.m_payload = payload->payload;<br>
                 m_bs.resetBits();<br>
                 sei.setSize(payload-><wbr>payloadSize);<br>
                 sei.write(m_bs, *slice->m_sps);<br>
diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/sei.cpp<br>
--- a/source/encoder/sei.cpp    Thu Jul 06 14:39:02 2017 +0530<br>
+++ b/source/encoder/sei.cpp    Wed Jul 12 12:32:07 2017 +0530<br>
@@ -54,21 +54,23 @@<br>
     }<br>
     WRITE_CODE(type, 8, "payload_type");<br>
     uint32_t payloadSize;<br>
-    if (hrdTypes || m_payloadType == USER_DATA_UNREGISTERED)<br>
+    if (hrdTypes || m_payloadType == USER_DATA_UNREGISTERED || m_payloadType == USER_DATA_REGISTERED_ITU_T_<wbr>T35)<br>
     {<br>
         if (hrdTypes)<br>
         {<br>
             X265_CHECK(0 == (count.getNumberOfWrittenBits(<wbr>) & 7), "payload unaligned\n");<br>
             payloadSize = count.getNumberOfWrittenBits() >> 3;<br>
         }<br>
+        else if (m_payloadType == USER_DATA_UNREGISTERED)<br>
+            payloadSize = m_payloadSize + 16;<br>
         else<br>
-            payloadSize = m_payloadSize + 16;<br>
+            payloadSize = m_payloadSize;<br>
<br>
         for (; payloadSize >= 0xff; payloadSize -= 0xff)<br>
             WRITE_CODE(0xff, 8, "payload_size");<br>
         WRITE_CODE(payloadSize, 8, "payload_size");<br>
     }<br>
-    else if(m_payloadType != USER_DATA_REGISTERED_ITU_T_<wbr>T35)<br>
+    else<br>
         WRITE_CODE(m_payloadSize, 8, "payload_size");<br>
     /* virtual writeSEI method, write to bs */<br>
     writeSEI(sps);<br>
diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/sei.h<br>
--- a/source/encoder/sei.h      Thu Jul 06 14:39:02 2017 +0530<br>
+++ b/source/encoder/sei.h      Wed Jul 12 12:32:07 2017 +0530<br>
@@ -276,25 +276,17 @@<br>
         m_payloadSize = 0;<br>
     }<br>
<br>
-    uint8_t *cim;<br>
+    uint8_t *m_payload;<br>
<br>
     // <a href="mailto:daniel.vt@samsung.com">daniel.vt@samsung.com</a> :: for the Creative Intent Meta Data Encoding ( <a href="mailto:seongnam.oh@samsung.com">seongnam.oh@samsung.com</a> )<br>
     void writeSEI(const SPS&)<br>
     {<br>
-        if (!cim)<br>
+        if (!m_payload)<br>
             return;<br>
<br>
-        int i = 0;<br>
-        int payloadSize = m_payloadSize;<br>
-        while (cim[i] == 0xFF)<br>
-        {<br>
-            i++;<br>
-            WRITE_CODE(0xFF, 8, "payload_size");<br>
-        }<br>
-        WRITE_CODE(cim[i], 8, "payload_size");<br>
-        i++;<br>
-        for (; i < payloadSize; ++i)<br>
-            WRITE_CODE(cim[i], 8, "creative_intent_metadata");<br>
+        uint32_t i = 0;<br>
+        for (; i < m_payloadSize; ++i)<br>
+            WRITE_CODE(m_payload[i], 8, "creative_intent_metadata");<br>
     }<br>
 };<br>
 }<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>
</blockquote></div><br></div></div>