[x265] [PATCH] fix payload write of USER_DATA_REGISTERED_ITU_T_T35 SEI message
Pradeep Ramachandran
pradeep at multicorewareinc.com
Wed Jul 12 16:52:33 CEST 2017
On Wed, Jul 12, 2017 at 1:11 PM, <bhavna at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Bhavna Hariharan <bhavna at multicorewareinc.com>
> # Date 1499842927 -19800
> # Wed Jul 12 12:32:07 2017 +0530
> # Node ID 3872cba7827fd6fdc2db62140cc4d108e97bc6bf
> # Parent 06217c0e0f5f7fb126deb05ffb875a4f4bae8f68
> fix payload write of USER_DATA_REGISTERED_ITU_T_T35 SEI message.
>
> inserts missing initial payload byte into the bitstream and removes
> extra byte appended at the end of bitstream while passing user SEI data
> (bitbucket issue #353)
>
Pushed to stable branch. Should be part of the imminent 2.5 version that I
will be tagging.
> diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Thu Jul 06 14:39:02 2017 +0530
> +++ b/source/encoder/encoder.cpp Wed Jul 12 12:32:07 2017 +0530
> @@ -615,12 +615,12 @@
> int32_t i = 0;
> toneMap.payloadSize = 0;
> while (cim[pic_in->poc][i] == 0xFF)
> - toneMap.payloadSize += cim[pic_in->poc][i++] + 1;
> - toneMap.payloadSize += cim[pic_in->poc][i] + 1;
> + toneMap.payloadSize += cim[pic_in->poc][i++];
> + toneMap.payloadSize += cim[pic_in->poc][i++];
>
> toneMap.payload = (uint8_t*)x265_malloc(sizeof(uint8_t)
> * toneMap.payloadSize);
> toneMap.payloadType = USER_DATA_REGISTERED_ITU_T_T35;
> - memcpy(toneMap.payload, cim[pic_in->poc],
> toneMap.payloadSize);
> + memcpy(toneMap.payload, cim[pic_in->poc] + i,
> toneMap.payloadSize);
> }
> }
> #endif
> diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Thu Jul 06 14:39:02 2017 +0530
> +++ b/source/encoder/frameencoder.cpp Wed Jul 12 12:32:07 2017 +0530
> @@ -669,7 +669,7 @@
> if (writeSei)
> {
> SEICreativeIntentMeta sei;
> - sei.cim = payload->payload;
> + sei.m_payload = payload->payload;
> m_bs.resetBits();
> sei.setSize(payload->payloadSize);
> sei.write(m_bs, *slice->m_sps);
> diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/sei.cpp
> --- a/source/encoder/sei.cpp Thu Jul 06 14:39:02 2017 +0530
> +++ b/source/encoder/sei.cpp Wed Jul 12 12:32:07 2017 +0530
> @@ -54,21 +54,23 @@
> }
> WRITE_CODE(type, 8, "payload_type");
> uint32_t payloadSize;
> - if (hrdTypes || m_payloadType == USER_DATA_UNREGISTERED)
> + if (hrdTypes || m_payloadType == USER_DATA_UNREGISTERED ||
> m_payloadType == USER_DATA_REGISTERED_ITU_T_T35)
> {
> if (hrdTypes)
> {
> X265_CHECK(0 == (count.getNumberOfWrittenBits() & 7),
> "payload unaligned\n");
> payloadSize = count.getNumberOfWrittenBits() >> 3;
> }
> + else if (m_payloadType == USER_DATA_UNREGISTERED)
> + payloadSize = m_payloadSize + 16;
> else
> - payloadSize = m_payloadSize + 16;
> + payloadSize = m_payloadSize;
>
> for (; payloadSize >= 0xff; payloadSize -= 0xff)
> WRITE_CODE(0xff, 8, "payload_size");
> WRITE_CODE(payloadSize, 8, "payload_size");
> }
> - else if(m_payloadType != USER_DATA_REGISTERED_ITU_T_T35)
> + else
> WRITE_CODE(m_payloadSize, 8, "payload_size");
> /* virtual writeSEI method, write to bs */
> writeSEI(sps);
> diff -r 06217c0e0f5f -r 3872cba7827f source/encoder/sei.h
> --- a/source/encoder/sei.h Thu Jul 06 14:39:02 2017 +0530
> +++ b/source/encoder/sei.h Wed Jul 12 12:32:07 2017 +0530
> @@ -276,25 +276,17 @@
> m_payloadSize = 0;
> }
>
> - uint8_t *cim;
> + uint8_t *m_payload;
>
> // daniel.vt at samsung.com :: for the Creative Intent Meta Data
> Encoding ( seongnam.oh at samsung.com )
> void writeSEI(const SPS&)
> {
> - if (!cim)
> + if (!m_payload)
> return;
>
> - int i = 0;
> - int payloadSize = m_payloadSize;
> - while (cim[i] == 0xFF)
> - {
> - i++;
> - WRITE_CODE(0xFF, 8, "payload_size");
> - }
> - WRITE_CODE(cim[i], 8, "payload_size");
> - i++;
> - for (; i < payloadSize; ++i)
> - WRITE_CODE(cim[i], 8, "creative_intent_metadata");
> + uint32_t i = 0;
> + for (; i < m_payloadSize; ++i)
> + WRITE_CODE(m_payload[i], 8, "creative_intent_metadata");
> }
> };
> }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170712/82fea358/attachment.html>
More information about the x265-devel
mailing list