diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c index cb75870ab0df0f13632d551ea533bb89d33b9215..600dfbb46921914b980df4c37decfd0586fce3dd 100644 --- a/vp9/common/vp9_alloccommon.c +++ b/vp9/common/vp9_alloccommon.c @@ -210,10 +210,6 @@ void vp9_remove_common(VP9_COMMON *cm) { 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); diff --git a/vp9/common/vp9_alloccommon.h b/vp9/common/vp9_alloccommon.h index 429e9290dc5e48c8dfc305a2dd7b9ea020bed6d8..06636a905b2894353ee4611f3d6586c795dd99fc 100644 --- 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(struct VP9Common *cm); -void vp9_remove_common(VP9_COMMON *cm); +int vp9_resize_frame_buffers(struct VP9Common *cm, int width, int height); -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_alloc_frame_buffers(struct VP9Common *cm, int width, int height); +void vp9_free_frame_buffers(struct VP9Common *cm); -void vp9_update_frame_size(VP9_COMMON *cm); +void vp9_update_frame_size(struct VP9Common *cm); -void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm); +void vp9_swap_mi_and_prev_mi(struct VP9Common *cm); #ifdef __cplusplus } // extern "C" diff --git a/vp9/decoder/vp9_decoder.c b/vp9/decoder/vp9_decoder.c index bcf05b892886e7a1130eb04dd2497ba45166c08b..982b851dcc3c382cc450c1f40aa0b671913d42bf 100644 --- a/vp9/decoder/vp9_decoder.c +++ b/vp9/decoder/vp9_decoder.c @@ -104,7 +104,7 @@ void vp9_initialize_dec() { static int init_done = 0; if (!init_done) { - vp9_initialize_common(); + vp9_init_neighbors(); vp9_init_quant_tables(); init_done = 1; } diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 4eabc2fc71ff6d927fdcf30143ec328cbfc6bbf2..29717f7f479eeec11f151c70647d93ef1d3ec789 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -148,13 +148,13 @@ void vp9_initialize_enc() { 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; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index edc48bb16648a9b806515be2ca0f3e409075ee68..12743b294f2626c5b5cd0f137d534cbcb26df741 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -55,10 +55,9 @@ static int kf_low = 400; // 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 @@ static int calculate_minq_index(double maxq, 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); } } diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index ed6266fe281c1debaffa81c27f346cf97f515ef2..2754395282296a65ef09849e6b8b4ad483e6c145 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -92,8 +92,7 @@ void vp9_setup_inter_frame(struct VP9_COMP *cpi); 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: diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 76d336d339183a2e5dae22e51a46b5490f4e7b5b..b6211e5fa2c8c80cbd506564cddedd27009874e4 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -108,7 +108,7 @@ void vp9_coef_tree_initialize() { 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; @@ -332,7 +332,3 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run, *t = t_backup; } } - -void vp9_tokenize_initialize() { - fill_value_tokens(); -}