Commit 0726dd97 authored by Linfeng Zhang's avatar Linfeng Zhang Committed by Gerrit Code Review
Browse files

Merge "Specialize 4 to 3 scaling in vp9_scale_and_extend_frame_c()"

parents ed3a80cb afee58f2
...@@ -20,8 +20,6 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src, ...@@ -20,8 +20,6 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src,
INTERP_FILTER filter_type, int phase_scaler) { INTERP_FILTER filter_type, int phase_scaler) {
const int src_w = src->y_crop_width; const int src_w = src->y_crop_width;
const int src_h = src->y_crop_height; const int src_h = src->y_crop_height;
const int dst_w = dst->y_crop_width;
const int dst_h = dst->y_crop_height;
const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer, const uint8_t *const srcs[3] = { src->y_buffer, src->u_buffer,
src->v_buffer }; src->v_buffer };
const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride }; const int src_strides[3] = { src->y_stride, src->uv_stride, src->uv_stride };
...@@ -30,6 +28,31 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src, ...@@ -30,6 +28,31 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src,
const InterpKernel *const kernel = vp9_filter_kernels[filter_type]; const InterpKernel *const kernel = vp9_filter_kernels[filter_type];
int x, y, i; int x, y, i;
if (4 * dst->y_crop_width == 3 * src_w &&
4 * dst->y_crop_height == 3 * src_h) {
// Specialize 4 to 3 scaling.
const int dst_ws[3] = { dst->y_crop_width, dst->uv_crop_width,
dst->uv_crop_width };
const int dst_hs[3] = { dst->y_crop_height, dst->uv_crop_height,
dst->uv_crop_height };
for (i = 0; i < MAX_MB_PLANE; ++i) {
const int dst_w = dst_ws[i];
const int dst_h = dst_hs[i];
const int src_stride = src_strides[i];
const int dst_stride = dst_strides[i];
for (y = 0; y < dst_h; y += 3) {
for (x = 0; x < dst_w; x += 3) {
const uint8_t *src_ptr = srcs[i] + 4 * y / 3 * src_stride + 4 * x / 3;
uint8_t *dst_ptr = dsts[i] + y * dst_stride + x;
vpx_scaled_2d_c(src_ptr, src_stride, dst_ptr, dst_stride, kernel,
phase_scaler, 64 / 3, phase_scaler, 64 / 3, 3, 3);
}
}
}
} else {
const int dst_w = dst->y_crop_width;
const int dst_h = dst->y_crop_height;
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
const int factor = (i == 0 || i == 3 ? 1 : 2); const int factor = (i == 0 || i == 3 ? 1 : 2);
const int src_stride = src_strides[i]; const int src_stride = src_strides[i];
...@@ -49,6 +72,7 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src, ...@@ -49,6 +72,7 @@ void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src,
} }
} }
} }
}
vpx_extend_frame_borders(dst); vpx_extend_frame_borders(dst);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment