Initialization code cleanup.
Change-Id: I47a8b4bf9a6cc0063d1a6785eaaad641d0659e24
This commit is contained in:
parent
2128f714aa
commit
5b8c834c1a
@ -210,10 +210,6 @@ void vp9_remove_common(VP9_COMMON *cm) {
|
|||||||
vp9_free_internal_frame_buffers(&cm->int_frame_buffers);
|
vp9_free_internal_frame_buffers(&cm->int_frame_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_initialize_common() {
|
|
||||||
vp9_init_neighbors();
|
|
||||||
}
|
|
||||||
|
|
||||||
void vp9_update_frame_size(VP9_COMMON *cm) {
|
void vp9_update_frame_size(VP9_COMMON *cm) {
|
||||||
const int aligned_width = ALIGN_POWER_OF_TWO(cm->width, MI_SIZE_LOG2);
|
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);
|
const int aligned_height = ALIGN_POWER_OF_TWO(cm->height, MI_SIZE_LOG2);
|
||||||
|
@ -12,24 +12,23 @@
|
|||||||
#ifndef VP9_COMMON_VP9_ALLOCCOMMON_H_
|
#ifndef VP9_COMMON_VP9_ALLOCCOMMON_H_
|
||||||
#define VP9_COMMON_VP9_ALLOCCOMMON_H_
|
#define VP9_COMMON_VP9_ALLOCCOMMON_H_
|
||||||
|
|
||||||
#include "vp9/common/vp9_onyxc_int.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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_resize_frame_buffers(struct VP9Common *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_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
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@ -104,7 +104,7 @@ void vp9_initialize_dec() {
|
|||||||
static int init_done = 0;
|
static int init_done = 0;
|
||||||
|
|
||||||
if (!init_done) {
|
if (!init_done) {
|
||||||
vp9_initialize_common();
|
vp9_init_neighbors();
|
||||||
vp9_init_quant_tables();
|
vp9_init_quant_tables();
|
||||||
init_done = 1;
|
init_done = 1;
|
||||||
}
|
}
|
||||||
|
@ -148,13 +148,13 @@ void vp9_initialize_enc() {
|
|||||||
static int init_done = 0;
|
static int init_done = 0;
|
||||||
|
|
||||||
if (!init_done) {
|
if (!init_done) {
|
||||||
vp9_initialize_common();
|
vp9_init_neighbors();
|
||||||
|
vp9_init_quant_tables();
|
||||||
|
|
||||||
vp9_coef_tree_initialize();
|
vp9_coef_tree_initialize();
|
||||||
vp9_tokenize_initialize();
|
vp9_tokenize_initialize();
|
||||||
vp9_init_quant_tables();
|
|
||||||
vp9_init_me_luts();
|
vp9_init_me_luts();
|
||||||
vp9_rc_init_minq_luts();
|
vp9_rc_init_minq_luts();
|
||||||
// init_base_skip_probs();
|
|
||||||
vp9_entropy_mv_init();
|
vp9_entropy_mv_init();
|
||||||
vp9_entropy_mode_init();
|
vp9_entropy_mode_init();
|
||||||
init_done = 1;
|
init_done = 1;
|
||||||
|
@ -55,10 +55,9 @@ static int kf_low = 400;
|
|||||||
// formulaic approach to facilitate easier adjustment of the Q tables.
|
// formulaic approach to facilitate easier adjustment of the Q tables.
|
||||||
// The formulae were derived from computing a 3rd order polynomial best
|
// 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))
|
// fit to the original data (after plotting real maxq vs minq (not q index))
|
||||||
static int calculate_minq_index(double maxq,
|
static int get_minq_index(double maxq, double x3, double x2, double x1) {
|
||||||
double x3, double x2, double x1, double c) {
|
|
||||||
int i;
|
int i;
|
||||||
const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq + c,
|
const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq,
|
||||||
maxq);
|
maxq);
|
||||||
|
|
||||||
// Special case handling to deal with the step from q2.0
|
// 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)
|
if (minqtarget <= 2.0)
|
||||||
return 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))
|
if (minqtarget <= vp9_convert_qindex_to_q(i))
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
|
|
||||||
return QINDEX_RANGE - 1;
|
return QINDEX_RANGE - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_rc_init_minq_luts(void) {
|
void vp9_rc_init_minq_luts() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < QINDEX_RANGE; i++) {
|
for (i = 0; i < QINDEX_RANGE; i++) {
|
||||||
const double maxq = vp9_convert_qindex_to_q(i);
|
const double maxq = vp9_convert_qindex_to_q(i);
|
||||||
|
|
||||||
|
kf_low_motion_minq[i] = get_minq_index(maxq, 0.000001, -0.0004, 0.15);
|
||||||
kf_low_motion_minq[i] = calculate_minq_index(maxq,
|
kf_high_motion_minq[i] = get_minq_index(maxq, 0.000002, -0.0012, 0.50);
|
||||||
0.000001,
|
gf_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.32);
|
||||||
-0.0004,
|
gf_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.50);
|
||||||
0.15,
|
afq_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.33);
|
||||||
0.0);
|
afq_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.55);
|
||||||
kf_high_motion_minq[i] = calculate_minq_index(maxq,
|
inter_minq[i] = get_minq_index(maxq, 0.00000271, -0.00113, 0.75);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ void vp9_setup_inter_frame(struct VP9_COMP *cpi);
|
|||||||
|
|
||||||
double vp9_convert_qindex_to_q(int qindex);
|
double vp9_convert_qindex_to_q(int qindex);
|
||||||
|
|
||||||
// initialize luts for minq
|
void vp9_rc_init_minq_luts();
|
||||||
void vp9_rc_init_minq_luts(void);
|
|
||||||
|
|
||||||
// Generally at the high level, the following flow is expected
|
// Generally at the high level, the following flow is expected
|
||||||
// to be enforced for rate control:
|
// to be enforced for rate control:
|
||||||
|
@ -108,7 +108,7 @@ void vp9_coef_tree_initialize() {
|
|||||||
vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
|
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;
|
TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE;
|
||||||
const vp9_extra_bit *const e = vp9_extra_bits;
|
const vp9_extra_bit *const e = vp9_extra_bits;
|
||||||
|
|
||||||
@ -333,7 +333,3 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
|
|||||||
*t = t_backup;
|
*t = t_backup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_tokenize_initialize() {
|
|
||||||
fill_value_tokens();
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user