X-Git-Url: https://git.piment-noir.org/?p=deb_x265.git;a=blobdiff_plain;f=source%2Fencoder%2Fnal.cpp;h=b0bc4c7f5d285531a6b3d04954a6863780277102;hp=c38c6516e4f912b202aaa1e7408fa248125199c9;hb=b53f7c52d8280ab63876efd6eb292c21430ac607;hpb=5c9b45285dd64723ad1dac380b98a7b1f3095674 diff --git a/source/encoder/nal.cpp b/source/encoder/nal.cpp index c38c651..b0bc4c7 100644 --- a/source/encoder/nal.cpp +++ b/source/encoder/nal.cpp @@ -193,12 +193,10 @@ uint32_t NALList::serializeSubstreams(uint32_t* streamSizeBytes, uint32_t stream { for (uint32_t i = 0; i < inSize; i++) { - if (bytes > 2 && !out[bytes - 2] && !out[bytes - 3] && out[bytes - 1] <= 0x03) + if (bytes >= 2 && !out[bytes - 2] && !out[bytes - 1] && inBytes[i] <= 0x03) { /* inject 0x03 to prevent emulating a start code */ - out[bytes] = out[bytes - 1]; - out[bytes - 1] = 0x03; - bytes++; + out[bytes++] = 3; } out[bytes++] = inBytes[i];