ref: 0a4403992a28e2c768d4d14dc7662f64f26b9d4c
parent: 4c7a783e8ca7826e975871c86b8f9417d0649a43
parent: a00278c6dcdf3c79a823576234774515f4a87156
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Sep 2 06:01:20 EDT 2014
Merge "Removing 'frames' field from VP9_COMP."
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -331,7 +331,7 @@
TWO_PASS twopass;
YV12_BUFFER_CONFIG alt_ref_buffer;
- YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
+
#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
@@ -191,6 +191,7 @@
}
static void temporal_filter_iterate_c(VP9_COMP *cpi,
+ YV12_BUFFER_CONFIG **frames,
int frame_count,
int alt_ref_index,
int strength,
@@ -206,7 +207,7 @@
DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 * 3);
DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 * 3);
MACROBLOCKD *mbd = &cpi->mb.e_mbd;
- YV12_BUFFER_CONFIG *f = cpi->frames[alt_ref_index];
+ YV12_BUFFER_CONFIG *f = frames[alt_ref_index];
uint8_t *dst1, *dst2;
DECLARE_ALIGNED_ARRAY(16, uint8_t, predictor, 16 * 16 * 3);
const int mb_uv_height = 16 >> mbd->plane[1].subsampling_y;
@@ -250,7 +251,7 @@
const int thresh_low = 10000;
const int thresh_high = 20000;
- if (cpi->frames[frame] == NULL)
+ if (frames[frame] == NULL)
continue;
mbd->mi[0]->bmi[0].as_mv[0].as_mv.row = 0;
@@ -261,9 +262,9 @@
} else {
// Find best match in this frame by MC
int err = temporal_filter_find_matching_mb_c(cpi,
- cpi->frames[alt_ref_index]->y_buffer + mb_y_offset,
- cpi->frames[frame]->y_buffer + mb_y_offset,
- cpi->frames[frame]->y_stride);
+ frames[alt_ref_index]->y_buffer + mb_y_offset,
+ frames[frame]->y_buffer + mb_y_offset,
+ frames[frame]->y_stride);
// Assign higher weight to matching MB if it's error
// score is lower. If not applying MC default behavior
@@ -275,10 +276,10 @@
if (filter_weight != 0) {
// Construct the predictors
temporal_filter_predictors_mb_c(mbd,
- cpi->frames[frame]->y_buffer + mb_y_offset,
- cpi->frames[frame]->u_buffer + mb_uv_offset,
- cpi->frames[frame]->v_buffer + mb_uv_offset,
- cpi->frames[frame]->y_stride,
+ frames[frame]->y_buffer + mb_y_offset,
+ frames[frame]->u_buffer + mb_uv_offset,
+ frames[frame]->v_buffer + mb_uv_offset,
+ frames[frame]->y_stride,
mb_uv_width, mb_uv_height,
mbd->mi[0]->bmi[0].as_mv[0].as_mv.row,
mbd->mi[0]->bmi[0].as_mv[0].as_mv.col,
@@ -432,6 +433,7 @@
int frames_to_blur_backward;
int frames_to_blur_forward;
struct scale_factors sf;
+ YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS] = {NULL};
// Apply context specific adjustments to the arnr filter parameters.
adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength);
@@ -440,12 +442,11 @@
start_frame = distance + frames_to_blur_forward;
// Setup frame pointers, NULL indicates frame not included in filter.
- vp9_zero(cpi->frames);
for (frame = 0; frame < frames_to_blur; ++frame) {
const int which_buffer = start_frame - frame;
struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead,
which_buffer);
- cpi->frames[frames_to_blur - 1 - frame] = &buf->img;
+ frames[frames_to_blur - 1 - frame] = &buf->img;
}
// Setup scaling factors. Scaling on each of the arnr frames is not supported
@@ -460,8 +461,8 @@
get_frame_new_buffer(cm)->y_crop_height);
for (frame = 0; frame < frames_to_blur; ++frame) {
- if (cm->mi_cols * MI_SIZE != cpi->frames[frame]->y_width ||
- cm->mi_rows * MI_SIZE != cpi->frames[frame]->y_height) {
+ if (cm->mi_cols * MI_SIZE != frames[frame]->y_width ||
+ cm->mi_rows * MI_SIZE != frames[frame]->y_height) {
if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used],
cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y,
@@ -470,9 +471,8 @@
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to reallocate alt_ref_buffer");
- cpi->frames[frame] =
- vp9_scale_if_required(cm, cpi->frames[frame],
- &cpi->svc.scaled_frames[frame_used]);
+ frames[frame] = vp9_scale_if_required(cm, frames[frame],
+ &cpi->svc.scaled_frames[frame_used]);
++frame_used;
}
}
@@ -483,6 +483,6 @@
cm->width, cm->height);
}
- temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward,
- strength, &sf);
+ temporal_filter_iterate_c(cpi, frames, frames_to_blur,
+ frames_to_blur_backward, strength, &sf);
}
--
⑨