[x265] [PATCH] Add param check when store commonly RSP in SPS in 2-pass mode

ayacc564 at 163.com ayacc564 at 163.com
Fri Oct 28 04:33:29 CEST 2016


# HG changeset patch
# User ZhengWang <zheng at multicorewareinc.com>
# Date 1477621695 -28800
#      五 10月 28 10:28:15 2016 +0800
# Node ID d0969d59975b649eec6c7c018b67ecd59d21ad21
# Parent  d216cb9b3b4777fd768311cb3c7281b0fcf1213d
Add param check when store commonly RSP in SPS in 2-pass mode.
Modify param "multi-pass-opt-rps" test command.

diff -r d216cb9b3b47 -r d0969d59975b source/common/param.cpp
--- a/source/common/param.cpp	四 10月 27 12:44:15 2016 +0530
+++ b/source/common/param.cpp	五 10月 28 10:28:15 2016 +0800
@@ -1535,6 +1535,11 @@
         if (p->bframes)
             s += sprintf(s, " pbratio=%.2f", p->rc.pbFactor);
     }
+    if (p->bMultiPassOptRPS)
+    {
+        BOOL(p->bMultiPassOptRPS, "multi-pass-opt-rps");
+        BOOL(p->bRepeatHeaders, "repeat-headers");
+    }
 #undef BOOL
     return buf;
 }
diff -r d216cb9b3b47 -r d0969d59975b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	四 10月 27 12:44:15 2016 +0530
+++ b/source/encoder/encoder.cpp	五 10月 28 10:28:15 2016 +0800
@@ -2473,6 +2473,11 @@
             rce = &rce2Pass[endNum];
             if (rce->sliceType == I_SLICE)
             {
+                if (m_param->keyframeMin && (endNum - beginNum + 1 < m_param->keyframeMin))
+                {
+                    endNum++;
+                    continue;
+                }
                 break;
             }
             endNum++;
diff -r d216cb9b3b47 -r d0969d59975b source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	四 10月 27 12:44:15 2016 +0530
+++ b/source/encoder/ratecontrol.cpp	五 10月 28 10:28:15 2016 +0800
@@ -462,6 +462,12 @@
                 CMP_OPT_FIRST_PASS("keyint", m_param->keyframeMax);
                 CMP_OPT_FIRST_PASS("scenecut", m_param->scenecutThreshold);
                 CMP_OPT_FIRST_PASS("intra-refresh", m_param->bIntraRefresh);
+                if (m_param->bMultiPassOptRPS)
+                {
+                    CMP_OPT_FIRST_PASS("multi-pass-opt-rps", m_param->bMultiPassOptRPS);
+                    CMP_OPT_FIRST_PASS("repeat-headers", m_param->bRepeatHeaders);
+                    CMP_OPT_FIRST_PASS("min-keyint", m_param->keyframeMin);
+                }
 
                 if ((p = strstr(opts, "b-adapt=")) != 0 && sscanf(p, "b-adapt=%d", &i) && i >= X265_B_ADAPT_NONE && i <= X265_B_ADAPT_TRELLIS)
                 {
diff -r d216cb9b3b47 -r d0969d59975b source/test/rate-control-tests.txt
--- a/source/test/rate-control-tests.txt	四 10月 27 12:44:15 2016 +0530
+++ b/source/test/rate-control-tests.txt	五 10月 28 10:28:15 2016 +0800
@@ -42,4 +42,4 @@
 CrowdRun_1920x1080_50_10bit_422.yuv,--preset superfast --bitrate 2500 --pass 1 -F4 --slow-firstpass,--preset superfast --bitrate 2500 --pass 2 -F4
 RaceHorses_416x240_30_10bit.yuv,--preset medium --crf 26 --vbv-maxrate 1000 --vbv-bufsize 1000 --pass 1,--preset fast --bitrate 1000  --vbv-maxrate 1000 --vbv-bufsize 700 --pass 3 -F4,--preset slow --bitrate 500 --vbv-maxrate 500  --vbv-bufsize 700 --pass 2 -F4
 sita_1920x1080_30.yuv, --preset ultrafast --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 1 --vbv-bufsize 7000 --vbv-maxrate 5000, --preset ultrafast --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 2 --vbv-bufsize 7000 --vbv-maxrate 5000 --repeat-headers
-sita_1920x1080_30.yuv, --preset medium --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 1 --vbv-bufsize 7000 --vbv-maxrate 5000 --multi-pass-opt-rps, --preset medium --crf 20 --no-cutree --keyint 50 --no-open-gop --pass 2 --vbv-bufsize 7000 --vbv-maxrate 5000 --repeat-headers --multi-pass-opt-rps
+sita_1920x1080_30.yuv, --preset medium --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 1 --vbv-bufsize 7000 --vbv-maxrate 5000 --multi-pass-opt-rps, --preset medium --crf 20 --no-cutree --keyint 50 --min-keyint 50 --no-open-gop --pass 2 --vbv-bufsize 7000 --vbv-maxrate 5000 --repeat-headers --multi-pass-opt-rps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 3969 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161028/256b2111/attachment.bin>


More information about the x265-devel mailing list