[x265] [PATCH 2 of 4] add methods to convert qpAqoffsets to qscale

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Oct 21 19:35:53 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1382375163 -19800
#      Mon Oct 21 22:36:03 2013 +0530
# Node ID c7c0e7e85437aca8595dbc53432fd66ae85ac4a8
# Parent  371bb66ae9345ebed4e0c028daeec1d65009a663
 add methods to convert qpAqoffsets to qscale

diff -r 371bb66ae934 -r c7c0e7e85437 source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Mon Oct 21 22:14:23 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.cpp	Mon Oct 21 22:36:03 2013 +0530
@@ -613,5 +613,13 @@
     1,  1,  1,  1,
     1,  1,  1,  1
 };
+
+const UChar x265_exp2_lut[64] =
+{
+    0,  3,  6,  8,  11, 14,  17,  20,  23,  26,  29,  32,  36,  39,  42,  45,
+    48,  52,  55,  58,  62,  65,  69,  72,  76,  80,  83,  87,  91,  94,  98,  102,
+    106,  110,  114,  118,  122,  126,  130,  135,  139,  143,  147,  152,  156,  161,  165,  170,
+    175,  179,  184,  189,  194,  198,  203,  208,  214,  219,  224,  229,  234,  240,  245,  250
+};
 }
 //! \}
diff -r 371bb66ae934 -r c7c0e7e85437 source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Mon Oct 21 22:14:23 2013 +0530
+++ b/source/Lib/TLibCommon/TComRom.h	Mon Oct 21 22:36:03 2013 +0530
@@ -298,6 +298,7 @@
 // CABAC tables
 extern const UChar g_lpsTable[64][4];
 extern const UChar g_renormTable[32];
+extern const UChar x265_exp2_lut[64];
 }
 
 #endif  //ifndef X265_TCOMROM_H
diff -r 371bb66ae934 -r c7c0e7e85437 source/common/common.cpp
--- a/source/common/common.cpp	Mon Oct 21 22:14:23 2013 +0530
+++ b/source/common/common.cpp	Mon Oct 21 22:36:03 2013 +0530
@@ -71,6 +71,15 @@
 
 #endif // if _WIN32
 
+/* Not a general-purpose function; multiplies input by -1/6 to convert
+ * qp to qscale. */
+int x265_exp2fix8(double x)
+{
+    int i =(int) x * (-64.f / 6.f) + 512.5f;
+    if (i < 0) return 0;
+    if (i > 1023) return 0xffff;
+    return (x265_exp2_lut[i & 63] + 256) << (i >> 6) >> 8;
+}
 void x265_log(x265_param_t *param, int level, const char *fmt, ...)
 {
     if (param && level > param->logLevel)
diff -r 371bb66ae934 -r c7c0e7e85437 source/common/common.h
--- a/source/common/common.h	Mon Oct 21 22:14:23 2013 +0530
+++ b/source/common/common.h	Mon Oct 21 22:36:03 2013 +0530
@@ -115,5 +115,5 @@
 void x265_print_params(x265_param_t *param);
 int x265_set_globals(x265_param_t *param);
 char *x265_param2string(x265_param_t *p);
-
+int x265_exp2fix8(double x);
 #endif // ifndef X265_COMMON_H


More information about the x265-devel mailing list