Merge "Eliminating several YV12_BUFFER_CONFIG usages." into experimental

This commit is contained in:
Dmitry Kovalev 2013-05-08 16:36:24 -07:00 коммит произвёл Gerrit Code Review
Родитель f0911886f3 81f33bc091
Коммит 7b602cba65
5 изменённых файлов: 35 добавлений и 46 удалений

Просмотреть файл

@ -18,11 +18,8 @@
#include "vp9/common/vp9_reconintra.h"
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
YV12_BUFFER_CONFIG *other,
int other_w, int other_h,
int this_w, int this_h) {
int other_h = other->y_crop_height;
int other_w = other->y_crop_width;
scale->x_num = other_w;
scale->x_den = this_w;
scale->x_offset_q4 = 0; // calculated per-mb

Просмотреть файл

@ -35,7 +35,7 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd,
VP9_COMMON *cm);
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
YV12_BUFFER_CONFIG *other,
int other_w, int other_h,
int this_w, int this_h);
void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
@ -67,14 +67,11 @@ static int unscaled_value(int val, const struct scale_factors *scale) {
return val;
}
static int scaled_buffer_offset(int x_offset,
int y_offset,
int stride,
static int scaled_buffer_offset(int x_offset, int y_offset, int stride,
const struct scale_factors *scale) {
if (scale)
return scale->scale_value_y(y_offset, scale) * stride +
scale->scale_value_x(x_offset, scale);
return y_offset * stride + x_offset;
const int x = scale ? scale->scale_value_x(x_offset, scale) : x_offset;
const int y = scale ? scale->scale_value_y(y_offset, scale) : y_offset;
return y * stride + x;
}
static void setup_pred_plane(struct buf_2d *dst,

Просмотреть файл

@ -1013,7 +1013,9 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
if (mapped_ref >= NUM_YV12_BUFFERS)
memset(sf, 0, sizeof(*sf));
else
vp9_setup_scale_factors_for_frame(sf, fb, pc->width, pc->height);
vp9_setup_scale_factors_for_frame(sf,
fb->y_crop_width, fb->y_crop_height,
pc->width, pc->height);
}
// Read the sign bias for each reference frame buffer.

Просмотреть файл

@ -3851,13 +3851,13 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
if (cm->active_ref_idx[i] >= NUM_YV12_BUFFERS) {
memset(&cm->active_ref_scale[i], 0, sizeof(cm->active_ref_scale[i]));
continue;
}
} else {
YV12_BUFFER_CONFIG *fb = &cm->yv12_fb[cm->active_ref_idx[i]];
vp9_setup_scale_factors_for_frame(&cm->active_ref_scale[i],
&cm->yv12_fb[cm->active_ref_idx[i]],
fb->y_crop_width, fb->y_crop_height,
cm->width, cm->height);
}
}
vp9_setup_interp_filters(&cpi->mb.e_mbd, DEFAULT_INTERP_FILTER, cm);

Просмотреть файл

@ -118,9 +118,9 @@ void vp9_temporal_filter_apply_c(uint8_t *frame1,
#if ALT_REF_MC_ENABLED
static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
YV12_BUFFER_CONFIG *arf_frame,
YV12_BUFFER_CONFIG *frame_ptr,
int mb_offset,
uint8_t *arf_frame_buf,
uint8_t *frame_ptr_buf,
int stride,
int error_thresh) {
MACROBLOCK *x = &cpi->mb;
MACROBLOCKD* const xd = &x->e_mbd;
@ -141,10 +141,10 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
best_ref_mv1_full.as_mv.row = best_ref_mv1.as_mv.row >> 3;
// Setup frame pointers
x->plane[0].src.buf = arf_frame->y_buffer + mb_offset;
x->plane[0].src.stride = arf_frame->y_stride;
xd->plane[0].pre[0].buf = frame_ptr->y_buffer + mb_offset;
xd->plane[0].pre[0].stride = arf_frame->y_stride;
x->plane[0].src.buf = arf_frame_buf;
x->plane[0].src.stride = stride;
xd->plane[0].pre[0].buf = frame_ptr_buf;
xd->plane[0].pre[0].stride = stride;
// Further step/diamond searches as necessary
if (cpi->speed < 8)
@ -258,9 +258,9 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
// Find best match in this frame by MC
err = temporal_filter_find_matching_mb_c
(cpi,
cpi->frames[alt_ref_index],
cpi->frames[frame],
mb_y_offset,
cpi->frames[alt_ref_index]->y_buffer + mb_y_offset,
cpi->frames[frame]->y_buffer + mb_y_offset,
cpi->frames[frame]->y_stride,
THRESH_LOW);
#endif
// Assign higher weight to matching MB if it's error
@ -358,10 +358,10 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi,
}
void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
VP9_COMMON *const cm = &cpi->common;
int frame = 0;
int num_frames_backward = 0;
int num_frames_forward = 0;
int frames_to_blur_backward = 0;
int frames_to_blur_forward = 0;
int frames_to_blur = 0;
@ -371,15 +371,13 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
int blur_type = cpi->oxcf.arnr_type;
int max_frames = cpi->active_arnr_frames;
num_frames_backward = distance;
num_frames_forward = vp9_lookahead_depth(cpi->lookahead)
const int num_frames_backward = distance;
const int num_frames_forward = vp9_lookahead_depth(cpi->lookahead)
- (num_frames_backward + 1);
switch (blur_type) {
case 1:
/////////////////////////////////////////
// Backward Blur
frames_to_blur_backward = num_frames_backward;
if (frames_to_blur_backward >= max_frames)
@ -389,7 +387,6 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
break;
case 2:
/////////////////////////////////////////
// Forward Blur
frames_to_blur_forward = num_frames_forward;
@ -402,7 +399,6 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
case 3:
default:
/////////////////////////////////////////
// Center Blur
frames_to_blur_forward = num_frames_forward;
frames_to_blur_backward = num_frames_backward;
@ -442,9 +438,9 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
// Setup scaling factors. Scaling on each of the arnr frames is not supported
vp9_setup_scale_factors_for_frame(&cpi->mb.e_mbd.scale_factor[0],
&cpi->common.yv12_fb[cpi->common.new_fb_idx],
cpi->common.width,
cpi->common.height);
cm->yv12_fb[cm->new_fb_idx].y_crop_width,
cm->yv12_fb[cm->new_fb_idx].y_crop_height,
cm->width, cm->height);
cpi->mb.e_mbd.scale_factor_uv[0] = cpi->mb.e_mbd.scale_factor[0];
// Setup frame pointers, NULL indicates frame not included in filter
@ -456,10 +452,7 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
cpi->frames[frames_to_blur - 1 - frame] = &buf->img;
}
temporal_filter_iterate_c(
cpi,
frames_to_blur,
frames_to_blur_backward,
temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward,
strength);
}