Change to extend full border only when needed

This is a short term optimization till we work out a decoder
implementation requiring no frame border extension.

Change-Id: I02d15bfde4d926b50a4e58b393d8c4062d1be70f
This commit is contained in:
Yaowu Xu 2013-07-15 14:59:59 -07:00
parent b02c4d364f
commit 5b915ebd92
7 changed files with 37 additions and 11 deletions

View File

@ -167,6 +167,8 @@ enum mv_precision {
};
#define VP9_REF_SCALE_SHIFT 14
#define VP9_REF_NO_SCALE 16384
struct scale_factors {
int x_scale_fp; // horizontal fixed point scale factor
int y_scale_fp; // vertical fixed point scale factor

View File

@ -16,6 +16,7 @@
#include "vp9/common/vp9_filter.h"
#include "vp9/common/vp9_reconinter.h"
#include "vp9/common/vp9_reconintra.h"
#include "./vpx_scale_rtcd.h"
static int scale_value_x_with_scaling(int val,
const struct scale_factors *scale) {
@ -406,6 +407,10 @@ void vp9_setup_scale_factors(VP9_COMMON *cm, int i) {
vp9_setup_scale_factors_for_frame(sf,
fb->y_crop_width, fb->y_crop_height,
cm->width, cm->height);
if (sf->x_scale_fp != VP9_REF_NO_SCALE ||
sf->y_scale_fp != VP9_REF_NO_SCALE)
vp9_extend_frame_borders(fb, cm->subsampling_x, cm->subsampling_y);
}
}

View File

@ -361,8 +361,9 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
cm->current_video_frame + 3000);
#endif
vp9_extend_frame_borders(cm->frame_to_show,
cm->subsampling_x, cm->subsampling_y);
vp9_extend_frame_inner_borders(cm->frame_to_show,
cm->subsampling_x,
cm->subsampling_y);
}
#if WRITE_RECON_BUFFER == 1

View File

@ -2402,7 +2402,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level, 0);
}
vp9_extend_frame_borders(cm->frame_to_show,
vp9_extend_frame_inner_borders(cm->frame_to_show,
cm->subsampling_x, cm->subsampling_y);
}

View File

@ -96,12 +96,13 @@ vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
}
#if CONFIG_VP9
void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
int subsampling_x, int subsampling_y) {
static void extend_frame(YV12_BUFFER_CONFIG *ybf,
int subsampling_x, int subsampling_y,
int ext_size) {
const int c_w = (ybf->y_crop_width + subsampling_x) >> subsampling_x;
const int c_h = (ybf->y_crop_height + subsampling_y) >> subsampling_y;
const int c_et = ybf->border >> subsampling_y;
const int c_el = ybf->border >> subsampling_x;
const int c_et = ext_size >> subsampling_y;
const int c_el = ext_size >> subsampling_x;
const int c_eb = (ybf->border + ybf->y_height - ybf->y_crop_height +
subsampling_y) >> subsampling_y;
const int c_er = (ybf->border + ybf->y_width - ybf->y_crop_width +
@ -114,9 +115,9 @@ void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
extend_plane(ybf->y_buffer, ybf->y_stride,
ybf->y_crop_width, ybf->y_crop_height,
ybf->border, ybf->border,
ybf->border + ybf->y_height - ybf->y_crop_height,
ybf->border + ybf->y_width - ybf->y_crop_width);
ext_size, ext_size,
ext_size + ybf->y_height - ybf->y_crop_height,
ext_size + ybf->y_width - ybf->y_crop_width);
extend_plane(ybf->u_buffer, ybf->uv_stride,
c_w, c_h, c_et, c_el, c_eb, c_er);
@ -124,6 +125,19 @@ void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
extend_plane(ybf->v_buffer, ybf->uv_stride,
c_w, c_h, c_et, c_el, c_eb, c_er);
}
void vp9_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf,
int subsampling_x, int subsampling_y) {
extend_frame(ybf, subsampling_x, subsampling_y, ybf->border);
}
void vp9_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf,
int subsampling_x, int subsampling_y) {
const int inner_bw = ybf->border > VP9INNERBORDERINPIXLES ?
VP9INNERBORDERINPIXLES : ybf->border;
extend_frame(ybf, subsampling_x, subsampling_y, inner_bw);
}
#endif
/****************************************************************************

View File

@ -28,4 +28,7 @@ specialize vp8_yv12_copy_y neon
if [ "$CONFIG_VP9" = "yes" ]; then
prototype void vp9_extend_frame_borders "struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y"
specialize vp9_extend_frame_borders
prototype void vp9_extend_frame_inner_borders "struct yv12_buffer_config *ybf, int subsampling_x, int subsampling_y"
specialize vp9_extend_frame_inner_borders_c
fi

View File

@ -18,7 +18,8 @@ extern "C" {
#include "vpx/vpx_integer.h"
#define VP8BORDERINPIXELS 32
#define VP9BORDERINPIXELS 160
#define VP9INNERBORDERINPIXLES 96
#define VP9BORDERINPIXELS 160
#define VP9_INTERP_EXTEND 4
/*************************************