diff options
author | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-18 21:53:44 -0500 |
commit | ec910d81405c736a4490383a250299a7837c2e64 (patch) | |
tree | 4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/aom_scale/generic/aom_scale.c | |
parent | 01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff) | |
download | UXP-ec910d81405c736a4490383a250299a7837c2e64.tar UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz UXP-ec910d81405c736a4490383a250299a7837c2e64.zip |
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/aom_scale/generic/aom_scale.c')
-rw-r--r-- | third_party/aom/aom_scale/generic/aom_scale.c | 76 |
1 files changed, 26 insertions, 50 deletions
diff --git a/third_party/aom/aom_scale/generic/aom_scale.c b/third_party/aom/aom_scale/generic/aom_scale.c index 14f3ae0da..d124832b7 100644 --- a/third_party/aom/aom_scale/generic/aom_scale.c +++ b/third_party/aom/aom_scale/generic/aom_scale.c @@ -476,54 +476,30 @@ void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, unsigned int hscale, unsigned int hratio, unsigned int vscale, unsigned int vratio, unsigned int interlaced) { - int i; - int dw = (hscale - 1 + src->y_width * hratio) / hscale; - int dh = (vscale - 1 + src->y_height * vratio) / vscale; - - /* call our internal scaling routines!! */ - Scale2D((unsigned char *)src->y_buffer, src->y_stride, src->y_width, - src->y_height, (unsigned char *)dst->y_buffer, dst->y_stride, dw, dh, - temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); - - if (dw < (int)dst->y_width) - for (i = 0; i < dh; ++i) - memset(dst->y_buffer + i * dst->y_stride + dw - 1, - dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1); - - if (dh < (int)dst->y_height) - for (i = dh - 1; i < (int)dst->y_height; ++i) - memcpy(dst->y_buffer + i * dst->y_stride, - dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1); - - Scale2D((unsigned char *)src->u_buffer, src->uv_stride, src->uv_width, - src->uv_height, (unsigned char *)dst->u_buffer, dst->uv_stride, - dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale, - vratio, interlaced); - - if (dw / 2 < (int)dst->uv_width) - for (i = 0; i < dst->uv_height; ++i) - memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, - dst->u_buffer[i * dst->uv_stride + dw / 2 - 2], - dst->uv_width - dw / 2 + 1); - - if (dh / 2 < (int)dst->uv_height) - for (i = dh / 2 - 1; i < (int)dst->y_height / 2; ++i) - memcpy(dst->u_buffer + i * dst->uv_stride, - dst->u_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width); - - Scale2D((unsigned char *)src->v_buffer, src->uv_stride, src->uv_width, - src->uv_height, (unsigned char *)dst->v_buffer, dst->uv_stride, - dw / 2, dh / 2, temp_area, temp_height, hscale, hratio, vscale, - vratio, interlaced); - - if (dw / 2 < (int)dst->uv_width) - for (i = 0; i < dst->uv_height; ++i) - memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, - dst->v_buffer[i * dst->uv_stride + dw / 2 - 2], - dst->uv_width - dw / 2 + 1); - - if (dh / 2 < (int)dst->uv_height) - for (i = dh / 2 - 1; i < (int)dst->y_height / 2; ++i) - memcpy(dst->v_buffer + i * dst->uv_stride, - dst->v_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width); + const int dw = (hscale - 1 + src->y_width * hratio) / hscale; + const int dh = (vscale - 1 + src->y_height * vratio) / vscale; + + for (int plane = 0; plane < 3; ++plane) { + const int is_uv = plane > 0; + const int plane_dw = dw >> is_uv; + const int plane_dh = dh >> is_uv; + + Scale2D((unsigned char *)src->buffers[plane], src->strides[is_uv], + src->widths[is_uv], src->heights[is_uv], + (unsigned char *)dst->buffers[plane], dst->strides[is_uv], plane_dw, + plane_dh, temp_area, temp_height, hscale, hratio, vscale, vratio, + interlaced); + + if (plane_dw < dst->widths[is_uv]) + for (int i = 0; i < plane_dh; ++i) + memset(dst->buffers[plane] + i * dst->strides[is_uv] + plane_dw - 1, + dst->buffers[plane][i * dst->strides[is_uv] + plane_dw - 2], + dst->widths[is_uv] - plane_dw + 1); + + if (plane_dh < dst->heights[is_uv]) + for (int i = plane_dh - 1; i < dst->heights[is_uv]; ++i) + memcpy(dst->buffers[plane] + i * dst->strides[is_uv], + dst->buffers[plane] + (plane_dh - 2) * dst->strides[is_uv], + dst->widths[is_uv] + 1); + } } |