[x265-commits] [x265] rc: release RC lock after RateControlStart for CQP and CR...

Aarthi at videolan.org Aarthi at videolan.org
Thu Mar 19 00:20:33 CET 2015


details:   http://hg.videolan.org/x265/rev/a277173fd57a
branches:  
changeset: 9810:a277173fd57a
user:      Aarthi Thirumalai
date:      Tue Mar 17 11:52:44 2015 +0530
description:
rc: release RC lock after RateControlStart for CQP and CRF(without VBV)

RateControlUpdateStats is not needed for CQP and CRF - without vbv,
prevent floating point divide by zero issue in CQP
Subject: [x265] smoke-test: ABR tests need to force -FN, remove 1080p slow test case

details:   http://hg.videolan.org/x265/rev/f391905eff32
branches:  
changeset: 9811:f391905eff32
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 18 18:14:48 2015 -0500
description:
smoke-test: ABR tests need to force -FN, remove 1080p slow test case
Subject: [x265] rc-test: reduce veryslow encodes, fix a couple broken tests

details:   http://hg.videolan.org/x265/rev/cbfa66e0b50c
branches:  
changeset: 9812:cbfa66e0b50c
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 18 18:16:51 2015 -0500
description:
rc-test: reduce veryslow encodes, fix a couple broken tests

diffstat:

 source/encoder/frameencoder.cpp    |  24 ++++++++++++------------
 source/encoder/ratecontrol.cpp     |  24 +++++++++++++++++++-----
 source/test/rate-control-tests.txt |  16 ++++------------
 source/test/smoke-tests.txt        |  11 +++++------
 4 files changed, 40 insertions(+), 35 deletions(-)

diffs (145 lines):

diff -r bfd74f29be67 -r cbfa66e0b50c source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Mar 18 10:59:54 2015 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Mar 18 18:16:51 2015 -0500
@@ -1042,24 +1042,24 @@ void FrameEncoder::processRowEncoder(int
      * after refLagRows (the number of rows reference frames must have completed
      * before referencees may begin encoding) */
     uint32_t rowCount = 0;
-    if (m_param->rc.rateControlMode == X265_RC_ABR)
+    if (m_param->rc.rateControlMode == X265_RC_ABR || bIsVbv)
     {
         if ((uint32_t)m_rce.encodeOrder <= 2 * (m_param->fpsNum / m_param->fpsDenom))
             rowCount = X265_MIN((m_numRows + 1) / 2, m_numRows - 1);
         else
             rowCount = X265_MIN(m_refLagRows, m_numRows - 1);
-    }
-    if (row == rowCount)
-    {
-        m_rce.rowTotalBits = 0;
-        if (bIsVbv)
-            for (uint32_t i = 0; i < rowCount; i++)
-                m_rce.rowTotalBits += curEncData.m_rowStat[i].encodedBits;
-        else
-            for (uint32_t cuAddr = 0; cuAddr < rowCount * numCols; cuAddr++)
-                m_rce.rowTotalBits += curEncData.m_cuStat[cuAddr].totalBits;
+        if (row == rowCount)
+        {
+            m_rce.rowTotalBits = 0;
+            if (bIsVbv)
+                for (uint32_t i = 0; i < rowCount; i++)
+                    m_rce.rowTotalBits += curEncData.m_rowStat[i].encodedBits;
+            else
+                for (uint32_t cuAddr = 0; cuAddr < rowCount * numCols; cuAddr++)
+                    m_rce.rowTotalBits += curEncData.m_cuStat[cuAddr].totalBits;
 
-        m_top->m_rateControl->rateControlUpdateStats(&m_rce);
+            m_top->m_rateControl->rateControlUpdateStats(&m_rce);
+        }
     }
 
     /* flush row bitstream (if WPP and no SAO) or flush frame if no WPP and no SAO */
diff -r bfd74f29be67 -r cbfa66e0b50c source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Mar 18 10:59:54 2015 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Mar 18 18:16:51 2015 -0500
@@ -1077,9 +1077,20 @@ int RateControl::rateControlStart(Frame*
             rce->frameSizePlanned = predictSize(&m_pred[m_sliceType], m_qp, (double)m_currentSatd);
         }
     }
-    // Do not increment m_startEndOrder here. Make rateControlEnd of previous thread
-    // to wait until rateControlUpdateStats of this frame is called
     m_framesDone++;
