summaryrefslogtreecommitdiff
path: root/vp8/encoder/rdopt.c
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2011-11-21 15:45:10 +0000
committerPaul Wilkins <paulwilkins@google.com>2011-11-22 08:42:33 +0000
commitd39b5d05462c4b0755dd93814e887bda22b7327c (patch)
tree09d47b006942401564bd7aebd638885303ed0105 /vp8/encoder/rdopt.c
parent9bac509ac505910a316bf3879ab57a2283920057 (diff)
downloadlibvpx-d39b5d05462c4b0755dd93814e887bda22b7327c.tar
libvpx-d39b5d05462c4b0755dd93814e887bda22b7327c.tar.gz
libvpx-d39b5d05462c4b0755dd93814e887bda22b7327c.tar.bz2
libvpx-d39b5d05462c4b0755dd93814e887bda22b7327c.zip
Removal of Qindex LUTS.
One of the problems arising when tweaking or adjusting the quantizer tables is that there are a lot of look up tables that depend on the QINDEX. Any adjustment to the link between QINDEX and real quantizer therefore tends to break aspects of for example the rate control. In this check in I have replaced several of the look up tables with functions that approximate the same results as the old Q luts but use a formulaic approach based on real Q values rather than QIndex. This should hopefully make it easier to experiment with changes to the Q tables without always having to go through and hand optimize a set of look up tables. Once things stabilize we may choose to re-instate luts for the sake of performance. Patch 2: Addressed Ronald's comments. vp8_init_me_luts() Added so luts only initialized once. Change-Id: Ic80db2212d2fd01e08e8cb5c7dca1fda1102be57
Diffstat (limited to 'vp8/encoder/rdopt.c')
-rw-r--r--vp8/encoder/rdopt.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index ab801f30f..6d4ed40a8 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -32,6 +32,7 @@
#include "variance.h"
#include "mcomp.h"
#include "rdopt.h"
+#include "ratectrl.h"
#include "vpx_mem/vpx_mem.h"
#include "dct.h"
#include "vp8/common/systemdependent.h"
@@ -201,44 +202,23 @@ static int rdmult_lut[QINDEX_RANGE]=
};
#endif
/* values are now correlated to quantizer */
-static int sad_per_bit16lut[QINDEX_RANGE] =
-{
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 10, 10,
- 10, 10, 10, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12,
- 12, 12, 13, 13, 13, 13, 14, 14
-};
-static int sad_per_bit4lut[QINDEX_RANGE] =
+static int sad_per_bit16lut[QINDEX_RANGE];
+static int sad_per_bit4lut[QINDEX_RANGE];
+
+void vp8_init_me_luts()
{
- 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 5, 5,
- 5, 5, 5, 5, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 8, 8, 8,
- 8, 8, 9, 9, 9, 9, 9, 9,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 15, 15, 15, 15,
- 16, 16, 16, 16, 17, 17, 17, 18,
- 18, 18, 19, 19, 19, 20, 20, 20,
-};
+ int i;
+
+ // Initialize the sad lut tables using a formulaic calculation for now
+ // This is to make it easier to resolve the impact of experimental changes
+ // to the quantizer tables.
+ for ( i = 0; i < QINDEX_RANGE; i++ )
+ {
+ sad_per_bit16lut[i] =
+ (int)((0.0418*vp8_convert_qindex_to_q(i)) + 2.4107);
+ sad_per_bit4lut[i] = (int)((0.063*vp8_convert_qindex_to_q(i)) + 2.742);
+ }
+}
void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex)
{
@@ -247,9 +227,6 @@ void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex)
}
-
-
-
void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
{
int q;