summaryrefslogtreecommitdiff
path: root/vp8/encoder/onyx_if.c
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2011-12-02 14:57:21 +0000
committerPaul Wilkins <paulwilkins@google.com>2011-12-02 15:30:01 +0000
commit8487a68baf32fc86af55c39cc7fd06c3444523d5 (patch)
tree8558833c85bda0c92d7dfcae56106f2d4d5cf012 /vp8/encoder/onyx_if.c
parent2b307b38e3d77555c6da3a65573d781c0a991a5b (diff)
downloadlibvpx-8487a68baf32fc86af55c39cc7fd06c3444523d5.tar
libvpx-8487a68baf32fc86af55c39cc7fd06c3444523d5.tar.gz
libvpx-8487a68baf32fc86af55c39cc7fd06c3444523d5.tar.bz2
libvpx-8487a68baf32fc86af55c39cc7fd06c3444523d5.zip
Further work on extended Q range.
Fixed some further QIndex related issues and replaced some tables (eg zbin and rounding) Also Added function (currently disabled by default) to populate the main AC and DC quantizer tables. Using the original AC range the resulting computed DC values give behavior broadly comparable on the DERF set. That is not to say that the equations will hold good over a more extended range. The purpose of this code is to make it easier to experiment with further alterations to the Q range and distribution of Q values plus the relative weights given to AC and DC. The function find_fp_qindex() ensures that changes to the Q tables are reflected in the value passed in to the first pass code. Slight experimental adjustment to static segment Q offset. Change-Id: I36186267d55dfc2a3d565d0cff7218ef300d1cd5
Diffstat (limited to 'vp8/encoder/onyx_if.c')
-rw-r--r--vp8/encoder/onyx_if.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index d7abbaaaf..265c2dd4c 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -195,6 +195,8 @@ int calculate_minq_index( double maxq,
if ( minqtarget <= vp8_convert_qindex_to_q(i) )
return i;
}
+ if ( i == QINDEX_RANGE )
+ return QINDEX_RANGE-1;
}
void init_minq_luts()
{
@@ -251,9 +253,11 @@ void vp8_initialize()
vp8_initialize_common();
//vp8_dmachine_specific_config();
vp8_tokenize_initialize();
+#if CONFIG_EXTEND_QRANGE
+ vp8_init_quant_tables();
+#endif
vp8_init_me_luts();
init_minq_luts();
-
init_done = 1;
}
}
@@ -467,7 +471,7 @@ static void init_seg_features(VP8_COMP *cpi)
xd->update_mb_segmentation_map = 1;
xd->update_mb_segmentation_data = 1;
- set_segdata( xd, 1, SEG_LVL_ALT_Q, -(2+(cpi->ni_av_qi >> 3)) );
+ set_segdata( xd, 1, SEG_LVL_ALT_Q, -(3+(cpi->ni_av_qi >> 3)) );
set_segdata( xd, 1, SEG_LVL_ALT_LF, -2 );
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
@@ -3281,12 +3285,30 @@ static int decide_key_frame(VP8_COMP *cpi)
return code_key_frame;
}
-#if !CONFIG_EXTEND_QRANGE
+
+/*#if !CONFIG_EXTEND_QRANGE
#define FIRSTPASS_QINDEX 26
#else
#define FIRSTPASS_QINDEX 49
-#endif
+#endif*/
+int find_fp_qindex()
+{
+ int i;
+
+ for ( i = 0; i < QINDEX_RANGE; i++ )
+ {
+ if ( vp8_convert_qindex_to_q(i) >= 30.0 )
+ {
+ break;
+ }
+ }
+
+ if ( i == QINDEX_RANGE )
+ i--;
+
+ return i;
+}
#if !(CONFIG_REALTIME_ONLY)
static void Pass1Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
@@ -3294,7 +3316,9 @@ static void Pass1Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
(void) size;
(void) dest;
(void) frame_flags;
- vp8_set_quantizer(cpi, FIRSTPASS_QINDEX);
+
+
+ vp8_set_quantizer(cpi, find_fp_qindex());
scale_and_extend_source(cpi->un_scaled_source, cpi);
vp8_first_pass(cpi);