[x265] [PATCH] [slices] allow number of slices more than rows (Issue #300-3)

chen chenm003 at 163.com
Thu Oct 27 18:12:58 CEST 2016


From e697fcd5fa0d36b33d42d01c2845ca36533dbd96 Mon Sep 17 00:00:00 2001
From: Min Chen <min.chen at multicorewareinc.com>
Date: Thu, 27 Oct 2016 11:11:09 -0500
Subject: [PATCH] [slices] allow number of slices more than rows (Issue #300-3)


---
 source/common/param.cpp    |    2 --
 source/encoder/encoder.cpp |   13 +++++++++++++
 source/encoder/nal.h       |    1 +
 3 files changed, 14 insertions(+), 2 deletions(-)


diff --git a/source/common/param.cpp b/source/common/param.cpp
index cd62310..d8ffa16 100644
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -1249,8 +1249,6 @@ int x265_check_params(x265_param* param)
         "qpmin exceeds supported range (0 to 69)");
     CHECK(param->log2MaxPocLsb < 4,
         "maximum of the picture order count can not be less than 4");
-    CHECK(1 > param->maxSlices || param->maxSlices > ((param->sourceHeight + param->maxCUSize - 1) / param->maxCUSize),
-        "The slices can not be more than number of rows");
     return check_failed;
 }
 
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 424018b..3734c24 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2120,6 +2120,19 @@ void Encoder::configure(x265_param *p)
         p->log2MaxPocLsb = 4;
     }
 
+    if (p->maxSlices < 1)
+    {
+        x265_log(p, X265_LOG_WARNING, "maxSlices can not be less than 1, force set to 1\n");
+        p->maxSlices = 1;
+    }
+
+    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)
+    {
+        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;
+    }
 }
 
 void Encoder::allocAnalysis(x265_analysis_data* analysis)
diff --git a/source/encoder/nal.h b/source/encoder/nal.h
index 15e542d..35f6961 100644
--- a/source/encoder/nal.h
+++ b/source/encoder/nal.h
@@ -34,6 +34,7 @@ class Bitstream;
 
 class NALList
 {
+public:
     static const int MAX_NAL_UNITS = 16;
 
 public:
-- 
1.7.9.msysgit.0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161028/2b48b8df/attachment.html>


More information about the x265-devel mailing list