From 7cdc986cdf590ede48daa4d54d73ef3d88b957ba Mon Sep 17 00:00:00 2001 From: Johann Date: Mon, 17 Oct 2011 18:21:10 -0700 Subject: [PATCH] Don't copy borders for loop_filter_pick During the _pick only the Y plane is examined. In addition, data beyond the borders of the frame is not read. Change-Id: Ic549adfca70fc6e0b55f8aab0efe81f0afac89f9 --- vp8/encoder/picklpf.c | 71 +-- vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm | 122 +++++ .../arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm | 504 --------------------- vpx_scale/arm/scalesystemdependent.c | 26 +- vpx_scale/arm/yv12extend_arm.h | 25 + vpx_scale/generic/scalesystemdependent.c | 20 +- vpx_scale/generic/yv12extend.c | 5 +- vpx_scale/generic/yv12extend_generic.h | 25 + vpx_scale/vpx_scale.mk | 4 +- vpx_scale/vpxscale.h | 13 +- vpx_scale/yv12extend.h | 12 +- 11 files changed, 199 insertions(+), 628 deletions(-) create mode 100644 vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm delete mode 100644 vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm create mode 100644 vpx_scale/arm/yv12extend_arm.h create mode 100644 vpx_scale/generic/yv12extend_generic.h diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c index beefe8d..e01c59e 100644 --- a/vp8/encoder/picklpf.c +++ b/vp8/encoder/picklpf.c @@ -22,9 +22,6 @@ #endif extern int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const vp8_variance_rtcd_vtable_t *rtcd); -#if HAVE_ARMV7 -extern void vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -#endif #if CONFIG_RUNTIME_CPU_DETECT #define IF_RTCD(x) (x) @@ -284,22 +281,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) int Bias = 0; // Bias against raising loop filter and in favour of lowering it // Make a copy of the unfiltered / processed recon buffer -#if HAVE_ARMV7 -#if CONFIG_RUNTIME_CPU_DETECT - if (cm->rtcd.flags & HAS_NEON) -#endif - { - vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(cm->frame_to_show, &cpi->last_frame_uf); - } -#if CONFIG_RUNTIME_CPU_DETECT - else -#endif -#endif -#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT - { - vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cpi->last_frame_uf); - } -#endif + vp8_yv12_copy_y_ptr(cm->frame_to_show, &cpi->last_frame_uf); if (cm->frame_type == KEY_FRAME) cm->sharpness_level = 0; @@ -325,22 +307,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) filt_best = filt_mid; // Re-instate the unfiltered frame -#if HAVE_ARMV7 -#if CONFIG_RUNTIME_CPU_DETECT - if (cm->rtcd.flags & HAS_NEON) -#endif - { - vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(&cpi->last_frame_uf, cm->frame_to_show); - } -#if CONFIG_RUNTIME_CPU_DETECT - else -#endif -#endif -#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT - { - vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show); - } -#endif + vp8_yv12_copy_y_ptr(&cpi->last_frame_uf, cm->frame_to_show); while (filter_step > 0) { @@ -362,22 +329,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) filt_err = vp8_calc_ss_err(sd, cm->frame_to_show, IF_RTCD(&cpi->rtcd.variance)); // Re-instate the unfiltered frame -#if HAVE_ARMV7 -#if CONFIG_RUNTIME_CPU_DETECT - if (cm->rtcd.flags & HAS_NEON) -#endif - { - vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(&cpi->last_frame_uf, cm->frame_to_show); - } -#if CONFIG_RUNTIME_CPU_DETECT - else -#endif -#endif -#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT - { - vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show); - } -#endif + vp8_yv12_copy_y_ptr(&cpi->last_frame_uf, cm->frame_to_show); // If value is close to the best so far then bias towards a lower loop filter value. if ((filt_err - Bias) < best_err) @@ -399,22 +351,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) filt_err = vp8_calc_ss_err(sd, cm->frame_to_show, IF_RTCD(&cpi->rtcd.variance)); // Re-instate the unfiltered frame -#if HAVE_ARMV7 -#if CONFIG_RUNTIME_CPU_DETECT - if (cm->rtcd.flags & HAS_NEON) -#endif - { - vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon(&cpi->last_frame_uf, cm->frame_to_show); - } -#if CONFIG_RUNTIME_CPU_DETECT - else -#endif -#endif -#if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT - { - vp8_yv12_copy_frame_yonly_ptr(&cpi->last_frame_uf, cm->frame_to_show); - } -#endif + vp8_yv12_copy_y_ptr(&cpi->last_frame_uf, cm->frame_to_show); // Was it better than the previous best? if (filt_err < (best_err - Bias)) diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm new file mode 100644 index 0000000..9189641 --- /dev/null +++ b/vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm @@ -0,0 +1,122 @@ +; +; Copyright (c) 2010 The WebM project authors. All Rights Reserved. +; +; Use of this source code is governed by a BSD-style license +; that can be found in the LICENSE file in the root of the source +; tree. An additional intellectual property rights grant can be found +; in the file PATENTS. All contributing project authors may +; be found in the AUTHORS file in the root of the source tree. +; + + + EXPORT |vp8_yv12_copy_y_neon| + + ARM + REQUIRE8 + PRESERVE8 + + INCLUDE asm_com_offsets.asm + + AREA ||.text||, CODE, READONLY, ALIGN=2 + +;void vpxyv12_copy_y_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) +|vp8_yv12_copy_y_neon| PROC + push {r4 - r11, lr} + vpush {d8-d15} + + ldr r4, [r0, #yv12_buffer_config_y_height] + ldr r5, [r0, #yv12_buffer_config_y_width] + ldr r6, [r0, #yv12_buffer_config_y_stride] + ldr r7, [r1, #yv12_buffer_config_y_stride] + ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 + ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 + + ; copy two rows at one time + mov lr, r4, lsr #1 + +cp_src_to_dst_height_loop1 + mov r8, r2 + mov r9, r3 + add r10, r2, r6 + add r11, r3, r7 + movs r12, r5, lsr #7 + ble extra_copy_needed ; y_width < 128 + +cp_src_to_dst_width_loop1 + vld1.8 {q0, q1}, [r8]! + vld1.8 {q8, q9}, [r10]! + vld1.8 {q2, q3}, [r8]! + vld1.8 {q10, q11}, [r10]! + vld1.8 {q4, q5}, [r8]! + vld1.8 {q12, q13}, [r10]! + vld1.8 {q6, q7}, [r8]! + vld1.8 {q14, q15}, [r10]! + + subs r12, r12, #1 + + vst1.8 {q0, q1}, [r9]! + vst1.8 {q8, q9}, [r11]! + vst1.8 {q2, q3}, [r9]! + vst1.8 {q10, q11}, [r11]! + vst1.8 {q4, q5}, [r9]! + vst1.8 {q12, q13}, [r11]! + vst1.8 {q6, q7}, [r9]! + vst1.8 {q14, q15}, [r11]! + + bne cp_src_to_dst_width_loop1 + + subs lr, lr, #1 + add r2, r2, r6, lsl #1 + add r3, r3, r7, lsl #1 + + bne cp_src_to_dst_height_loop1 + +extra_copy_needed + ands r10, r5, #0x7f ;check to see if extra copy is needed + sub r11, r5, r10 + ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 + ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 + bne extra_cp_src_to_dst_width1 +end_of_cp_src_to_dst1 + + vpop {d8 - d15} + pop {r4-r11, pc} + +;============================= +extra_cp_src_to_dst_width1 + add r2, r2, r11 + add r3, r3, r11 + add r0, r8, r6 + add r11, r9, r7 + + mov lr, r4, lsr #1 +extra_cp_src_to_dst_height_loop1 + mov r8, r2 + mov r9, r3 + add r0, r8, r6 + add r11, r9, r7 + + mov r12, r10 + +extra_cp_src_to_dst_width_loop1 + vld1.8 {q0}, [r8]! + vld1.8 {q1}, [r0]! + + subs r12, r12, #16 + + vst1.8 {q0}, [r9]! + vst1.8 {q1}, [r11]! + bne extra_cp_src_to_dst_width_loop1 + + subs lr, lr, #1 + + add r2, r2, r6, lsl #1 + add r3, r3, r7, lsl #1 + + bne extra_cp_src_to_dst_height_loop1 + + b end_of_cp_src_to_dst1 + + ENDP + + END diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm deleted file mode 100644 index 1f8b4a6..0000000 --- a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm +++ /dev/null @@ -1,504 +0,0 @@ -; -; Copyright (c) 2010 The WebM project authors. All Rights Reserved. -; -; Use of this source code is governed by a BSD-style license -; that can be found in the LICENSE file in the root of the source -; tree. An additional intellectual property rights grant can be found -; in the file PATENTS. All contributing project authors may -; be found in the AUTHORS file in the root of the source tree. -; - - - EXPORT |vp8_yv12_copy_frame_yonly_neon| - EXPORT |vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon| - - ARM - REQUIRE8 - PRESERVE8 - - INCLUDE asm_com_offsets.asm - - AREA ||.text||, CODE, READONLY, ALIGN=2 -;void vpxyv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -; Note: this is VP8 function, which has border=32 and 16. Internal y_width and y_height -; are always multiples of 16. - -|vp8_yv12_copy_frame_yonly_neon| PROC - push {r4 - r11, lr} - vpush {d8 - d15} - - ldr r4, [r0, #yv12_buffer_config_y_height] - ldr r5, [r0, #yv12_buffer_config_y_width] - ldr r6, [r0, #yv12_buffer_config_y_stride] - ldr r7, [r1, #yv12_buffer_config_y_stride] - ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 - - ; copy two rows at one time - mov lr, r4, lsr #1 - -cp_src_to_dst_height_loop - mov r8, r2 - mov r9, r3 - add r10, r2, r6 - add r11, r3, r7 - movs r12, r5, lsr #7 - ble extra_cp_needed ; y_width < 128 - -cp_src_to_dst_width_loop - vld1.8 {q0, q1}, [r8]! - vld1.8 {q8, q9}, [r10]! - vld1.8 {q2, q3}, [r8]! - vld1.8 {q10, q11}, [r10]! - vld1.8 {q4, q5}, [r8]! - vld1.8 {q12, q13}, [r10]! - vld1.8 {q6, q7}, [r8]! - vld1.8 {q14, q15}, [r10]! - - subs r12, r12, #1 - - vst1.8 {q0, q1}, [r9]! - vst1.8 {q8, q9}, [r11]! - vst1.8 {q2, q3}, [r9]! - vst1.8 {q10, q11}, [r11]! - vst1.8 {q4, q5}, [r9]! - vst1.8 {q12, q13}, [r11]! - vst1.8 {q6, q7}, [r9]! - vst1.8 {q14, q15}, [r11]! - - bne cp_src_to_dst_width_loop - - subs lr, lr, #1 - add r2, r2, r6, lsl #1 - add r3, r3, r7, lsl #1 - - bne cp_src_to_dst_height_loop - -extra_cp_needed - ands r10, r5, #0x7f ;check to see if extra copy is needed - sub r11, r5, r10 - ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 - bne extra_cp_src_to_dst_width -end_of_cp_src_to_dst - - - ;vpxyv12_extend_frame_borders_yonly - mov r0, r1 - ;Not need to load y_width, since: y_width = y_stride - 2*border - ldr r3, [r0, #yv12_buffer_config_border] - ldr r1, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - ldr r4, [r0, #yv12_buffer_config_y_height] - ldr lr, [r0, #yv12_buffer_config_y_stride] - - cmp r3, #16 - beq b16_extend_frame_borders - -;======================= -b32_extend_frame_borders -;border = 32 -;======================= -;Border copy for Y plane -;copy the left and right most columns out - sub r5, r1, r3 ;destptr1 - add r6, r1, lr - sub r6, r6, r3, lsl #1 ;destptr2 - sub r2, r6, #1 ;srcptr2 - - ;Do four rows at one time - mov r12, r4, lsr #2 - -copy_left_right_y - vld1.8 {d0[], d1[]}, [r1], lr - vld1.8 {d4[], d5[]}, [r2], lr - vld1.8 {d8[], d9[]}, [r1], lr - vld1.8 {d12[], d13[]}, [r2], lr - vld1.8 {d16[], d17[]}, [r1], lr - vld1.8 {d20[], d21[]}, [r2], lr - vld1.8 {d24[], d25[]}, [r1], lr - vld1.8 {d28[], d29[]}, [r2], lr - - vmov q1, q0 - vmov q3, q2 - vmov q5, q4 - vmov q7, q6 - vmov q9, q8 - vmov q11, q10 - vmov q13, q12 - vmov q15, q14 - - subs r12, r12, #1 - - vst1.8 {q0, q1}, [r5], lr - vst1.8 {q2, q3}, [r6], lr - vst1.8 {q4, q5}, [r5], lr - vst1.8 {q6, q7}, [r6], lr - vst1.8 {q8, q9}, [r5], lr - vst1.8 {q10, q11}, [r6], lr - vst1.8 {q12, q13}, [r5], lr - vst1.8 {q14, q15}, [r6], lr - - bne copy_left_right_y - -;Now copy the top and bottom source lines into each line of the respective borders - ldr r7, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - mul r8, r3, lr - - mov r12, lr, lsr #7 - - sub r6, r1, r3 ;destptr2 - sub r2, r6, lr ;srcptr2 - sub r1, r7, r3 ;srcptr1 - sub r5, r1, r8 ;destptr1 - -copy_top_bottom_y - vld1.8 {q0, q1}, [r1]! - vld1.8 {q8, q9}, [r2]! - vld1.8 {q2, q3}, [r1]! - vld1.8 {q10, q11}, [r2]! - vld1.8 {q4, q5}, [r1]! - vld1.8 {q12, q13}, [r2]! - vld1.8 {q6, q7}, [r1]! - vld1.8 {q14, q15}, [r2]! - - mov r7, r3 - -top_bottom_32 - subs r7, r7, #1 - - vst1.8 {q0, q1}, [r5]! - vst1.8 {q8, q9}, [r6]! - vst1.8 {q2, q3}, [r5]! - vst1.8 {q10, q11}, [r6]! - vst1.8 {q4, q5}, [r5]! - vst1.8 {q12, q13}, [r6]! - vst1.8 {q6, q7}, [r5]! - vst1.8 {q14, q15}, [r6]! - - add r5, r5, lr - sub r5, r5, #128 - add r6, r6, lr - sub r6, r6, #128 - - bne top_bottom_32 - - sub r5, r1, r8 - add r6, r2, lr - - subs r12, r12, #1 - bne copy_top_bottom_y - - mov r7, lr, lsr #4 ;check to see if extra copy is needed - ands r7, r7, #0x7 - bne extra_top_bottom_y -end_of_border_copy_y - - vpop {d8 - d15} - pop {r4 - r11, pc} - -;===================== -;extra copy part for Y -extra_top_bottom_y - vld1.8 {q0}, [r1]! - vld1.8 {q2}, [r2]! - - mov r9, r3, lsr #3 - -extra_top_bottom_32 - subs r9, r9, #1 - - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - bne extra_top_bottom_32 - - sub r5, r1, r8 - add r6, r2, lr - subs r7, r7, #1 - bne extra_top_bottom_y - - b end_of_border_copy_y - - -;======================= -b16_extend_frame_borders -;border = 16 -;======================= -;Border copy for Y plane -;copy the left and right most columns out - sub r5, r1, r3 ;destptr1 - add r6, r1, lr - sub r6, r6, r3, lsl #1 ;destptr2 - sub r2, r6, #1 ;srcptr2 - - ;Do four rows at one time - mov r12, r4, lsr #2 - -copy_left_right_y_b16 - vld1.8 {d0[], d1[]}, [r1], lr - vld1.8 {d4[], d5[]}, [r2], lr - vld1.8 {d8[], d9[]}, [r1], lr - vld1.8 {d12[], d13[]}, [r2], lr - vld1.8 {d16[], d17[]}, [r1], lr - vld1.8 {d20[], d21[]}, [r2], lr - vld1.8 {d24[], d25[]}, [r1], lr - vld1.8 {d28[], d29[]}, [r2], lr - - subs r12, r12, #1 - - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q4}, [r5], lr - vst1.8 {q6}, [r6], lr - vst1.8 {q8}, [r5], lr - vst1.8 {q10}, [r6], lr - vst1.8 {q12}, [r5], lr - vst1.8 {q14}, [r6], lr - - bne copy_left_right_y_b16 - -;Now copy the top and bottom source lines into each line of the respective borders - ldr r7, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - mul r8, r3, lr - - mov r12, lr, lsr #7 - - sub r6, r1, r3 ;destptr2 - sub r2, r6, lr ;srcptr2 - sub r1, r7, r3 ;srcptr1 - sub r5, r1, r8 ;destptr1 - -copy_top_bottom_y_b16 - vld1.8 {q0, q1}, [r1]! - vld1.8 {q8, q9}, [r2]! - vld1.8 {q2, q3}, [r1]! - vld1.8 {q10, q11}, [r2]! - vld1.8 {q4, q5}, [r1]! - vld1.8 {q12, q13}, [r2]! - vld1.8 {q6, q7}, [r1]! - vld1.8 {q14, q15}, [r2]! - - mov r7, r3 - -top_bottom_16_b16 - subs r7, r7, #1 - - vst1.8 {q0, q1}, [r5]! - vst1.8 {q8, q9}, [r6]! - vst1.8 {q2, q3}, [r5]! - vst1.8 {q10, q11}, [r6]! - vst1.8 {q4, q5}, [r5]! - vst1.8 {q12, q13}, [r6]! - vst1.8 {q6, q7}, [r5]! - vst1.8 {q14, q15}, [r6]! - - add r5, r5, lr - sub r5, r5, #128 - add r6, r6, lr - sub r6, r6, #128 - - bne top_bottom_16_b16 - - sub r5, r1, r8 - add r6, r2, lr - - subs r12, r12, #1 - bne copy_top_bottom_y_b16 - - mov r7, lr, lsr #4 ;check to see if extra copy is needed - ands r7, r7, #0x7 - bne extra_top_bottom_y_b16 -end_of_border_copy_y_b16 - - vpop {d8 - d15} - pop {r4 - r11, pc} - -;===================== -;extra copy part for Y -extra_top_bottom_y_b16 - vld1.8 {q0}, [r1]! - vld1.8 {q2}, [r2]! - - mov r9, r3, lsr #3 - -extra_top_bottom_16_b16 - subs r9, r9, #1 - - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - vst1.8 {q0}, [r5], lr - vst1.8 {q2}, [r6], lr - bne extra_top_bottom_16_b16 - - sub r5, r1, r8 - add r6, r2, lr - subs r7, r7, #1 - bne extra_top_bottom_y_b16 - - b end_of_border_copy_y_b16 - -;============================= -extra_cp_src_to_dst_width - add r2, r2, r11 - add r3, r3, r11 - add r0, r8, r6 - add r11, r9, r7 - - mov lr, r4, lsr #1 -extra_cp_src_to_dst_height_loop - mov r8, r2 - mov r9, r3 - add r0, r8, r6 - add r11, r9, r7 - - mov r12, r10 - -extra_cp_src_to_dst_width_loop - vld1.8 {q0}, [r8]! - vld1.8 {q1}, [r0]! - - subs r12, r12, #16 - - vst1.8 {q0}, [r9]! - vst1.8 {q1}, [r11]! - bne extra_cp_src_to_dst_width_loop - - subs lr, lr, #1 - - add r2, r2, r6, lsl #1 - add r3, r3, r7, lsl #1 - - bne extra_cp_src_to_dst_height_loop - - b end_of_cp_src_to_dst - - ENDP - -;=========================================================== -;In vp8cx_pick_filter_level(), call vp8_yv12_copy_frame_yonly -;without extend_frame_borders. -|vp8_yv12_copy_frame_yonly_no_extend_frame_borders_neon| PROC - push {r4 - r11, lr} - vpush {d8-d15} - - ldr r4, [r0, #yv12_buffer_config_y_height] - ldr r5, [r0, #yv12_buffer_config_y_width] - ldr r6, [r0, #yv12_buffer_config_y_stride] - ldr r7, [r1, #yv12_buffer_config_y_stride] - ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 - - ; copy two rows at one time - mov lr, r4, lsr #1 - -cp_src_to_dst_height_loop1 - mov r8, r2 - mov r9, r3 - add r10, r2, r6 - add r11, r3, r7 - movs r12, r5, lsr #7 - ble extra_copy_needed ; y_width < 128 - -cp_src_to_dst_width_loop1 - vld1.8 {q0, q1}, [r8]! - vld1.8 {q8, q9}, [r10]! - vld1.8 {q2, q3}, [r8]! - vld1.8 {q10, q11}, [r10]! - vld1.8 {q4, q5}, [r8]! - vld1.8 {q12, q13}, [r10]! - vld1.8 {q6, q7}, [r8]! - vld1.8 {q14, q15}, [r10]! - - subs r12, r12, #1 - - vst1.8 {q0, q1}, [r9]! - vst1.8 {q8, q9}, [r11]! - vst1.8 {q2, q3}, [r9]! - vst1.8 {q10, q11}, [r11]! - vst1.8 {q4, q5}, [r9]! - vst1.8 {q12, q13}, [r11]! - vst1.8 {q6, q7}, [r9]! - vst1.8 {q14, q15}, [r11]! - - bne cp_src_to_dst_width_loop1 - - subs lr, lr, #1 - add r2, r2, r6, lsl #1 - add r3, r3, r7, lsl #1 - - bne cp_src_to_dst_height_loop1 - -extra_copy_needed - ands r10, r5, #0x7f ;check to see if extra copy is needed - sub r11, r5, r10 - ldr r2, [r0, #yv12_buffer_config_y_buffer] ;srcptr1 - ldr r3, [r1, #yv12_buffer_config_y_buffer] ;dstptr1 - bne extra_cp_src_to_dst_width1 -end_of_cp_src_to_dst1 - - vpop {d8 - d15} - pop {r4-r11, pc} - -;============================= -extra_cp_src_to_dst_width1 - add r2, r2, r11 - add r3, r3, r11 - add r0, r8, r6 - add r11, r9, r7 - - mov lr, r4, lsr #1 -extra_cp_src_to_dst_height_loop1 - mov r8, r2 - mov r9, r3 - add r0, r8, r6 - add r11, r9, r7 - - mov r12, r10 - -extra_cp_src_to_dst_width_loop1 - vld1.8 {q0}, [r8]! - vld1.8 {q1}, [r0]! - - subs r12, r12, #16 - - vst1.8 {q0}, [r9]! - vst1.8 {q1}, [r11]! - bne extra_cp_src_to_dst_width_loop1 - - subs lr, lr, #1 - - add r2, r2, r6, lsl #1 - add r3, r3, r7, lsl #1 - - bne extra_cp_src_to_dst_height_loop1 - - b end_of_cp_src_to_dst1 - - ENDP - - END diff --git a/vpx_scale/arm/scalesystemdependent.c b/vpx_scale/arm/scalesystemdependent.c index cdfc23e..549736a 100644 --- a/vpx_scale/arm/scalesystemdependent.c +++ b/vpx_scale/arm/scalesystemdependent.c @@ -12,23 +12,7 @@ #include "vpx_config.h" #include "vpx_ports/arm.h" #include "vpx_scale/vpxscale.h" - - -void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf); -extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf); -extern void vp8_yv12_extend_frame_borders_neon(YV12_BUFFER_CONFIG *ybf); - -void (*vp8_yv12_copy_frame_yonly_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_yonly_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - -void (*vp8_yv12_copy_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - -/**************************************************************************** -* Imports -*****************************************************************************/ +#include "vpx_scale/yv12extend.h" /**************************************************************************** * @@ -78,9 +62,9 @@ void vp8_scale_machine_specific_config() */ #if !HAVE_ARMV7 || CONFIG_RUNTIME_CPU_DETECT - vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders; - vp8_yv12_copy_frame_yonly_ptr = vp8_yv12_copy_frame_yonly; - vp8_yv12_copy_frame_ptr = vp8_yv12_copy_frame; + vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders; + vp8_yv12_copy_y_ptr = vp8_yv12_copy_y_c; + vp8_yv12_copy_frame_ptr = vp8_yv12_copy_frame; #endif #if HAVE_ARMV7 #if CONFIG_RUNTIME_CPU_DETECT @@ -89,7 +73,7 @@ void vp8_scale_machine_specific_config() #endif { vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders_neon; - vp8_yv12_copy_frame_yonly_ptr = vp8_yv12_copy_frame_yonly_neon; + vp8_yv12_copy_y_ptr = vp8_yv12_copy_y_neon; vp8_yv12_copy_frame_ptr = vp8_yv12_copy_frame_neon; } #endif diff --git a/vpx_scale/arm/yv12extend_arm.h b/vpx_scale/arm/yv12extend_arm.h new file mode 100644 index 0000000..a7e4c16 --- /dev/null +++ b/vpx_scale/arm/yv12extend_arm.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + +#ifndef YV12_EXTEND_ARM_H +#define YV12_EXTEND_ARM_H + +#include "vpx_scale/yv12config.h" + + void vp8_yv12_extend_frame_borders_neon(YV12_BUFFER_CONFIG *ybf); + + /* Copy Y,U,V buffer data from src to dst, filling border of dst as well. */ + void vp8_yv12_copy_frame_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); + + /* Copy Y buffer data from src_ybc to dst_ybc without filling border data */ + void vp8_yv12_copy_y_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); + +#endif /* YV12_EXTEND_ARM_H */ diff --git a/vpx_scale/generic/scalesystemdependent.c b/vpx_scale/generic/scalesystemdependent.c index 5421715..3f5d2ce 100644 --- a/vpx_scale/generic/scalesystemdependent.c +++ b/vpx_scale/generic/scalesystemdependent.c @@ -11,21 +11,9 @@ #include "vpx_config.h" #include "vpx_scale/vpxscale.h" +#include "vpx_scale/yv12extend.h" -void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf); -extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf); - -void (*vp8_yv12_copy_frame_yonly_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - -void (*vp8_yv12_copy_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - -/**************************************************************************** -* Imports -*****************************************************************************/ - /**************************************************************************** * * ROUTINE : vp8_scale_machine_specific_config @@ -71,8 +59,8 @@ void vp8_scale_machine_specific_config() vp8_horizontal_line_5_4_scale = vp8cx_horizontal_line_5_4_scale_c; #endif - vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders; - vp8_yv12_copy_frame_yonly_ptr = vp8_yv12_copy_frame_yonly; - vp8_yv12_copy_frame_ptr = vp8_yv12_copy_frame; + vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders; + vp8_yv12_copy_y_ptr = vp8_yv12_copy_y_c; + vp8_yv12_copy_frame_ptr = vp8_yv12_copy_frame; } diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c index c087bdd..b9125de 100644 --- a/vpx_scale/generic/yv12extend.c +++ b/vpx_scale/generic/yv12extend.c @@ -259,8 +259,7 @@ vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) vp8_yv12_extend_frame_borders_ptr(dst_ybc); } -void -vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) +void vp8_yv12_copy_y_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc) { int row; unsigned char *source, *dest; @@ -275,6 +274,4 @@ vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_y source += src_ybc->y_stride; dest += dst_ybc->y_stride; } - - extend_frame_borders_yonly(dst_ybc); } diff --git a/vpx_scale/generic/yv12extend_generic.h b/vpx_scale/generic/yv12extend_generic.h new file mode 100644 index 0000000..cc2a554 --- /dev/null +++ b/vpx_scale/generic/yv12extend_generic.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + +#ifndef YV12_EXTEND_GENERIC_H +#define YV12_EXTEND_GENERIC_H + +#include "vpx_scale/yv12config.h" + + void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf); + + /* Copy Y,U,V buffer data from src to dst, filling border of dst as well. */ + void vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); + + /* Copy Y buffer data from src_ybc to dst_ybc without filling border data */ + void vp8_yv12_copy_y_c(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); + +#endif /* YV12_EXTEND_GENERIC_H */ diff --git a/vpx_scale/vpx_scale.mk b/vpx_scale/vpx_scale.mk index 9680ded..e91120d 100644 --- a/vpx_scale/vpx_scale.mk +++ b/vpx_scale/vpx_scale.mk @@ -6,16 +6,18 @@ SCALE_SRCS-yes += vpxscale.h SCALE_SRCS-yes += generic/vpxscale.c SCALE_SRCS-yes += generic/yv12config.c SCALE_SRCS-yes += generic/yv12extend.c +SCALE_SRCS-yes += generic/yv12extend_generic.h SCALE_SRCS-yes += generic/scalesystemdependent.c SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += generic/gen_scalers.c #arm +SCALE_SRCS-$(HAVE_ARMV7) += arm/yv12extend_arm.h SCALE_SRCS-$(HAVE_ARMV7) += arm/scalesystemdependent.c SCALE_SRCS_REMOVE-$(HAVE_ARMV7) += generic/scalesystemdependent.c #neon SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/vp8_vpxyv12_copyframe_func_neon$(ASM) -SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/vp8_vpxyv12_copyframeyonly_neon$(ASM) +SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/vp8_vpxyv12_copy_y_neon$(ASM) SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/vp8_vpxyv12_copysrcframe_func_neon$(ASM) SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/vp8_vpxyv12_extendframeborders_neon$(ASM) SCALE_SRCS-$(HAVE_ARMV7) += arm/neon/yv12extend_arm.c diff --git a/vpx_scale/vpxscale.h b/vpx_scale/vpxscale.h index 86fc128..a13a65f 100644 --- a/vpx_scale/vpxscale.h +++ b/vpx_scale/vpxscale.h @@ -13,6 +13,7 @@ #define VPXSCALE_H #include "vpx_scale/yv12config.h" +#include "vpx_scale/yv12extend.h" void vp8cx_horizontal_line_4_5_scale_c(const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width); void vp8cx_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); void vp8cx_last_vertical_band_4_5_scale_c(unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width); @@ -99,16 +100,4 @@ extern void vp8_scale_frame ); extern void vp8_scale_machine_specific_config(void); -extern void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf); -extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf); -extern void vp8_yv12_extend_frame_borders_neon(YV12_BUFFER_CONFIG *ybf); - -extern void (*vp8_yv12_copy_frame_yonly_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_yonly_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - -extern void (*vp8_yv12_copy_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); -extern void vp8_yv12_copy_frame_neon(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - #endif diff --git a/vpx_scale/yv12extend.h b/vpx_scale/yv12extend.h index 0c239b9..80a0f98 100644 --- a/vpx_scale/yv12extend.h +++ b/vpx_scale/yv12extend.h @@ -13,18 +13,24 @@ #define YV12_EXTEND_H #include "vpx_scale/yv12config.h" +#include "vpx_scale/generic/yv12extend_generic.h" + +#if HAVE_ARMV7 +#include "vpx_scale/arm/yv12extend_arm.h" +#endif #ifdef __cplusplus extern "C" { #endif - void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf); + void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf); /* Copy Y,U,V buffer data from src to dst, filling border of dst as well. */ + void (*vp8_yv12_copy_frame_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - void vp8_yv12_copy_frame(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); - void vp8_yv12_copy_frame_yonly(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); + /* Copy Y buffer data from src_ybc to dst_ybc without filling border data */ + void (*vp8_yv12_copy_y_ptr)(YV12_BUFFER_CONFIG *src_ybc, YV12_BUFFER_CONFIG *dst_ybc); #ifdef __cplusplus } -- 2.7.4