[x265] [PATCH] fix: output wrong WppEntryOffset when emulating start code at end of WPP row

Min Chen chenm003 at 163.com
Wed Dec 17 00:53:24 CET 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1418773994 28800
# Node ID edcda7c9e2c097f02eef41a22f07ee18aa9b8e8d
# Parent  b1c2ef980dfe59c486454a8838c2c1bb74bf4d32
fix: output wrong WppEntryOffset when emulating start code at end of WPP row

diff -r b1c2ef980dfe -r edcda7c9e2c0 source/encoder/nal.cpp
--- a/source/encoder/nal.cpp	Thu Dec 11 16:52:06 2014 -0600
+++ b/source/encoder/nal.cpp	Tue Dec 16 15:53:14 2014 -0800
@@ -193,12 +193,10 @@
         {
             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];



More information about the x265-devel mailing list