+
+    /* CQP and CRF (without capped VBV) doesn't use mid-frame statistics to 
+     * tune RateControl parameters for other frames.
+     * Hence, for these modes, update m_startEndOrder and unlock RC for previous threads waiting in
+     * RateControlEnd here.those modes here. For the rest - ABR
+     * and VBV, unlock only after rateControlUpdateStats of this frame is called */
+    if (m_param->rc.rateControlMode != X265_RC_ABR && !m_isVbv)
+    {
+        m_startEndOrder.incr();
+
+        if (rce->encodeOrder < m_param->frameNumThreads - 1)
+            m_startEndOrder.incr(); // faked rateControlEnd calls for negative frames
+    }
     return m_qp;
 }
 
@@ -1587,10 +1598,13 @@ void RateControl::rateControlUpdateStats
 
     /* do not allow the next frame to enter rateControlStart() until this
      * frame has updated its mid-frame statistics */
-    m_startEndOrder.incr();
+    if (m_param->rc.rateControlMode == X265_RC_ABR || m_isVbv)
+    {
+        m_startEndOrder.incr();
 
-    if (rce->encodeOrder < m_param->frameNumThreads - 1)
-        m_startEndOrder.incr(); // faked rateControlEnd calls for negative frames
+        if (rce->encodeOrder < m_param->frameNumThreads - 1)
+            m_startEndOrder.incr(); // faked rateControlEnd calls for negative frames
+    }
 }
 
 void RateControl::checkAndResetABR(RateControlEntry* rce, bool isFrameDone)
diff -r bfd74f29be67 -r cbfa66e0b50c source/test/rate-control-tests.txt
--- a/source/test/rate-control-tests.txt	Wed Mar 18 10:59:54 2015 +0530
+++ b/source/test/rate-control-tests.txt	Wed Mar 18 18:16:51 2015 -0500
@@ -15,8 +15,6 @@ 112_1920x1080_25.yuv,--preset superfast 
 112_1920x1080_25.yuv,--preset superfast --bitrate 30000 --vbv-maxrate 30000 --vbv-bufsize 30000 --repeat-headers
 112_1920x1080_25.yuv,--preset superfast --bitrate 4000 --vbv-maxrate 6000 --vbv-bufsize 6000 --aud
 112_1920x1080_25.yuv,--preset veryslow --bitrate 1000 --vbv-maxrate 3000 --vbv-bufsize 3000 --repeat-headers
-112_1920x1080_25.yuv,--preset veryslow --bitrate 10000 --vbv-maxrate 15000 --vbv-bufsize 15000 --aud
-112_1920x1080_25.yuv,--preset veryslow --bitrate 4000 --vbv-maxrate 4000 --vbv-bufsize 6000 --hrd
 big_buck_bunny_360p24.y4m,--preset medium --bitrate 1000 --vbv-bufsize 3000 --vbv-maxrate 3000 --repeat-headers
 big_buck_bunny_360p24.y4m,--preset medium --bitrate 3000 --vbv-bufsize 3000 --vbv-maxrate 3000 --hrd
 big_buck_bunny_360p24.y4m,--preset medium --bitrate 400 --vbv-bufsize 600 --vbv-maxrate 600 --aud
@@ -25,18 +23,12 @@ big_buck_bunny_360p24.y4m,--preset super
 big_buck_bunny_360p24.y4m,--preset superfast --bitrate 3000 --vbv-bufsize 9000 --vbv-maxrate 9000 --repeat-headers
 big_buck_bunny_360p24.y4m,--preset superfast --bitrate 400 --vbv-bufsize 600 --vbv-maxrate 400 --hrd
 big_buck_bunny_360p24.y4m,--preset superfast --crf 6 --vbv-bufsize 1000 --vbv-maxrate 1000 --aud
-big_buck_bunny_360p24.y4m,--preset veryslow --bitrate 1000 --vbv-bufsize 1500 --vbv-maxrate 1000 --hrd
-big_buck_bunny_360p24.y4m,--preset veryslow --bitrate 400 --vbv-bufsize 400 --vbv-maxrate 400 --repeat-headers
-big_buck_bunny_360p24.y4m,--preset veryslow --bitrate 4500 --vbv-bufsize 4500 --vbv-maxrate 4500 --aud
-big_buck_bunny_360p24.y4m,--preset veryslow --crf 12 --vbv-bufsize 400 --vbv-maxrate 400 --hrd
 
 # multi-pass rate control tests
