Merge "Eliminating several YV12_BUFFER_CONFIG usages." into experimental
This commit is contained in:
Коммит
7b602cba65
|
@ -18,11 +18,8 @@
|
||||||
#include "vp9/common/vp9_reconintra.h"
|
#include "vp9/common/vp9_reconintra.h"
|
||||||
|
|
||||||
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
|
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 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_num = other_w;
|
||||||
scale->x_den = this_w;
|
scale->x_den = this_w;
|
||||||
scale->x_offset_q4 = 0; // calculated per-mb
|
scale->x_offset_q4 = 0; // calculated per-mb
|
||||||
|
|
|
@ -35,7 +35,7 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd,
|
||||||
VP9_COMMON *cm);
|
VP9_COMMON *cm);
|
||||||
|
|
||||||
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
|
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 this_w, int this_h);
|
||||||
|
|
||||||
void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
|
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;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scaled_buffer_offset(int x_offset,
|
static int scaled_buffer_offset(int x_offset, int y_offset, int stride,
|
||||||
int y_offset,
|
|
||||||
int stride,
|
|
||||||
const struct scale_factors *scale) {
|
const struct scale_factors *scale) {
|
||||||
if (scale)
|
const int x = scale ? scale->scale_value_x(x_offset, scale) : x_offset;
|
||||||
return scale->scale_value_y(y_offset, scale) * stride +
|
const int y = scale ? scale->scale_value_y(y_offset, scale) : y_offset;
|
||||||
scale->scale_value_x(x_offset, scale);
|
return y * stride + x;
|
||||||
return y_offset * stride + x_offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_pred_plane(struct buf_2d *dst,
|
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)
|
if (mapped_ref >= NUM_YV12_BUFFERS)
|
||||||
memset(sf, 0, sizeof(*sf));
|
memset(sf, 0, sizeof(*sf));
|
||||||
else
|
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.
|
// 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) {
|
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
|
||||||
if (cm->active_ref_idx[i] >= NUM_YV12_BUFFERS) {
|
if (cm->active_ref_idx[i] >= NUM_YV12_BUFFERS) {
|
||||||
memset(&cm->active_ref_scale[i], 0, sizeof(cm->active_ref_scale[i]));
|
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],
|
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);
|
cm->width, cm->height);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vp9_setup_interp_filters(&cpi->mb.e_mbd, DEFAULT_INTERP_FILTER, cm);
|
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
|
#if ALT_REF_MC_ENABLED
|
||||||
|
|
||||||
static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
|
static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
|
||||||
YV12_BUFFER_CONFIG *arf_frame,
|
uint8_t *arf_frame_buf,
|
||||||
YV12_BUFFER_CONFIG *frame_ptr,
|
uint8_t *frame_ptr_buf,
|
||||||
int mb_offset,
|
int stride,
|
||||||
int error_thresh) {
|
int error_thresh) {
|
||||||
MACROBLOCK *x = &cpi->mb;
|
MACROBLOCK *x = &cpi->mb;
|
||||||
MACROBLOCKD* const xd = &x->e_mbd;
|
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;
|
best_ref_mv1_full.as_mv.row = best_ref_mv1.as_mv.row >> 3;
|
||||||
|
|
||||||
// Setup frame pointers
|
// Setup frame pointers
|
||||||
x->plane[0].src.buf = arf_frame->y_buffer + mb_offset;
|
x->plane[0].src.buf = arf_frame_buf;
|
||||||
x->plane[0].src.stride = arf_frame->y_stride;
|
x->plane[0].src.stride = stride;
|
||||||
xd->plane[0].pre[0].buf = frame_ptr->y_buffer + mb_offset;
|
xd->plane[0].pre[0].buf = frame_ptr_buf;
|
||||||
xd->plane[0].pre[0].stride = arf_frame->y_stride;
|
xd->plane[0].pre[0].stride = stride;
|
||||||
|
|
||||||
// Further step/diamond searches as necessary
|
// Further step/diamond searches as necessary
|
||||||
if (cpi->speed < 8)
|
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
|
// Find best match in this frame by MC
|
||||||
err = temporal_filter_find_matching_mb_c
|
err = temporal_filter_find_matching_mb_c
|
||||||
(cpi,
|
(cpi,
|
||||||
cpi->frames[alt_ref_index],
|
cpi->frames[alt_ref_index]->y_buffer + mb_y_offset,
|
||||||
cpi->frames[frame],
|
cpi->frames[frame]->y_buffer + mb_y_offset,
|
||||||
mb_y_offset,
|
cpi->frames[frame]->y_stride,
|
||||||
THRESH_LOW);
|
THRESH_LOW);
|
||||||
#endif
|
#endif
|
||||||
// Assign higher weight to matching MB if it's error
|
// 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) {
|
void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
|
||||||
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
|
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
|
|
||||||
int num_frames_backward = 0;
|
|
||||||
int num_frames_forward = 0;
|
|
||||||
int frames_to_blur_backward = 0;
|
int frames_to_blur_backward = 0;
|
||||||
int frames_to_blur_forward = 0;
|
int frames_to_blur_forward = 0;
|
||||||
int frames_to_blur = 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 blur_type = cpi->oxcf.arnr_type;
|
||||||
int max_frames = cpi->active_arnr_frames;
|
int max_frames = cpi->active_arnr_frames;
|
||||||
|
|
||||||
num_frames_backward = distance;
|
const int num_frames_backward = distance;
|
||||||
num_frames_forward = vp9_lookahead_depth(cpi->lookahead)
|
const int num_frames_forward = vp9_lookahead_depth(cpi->lookahead)
|
||||||
- (num_frames_backward + 1);
|
- (num_frames_backward + 1);
|
||||||
|
|
||||||
switch (blur_type) {
|
switch (blur_type) {
|
||||||
case 1:
|
case 1:
|
||||||
/////////////////////////////////////////
|
|
||||||
// Backward Blur
|
// Backward Blur
|
||||||
|
|
||||||
frames_to_blur_backward = num_frames_backward;
|
frames_to_blur_backward = num_frames_backward;
|
||||||
|
|
||||||
if (frames_to_blur_backward >= max_frames)
|
if (frames_to_blur_backward >= max_frames)
|
||||||
|
@ -389,7 +387,6 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
/////////////////////////////////////////
|
|
||||||
// Forward Blur
|
// Forward Blur
|
||||||
|
|
||||||
frames_to_blur_forward = num_frames_forward;
|
frames_to_blur_forward = num_frames_forward;
|
||||||
|
@ -402,7 +399,6 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
default:
|
default:
|
||||||
/////////////////////////////////////////
|
|
||||||
// Center Blur
|
// Center Blur
|
||||||
frames_to_blur_forward = num_frames_forward;
|
frames_to_blur_forward = num_frames_forward;
|
||||||
frames_to_blur_backward = num_frames_backward;
|
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
|
// 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],
|
vp9_setup_scale_factors_for_frame(&cpi->mb.e_mbd.scale_factor[0],
|
||||||
&cpi->common.yv12_fb[cpi->common.new_fb_idx],
|
cm->yv12_fb[cm->new_fb_idx].y_crop_width,
|
||||||
cpi->common.width,
|
cm->yv12_fb[cm->new_fb_idx].y_crop_height,
|
||||||
cpi->common.height);
|
cm->width, cm->height);
|
||||||
cpi->mb.e_mbd.scale_factor_uv[0] = cpi->mb.e_mbd.scale_factor[0];
|
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
|
// 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;
|
cpi->frames[frames_to_blur - 1 - frame] = &buf->img;
|
||||||
}
|
}
|
||||||
|
|
||||||
temporal_filter_iterate_c(
|
temporal_filter_iterate_c(cpi, frames_to_blur, frames_to_blur_backward,
|
||||||
cpi,
|
|
||||||
frames_to_blur,
|
|
||||||
frames_to_blur_backward,
|
|
||||||
strength);
|
strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче