Commit 06f3e51d authored by John Koleszar's avatar John Koleszar

vpx_scale: sync from master

Update vpx_scale from current code in master, run style transform, fix
lint warnings.

Change-Id: I47eadeb5b6881d448ea3728537f9b8a5b5aac78e
parent 4b2c2b9a
......@@ -81,7 +81,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
oci->fb_idx_ref_cnt[i] = 0;
oci->yv12_fb[i].flags = 0;
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0) {
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height,
VP9BORDERINPIXELS) < 0) {
vp9_de_alloc_frame_buffers(oci);
return 1;
}
......@@ -97,12 +98,14 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
oci->fb_idx_ref_cnt[2] = 1;
oci->fb_idx_ref_cnt[3] = 1;
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0) {
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16,
VP9BORDERINPIXELS) < 0) {
vp9_de_alloc_frame_buffers(oci);
return 1;
}
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0) {
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height,
VP9BORDERINPIXELS) < 0) {
vp9_de_alloc_frame_buffers(oci);
return 1;
}
......
......@@ -27,7 +27,7 @@ DEFINE(yv12_buffer_config_y_buffer, offsetof(YV12_BUFFER_CONFIG, y_b
DEFINE(yv12_buffer_config_u_buffer, offsetof(YV12_BUFFER_CONFIG, u_buffer));
DEFINE(yv12_buffer_config_v_buffer, offsetof(YV12_BUFFER_CONFIG, v_buffer));
DEFINE(yv12_buffer_config_border, offsetof(YV12_BUFFER_CONFIG, border));
DEFINE(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS);
DEFINE(VP9BORDERINPIXELS_VAL, VP9BORDERINPIXELS);
END
......@@ -36,5 +36,5 @@ END
#if HAVE_ARMV7
/* vp8_yv12_extend_frame_borders_neon makes several assumptions based on this */
ct_assert(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS == 32)
ct_assert(VP9BORDERINPIXELS_VAL, VP9BORDERINPIXELS == 32)
#endif
......@@ -12,7 +12,6 @@
#include "vpx_ports/config.h"
#include "vpx_scale/yv12config.h"
#include "postproc.h"
#include "vpx_scale/yv12extend.h"
#include "vpx_scale/vpxscale.h"
#include "systemdependent.h"
......@@ -667,7 +666,7 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest,
vp9_deblock(oci->frame_to_show, &oci->post_proc_buffer,
q, 1, 0, RTCD_VTABLE(oci));
} else {
vp8_yv12_copy_frame_ptr(oci->frame_to_show, &oci->post_proc_buffer);
vp8_yv12_copy_frame(oci->frame_to_show, &oci->post_proc_buffer);
}
if (flags & VP9D_ADDNOISE) {
......
......@@ -576,27 +576,29 @@ static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) {
* filtering. The bottom and right edges use 16 pixels plus 2 pixels
* left of the central pixel when filtering.
*/
if (mv->col < (xd->mb_to_left_edge - ((16 + INTERP_EXTEND) << 3)))
if (mv->col < (xd->mb_to_left_edge - ((16 + VP9_INTERP_EXTEND) << 3)))
mv->col = xd->mb_to_left_edge - (16 << 3);
else if (mv->col > xd->mb_to_right_edge + ((15 + INTERP_EXTEND) << 3))
else if (mv->col > xd->mb_to_right_edge + ((15 + VP9_INTERP_EXTEND) << 3))
mv->col = xd->mb_to_right_edge + (16 << 3);
if (mv->row < (xd->mb_to_top_edge - ((16 + INTERP_EXTEND) << 3)))
if (mv->row < (xd->mb_to_top_edge - ((16 + VP9_INTERP_EXTEND) << 3)))
mv->row = xd->mb_to_top_edge - (16 << 3);
else if (mv->row > xd->mb_to_bottom_edge + ((15 + INTERP_EXTEND) << 3))
else if (mv->row > xd->mb_to_bottom_edge + ((15 + VP9_INTERP_EXTEND) << 3))
mv->row = xd->mb_to_bottom_edge + (16 << 3);
}
/* A version of the above function for chroma block MVs.*/
static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) {
mv->col = (2 * mv->col < (xd->mb_to_left_edge - ((16 + INTERP_EXTEND) << 3))) ?
const int extend = VP9_INTERP_EXTEND;
mv->col = (2 * mv->col < (xd->mb_to_left_edge - ((16 + extend) << 3))) ?
(xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col;
mv->col = (2 * mv->col > xd->mb_to_right_edge + ((15 + INTERP_EXTEND) << 3)) ?
mv->col = (2 * mv->col > xd->mb_to_right_edge + ((15 + extend) << 3)) ?
(xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col;
mv->row = (2 * mv->row < (xd->mb_to_top_edge - ((16 + INTERP_EXTEND) << 3))) ?
mv->row = (2 * mv->row < (xd->mb_to_top_edge - ((16 + extend) << 3))) ?
(xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row;
mv->row = (2 * mv->row > xd->mb_to_bottom_edge + ((15 + INTERP_EXTEND) << 3)) ?
mv->row = (2 * mv->row > xd->mb_to_bottom_edge + ((15 + extend) << 3)) ?
(xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row;
}
......@@ -621,12 +623,12 @@ void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd,
if (xd->mode_info_context->mbmi.pred_filter_enabled) {
if ((ymv.as_mv.row | ymv.as_mv.col) & 7) {
// Sub-pel filter needs extended input
int len = 15 + (INTERP_EXTEND << 1);
int len = 15 + (VP9_INTERP_EXTEND << 1);
unsigned char Temp[32 * 32]; // Data required by sub-pel filter
unsigned char *pTemp = Temp + (INTERP_EXTEND - 1) * (len + 1);
unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
// Copy extended MB into Temp array, applying the spatial filter
filter_mb(ptr - (INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
filter_mb(ptr - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
Temp, len, len, len);
// Sub-pel interpolation
......@@ -693,15 +695,15 @@ void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
int i;
unsigned char *pSrc = uptr;
unsigned char *pDst = dst_u;
int len = 7 + (INTERP_EXTEND << 1);
int len = 7 + (VP9_INTERP_EXTEND << 1);
unsigned char Temp[32 * 32]; // Data required by the sub-pel filter
unsigned char *pTemp = Temp + (INTERP_EXTEND - 1) * (len + 1);
unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
// U & V
for (i = 0; i < 2; i++) {
if (_o16x16mv.as_int & 0x000f000f) {
// Copy extended MB into Temp array, applying the spatial filter
filter_mb(pSrc - (INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
filter_mb(pSrc - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
Temp, len, len, len);
// Sub-pel filter
......@@ -831,12 +833,12 @@ void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd,
if (xd->mode_info_context->mbmi.pred_filter_enabled) {
if ((mv_row | mv_col) & 7) {
// Sub-pel filter needs extended input
int len = 15 + (INTERP_EXTEND << 1);
int len = 15 + (VP9_INTERP_EXTEND << 1);
unsigned char Temp[32 * 32]; // Data required by sub-pel filter
unsigned char *pTemp = Temp + (INTERP_EXTEND - 1) * (len + 1);
unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
// Copy extended MB into Temp array, applying the spatial filter
filter_mb(ptr - (INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
filter_mb(ptr - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
Temp, len, len, len);
// Sub-pel filter
......@@ -898,9 +900,9 @@ void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
#if CONFIG_PRED_FILTER
if (xd->mode_info_context->mbmi.pred_filter_enabled) {
int i;
int len = 7 + (INTERP_EXTEND << 1);
int len = 7 + (VP9_INTERP_EXTEND << 1);
unsigned char Temp[32 * 32]; // Data required by sub-pel filter
unsigned char *pTemp = Temp + (INTERP_EXTEND - 1) * (len + 1);
unsigned char *pTemp = Temp + (VP9_INTERP_EXTEND - 1) * (len + 1);
unsigned char *pSrc = uptr;
unsigned char *pDst = dst_u;
......@@ -908,7 +910,7 @@ void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
for (i = 0; i < 2; i++) {
if ((omv_row | omv_col) & 15) {
// Copy extended MB into Temp array, applying the spatial filter
filter_mb(pSrc - (INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
filter_mb(pSrc - (VP9_INTERP_EXTEND - 1) * (pre_stride + 1), pre_stride,
Temp, len, len, len);
// Sub-pel filter
......
......@@ -480,3 +480,39 @@ specialize vp9_short_walsh8x4_x8
fi
# end encoder functions
# Scaler functions
if [ "CONFIG_SPATIAL_RESAMPLING" != "yes" ]; then
prototype void vp8_horizontal_line_4_5_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_4_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_4_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_2_3_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_2_3_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_2_3_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_3_5_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_3_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_3_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_3_4_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_3_4_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_3_4_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_1_2_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_1_2_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_1_2_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_5_4_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_5_4_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_5_3_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_5_3_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_2_1_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_2_1_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_vertical_band_2_1_scale_i "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
fi
prototype void vp8_yv12_extend_frame_borders "struct yv12_buffer_config *ybf"
specialize vp8_yv12_extend_frame_borders neon
prototype void vp8_yv12_copy_frame "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"
specialize vp8_yv12_copy_frame neon
prototype void vp8_yv12_copy_y "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"
specialize vp8_yv12_copy_y neon
......@@ -20,7 +20,6 @@
#include "vp9/common/entropymode.h"
#include "vp9/common/quant_common.h"
#include "vpx_scale/vpxscale.h"
#include "vpx_scale/yv12extend.h"
#include "vp9/common/setupintrarecon.h"
#include "decodemv.h"
......
......@@ -17,7 +17,6 @@
#include "onyxd_int.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/alloccommon.h"
#include "vpx_scale/yv12extend.h"
#include "vp9/common/loopfilter.h"
#include "vp9/common/swapyv12buffer.h"
#include <stdio.h>
......@@ -108,7 +107,6 @@ void vp9_initialize_dec(void) {
if (!init_done) {
vp9_initialize_common();
vp9_init_quant_tables();
vp8_scale_machine_specific_config();
init_done = 1;
}
}
......@@ -191,7 +189,7 @@ vpx_codec_err_t vp9_get_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
vpx_internal_error(&pbi->common.error, VPX_CODEC_ERROR,
"Incorrect buffer dimensions");
} else
vp8_yv12_copy_frame_ptr(&cm->yv12_fb[ref_fb_idx], sd);
vp8_yv12_copy_frame(&cm->yv12_fb[ref_fb_idx], sd);
return pbi->common.error.error_code;
}
......@@ -231,7 +229,7 @@ vpx_codec_err_t vp9_set_reference_dec(VP9D_PTR ptr, VP9_REFFRAME ref_frame_flag,
/* Manage the reference counters and copy image. */
ref_cnt_fb(cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb);
vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[*ref_fb_ptr]);
vp8_yv12_copy_frame(sd, &cm->yv12_fb[*ref_fb_ptr]);
}
return pbi->common.error.error_code;
......@@ -428,7 +426,7 @@ int vp9_receive_compressed_data(VP9D_PTR ptr, unsigned long size,
/* Apply the loop filter if appropriate. */
vp9_loop_filter_frame(cm, &pbi->mb);
}
vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show);
vp8_yv12_extend_frame_borders(cm->frame_to_show);
}
#if CONFIG_DEBUG
......
......@@ -13,7 +13,6 @@
#include "vp9/encoder/onyx_int.h"
#include "vp9/encoder/quantize.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_scale/yv12extend.h"
#include "vpx_scale/vpxscale.h"
#include "vp9/common/alloccommon.h"
......
......@@ -574,12 +574,12 @@ static void pick_mb_modes(VP9_COMP *cpi,
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 16x16 block size
x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_row_min = -((mb_row * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
(VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND));
x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
(VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND));
xd->up_available = (mb_row != 0);
xd->left_available = (mb_col != 0);
......@@ -759,12 +759,12 @@ static void pick_sb_modes (VP9_COMP *cpi,
/* Set up limit values for MV components to prevent them from
* extending beyond the UMV borders assuming 16x16 block size */
x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_row_min = -((mb_row * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
(VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 32 - VP9_INTERP_EXTEND));
x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
(VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 32 - VP9_INTERP_EXTEND));
xd->up_available = (mb_row != 0);
xd->left_available = (mb_col != 0);
......@@ -939,22 +939,22 @@ static void encode_sb(VP9_COMP *cpi,
if (xd->mode_info_context->mbmi.encoded_as_sb) {
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 32x32 block size
x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_row_min = -((mb_row * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
(VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 32 - VP9_INTERP_EXTEND));
x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
(VP8BORDERINPIXELS - 32 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 32 - VP9_INTERP_EXTEND));
} else {
#endif
// Set up limit values for MV components to prevent them from
// extending beyond the UMV borders assuming 16x16 block size
x->mv_row_min = -((mb_row * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP8BORDERINPIXELS - INTERP_EXTEND);
x->mv_row_min = -((mb_row * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_col_min = -((mb_col * 16) + VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
x->mv_row_max = ((cm->mb_rows - mb_row) * 16 +
(VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND));
x->mv_col_max = ((cm->mb_cols - mb_col) * 16 +
(VP8BORDERINPIXELS - 16 - INTERP_EXTEND));
(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND));
#if CONFIG_SUPERBLOCKS
}
#endif
......
......@@ -21,7 +21,6 @@
#include "encodemb.h"
#include "vp9/common/extend.h"
#include "vp9/common/systemdependent.h"
#include "vpx_scale/yv12extend.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/swapyv12buffer.h"
#include <stdio.h>
......@@ -513,8 +512,9 @@ void vp9_first_pass(VP9_COMP *cpi) {
recon_uvoffset = (mb_row * recon_uv_stride * 8);
// Set up limit values for motion vectors to prevent them extending outside the UMV borders
x->mv_row_min = -((mb_row * 16) + (VP8BORDERINPIXELS - 16));
x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + (VP8BORDERINPIXELS - 16);
x->mv_row_min = -((mb_row * 16) + (VP9BORDERINPIXELS - 16));
x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16)
+ (VP9BORDERINPIXELS - 16);
// for each macroblock col in image
......@@ -544,8 +544,9 @@ void vp9_first_pass(VP9_COMP *cpi) {
intra_error += (int64_t)this_error;
// Set up limit values for motion vectors to prevent them extending outside the UMV borders
x->mv_col_min = -((mb_col * 16) + (VP8BORDERINPIXELS - 16));
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + (VP8BORDERINPIXELS - 16);
x->mv_col_min = -((mb_col * 16) + (VP9BORDERINPIXELS - 16));
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16)
+ (VP9BORDERINPIXELS - 16);
// Other than for the first frame do a motion search
if (cm->current_video_frame > 0) {
......@@ -764,7 +765,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
(cpi->twopass.this_frame_stats->pcnt_inter > 0.20) &&
((cpi->twopass.this_frame_stats->intra_error /
cpi->twopass.this_frame_stats->coded_error) > 2.0))) {
vp8_yv12_copy_frame_ptr(lst_yv12, gld_yv12);
vp8_yv12_copy_frame(lst_yv12, gld_yv12);
cpi->twopass.sr_update_lag = 1;
} else
cpi->twopass.sr_update_lag++;
......@@ -775,7 +776,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Special case for the first frame. Copy into the GF buffer as a second reference.
if (cm->current_video_frame == 0) {
vp8_yv12_copy_frame_ptr(lst_yv12, gld_yv12);
vp8_yv12_copy_frame(lst_yv12, gld_yv12);
}
......
......@@ -80,7 +80,7 @@ vp9_lookahead_init(unsigned int width,
goto bail;
for (i = 0; i < depth; i++)
if (vp8_yv12_alloc_frame_buffer(&ctx->buf[i].img,
width, height, VP8BORDERINPIXELS))
width, height, VP9BORDERINPIXELS))
goto bail;
}
return ctx;
......
......@@ -303,8 +303,9 @@ static void update_mbgraph_frame_stats
// Set up limit values for motion vectors to prevent them extending outside the UMV borders
arf_top_mv.as_int = 0;
gld_top_mv.as_int = 0;
x->mv_row_min = -(VP8BORDERINPIXELS - 16 - INTERP_EXTEND);
x->mv_row_max = (cm->mb_rows - 1) * 16 + VP8BORDERINPIXELS - 16 - INTERP_EXTEND;
x->mv_row_min = -(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND);
x->mv_row_max = (cm->mb_rows - 1) * 16 + VP9BORDERINPIXELS
- 16 - VP9_INTERP_EXTEND;
xd->up_available = 0;
xd->dst.y_stride = buf->y_stride;
xd->pre.y_stride = buf->y_stride;
......@@ -320,8 +321,9 @@ static void update_mbgraph_frame_stats
// Set up limit values for motion vectors to prevent them extending outside the UMV borders
arf_left_mv.as_int = arf_top_mv.as_int;
gld_left_mv.as_int = gld_top_mv.as_int;
x->mv_col_min = -(VP8BORDERINPIXELS - 16 - INTERP_EXTEND);
x->mv_col_max = (cm->mb_cols - 1) * 16 + VP8BORDERINPIXELS - 16 - INTERP_EXTEND;
x->mv_col_min = -(VP9BORDERINPIXELS - 16 - VP9_INTERP_EXTEND);
x->mv_col_max = (cm->mb_cols - 1) * 16 + VP9BORDERINPIXELS
- 16 - VP9_INTERP_EXTEND;
xd->left_available = 0;
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
......
......@@ -275,14 +275,14 @@ int vp9_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int buf_r1, buf_r2, buf_c1, buf_c2;
// Clamping to avoid out-of-range data access
buf_r1 = ((bestmv->as_mv.row - INTERP_EXTEND) < x->mv_row_min) ?
(bestmv->as_mv.row - x->mv_row_min) : INTERP_EXTEND - 1;
buf_r2 = ((bestmv->as_mv.row + INTERP_EXTEND) > x->mv_row_max) ?
(x->mv_row_max - bestmv->as_mv.row) : INTERP_EXTEND - 1;
buf_c1 = ((bestmv->as_mv.col - INTERP_EXTEND) < x->mv_col_min) ?
(bestmv->as_mv.col - x->mv_col_min) : INTERP_EXTEND - 1;
buf_c2 = ((bestmv->as_mv.col + INTERP_EXTEND) > x->mv_col_max) ?
(x->mv_col_max - bestmv->as_mv.col) : INTERP_EXTEND - 1;
buf_r1 = ((bestmv->as_mv.row - VP9_INTERP_EXTEND) < x->mv_row_min) ?
(bestmv->as_mv.row - x->mv_row_min) : VP9_INTERP_EXTEND - 1;
buf_r2 = ((bestmv->as_mv.row + VP9_INTERP_EXTEND) > x->mv_row_max) ?
(x->mv_row_max - bestmv->as_mv.row) : VP9_INTERP_EXTEND - 1;
buf_c1 = ((bestmv->as_mv.col - VP9_INTERP_EXTEND) < x->mv_col_min) ?
(bestmv->as_mv.col - x->mv_col_min) : VP9_INTERP_EXTEND - 1;
buf_c2 = ((bestmv->as_mv.col + VP9_INTERP_EXTEND) > x->mv_col_max) ?
(x->mv_col_max - bestmv->as_mv.col) : VP9_INTERP_EXTEND - 1;
y_stride = 32;
/* Copy to intermediate buffer before searching. */
......
......@@ -23,7 +23,6 @@
#include "ratectrl.h"
#include "vp9/common/quant_common.h"
#include "segmentation.h"
#include "vpx_scale/yv12extend.h"
#if CONFIG_POSTPROC
#include "vp9/common/postproc.h"
#endif
......@@ -309,7 +308,6 @@ void vp9_initialize_enc() {
static int init_done = 0;
if (!init_done) {
vp8_scale_machine_specific_config();
vp9_initialize_common();
vp9_tokenize_initialize();
vp9_init_quant_tables();
......@@ -1239,7 +1237,7 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
#if VP9_TEMPORAL_ALT_REF
if (vp8_yv12_alloc_frame_buffer(&cpi->alt_ref_buffer,
width, height, VP8BORDERINPIXELS))
width, height, VP9BORDERINPIXELS))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate altref buffer");
......@@ -1283,12 +1281,12 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
if (vp8_yv12_alloc_frame_buffer(&cpi->last_frame_uf,
width, height, VP8BORDERINPIXELS))
width, height, VP9BORDERINPIXELS))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate last frame buffer");
if (vp8_yv12_alloc_frame_buffer(&cpi->scaled_source,
width, height, VP8BORDERINPIXELS))
width, height, VP9BORDERINPIXELS))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate scaled source buffer");
......@@ -2405,7 +2403,7 @@ int vp9_get_reference_enc(VP9_PTR ptr, VP9_REFFRAME ref_frame_flag,
else
return -1;
vp8_yv12_copy_frame_ptr(&cm->yv12_fb[ref_fb_idx], sd);
vp8_yv12_copy_frame(&cm->yv12_fb[ref_fb_idx], sd);
return 0;
}
......@@ -2426,7 +2424,7 @@ int vp9_set_reference_enc(VP9_PTR ptr, VP9_REFFRAME ref_frame_flag,
else
return -1;
vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[ref_fb_idx]);
vp8_yv12_copy_frame(sd, &cm->yv12_fb[ref_fb_idx]);
return 0;
}
......@@ -2806,7 +2804,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
vp9_loop_filter_frame(cm, &cpi->mb.e_mbd);
}
vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show);
vp8_yv12_extend_frame_borders(cm->frame_to_show);
}
......
......@@ -13,7 +13,6 @@
#include "onyx_int.h"
#include "quantize.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_scale/yv12extend.h"
#include "vpx_scale/vpxscale.h"
#include "vp9/common/alloccommon.h"
#include "vp9/common/loopfilter.h"
......@@ -279,7 +278,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
#endif
#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT
{
vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cpi->last_frame_uf);
vp8_yv12_copy_frame(cm->frame_to_show, &cpi->last_frame_uf);
}
#endif
......@@ -320,7 +319,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
#endif
#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT
{
vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show);
vp8_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
}
#endif
......@@ -359,7 +358,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
#endif
#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT
{
vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show);
vp8_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
}
#endif
......@@ -394,7 +393,7 @@ void vp9_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP9_COMP *cpi) {
#endif
#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT
{
vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show);
vp8_yv12_copy_y(&cpi->last_frame_uf, cm->frame_to_show);
}
#endif
......
......@@ -22,7 +22,6 @@
#include "ratectrl.h"
#include "vp9/common/quant_common.h"
#include "segmentation.h"
#include "vpx_scale/yv12extend.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/swapyv12buffer.h"
#include "vpx_ports/vpx_timer.h"
......@@ -247,18 +246,19 @@ static void temporal_filter_iterate_c
for (mb_row = 0; mb_row < mb_rows; mb_row++) {
#if ALT_REF_MC_ENABLED
// Source frames are extended to 16 pixels. This is different than
// L/A/G reference frames that have a border of 32 (VP8BORDERINPIXELS)
// L/A/G reference frames that have a border of 32 (VP9BORDERINPIXELS)
// A 6/8 tap filter is used for motion search. This requires 2 pixels
// before and 3 pixels after. So the largest Y mv on a border would
// then be 16 - INTERP_EXTEND. The UV blocks are half the size of the Y and
// therefore only extended by 8. The largest mv that a UV block
// can support is 8 - INTERP_EXTEND. A UV mv is half of a Y mv.
// (16 - INTERP_EXTEND) >> 1 which is greater than 8 - INTERP_EXTEND.
// then be 16 - VP9_INTERP_EXTEND. The UV blocks are half the size of the
// Y and therefore only extended by 8. The largest mv that a UV block
// can support is 8 - VP9_INTERP_EXTEND. A UV mv is half of a Y mv.
// (16 - VP9_INTERP_EXTEND) >> 1 which is greater than
// 8 - VP9_INTERP_EXTEND.
// To keep the mv in play for both Y and UV planes the max that it
// can be on a border is therefore 16 - (2*INTERP_EXTEND+1).
cpi->mb.mv_row_min = -((mb_row * 16) + (17 - 2 * INTERP_EXTEND));
// can be on a border is therefore 16 - (2*VP9_INTERP_EXTEND+1).
cpi->mb.mv_row_min = -((mb_row * 16) + (17 - 2 * VP9_INTERP_EXTEND));
cpi->mb.mv_row_max = ((cpi->common.mb_rows - 1 - mb_row) * 16)
+ (17 - 2 * INTERP_EXTEND);
+ (17 - 2 * VP9_INTERP_EXTEND);
#endif
for (mb_col = 0; mb_col < mb_cols; mb_col++) {
......@@ -269,9 +269,9 @@ static void temporal_filter_iterate_c
vpx_memset(count, 0, 384 * sizeof(unsigned short));
#if ALT_REF_MC_ENABLED
cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * INTERP_EXTEND));
cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND));
cpi->mb.mv_col_max = ((cpi->common.mb_cols - 1 - mb_col) * 16)