From 6ce097ba2f3cd1c269bacd032b775b6d296433fc Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 2 Nov 2012 02:59:44 +0200 Subject: [PATCH] neon filters: support optional color space conversion --- arm/neon_eagle2x.Sinc | 17 +++++++++++++++++ arm/neon_normalxx.Sinc | 14 ++++++++++++++ arm/neon_scale2x.Sinc | 26 ++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/arm/neon_eagle2x.Sinc b/arm/neon_eagle2x.Sinc index cfbd303..ec2ba0d 100644 --- a/arm/neon_eagle2x.Sinc +++ b/arm/neon_eagle2x.Sinc @@ -527,6 +527,11 @@ vld1.16 {d27[3]}, [\reg1] @ S3prev[7] = src[2 * (counter & 7) - 2 + srcstride] .endif + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q14, q15, q8, q9, q10 + bgr1555_to_rgb565 q6, q7, q8, q9, q10 + #endif + ubfx \reg1, \counter, #0, #3 @ reg1 = counter & 7 lsl \reg1, #2 @@ -629,6 +634,12 @@ vbsl q6, \qY, q12 @ E3 = < (X == Y && X == V) ? Y : C > vbsl q7, \qY, q12 @ E4 = < (Z == Y && Z == W) ? Y : C > + + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q14, q15, q0, q1, q2 + bgr1555_to_rgb565 q6, q7, q0, q1, q2 + #endif + vst2.16 {q14-q15}, [\aldst1]! @ [dst] = E1,E2; dst1 += 2*2*8 cmp \counter, #8 @@ -721,6 +732,12 @@ vbsl q6, \qY, q12 @ E3 = < (X == Y && X == V) ? Y : C > vbsl q7, \qY, q12 @ E4 = < (Z == Y && Z == W) ? Y : C > + + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q14, q15, q8, q9, q10 + bgr1555_to_rgb565 q6, q7, q8, q9, q10 + #endif + vst2.16 {q14-q15}, [\aldst1]! @ [dst] = E1,E2; dst1 += 2*2*8 vst2.16 {q6-q7}, [\aldst2]! @ [dst + dststride] = E3,E4; dst2 += 2*2*8 diff --git a/arm/neon_normalxx.Sinc b/arm/neon_normalxx.Sinc index 0391e12..0546ac2 100644 --- a/arm/neon_normalxx.Sinc +++ b/arm/neon_normalxx.Sinc @@ -30,6 +30,20 @@ #define A256 :256 #endif +.macro bgr1555_to_rgb565 dr0 dr1 t0 t1 t2 + str r0, [sp, #-4] + mov r0, #0x07c0 + vshl.u16 \t0, \dr0, #11 + vshl.u16 \t1, \dr1, #11 + vshl.u16 \dr0, \dr0, #1 + vshl.u16 \dr1, \dr1, #1 + vdup.16 \t2, r0 + vsri.u16 \t0, \dr0, #11 + vsri.u16 \t1, \dr1, #11 + ldr r0, [sp, #-4] + vbif \dr0, \t0, \t2 + vbif \dr1, \t1, \t2 +.endm .macro _neon_normalxx_8_16_line_middle src, dst, pal, counter, reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg8, reg9, dststride, dA, dB ldr \reg1, [\src] @ reg1 = src[0-3] diff --git a/arm/neon_scale2x.Sinc b/arm/neon_scale2x.Sinc index a3379ca..774f7ff 100644 --- a/arm/neon_scale2x.Sinc +++ b/arm/neon_scale2x.Sinc @@ -309,10 +309,16 @@ vorn q3, q10, q3 @ tmp3 = < C0 || !(H == F) > vbsl q2, q12, q14 @ E2 = < (C0 || !(D == H)) ? E : D > - vst2.16 {q0-q1}, [\dst1] @ [dst] = E0,E1 vbsl q3, q12, q15 @ E3 = < (C0 || !(H == F)) ? E : F > + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q0, q1, q12, q14, q15 + bgr1555_to_rgb565 q2, q3, q12, q14, q15 + #endif + + vst2.16 {q0-q1}, [\dst1] @ [dst] = E0,E1 + bic \counter, \counter, #7 .ifeqs "\qB", "q11" add \src1, \src1, \reg1, lsl #1 @@ -379,12 +385,18 @@ vorn q3, q10, q3 @ tmp3 = < C0 || !(H == F) > vbsl q2, q12, q14 @ E2 = < (C0 || !(D == H)) ? E : D > + + vbsl q3, q12, q15 @ E3 = < (C0 || !(H == F)) ? E : F > + + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q0, q1, q12, q14, q15 + bgr1555_to_rgb565 q2, q3, q12, q14, q15 + #endif + vst2.16 {q0-q1}, [\aldst1]! @ [dst] = E0,E1; dst1 += 2*2*8 cmp \counter, #8 - vbsl q3, q12, q15 @ E3 = < (C0 || !(H == F)) ? E : F > - vst2.16 {q2-q3}, [\aldst2]! @ [dst + dststride] = E2,E3; dst2 += 2*2*8 bhi 2b @@ -432,10 +444,16 @@ vorn q3, q10, q3 @ tmp3 = < C0 || !(H == F) > vbsl q2, q12, q14 @ E2 = < (C0 || !(D == H)) ? E : D > - vst2.16 {q0-q1}, [\aldst1]! @ [dst] = E0,E1; dst1 += 2*2*8 vbsl q3, q12, q15 @ E3 = < (C0 || !(H == F)) ? E : F > + #ifdef DO_BGR_TO_RGB + bgr1555_to_rgb565 q0, q1, q12, q14, q15 + bgr1555_to_rgb565 q2, q3, q12, q14, q15 + #endif + + vst2.16 {q0-q1}, [\aldst1]! @ [dst] = E0,E1; dst1 += 2*2*8 + vst2.16 {q2-q3}, [\aldst2]! @ [dst + dststride] = E2,E3; dst2 += 2*2*8 .endm -- 2.39.5