[x265-commits] [x265] TComRom: hard-code the lambda tables
Steve Borho
steve at borho.org
Mon Apr 28 20:17:45 CEST 2014
details: http://hg.videolan.org/x265/rev/4f7658b3c78a
branches:
changeset: 6789:4f7658b3c78a
user: Steve Borho <steve at borho.org>
date: Mon Apr 28 13:17:25 2014 -0500
description:
TComRom: hard-code the lambda tables
diffstat:
source/Lib/TLibCommon/TComRom.cpp | 48 +++++++++++++++++++++++++++-----------
source/Lib/TLibCommon/TComRom.h | 4 +-
2 files changed, 36 insertions(+), 16 deletions(-)
diffs (80 lines):
diff -r 84d31cb2aeab -r 4f7658b3c78a source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp Mon Apr 28 18:54:09 2014 +0530
+++ b/source/Lib/TLibCommon/TComRom.cpp Mon Apr 28 13:17:25 2014 -0500
@@ -126,19 +126,41 @@ public:
}
};
-double x265_lambda_tab[MAX_MAX_QP + 1];
-double x265_lambda2_tab[MAX_MAX_QP + 1];
+// lambda = pow(2, (double)q / 6 - 2);
+const double x265_lambda_tab[MAX_MAX_QP + 1] = {
+ 0.2500, 0.2806, 0.3150, 0.3536, 0.3969,
+ 0.4454, 0.5000, 0.5612, 0.6300, 0.7071,
+ 0.7937, 0.8909, 1.0000, 1.1225, 1.2599,
+ 1.4142, 1.5874, 1.7818, 2.0000, 2.2449,
+ 2.5198, 2.8284, 3.1748, 3.5636, 4.0000,
+ 4.4898, 5.0397, 5.6569, 6.3496, 7.1272,
+ 8.0000, 8.9797, 10.0794, 11.3137, 12.6992,
+ 14.2544, 16.0000, 17.9594, 20.1587, 22.6274,
+ 25.3984, 28.5088, 32.0000, 35.9188, 40.3175,
+ 45.2548, 50.7968, 57.0175, 64.0000, 71.8376,
+ 80.6349, 90.5097, 101.5937, 114.0350, 128.0000,
+ 143.6751, 161.2699, 181.0193, 203.1873, 228.0701,
+ 256.0000, 287.3503, 322.5398, 362.0387, 406.3747,
+ 456.1401, 512.0000, 574.7006, 645.0796, 724.0773
+};
-static void initLambda(double scale)
-{
- for (int q = 0; q <= MAX_MAX_QP; q++)
- {
- double lambda = pow(2, (double)q / 6 - 2);
-
- x265_lambda_tab[q] = lambda;
- x265_lambda2_tab[q] = pow(lambda, 2) * scale;
- }
-}
+// lambda2 = pow(lambda, 2) * scale (0.85);
+const double x265_lambda2_tab[MAX_MAX_QP + 1] = {
+ 0.0531, 0.0669, 0.0843, 0.1063, 0.1339,
+ 0.1687, 0.2125, 0.2677, 0.3373, 0.4250,
+ 0.5355, 0.6746, 0.8500, 1.0709, 1.3493,
+ 1.7000, 2.1419, 2.6986, 3.4000, 4.2837,
+ 5.3972, 6.8000, 8.5675, 10.7943, 13.6000,
+ 17.1349, 21.5887, 27.2000, 34.2699, 43.1773,
+ 54.4000, 68.5397, 86.3546, 108.8000, 137.0794,
+ 172.7092, 217.6000, 274.1588, 345.4185, 435.2000,
+ 548.3176, 690.8369, 870.4000, 1096.6353, 1381.6739,
+ 1740.8000, 2193.2706, 2763.3478, 3481.6000, 4386.5411,
+ 5526.6955, 6963.2000, 8773.0823, 11053.3910, 13926.4000,
+ 17546.1645, 22106.7820, 27852.8000, 35092.3290, 44213.5640,
+ 55705.6000, 70184.6580, 88427.1280, 111411.2000, 140369.3161,
+ 176854.2561, 222822.4000, 280738.6321, 353708.5122, 445644.8000
+};
static int initialized /* = 0 */;
@@ -148,8 +170,6 @@ void initROM()
if (ATOMIC_CAS32(&initialized, 0, 1) == 1)
return;
- initLambda(0.85);
-
int i, c;
// g_aucConvertToBit[ x ]: log2(x/4), if x=4 -> 0, x=8 -> 1, x=16 -> 2, ...
diff -r 84d31cb2aeab -r 4f7658b3c78a source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h Mon Apr 28 18:54:09 2014 +0530
+++ b/source/Lib/TLibCommon/TComRom.h Mon Apr 28 13:17:25 2014 -0500
@@ -271,8 +271,8 @@ extern const uint32_t g_scalingListNum[S
extern const int g_winUnitX[MAX_CHROMA_FORMAT_IDC + 1];
extern const int g_winUnitY[MAX_CHROMA_FORMAT_IDC + 1];
-extern double x265_lambda_tab[MAX_MAX_QP + 1];
-extern double x265_lambda2_tab[MAX_MAX_QP + 1];
+extern const double x265_lambda_tab[MAX_MAX_QP + 1];
+extern const double x265_lambda2_tab[MAX_MAX_QP + 1];
// CABAC tables
extern const uint8_t g_lpsTable[64][4];
More information about the x265-commits
mailing list