ref: 92c536b465422bce94e8d47d08bf218e3f8e222c
parent: 528a5c28b313fbcc7da6264f7151d26a610ddcfd
author: Dmitry Kovalev <[email protected]>
date: Thu May 1 07:35:50 EDT 2014
Adding vp9_temporal_filter_init() function. Change-Id: I0d50354111df79b74aafcd3bb7dc14df3c14733a
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -162,6 +162,7 @@
vp9_rc_init_minq_luts();
vp9_entropy_mv_init();
vp9_entropy_mode_init();
+ vp9_temporal_filter_init();
init_done = 1;
}
}
@@ -536,7 +537,6 @@
static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) {
VP9_COMMON *const cm = &cpi->common;
- int i;
cpi->oxcf = *oxcf;
@@ -571,10 +571,6 @@
cpi->alt_fb_idx = 2;
set_tile_limits(cpi);
-
- cpi->fixed_divide[0] = 0;
- for (i = 1; i < 512; i++)
- cpi->fixed_divide[i] = 0x80000 / i;
}
static int get_pass(MODE mode) {
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -443,7 +443,6 @@
YV12_BUFFER_CONFIG alt_ref_buffer;
YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
- int fixed_divide[512];
#if CONFIG_INTERNAL_STATS
unsigned int mode_chosen_counts[MAX_MODES];
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -27,6 +27,8 @@
#include "vpx_ports/vpx_timer.h"
#include "vpx_scale/vpx_scale.h"
+static int fixed_divide[512];
+
static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd,
uint8_t *y_mb_ptr,
uint8_t *u_mb_ptr,
@@ -78,6 +80,14 @@
kernel, mv_precision_uv, x, y);
}
+void vp9_temporal_filter_init() {
+ int i;
+
+ fixed_divide[0] = 0;
+ for (i = 1; i < 512; ++i)
+ fixed_divide[i] = 0x80000 / i;
+}
+
void vp9_temporal_filter_apply_c(uint8_t *frame1,
unsigned int stride,
uint8_t *frame2,
@@ -294,7 +304,7 @@
for (i = 0, k = 0; i < 16; i++) {
for (j = 0; j < 16; j++, k++) {
unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
+ pval *= fixed_divide[count[k]];
pval >>= 19;
dst1[byte] = (uint8_t)pval;
@@ -315,13 +325,13 @@
// U
unsigned int pval = accumulator[k] + (count[k] >> 1);
- pval *= cpi->fixed_divide[count[k]];
+ pval *= fixed_divide[count[k]];
pval >>= 19;
dst1[byte] = (uint8_t)pval;
// V
pval = accumulator[m] + (count[m] >> 1);
- pval *= cpi->fixed_divide[count[m]];
+ pval *= fixed_divide[count[m]];
pval >>= 19;
dst2[byte] = (uint8_t)pval;
--- a/vp9/encoder/vp9_temporal_filter.h
+++ b/vp9/encoder/vp9_temporal_filter.h
@@ -15,6 +15,7 @@
extern "C" {
#endif
+void vp9_temporal_filter_init();
void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance);
void vp9_configure_arnr_filter(VP9_COMP *cpi,
const unsigned int frames_to_arnr,