[x265] [PATCH 1 of 2] Support high payload size

bhavna at multicorewareinc.com bhavna at multicorewareinc.com
Fri Jun 23 09:23:04 CEST 2017


# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1495523574 -19800
#      Tue May 23 12:42:54 2017 +0530
# Branch stable
# Node ID f4de3ccf989164ed89cc48e49e55d627a8414522
# Parent  dccf02340c7538e81a940ca53322762d5d284654
Support high payload size

diff -r dccf02340c75 -r f4de3ccf9891 source/dynamicHDR10/metadataFromJson.cpp
--- a/source/dynamicHDR10/metadataFromJson.cpp	Thu May 25 10:31:58 2017 +0530
+++ b/source/dynamicHDR10/metadataFromJson.cpp	Tue May 23 12:42:54 2017 +0530
@@ -168,7 +168,7 @@
     {
         int payloadBytes = 1;
 
-        for(;payload > 0xFF; payload -= 0xFF, ++payloadBytes);
+        for(;payload >= 0xFF; payload -= 0xFF, ++payloadBytes);
 
         if(payloadBytes > 1)
         {
diff -r dccf02340c75 -r f4de3ccf9891 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu May 25 10:31:58 2017 +0530
+++ b/source/encoder/encoder.cpp	Tue May 23 12:42:54 2017 +0530
@@ -607,8 +607,13 @@
             uint8_t *cim = NULL;
             if (m_hdr10plus_api->hdr10plus_json_to_frame_cim(m_param->toneMapFile, pic_in->poc, cim))
             {
-                toneMap.payload = (uint8_t*)x265_malloc(sizeof(uint8_t) * cim[0]);
-                toneMap.payloadSize = cim[0];
+                int32_t i = 0;
+                toneMap.payloadSize = 0;
+                while (cim[i] == 0xFF)
+                    toneMap.payloadSize += cim[i++] + 1;
+                toneMap.payloadSize += cim[i] + 1;
+
+                toneMap.payload = (uint8_t*)x265_malloc(sizeof(uint8_t) * toneMap.payloadSize);
                 toneMap.payloadType = USER_DATA_REGISTERED_ITU_T_T35;
                 memcpy(toneMap.payload, cim, toneMap.payloadSize);
             }
diff -r dccf02340c75 -r f4de3ccf9891 source/encoder/sei.h
--- a/source/encoder/sei.h	Thu May 25 10:31:58 2017 +0530
+++ b/source/encoder/sei.h	Tue May 23 12:42:54 2017 +0530
@@ -289,12 +289,10 @@
         while (cim[i] == 0xFF)
         {
             i++;
-            payloadSize += cim[i];
             WRITE_CODE(0xFF, 8, "payload_size");
         }
-        WRITE_CODE(payloadSize, 8, "payload_size");
+        WRITE_CODE(cim[i], 8, "payload_size");
         i++;
-        payloadSize += i;
         for (; i < payloadSize; ++i)
             WRITE_CODE(cim[i], 8, "creative_intent_metadata");
     }


More information about the x265-devel mailing list