-big_buck_bunny_360p24.y4m,--preset veryslow --crf 40 --pass 1,--preset veryslow --crf 40 --pass 2,--preset veryslow --bitrate 200 --pass 2
-big_buck_bunny_360p24.y4m,--preset superfast --bitrate 30000 --pass 1 -F4,--preset superfast --bitrate 30000 --pass 2 -F4
-big_buck_bunny_360p24.y4m,--preset medium --bitrate 700 --vbv-bufsize 900 --vbv-maxrate 700 --pass 1 -F4 --slow-firstpass,--preset medium --bitrate 700 --vbv-bufsize 900 --vbv-maxrate 700 --pass 2 -F4
-112_1920x1080_25.yuv,--preset veryslow --bitrate 1000 --pass 1 -F4,--preset veryslow --bitrate 1000 --pass 2 -F4
+big_buck_bunny_360p24.y4m,--preset slow --crf 40 --pass 1,--preset slow --bitrate 200 --pass 2
+big_buck_bunny_360p24.y4m,--preset medium --bitrate 700 -pass 1 -F4 --slow-firstpass,--preset medium --bitrate 700 --vbv-bufsize 900 --vbv-maxrate 700 --pass 2 -F4
+112_1920x1080_25.yuv,--preset slow --bitrate 1000 --pass 1 -F4,--preset slow --bitrate 1000 --pass 2 -F4
 112_1920x1080_25.yuv,--preset superfast --crf 12 --pass 1,--preset superfast --bitrate 4000 --pass 2 -F4
 RaceHorses_416x240_30_10bit.yuv,--preset veryslow --crf 40 --pass 1, --preset veryslow --bitrate 200 --pass 2 -F4
 RaceHorses_416x240_30_10bit.yuv,--preset superfast --bitrate 600 --pass 1 -F4 --slow-firstpass,--preset superfast --bitrate 600 --pass 2 -F4
-RaceHorses_416x240_30_10bit.yuv,--preset medium --crf 28 --pass 1,--preset medium --bitrate 750 --pass 2 -F4
-RaceHorses_416x240_30_10bit.yuv,--preset medium --crf 26 --pass 1,--preset medium --bitrate 1000 --pass 3 -F4,--preset medium --bitrate 1000 --pass 2 -F4
+RaceHorses_416x240_30_10bit.yuv,--preset medium --crf 26 --pass 1,--preset medium --bitrate 500 --pass 3 -F4,--preset medium --bitrate 500 --pass 2 -F4
diff -r bfd74f29be67 -r cbfa66e0b50c source/test/smoke-tests.txt
--- a/source/test/smoke-tests.txt	Wed Mar 18 10:59:54 2015 +0530
+++ b/source/test/smoke-tests.txt	Wed Mar 18 18:16:51 2015 -0500
@@ -1,18 +1,17 @@
 # List of command lines to be run by smoke tests, see https://bitbucket.org/sborho/test-harness
 
 big_buck_bunny_360p24.y4m,--preset=superfast --bitrate 400 --vbv-bufsize 600 --vbv-maxrate 400 --hrd --aud --repeat-headers
-big_buck_bunny_360p24.y4m,--preset=medium --bitrate 1000 --cu-lossless --scaling-list default
+big_buck_bunny_360p24.y4m,--preset=medium --bitrate 1000 -F4 --cu-lossless --scaling-list default
 big_buck_bunny_360p24.y4m,--preset=slower --no-weightp --cu-stats --pme
-washdc_422_ntsc.y4m,--preset=faster --strong-intra-smoothing  --keyint 1
+washdc_422_ntsc.y4m,--preset=faster --no-strong-intra-smoothing --keyint 1
 washdc_422_ntsc.y4m,--preset=medium --qp 40 --nr-inter 400 -F4
-washdc_422_ntsc.y4m,--preset=veryslow --pmode --tskip
-old_town_cross_444_720p50.y4m,--preset=ultrafast --weightp
+washdc_422_ntsc.y4m,--preset=veryslow --pmode --tskip --rdoq-level 0
+old_town_cross_444_720p50.y4m,--preset=ultrafast --weightp --keyint -1
 old_town_cross_444_720p50.y4m,--preset=fast --keyint 20 --min-cu-size 16
 old_town_cross_444_720p50.y4m,--preset=slow --sao-non-deblock --pmode
 RaceHorses_416x240_30_10bit.yuv,--preset=veryfast --cu-stats --max-tu-size 8
-RaceHorses_416x240_30_10bit.yuv,--preset=slower --bitrate 500 --rdoq-level 1
+RaceHorses_416x240_30_10bit.yuv,--preset=slower --bitrate 500 -F4 --rdoq-level 1
 CrowdRun_1920x1080_50_10bit_444.yuv,--preset=ultrafast --constrained-intra --min-keyint 5 --keyint 10
 CrowdRun_1920x1080_50_10bit_444.yuv,--preset=medium --max-tu-size 16
-CrowdRun_1920x1080_50_10bit_444.yuv,--preset=slow --keyint -1 --rdoq-level 0
 DucksAndLegs_1920x1080_60_10bit_422.yuv, --preset=veryfast --min-cu 16
 DucksAndLegs_1920x1080_60_10bit_422.yuv, --preset=fast --weightb --interlace bff


More information about the x265-commits mailing list