[x265] [PATCH] Fix issues in configuring cbQpOffset and crQpOffset for 444 input

gopi.satykrishna at multicorewareinc.com gopi.satykrishna at multicorewareinc.com
Tue May 7 07:33:02 CEST 2019


# HG changeset patch
# User gopi Satykrishna Akisetty
# Date 1557138241 -19800
#      Mon May 06 15:54:01 2019 +0530
# Node ID 27b80b586cf86c6786b70d41b3e95ac4dc4a967b
# Parent  feec4bdf98663ac4a2561b63e1ccec423c7d26a4
Fix issues in configuring cbQpOffset and crQpOffset for 444 input

diff -r feec4bdf9866 -r 27b80b586cf8 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Tue Apr 30 09:41:10 2019 +0530
+++ b/doc/reST/cli.rst	Mon May 06 15:54:01 2019 +0530
@@ -1333,6 +1333,10 @@
 judder is happening, and allow the encoder to use some blur in these
 areas of high motion.
 
+In 444, chroma gets twice as much resolution, so halve the quality when psy-rd is enabled.
+So when psy-rd is enabled for 444 videos, cbQpOffset and crQpOffset are set to value 6,
+if they are not explicitly set.
+
 .. option:: --psy-rd <float>
 
 	Influence rate distortion optimizated mode decision to preserve the
diff -r feec4bdf9866 -r 27b80b586cf8 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Apr 30 09:41:10 2019 +0530
+++ b/source/encoder/encoder.cpp	Mon May 06 15:54:01 2019 +0530
@@ -80,6 +80,7 @@
  * TODO: come up an algorithm for adoptive threshold */
 #define MVTHRESHOLD (10*10)
 #define PU_2Nx2N 1
+#define MAX_CHROMA_QP_OFFSET 12
 static const char* defaultAnalysisFileName = "x265_analysis.dat";
 
 using namespace X265_NS;
@@ -2802,8 +2803,13 @@
     /* In 444, chroma gets twice as much resolution, so halve quality when psy-rd is enabled */
     if (p->internalCsp == X265_CSP_I444 && p->psyRd)
     {
-        p->cbQpOffset += 6;
-        p->crQpOffset += 6;
+        if (!p->cbQpOffset && !p->crQpOffset)
+        {
+            p->cbQpOffset = MAX_CHROMA_QP_OFFSET / 2;
+            p->crQpOffset = MAX_CHROMA_QP_OFFSET / 2;
+            x265_log(p, X265_LOG_WARNING, "halving the quality when psy-rd is enabled for 444 input."
+                     " Setting cbQpOffset = %d and crQpOffset = %d\n", p->cbQpOffset, p->crQpOffset);
+        }
     }
 
     if (p->bLossless)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190507/743cd142/attachment.bin>


More information about the x265-devel mailing list