Commit a00278c6 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Removing 'frames' field from VP9_COMP.

Using local variable instead.

Change-Id: If592d73ba2b04972cdae938751155c183a6db25a
parent e735b576
...@@ -331,7 +331,7 @@ typedef struct VP9_COMP { ...@@ -331,7 +331,7 @@ typedef struct VP9_COMP {
TWO_PASS twopass; TWO_PASS twopass;
YV12_BUFFER_CONFIG alt_ref_buffer; YV12_BUFFER_CONFIG alt_ref_buffer;
YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
#if CONFIG_INTERNAL_STATS #if CONFIG_INTERNAL_STATS
unsigned int mode_chosen_counts[MAX_MODES]; unsigned int mode_chosen_counts[MAX_MODES];
......
...@@ -188,6 +188,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi, ...@@ -188,6 +188,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
} }
static void temporal_filter_iterate_c(VP9_COMP *cpi, static void temporal_filter_iterate_c(VP9_COMP *cpi,
YV12_BUFFER_CONFIG **frames,
int frame_count, int frame_count,
int alt_ref_index, int alt_ref_index,
int strength, int strength,
...@@ -203,7 +204,7 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, ...@@ -203,7 +204,7 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 * 3); DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 * 3);
DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 * 3); DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 * 3);
MACROBLOCKD *mbd = &cpi->mb.e_mbd; 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; uint8_t *dst1, *dst2;
DECLARE_ALIGNED_ARRAY(16, uint8_t, predictor, 16 * 16 * 3); DECLARE_ALIGNED_ARRAY(16, uint8_t, predictor, 16 * 16 * 3);
const int mb_uv_height = 16 >> mbd->plane[1].subsampling_y; const int mb_uv_height = 16 >> mbd->plane[1].subsampling_y;
...@@ -247,7 +248,7 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, ...@@ -247,7 +248,7 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
const int thresh_low = 10000; const int thresh_low = 10000;
const int thresh_high = 20000; const int thresh_high = 20000;
if (cpi->frames[frame] == NULL) if (frames[frame] == NULL)
continue; continue;
mbd->mi[0]->bmi[0].as_mv[0].as_mv.row = 0; mbd->mi[0]->bmi[0].as_mv[0].as_mv.row = 0;
...@@ -258,9 +259,9 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, ...@@ -258,9 +259,9 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
} else { } else {
// Find best match in this frame by MC // Find best match in this frame by MC
int err = temporal_filter_find_matching_mb_c(cpi, int err = temporal_filter_find_matching_mb_c(cpi,
cpi->frames[alt_ref_index]->y_buffer + mb_y_offset, frames[alt_ref_index]->y_buffer + mb_y_offset,
cpi->frames[frame]->y_buffer + mb_y_offset, frames[frame]->y_buffer + mb_y_offset,
cpi->frames[frame]->y_stride); frames[frame]->y_stride);
// Assign higher weight to matching MB if it's error // Assign higher weight to matching MB if it's error
// score is lower. If not applying MC default behavior // score is lower. If not applying MC default behavior
...@@ -272,10 +273,10 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, ...@@ -272,10 +273,10 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
if (filter_weight != 0) { if (filter_weight != 0) {
// Construct the predictors // Construct the predictors
temporal_filter_predictors_mb_c(mbd, temporal_filter_predictors_mb_c(mbd,
cpi->frames[frame]->y_buffer + mb_y_offset, frames[frame]->y_buffer + mb_y_offset,
cpi->frames[frame]->u_buffer + mb_uv_offset, frames[frame]->u_buffer + mb_uv_offset,
cpi->frames[frame]->v_buffer + mb_uv_offset, frames[frame]->v_buffer + mb_uv_offset,
cpi->frames[frame]->y_stride, frames[frame]->y_stride,
mb_uv_width, mb_uv_height, 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.row,
mbd->mi[0]->bmi[0].as_mv[0].as_mv.col, mbd->mi[0]->bmi[0].as_mv[0].as_mv.col,
...@@ -429,6 +430,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -429,6 +430,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
int frames_to_blur_backward; int frames_to_blur_backward;
int frames_to_blur_forward; int frames_to_blur_forward;
struct scale_factors sf; struct scale_factors sf;
YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS] = {NULL};
// Apply context specific adjustments to the arnr filter parameters. // Apply context specific adjustments to the arnr filter parameters.
adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength); adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength);
...@@ -437,12 +439,11 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -437,12 +439,11 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
start_frame = distance + frames_to_blur_forward; start_frame = distance + frames_to_blur_forward;
// Setup frame pointers, NULL indicates frame not included in filter. // Setup frame pointers, NULL indicates frame not included in filter.
vp9_zero(cpi->frames);
for (frame = 0; frame < frames_to_blur; ++frame) { for (frame = 0; frame < frames_to_blur; ++frame) {
const int which_buffer = start_frame - frame; const int which_buffer = start_frame - frame;
struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead, struct lookahead_entry *buf = vp9_lookahead_peek(cpi->lookahead,
which_buffer); 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 // Setup scaling factors. Scaling on each of the arnr frames is not supported
...@@ -457,8 +458,8 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -457,8 +458,8 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
get_frame_new_buffer(cm)->y_crop_height); get_frame_new_buffer(cm)->y_crop_height);
for (frame = 0; frame < frames_to_blur; ++frame) { for (frame = 0; frame < frames_to_blur; ++frame) {
if (cm->mi_cols * MI_SIZE != cpi->frames[frame]->y_width || if (cm->mi_cols * MI_SIZE != frames[frame]->y_width ||
cm->mi_rows * MI_SIZE != cpi->frames[frame]->y_height) { cm->mi_rows * MI_SIZE != frames[frame]->y_height) {
if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used],
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
...@@ -467,8 +468,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -467,8 +468,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to reallocate alt_ref_buffer"); "Failed to reallocate alt_ref_buffer");
cpi->frames[frame] = frames[frame] = vp9_scale_if_required(cm, frames[frame],
vp9_scale_if_required(cm, cpi->frames[frame],
&cpi->svc.scaled_frames[frame_used]); &cpi->svc.scaled_frames[frame_used]);
++frame_used; ++frame_used;
} }
...@@ -480,6 +480,6 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -480,6 +480,6 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
cm->width, cm->height); cm->width, cm->height);
} }
temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward, temporal_filter_iterate_c(cpi, frames, frames_to_blur,
strength, &sf); frames_to_blur_backward, strength, &sf);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment