Merge "Removing 'frames' field from VP9_COMP."
This commit is contained in:
@@ -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];
|
||||||
|
@@ -191,6 +191,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,
|
||||||
@@ -206,7 +207,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;
|
||||||
@@ -250,7 +251,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;
|
||||||
@@ -261,9 +262,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
|
||||||
@@ -275,10 +276,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,
|
||||||
@@ -432,6 +433,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);
|
||||||
@@ -440,12 +442,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
|
||||||
@@ -460,8 +461,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,
|
||||||
@@ -470,8 +471,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;
|
||||||
}
|
}
|
||||||
@@ -483,6 +483,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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user