Merge "Add VPX.framework built script."
diff --git a/configure b/configure
index 800553e..9a7de73 100755
--- a/configure
+++ b/configure
@@ -272,6 +272,7 @@
alpha
multiple_arf
spatial_svc
+ denoising
"
CONFIG_LIST="
external_build
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 762b7e3..4d16a5f 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -98,6 +98,9 @@
#ifdef OUTPUT_YUV_SRC
FILE *yuv_file;
#endif
+#ifdef OUTPUT_YUV_DENOISED
+FILE *yuv_denoised_file;
+#endif
#if 0
FILE *framepsnr;
@@ -1961,6 +1964,9 @@
#ifdef OUTPUT_YUV_SRC
yuv_file = fopen("bd.yuv", "ab");
#endif
+#ifdef OUTPUT_YUV_DENOISED
+ yuv_denoised_file = fopen("denoised.yuv", "ab");
+#endif
#if 0
framepsnr = fopen("framepsnr.stt", "a");
@@ -2410,6 +2416,9 @@
#ifdef OUTPUT_YUV_SRC
fclose(yuv_file);
#endif
+#ifdef OUTPUT_YUV_DENOISED
+ fclose(yuv_denoised_file);
+#endif
#if 0
@@ -2610,7 +2619,7 @@
}
-#if OUTPUT_YUV_SRC
+#if defined(OUTPUT_YUV_SRC) || defined(OUTPUT_YUV_DENOISED)
void vp8_write_yuv_frame(FILE *yuv_file, YV12_BUFFER_CONFIG *s)
{
unsigned char *src = s->y_buffer;
@@ -4430,6 +4439,11 @@
update_reference_frames(cpi);
+#ifdef OUTPUT_YUV_DENOISED
+ vp8_write_yuv_frame(yuv_denoised_file,
+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME]);
+#endif
+
#if !(CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING)
if (cpi->oxcf.error_resilient_mode)
{
diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c
new file mode 100644
index 0000000..687b4c2
--- /dev/null
+++ b/vp9/encoder/vp9_denoiser.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include "vp9/encoder/vp9_denoiser.h"
+#include "vpx_scale/yv12config.h"
+
+static const int widths[] = {4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64};
+static const int heights[] = {4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64};
+
+int vp9_denoiser_filter() {
+ return 0;
+}
+
+void vp9_denoiser_denoise(VP9_DENOISER *denoiser,
+ MACROBLOCK *mb, MODE_INFO **grid,
+ int mi_row, int mi_col, BLOCK_SIZE bs) {
+ return;
+}
+
+void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
+ FRAME_TYPE frame_type,
+ int refresh_alt_ref_frame,
+ int refresh_golden_frame,
+ int refresh_last_frame) {
+ return;
+}
+
+void vp9_denoiser_update_frame_stats() {
+ return;
+}
+
+int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
+ int border) {
+ return 0;
+}
+
+void vp9_denoiser_free(VP9_DENOISER *denoiser) {
+ return;
+}
+
diff --git a/vp9/encoder/vp9_denoiser.h b/vp9/encoder/vp9_denoiser.h
new file mode 100644
index 0000000..a7a8d93
--- /dev/null
+++ b/vp9/encoder/vp9_denoiser.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef VP9_ENCODER_DENOISER_H_
+#define VP9_ENCODER_DENOISER_H_
+
+#include "vp9/encoder/vp9_block.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum vp9_denoiser_decision {
+ COPY_BLOCK,
+ FILTER_BLOCK
+};
+
+typedef struct vp9_denoiser {
+ struct buf_2d running_avg_y;
+ struct buf_2d mc_running_avg_y;
+} VP9_DENOISER;
+
+void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
+ FRAME_TYPE frame_type,
+ int refresh_alt_ref_frame,
+ int refresh_golden_frame,
+ int refresh_last_frame);
+
+void vp9_denoiser_denoise(VP9_DENOISER *denoiser,
+ MACROBLOCK *mb, MODE_INFO **grid,
+ int mi_row, int mi_col, BLOCK_SIZE bs);
+
+void vp9_denoiser_update_frame_stats();
+
+int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
+ int border);
+
+void vp9_denoiser_free(VP9_DENOISER *denoiser);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // VP9_ENCODER_DENOISER_H_
diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c
index 9d44865..9ad6db0 100644
--- a/vp9/encoder/vp9_encodemv.c
+++ b/vp9/encoder/vp9_encodemv.c
@@ -216,7 +216,7 @@
// If auto_mv_step_size is enabled then keep track of the largest
// motion vector component used.
- if (!cpi->dummy_packing && cpi->sf.auto_mv_step_size) {
+ if (!cpi->dummy_packing && cpi->sf.mv.auto_mv_step_size) {
unsigned int maxv = MAX(abs(mv->row), abs(mv->col)) >> 3;
cpi->max_mv_magnitude = MAX(maxv, cpi->max_mv_magnitude);
}
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index aa7a91d..1aaa1d5 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -484,9 +484,9 @@
{
int y_stride = cpi->scaled_source.y_stride;
- if (cpi->sf.search_method == NSTEP) {
+ if (cpi->sf.mv.search_method == NSTEP) {
vp9_init3smotion_compensation(&cpi->ss_cfg, y_stride);
- } else if (cpi->sf.search_method == DIAMOND) {
+ } else if (cpi->sf.mv.search_method == DIAMOND) {
vp9_init_dsmotion_compensation(&cpi->ss_cfg, y_stride);
}
}
@@ -680,6 +680,11 @@
cpi->ext_refresh_frame_flags_pending = 0;
cpi->ext_refresh_frame_context_pending = 0;
+
+#if CONFIG_DENOISING
+ vp9_denoiser_alloc(&(cpi->denoiser), cm->width, cm->height,
+ VP9_ENC_BORDER_IN_PIXELS);
+#endif
}
#ifndef M_LOG2_E
@@ -1085,6 +1090,10 @@
#endif
}
+#if CONFIG_DENOISING
+ vp9_denoiser_free(&(cpi->denoiser));
+#endif
+
dealloc_compressor_data(cpi);
vpx_free(cpi->tok);
@@ -1547,6 +1556,13 @@
ref_cnt_fb(cm->frame_bufs,
&cm->ref_frame_map[cpi->lst_fb_idx], cm->new_fb_idx);
}
+#if CONFIG_DENOISING
+ vp9_denoiser_update_frame_info(&cpi->denoiser,
+ cpi->common.frame_type,
+ cpi->refresh_alt_ref_frame,
+ cpi->refresh_golden_frame,
+ cpi->refresh_last_frame);
+#endif
}
static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
@@ -2012,7 +2028,7 @@
// Initialize cpi->mv_step_param to default based on max resolution.
cpi->mv_step_param = vp9_init_search_range(sf, max_mv_def);
// Initialize cpi->max_mv_magnitude and cpi->mv_step_param if appropriate.
- if (sf->auto_mv_step_size) {
+ if (sf->mv.auto_mv_step_size) {
if (frame_is_intra_only(cm)) {
// Initialize max_mv_magnitude for use in the first INTER frame
// after a key/intra-only frame.
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index 6b0e228..4364939 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -36,6 +36,9 @@
#include "vp9/encoder/vp9_svc_layercontext.h"
#include "vp9/encoder/vp9_tokenize.h"
#include "vp9/encoder/vp9_variance.h"
+#if CONFIG_DENOISING
+#include "vp9/encoder/vp9_denoiser.h"
+#endif
#ifdef __cplusplus
extern "C" {
@@ -526,6 +529,10 @@
int this_frame_weight;
int max_arf_level;
#endif
+
+#if CONFIG_DENOISING
+ VP9_DENOISER denoiser;
+#endif
} VP9_COMP;
void vp9_initialize_enc();
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 430f713..b430b56 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1083,38 +1083,30 @@
}
// Update the motion related elements to the GF arf boost calculation.
-static void accumulate_frame_motion_stats(
- FIRSTPASS_STATS *this_frame,
- double *this_frame_mv_in_out,
- double *mv_in_out_accumulator,
- double *abs_mv_in_out_accumulator,
- double *mv_ratio_accumulator) {
- double motion_pct;
-
- // Accumulate motion stats.
- motion_pct = this_frame->pcnt_motion;
+static void accumulate_frame_motion_stats(const FIRSTPASS_STATS *stats,
+ double *mv_in_out,
+ double *mv_in_out_accumulator,
+ double *abs_mv_in_out_accumulator,
+ double *mv_ratio_accumulator) {
+ const double pct = stats->pcnt_motion;
// Accumulate Motion In/Out of frame stats.
- *this_frame_mv_in_out = this_frame->mv_in_out_count * motion_pct;
- *mv_in_out_accumulator += this_frame->mv_in_out_count * motion_pct;
- *abs_mv_in_out_accumulator += fabs(this_frame->mv_in_out_count * motion_pct);
+ *mv_in_out = stats->mv_in_out_count * pct;
+ *mv_in_out_accumulator += *mv_in_out;
+ *abs_mv_in_out_accumulator += fabs(*mv_in_out);
- // Accumulate a measure of how uniform (or conversely how random)
- // the motion field is (a ratio of absmv / mv).
- if (motion_pct > 0.05) {
- const double this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVr));
+ // Accumulate a measure of how uniform (or conversely how random) the motion
+ // field is (a ratio of abs(mv) / mv).
+ if (pct > 0.05) {
+ const double mvr_ratio = fabs(stats->mvr_abs) /
+ DOUBLE_DIVIDE_CHECK(fabs(stats->MVr));
+ const double mvc_ratio = fabs(stats->mvc_abs) /
+ DOUBLE_DIVIDE_CHECK(fabs(stats->MVc));
- const double this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
- DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVc));
-
- *mv_ratio_accumulator += (this_frame_mvr_ratio < this_frame->mvr_abs)
- ? (this_frame_mvr_ratio * motion_pct)
- : this_frame->mvr_abs * motion_pct;
-
- *mv_ratio_accumulator += (this_frame_mvc_ratio < this_frame->mvc_abs)
- ? (this_frame_mvc_ratio * motion_pct)
- : this_frame->mvc_abs * motion_pct;
+ *mv_ratio_accumulator += pct * (mvr_ratio < stats->mvr_abs ?
+ mvr_ratio : stats->mvr_abs);
+ *mv_ratio_accumulator += pct * (mvc_ratio < stats->mvc_abs ?
+ mvc_ratio : stats->mvc_abs);
}
}
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index 842bc5b..8106960 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -25,9 +25,10 @@
MV *dst_mv,
int mb_row,
int mb_col) {
- MACROBLOCK *const x = &cpi->mb;
+ MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
- vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
+ const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
+ const vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
const int tmp_col_min = x->mv_col_min;
const int tmp_col_max = x->mv_col_max;
@@ -36,9 +37,9 @@
MV ref_full;
// Further step/diamond searches as necessary
- int step_param = cpi->sf.reduce_first_step_size +
+ int step_param = mv_sf->reduce_first_step_size +
(cpi->oxcf.speed > 5 ? 1 : 0);
- step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
+ step_param = MIN(step_param, mv_sf->max_step_search_steps - 2);
vp9_set_mv_search_range(x, ref_mv);
@@ -56,7 +57,7 @@
unsigned int sse;
cpi->find_fractional_mv_step(
x, dst_mv, ref_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
- &v_fn_ptr, 0, cpi->sf.subpel_iters_per_step, NULL, NULL, &distortion,
+ &v_fn_ptr, 0, mv_sf->subpel_iters_per_step, NULL, NULL, &distortion,
&sse);
}
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 48ac5f9..cb45dfa 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -60,8 +60,8 @@
while ((size << sr) < MAX_FULL_PEL_VAL)
sr++;
- sr += sf->reduce_first_step_size;
- sr = MIN(sr, (sf->max_step_search_steps - 2));
+ sr += sf->mv.reduce_first_step_size;
+ sr = MIN(sr, (sf->mv.max_step_search_steps - 2));
return sr;
}
@@ -1600,7 +1600,7 @@
const MV *ref_mv, MV *tmp_mv,
int var_max, int rd) {
const SPEED_FEATURES *const sf = &cpi->sf;
- const SEARCH_METHODS method = sf->search_method;
+ const SEARCH_METHODS method = sf->mv.search_method;
vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
int var = 0;
@@ -1627,7 +1627,8 @@
break;
case NSTEP:
var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
- (sf->max_step_search_steps - 1) - step_param,
+ (sf->mv.max_step_search_steps - 1) -
+ step_param,
1, fn_ptr, ref_mv, tmp_mv);
break;
default:
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index 4b0b85a..80966ad 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -132,8 +132,8 @@
cpi->common.allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[bsize],
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
+ cpi->sf.mv.subpel_force_stop,
+ cpi->sf.mv.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref]);
@@ -438,6 +438,10 @@
}
}
+#if CONFIG_DENOISING
+ vp9_denoiser_update_frame_stats();
+#endif
+
if (this_rd < best_rd || x->skip) {
best_rd = this_rd;
*returnrate = rate;
@@ -453,6 +457,7 @@
}
}
+
mbmi->mode = best_mode;
mbmi->interp_filter = best_pred_filter;
mbmi->ref_frame[0] = best_ref_frame;
@@ -488,6 +493,10 @@
}
}
}
+#if CONFIG_DENOISING
+ vp9_denoiser_denoise(&cpi->denoiser, x, cpi->common.mi_grid_visible, mi_row,
+ mi_col, bsize);
+#endif
return INT64_MAX;
}
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index e110df2..429dcb1 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1826,7 +1826,7 @@
else
max_mv = MAX(abs(bsi->mvp.as_mv.row), abs(bsi->mvp.as_mv.col)) >> 3;
- if (cpi->sf.auto_mv_step_size && cm->show_frame) {
+ if (cpi->sf.mv.auto_mv_step_size && cm->show_frame) {
// Take wtd average of the step_params based on the last frame's
// max mv magnitude and the best ref mvs of the current block for
// the given reference.
@@ -1881,8 +1881,8 @@
&bsi->ref_mv[0]->as_mv,
cm->allow_high_precision_mv,
x->errorperbit, &cpi->fn_ptr[bsize],
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
+ cpi->sf.mv.subpel_force_stop,
+ cpi->sf.mv.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&distortion,
&x->pred_sse[mbmi->ref_frame[0]]);
@@ -2338,7 +2338,7 @@
// Work out the size of the first step in the mv step search.
// 0 here is maximum length first step. 1 is MAX >> 1 etc.
- if (cpi->sf.auto_mv_step_size && cm->show_frame) {
+ if (cpi->sf.mv.auto_mv_step_size && cm->show_frame) {
// Take wtd average of the step_params based on the last frame's
// max mv magnitude and that based on the best ref mvs of the current
// block for the given reference.
@@ -2399,8 +2399,8 @@
cm->allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[bsize],
- cpi->sf.subpel_force_stop,
- cpi->sf.subpel_iters_per_step,
+ cpi->sf.mv.subpel_force_stop,
+ cpi->sf.mv.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref]);
}
@@ -2524,7 +2524,7 @@
cpi->common.allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[bsize],
- 0, cpi->sf.subpel_iters_per_step,
+ 0, cpi->sf.mv.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&dis, &sse, second_pred,
pw, ph);
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index 700862f..6beb872 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -69,9 +69,9 @@
sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
sf->use_rd_breakout = 1;
sf->adaptive_motion_search = 1;
- sf->auto_mv_step_size = 1;
+ sf->mv.auto_mv_step_size = 1;
sf->adaptive_rd_thresh = 2;
- sf->subpel_iters_per_step = 1;
+ sf->mv.subpel_iters_per_step = 1;
sf->mode_skip_start = 10;
sf->adaptive_pred_interp_filter = 1;
@@ -140,7 +140,7 @@
sf->partition_search_type = FIXED_PARTITION;
sf->optimize_coefficients = 0;
- sf->search_method = HEX;
+ sf->mv.search_method = HEX;
sf->disable_filter_search_var_thresh = 500;
for (i = 0; i < TX_SIZES; ++i) {
sf->intra_y_mode_mask[i] = INTRA_DC;
@@ -174,7 +174,7 @@
sf->use_rd_breakout = 1;
sf->adaptive_motion_search = 1;
sf->adaptive_pred_interp_filter = 1;
- sf->auto_mv_step_size = 1;
+ sf->mv.auto_mv_step_size = 1;
sf->adaptive_rd_thresh = 2;
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
@@ -213,7 +213,7 @@
sf->constrain_copy_partition = 1;
sf->use_uv_intra_rd_estimate = 1;
sf->skip_encode_sb = 1;
- sf->subpel_iters_per_step = 1;
+ sf->mv.subpel_iters_per_step = 1;
sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
sf->adaptive_rd_thresh = 4;
sf->mode_skip_start = 6;
@@ -232,14 +232,14 @@
sf->adjust_partitioning_from_last_frame =
cm->last_frame_type != cm->frame_type || (0 ==
(frames_since_key + 1) % sf->last_partitioning_redo_frequency);
- sf->subpel_force_stop = 1;
+ sf->mv.subpel_force_stop = 1;
for (i = 0; i < TX_SIZES; i++) {
sf->intra_y_mode_mask[i] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[i] = INTRA_DC;
}
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC;
sf->frame_parameter_update = 0;
- sf->search_method = FAST_HEX;
+ sf->mv.search_method = FAST_HEX;
sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEAR_NEW;
sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST;
sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST;
@@ -259,7 +259,7 @@
sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15;
sf->partition_search_type = REFERENCE_PARTITION;
sf->use_nonrd_pick_mode = 1;
- sf->search_method = FAST_DIAMOND;
+ sf->mv.search_method = FAST_DIAMOND;
sf->allow_skip_recode = 0;
}
@@ -287,15 +287,15 @@
// best quality defaults
sf->frame_parameter_update = 1;
- sf->search_method = NSTEP;
+ sf->mv.search_method = NSTEP;
sf->recode_loop = ALLOW_RECODE;
- sf->subpel_search_method = SUBPEL_TREE;
- sf->subpel_iters_per_step = 2;
- sf->subpel_force_stop = 0;
+ sf->mv.subpel_search_method = SUBPEL_TREE;
+ sf->mv.subpel_iters_per_step = 2;
+ sf->mv.subpel_force_stop = 0;
sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
- sf->reduce_first_step_size = 0;
- sf->auto_mv_step_size = 0;
- sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
+ sf->mv.reduce_first_step_size = 0;
+ sf->mv.auto_mv_step_size = 0;
+ sf->mv.max_step_search_steps = MAX_MVSEARCH_STEPS;
sf->comp_inter_joint_search_thresh = BLOCK_4X4;
sf->adaptive_rd_thresh = 0;
sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF;
@@ -370,7 +370,7 @@
sf->optimize_coefficients = 0;
}
- if (sf->subpel_search_method == SUBPEL_TREE) {
+ if (sf->mv.subpel_search_method == SUBPEL_TREE) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_tree;
}
diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h
index 4a1a13b..c796421 100644
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -133,27 +133,10 @@
ONE_LOOP_REDUCED = 2
} FAST_COEFF_UPDATE;
-typedef struct SPEED_FEATURES {
- // Frame level coding parameter update
- int frame_parameter_update;
-
+typedef struct MV_SPEED_FEATURES {
// Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc).
SEARCH_METHODS search_method;
- RECODE_LOOP_TYPE recode_loop;
-
- // Subpel_search_method can only be subpel_tree which does a subpixel
- // logarithmic search that keeps stepping at 1/2 pixel units until
- // you stop getting a gain, and then goes on to 1/4 and repeats
- // the same process. Along the way it skips many diagonals.
- SUBPEL_SEARCH_METHODS subpel_search_method;
-
- // Maximum number of steps in logarithmic subpel search before giving up.
- int subpel_iters_per_step;
-
- // Control when to stop subpel search
- int subpel_force_stop;
-
// This parameter controls the number of steps we'll do in a diamond
// search.
int max_step_search_steps;
@@ -166,6 +149,27 @@
// largest motion vector found in the last frame.
int auto_mv_step_size;
+ // Subpel_search_method can only be subpel_tree which does a subpixel
+ // logarithmic search that keeps stepping at 1/2 pixel units until
+ // you stop getting a gain, and then goes on to 1/4 and repeats
+ // the same process. Along the way it skips many diagonals.
+ SUBPEL_SEARCH_METHODS subpel_search_method;
+
+ // Maximum number of steps in logarithmic subpel search before giving up.
+ int subpel_iters_per_step;
+
+ // Control when to stop subpel search
+ int subpel_force_stop;
+} MV_SPEED_FEATURES;
+
+typedef struct SPEED_FEATURES {
+ MV_SPEED_FEATURES mv;
+
+ // Frame level coding parameter update
+ int frame_parameter_update;
+
+ RECODE_LOOP_TYPE recode_loop;
+
// Trellis (dynamic programming) optimization of quantized values (+1, 0).
int optimize_coefficients;
diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c
index f501971..31f8c32 100644
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -137,8 +137,9 @@
uint8_t *arf_frame_buf,
uint8_t *frame_ptr_buf,
int stride) {
- MACROBLOCK *x = &cpi->mb;
- MACROBLOCKD* const xd = &x->e_mbd;
+ MACROBLOCK *const x = &cpi->mb;
+ MACROBLOCKD *const xd = &x->e_mbd;
+ const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
int step_param;
int sadpb = x->sadperbit16;
int bestsme = INT_MAX;
@@ -162,8 +163,8 @@
xd->plane[0].pre[0].buf = frame_ptr_buf;
xd->plane[0].pre[0].stride = stride;
- step_param = cpi->sf.reduce_first_step_size + (cpi->oxcf.speed > 5 ? 1 : 0);
- step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
+ step_param = mv_sf->reduce_first_step_size + (cpi->oxcf.speed > 5 ? 1 : 0);
+ step_param = MIN(step_param, mv_sf->max_step_search_steps - 2);
// Ignore mv costing by sending NULL pointer instead of cost arrays
vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
@@ -175,7 +176,7 @@
cpi->common.allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
- 0, cpi->sf.subpel_iters_per_step,
+ 0, mv_sf->subpel_iters_per_step,
NULL, NULL,
&distortion, &sse);
diff --git a/vp9/vp9cx.mk b/vp9/vp9cx.mk
index a44ffc1..9dbb678 100644
--- a/vp9/vp9cx.mk
+++ b/vp9/vp9cx.mk
@@ -23,6 +23,8 @@
VP9_CX_SRCS-yes += encoder/vp9_cost.h
VP9_CX_SRCS-yes += encoder/vp9_cost.c
VP9_CX_SRCS-yes += encoder/vp9_dct.c
+VP9_CX_SRCS-$(CONFIG_DENOISING) += encoder/vp9_denoiser.c
+VP9_CX_SRCS-$(CONFIG_DENOISING) += encoder/vp9_denoiser.h
VP9_CX_SRCS-yes += encoder/vp9_encodeframe.c
VP9_CX_SRCS-yes += encoder/vp9_encodeframe.h
VP9_CX_SRCS-yes += encoder/vp9_encodemb.c