[x265] [PATCH] bpyramid: Support for b-pyramid with b-adapt 0

Gopu Govindaswamy gopu at multicorewareinc.com
Wed Nov 20 09:57:25 CET 2013


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1384937803 -19800
# Node ID 8e9c965648f6a5f54fcadc6c4235a77d997b919f
# Parent  108ddc9e5c6b15e758ccbf08a0e923cbb7b28b5e
bpyramid: Support for b-pyramid with b-adapt 0

Test results for reference when enable and disable the b-pyramid with b-adapt=0

Cli option :  --bframes=10 --b-adapt=0 --b-pyramid=1 -f 100
Enable  B-references  : --b-pyramid=1
Disable B-references  : --b-pyramid=0

Results:
Enable / Disable

clip - BasketballDrive_1920x1080_50
Total time taken - 57.84s (1.73 fps) / 51.74s (1.93 fps)
Bitrates - 4725.37 / 5660.68
PSNR     - 37.178 / 37.178


Clip - Cactus_1920x1080_50
Total time taken - 41.90s (2.39 fps) / 47.08s (2.12 fps)
Bitrates - 3800.62 / 4838.73
PSNR     - 35.640 / 35.615


Clip - Johnny_1280x720_60
Total time taken - 10.41s (9.61 fps) / 10.34s (9.67 fps)
Bitrates - 327.21 / 383.25
PSNR     - 40.674 / 40.631

Clip - FourPeople_1280x720_60
Total time taken - 10.72s (9.33 fps) / 10.18s (9.82 fps)
Bitrates - 547.18 / 640.88
PSNR     - 39.808 / 39.789

diff -r 108ddc9e5c6b -r 8e9c965648f6 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue Nov 19 23:45:52 2013 -0600
+++ b/source/encoder/slicetype.cpp	Wed Nov 20 14:26:43 2013 +0530
@@ -859,13 +859,29 @@
             pic->m_lowres.sliceType = X265_TYPE_P;
         outputQueue.pushBack(*pic);
         numDecided++;
+
+        if (cfg->param.bpyramid && bframes > 1)
+        {
+            int bref = bframes / 2;
+            if (list[bref - 1]->m_lowres.sliceType == X265_TYPE_AUTO)
+            {
+                list[bref - 1]->m_lowres.sliceType = X265_TYPE_BREF;
+                outputQueue.pushBack(*list[bref - 1]);
+                numDecided++;
+            }
+        }
+
         for (int i = 0; i < bframes; i++)
         {
             pic = list[i];
             if (pic->m_lowres.sliceType == X265_TYPE_AUTO)
                 pic->m_lowres.sliceType = X265_TYPE_B;
-            outputQueue.pushBack(*pic);
-            numDecided++;
+
+            if (pic->m_lowres.sliceType != X265_TYPE_BREF)
+            {
+                outputQueue.pushBack(*pic);
+                numDecided++;
+            }
         }
     }
 }


More information about the x265-devel mailing list