[x265] [PATCH] fix maxSlices limit checking

Mateusz Brzostek mateusz at msystem.waw.pl
Sat Mar 11 00:34:22 CET 2017


In message
[x265] x265 crashes/gets stuck when giving more than '--slices 16'
there is description of crash. You can reproduce this crash by:
x265 --slices 17 ducks_take_off_1080p50.y4m out.hevc

This small patch avoid the crash. Please review.

# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1489188353 -3600
#      Sat Mar 11 00:25:53 2017 +0100
# Node ID b5daf53bd011d4c0e08880de4fa46310f1111e32
# Parent  88fd9082764c7d7b4668e30763a93215980efd70
fix maxSlices limit checking

diff -r 88fd9082764c -r b5daf53bd011 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp    Wed Mar 08 17:15:59 2017 +0530
+++ b/source/encoder/encoder.cpp    Sat Mar 11 00:25:53 2017 +0100
@@ -2294,7 +2294,7 @@
 
     const uint32_t numRows = (p->sourceHeight + p->maxCUSize - 1) / p->maxCUSize;
     const uint32_t slicesLimit = X265_MIN(numRows, NALList::MAX_NAL_UNITS - 1);
-    if (p->maxSlices > numRows)
+    if (p->maxSlices > slicesLimit)
     {
         x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit);
         p->maxSlices = slicesLimit;

-------------- next part --------------
# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1489188353 -3600
#      Sat Mar 11 00:25:53 2017 +0100
# Node ID b5daf53bd011d4c0e08880de4fa46310f1111e32
# Parent  88fd9082764c7d7b4668e30763a93215980efd70
fix maxSlices limit checking

diff -r 88fd9082764c -r b5daf53bd011 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Mar 08 17:15:59 2017 +0530
+++ b/source/encoder/encoder.cpp	Sat Mar 11 00:25:53 2017 +0100
@@ -2294,7 +2294,7 @@
 
     const uint32_t numRows = (p->sourceHeight + p->maxCUSize - 1) / p->maxCUSize;
     const uint32_t slicesLimit = X265_MIN(numRows, NALList::MAX_NAL_UNITS - 1);
-    if (p->maxSlices > numRows)
+    if (p->maxSlices > slicesLimit)
     {
         x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit);
         p->maxSlices = slicesLimit;


More information about the x265-devel mailing list