[x265] [PATCH 1 of 3] TComRom: Adding chroma qp-lambda mapping tables from x264

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Mon Jun 16 13:19:39 CEST 2014


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1402915320 -19800
#      Mon Jun 16 16:12:00 2014 +0530
# Node ID ff3a85f715d43e2c21aec295426ae9dbe7c03d75
# Parent  e69a427e461f8c8944b68323a3d77295b65ec779
TComRom: Adding chroma qp-lambda mapping tables from x264

diff -r e69a427e461f -r ff3a85f715d4 source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Thu Jun 12 22:53:47 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.cpp	Mon Jun 16 16:12:00 2014 +0530
@@ -352,6 +352,43 @@
     { -2, 10, 58, -2 }
 };
 
+const uint16_t x265_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1] =
+{
+       16,    20,    25,    32,    40,    50,
+       64,    80,   101,   128,   161,   203,
+      256,   322,   406,   512,   645,   812,
+     1024,  1290,  1625,  2048,  2580,  3250,
+     4096,  5160,  6501,  8192, 10321, 13003,
+    16384, 20642, 26007, 32768, 41285, 52015,
+    65535
+};
+
+#define QP(qP) ((qP)+QP_BD_OFFSET)
+
+const uint8_t chroma_qp_table[QP_MAX_SPEC + 18 + 1 + 12*2] =
+{
+         0,      0,      0,      0,      0,      0,
+         0,      0,      0,      0,      0,      0,
+#if BIT_DEPTH > 9
+   QP(-12),QP(-11),QP(-10), QP(-9), QP(-8), QP(-7),
+#endif
+#if BIT_DEPTH > 8
+    QP(-6), QP(-5), QP(-4), QP(-3), QP(-2), QP(-1),
+#endif
+     QP(0),  QP(1),  QP(2),  QP(3),  QP(4),  QP(5),
+     QP(6),  QP(7),  QP(8),  QP(9), QP(10), QP(11),
+    QP(12), QP(13), QP(14), QP(15), QP(16), QP(17),
+    QP(18), QP(19), QP(20), QP(21), QP(22), QP(23),
+    QP(24), QP(25), QP(26), QP(27), QP(28), QP(29),
+    QP(29), QP(30), QP(31), QP(32), QP(32), QP(33),
+    QP(34), QP(34), QP(35), QP(35), QP(36), QP(36),
+    QP(37), QP(37), QP(37), QP(38), QP(38), QP(38),
+    QP(39), QP(39), QP(39), QP(39),
+    QP(39), QP(39), QP(39), QP(39), QP(39), QP(39),
+    QP(39), QP(39), QP(39), QP(39), QP(39), QP(39),
+};
+#undef QP
+
 const int g_quantScales[6] =
 {
     26214, 23302, 20560, 18396, 16384, 14564
diff -r e69a427e461f -r ff3a85f715d4 source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Thu Jun 12 22:53:47 2014 -0500
+++ b/source/Lib/TLibCommon/TComRom.h	Mon Jun 16 16:12:00 2014 +0530
@@ -273,6 +273,9 @@
 extern const double x265_lambda_tab[MAX_MAX_QP + 1];
 extern const double x265_lambda2_tab[MAX_MAX_QP + 1];
 
+extern const uint16_t x265_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1]; 
+extern const uint8_t chroma_qp_table[QP_MAX_SPEC + 18 + 1 + 12*2]; 
+
 // CABAC tables
 extern const uint8_t g_lpsTable[64][4];
 extern const uint8_t x265_exp2_lut[64];
diff -r e69a427e461f -r ff3a85f715d4 source/common/common.h
--- a/source/common/common.h	Thu Jun 12 22:53:47 2014 -0500
+++ b/source/common/common.h	Mon Jun 16 16:12:00 2014 +0530
@@ -146,6 +146,9 @@
 #define X265_MIN4(a, b, c, d) X265_MIN((a), X265_MIN3((b), (c), (d)))
 #define X265_MAX4(a, b, c, d) X265_MAX((a), X265_MAX3((b), (c), (d)))
 #define QP_BD_OFFSET (6 * (X265_DEPTH - 8))
+#define QP_MAX_SPEC (MAX_QP + QP_BD_OFFSET)
+#define MAX_CHROMA_LAMBDA_OFFSET    36
+
 
 // arbitrary, but low because SATD scores are 1/4 normal
 #define X265_LOOKAHEAD_QP (12 + QP_BD_OFFSET)


More information about the x265-devel mailing list