[x265] [PATCH] Support high payload size
bhavna at multicorewareinc.com
bhavna at multicorewareinc.com
Thu May 25 15:17:10 CEST 2017
# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1495523574 -19800
# Tue May 23 12:42:54 2017 +0530
# Node ID 38e7a4373f26b463e13107ff24dc92440a5fc119
# Parent 355cf3582263acc9bbcb8faa24f1dfa009f41de3
Support high payload size
diff -r 355cf3582263 -r 38e7a4373f26 source/dynamicHDR10/metadataFromJson.cpp
--- a/source/dynamicHDR10/metadataFromJson.cpp Mon May 22 12:05:24 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 355cf3582263 -r 38e7a4373f26 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon May 22 12:05:24 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 355cf3582263 -r 38e7a4373f26 source/encoder/sei.h
--- a/source/encoder/sei.h Mon May 22 12:05:24 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