ref: 79c51573c104123a4ad5235738ae41def8646f8f
parent: a5d51fbdf3cacec5f0a8d3619a259fee63652aeb
parent: 5b8c834c1ae70b9b8d0e13c243a9696b10af8833
author: Dmitry Kovalev <[email protected]>
date: Mon Mar 24 12:12:42 EDT 2014
Merge "Initialization code cleanup."
--- a/vp9/common/vp9_alloccommon.c
+++ b/vp9/common/vp9_alloccommon.c
@@ -210,10 +210,6 @@
vp9_free_internal_frame_buffers(&cm->int_frame_buffers);
}
-void vp9_initialize_common() {
- vp9_init_neighbors();
-}
-
void vp9_update_frame_size(VP9_COMMON *cm) {
const int aligned_width = ALIGN_POWER_OF_TWO(cm->width, MI_SIZE_LOG2);
const int aligned_height = ALIGN_POWER_OF_TWO(cm->height, MI_SIZE_LOG2);
--- a/vp9/common/vp9_alloccommon.h
+++ b/vp9/common/vp9_alloccommon.h
@@ -12,24 +12,23 @@
#ifndef VP9_COMMON_VP9_ALLOCCOMMON_H_
#define VP9_COMMON_VP9_ALLOCCOMMON_H_
-#include "vp9/common/vp9_onyxc_int.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-void vp9_initialize_common();
+struct VP9Common;
-void vp9_remove_common(VP9_COMMON *cm);
+void vp9_remove_common(struct VP9Common *cm);
-int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height);
-int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height);
-void vp9_free_frame_buffers(VP9_COMMON *cm);
+int vp9_resize_frame_buffers(struct VP9Common *cm, int width, int height);
+int vp9_alloc_frame_buffers(struct VP9Common *cm, int width, int height);
-void vp9_update_frame_size(VP9_COMMON *cm);
+void vp9_free_frame_buffers(struct VP9Common *cm);
-void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm);
+void vp9_update_frame_size(struct VP9Common *cm);
+
+void vp9_swap_mi_and_prev_mi(struct VP9Common *cm);
#ifdef __cplusplus
} // extern "C"
--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -104,7 +104,7 @@
static int init_done = 0;
if (!init_done) {
- vp9_initialize_common();
+ vp9_init_neighbors();
vp9_init_quant_tables();
init_done = 1;
}
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -148,13 +148,13 @@
static int init_done = 0;
if (!init_done) {
- vp9_initialize_common();
+ vp9_init_neighbors();
+ vp9_init_quant_tables();
+
vp9_coef_tree_initialize();
vp9_tokenize_initialize();
- vp9_init_quant_tables();
vp9_init_me_luts();
vp9_rc_init_minq_luts();
- // init_base_skip_probs();
vp9_entropy_mv_init();
vp9_entropy_mode_init();
init_done = 1;
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -55,10 +55,9 @@
// formulaic approach to facilitate easier adjustment of the Q tables.
// The formulae were derived from computing a 3rd order polynomial best
// fit to the original data (after plotting real maxq vs minq (not q index))
-static int calculate_minq_index(double maxq,
- double x3, double x2, double x1, double c) {
+static int get_minq_index(double maxq, double x3, double x2, double x1) {
int i;
- const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq + c,
+ const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq,
maxq);
// Special case handling to deal with the step from q2.0
@@ -66,57 +65,26 @@
if (minqtarget <= 2.0)
return 0;
- for (i = 0; i < QINDEX_RANGE; i++) {
+ for (i = 0; i < QINDEX_RANGE; i++)
if (minqtarget <= vp9_convert_qindex_to_q(i))
return i;
- }
return QINDEX_RANGE - 1;
}
-void vp9_rc_init_minq_luts(void) {
+void vp9_rc_init_minq_luts() {
int i;
for (i = 0; i < QINDEX_RANGE; i++) {
const double maxq = vp9_convert_qindex_to_q(i);
-
- kf_low_motion_minq[i] = calculate_minq_index(maxq,
- 0.000001,
- -0.0004,
- 0.15,
- 0.0);
- kf_high_motion_minq[i] = calculate_minq_index(maxq,
- 0.000002,
- -0.0012,
- 0.50,
- 0.0);
-
- gf_low_motion_minq[i] = calculate_minq_index(maxq,
- 0.0000015,
- -0.0009,
- 0.32,
- 0.0);
- gf_high_motion_minq[i] = calculate_minq_index(maxq,
- 0.0000021,
- -0.00125,
- 0.50,
- 0.0);
- afq_low_motion_minq[i] = calculate_minq_index(maxq,
- 0.0000015,
- -0.0009,
- 0.33,
- 0.0);
- afq_high_motion_minq[i] = calculate_minq_index(maxq,
- 0.0000021,
- -0.00125,
- 0.55,
- 0.0);
- inter_minq[i] = calculate_minq_index(maxq,
- 0.00000271,
- -0.00113,
- 0.75,
- 0.0);
+ kf_low_motion_minq[i] = get_minq_index(maxq, 0.000001, -0.0004, 0.15);
+ kf_high_motion_minq[i] = get_minq_index(maxq, 0.000002, -0.0012, 0.50);
+ gf_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.32);
+ gf_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.50);
+ afq_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.33);
+ afq_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.55);
+ inter_minq[i] = get_minq_index(maxq, 0.00000271, -0.00113, 0.75);
}
}
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -92,8 +92,7 @@
double vp9_convert_qindex_to_q(int qindex);
-// initialize luts for minq
-void vp9_rc_init_minq_luts(void);
+void vp9_rc_init_minq_luts();
// Generally at the high level, the following flow is expected
// to be enforced for rate control:
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -108,7 +108,7 @@
vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
}
-static void fill_value_tokens() {
+void vp9_tokenize_initialize() {
TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE;
const vp9_extra_bit *const e = vp9_extra_bits;
@@ -331,8 +331,4 @@
vp9_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
*t = t_backup;
}
-}
-
-void vp9_tokenize_initialize() {
- fill_value_tokens();
}