<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div>From e697fcd5fa0d36b33d42d01c2845ca36533dbd96 Mon Sep 17 00:00:00 2001</div><div>From: Min Chen <min.chen@multicorewareinc.com></div><div>Date: Thu, 27 Oct 2016 11:11:09 -0500</div><div>Subject: [PATCH] [slices] allow number of slices more than rows (Issue #300-3)</div><div><br></div><div>---</div><div> source/common/param.cpp    |    2 --</div><div> source/encoder/encoder.cpp |   13 +++++++++++++</div><div> source/encoder/nal.h       |    1 +</div><div> 3 files changed, 14 insertions(+), 2 deletions(-)</div><div><br></div><div>diff --git a/source/common/param.cpp b/source/common/param.cpp</div><div>index cd62310..d8ffa16 100644</div><div>--- a/source/common/param.cpp</div><div>+++ b/source/common/param.cpp</div><div>@@ -1249,8 +1249,6 @@ int x265_check_params(x265_param* param)</div><div>         "qpmin exceeds supported range (0 to 69)");</div><div>     CHECK(param->log2MaxPocLsb < 4,</div><div>         "maximum of the picture order count can not be less than 4");</div><div>-    CHECK(1 > param->maxSlices || param->maxSlices > ((param->sourceHeight + param->maxCUSize - 1) / param->maxCUSize),</div><div>-        "The slices can not be more than number of rows");</div><div>     return check_failed;</div><div> }</div><div> </div><div>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp</div><div>index 424018b..3734c24 100644</div><div>--- a/source/encoder/encoder.cpp</div><div>+++ b/source/encoder/encoder.cpp</div><div>@@ -2120,6 +2120,19 @@ void Encoder::configure(x265_param *p)</div><div>         p->log2MaxPocLsb = 4;</div><div>     }</div><div> </div><div>+    if (p->maxSlices < 1)</div><div>+    {</div><div>+        x265_log(p, X265_LOG_WARNING, "maxSlices can not be less than 1, force set to 1\n");</div><div>+        p->maxSlices = 1;</div><div>+    }</div><div>+</div><div>+    const uint32_t numRows = (p->sourceHeight + p->maxCUSize - 1) / p->maxCUSize;</div><div>+    const uint32_t slicesLimit = X265_MIN(numRows, NALList::MAX_NAL_UNITS - 1);</div><div>+    if (p->maxSlices > numRows)</div><div>+    {</div><div>+        x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit);</div><div>+        p->maxSlices = slicesLimit;</div><div>+    }</div><div> }</div><div> </div><div> void Encoder::allocAnalysis(x265_analysis_data* analysis)</div><div>diff --git a/source/encoder/nal.h b/source/encoder/nal.h</div><div>index 15e542d..35f6961 100644</div><div>--- a/source/encoder/nal.h</div><div>+++ b/source/encoder/nal.h</div><div>@@ -34,6 +34,7 @@ class Bitstream;</div><div> </div><div> class NALList</div><div> {</div><div>+public:</div><div>     static const int MAX_NAL_UNITS = 16;</div><div> </div><div> public:</div><div>-- </div><div>1.7.9.msysgit.0</div><div><br></div></div>