>From 723d481034e43ec562e4c70151e15bb5717ad819 Mon Sep 17 00:00:00 2001 From: kui zheng <kui.zh...@arm.com> Date: Wed, 16 Nov 2011 15:51:42 +0800 Subject: [PATCH] generic: Add NEON version of Bop_rgb32_to_Aop_rgb16_LE
Signed-off-by: kui zheng <kui.zh...@arm.com> --- src/gfx/generic/generic.c | 4 ++ src/gfx/generic/generic_neon.h | 75 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 0 deletions(-) diff --git a/src/gfx/generic/generic.c b/src/gfx/generic/generic.c index 4da46cc..dc5826a 100644 --- a/src/gfx/generic/generic.c +++ b/src/gfx/generic/generic.c @@ -9215,7 +9215,11 @@ bool gAcquire( CardState *state, DFBAccelerationMask accel ) (source->config.format == DSPF_RGB32 || source->config.format == DSPF_ARGB) && destination->config.format == DSPF_RGB16) { +#ifdef USE_NEON + *funcs++ = Bop_rgb32_to_Aop_rgb16_LE_NEON; +#else *funcs++ = Bop_rgb32_to_Aop_rgb16_LE; +#endif break; } #endif diff --git a/src/gfx/generic/generic_neon.h b/src/gfx/generic/generic_neon.h index 1220e71..3c63a79 100644 --- a/src/gfx/generic/generic_neon.h +++ b/src/gfx/generic/generic_neon.h @@ -179,4 +179,79 @@ static void Sop_argb_to_Dacc_NEON ( GenefxState *gfxs ) ); } +/* + * NEON verion of Bop_rgb32_to_Aop_rgb16_LE. + */ +static void Bop_rgb32_to_Aop_rgb16_LE_NEON( GenefxState *gfxs ) +{ + int w = gfxs->length; + u32 *S = gfxs->Bop[0]; + u32 *D = gfxs->Aop[0]; + + if ((unsigned long)D & 2) { + u16 *d = (u16*)D; + d[0] = RGB32_TO_RGB16( S[0] ); + w--; + S++; + D = (u32*)(d+1); + } + + __asm__ __volatile__ ( + "lsrs r4, %[len], #3 \n\t" + "beq 2f \n\t" + + "1: \n\t" + "subs r4, r4, #1 \n\t" + "pld [%[S], #0xC0] \n\t" + "vld4.8 {d0, d1, d2, d3}, [%[S]]! \n\t" + "vshll.u8 q2, d2, #8 \n\t" + "vshll.u8 q3, d1, #8 \n\t" + "vsri.16 q2, q3, #5 \n\t" + "vshll.u8 q3, d0, #8 \n\t" + "vsri.16 q2, q3, #11 \n\t" + "vst1.16 {q2}, [%[D]]! \n\t" + "bne 1b \n\t" + + "2: \n\t" + "ands r5, %[len], #7 \n\t" + "beq 5f \n\t" + "cmp r5, #4 \n\t" + "blt 4f \n\t" + + "3: \n\t" + "vld1.32 {d0, d1}, [%[S]]! \n\t" + "vshr.u32 q1, q0, #19 \n\t" + "vshr.u16 q2, q0, #10 \n\t" + "vshl.u16 q3, q0, #8 \n\t" + "vshl.u16 q1, q1, #11 \n\t" + "vshl.u16 q2, q2, #5 \n\t" + "vshr.u16 q3, q3, #11 \n\t" + "vorr q1, q1, q2 \n\t" + "vorr q1, q1, q3 \n\t" + "vmovn.i32 d4, q1 \n\t" + "vst1.16 {d4}, [%[D]]! \n\t" + + "ands r5, %[len], #3 \n\t" + "beq 5f \n\t" + + "4: \n\t" + "vld1.32 {d0[0]}, [%[S]]!\n\t" + "vshr.u32 d1, d0, #19 \n\t" + "vshr.u16 d2, d0, #10 \n\t" + "vshl.u16 d3, d0, #8 \n\t" + "vshl.u16 d1, d1, #11 \n\t" + "vshl.u16 d2, d2, #5 \n\t" + "vshr.u16 d3, d3, #11 \n\t" + "vorr d1, d1, d2 \n\t" + "vorr d1, d1, d3 \n\t" + "vst1.16 {d1[0]}, [%[D]]!\n\t" + "subs r5, r5, #1 \n\t" + "bne 4b \n\t" + "5: " + : + : [S] "r" (S), [len] "r" (w), [D] "r" (D) + : "memory", "r4", "r5", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7" + ); +} -- 1.7.1 -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
0004-generic-Add-NEON-version-of-Bop_rgb32_to_Aop_rgb16_L.patch
Description: 0004-generic-Add-NEON-version-of-Bop_rgb32_to_Aop_rgb16_L.patch
_______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev