2 * (C) GraÅžvydas "notaz" Ignotas, 2010
4 * This work is licensed under the terms of any of these licenses
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
11 #include "arm_features.h"
15 #error Compiling NEON code, but appropriate preprocessor flag is missing
16 #error This usually means -mfpu=neon or -mfloat-abi= is not correctly specified
22 FUNCTION(bgr555_to_rgb565): @ dst, src, bytes
30 @ Pulls 15-bit BGR color values (which are actually 16 bits) into q0-q3.
31 @ example: q0 = 0111 1110 0101 0011
33 @ Shift BGR color 1 bit to the left, discarding MSB and preparing for vbit.
34 @ MSB is used for transparency (not needed here, and can mess with green).
35 @ example: q0 = 1111 1100 1010 0110
40 @ Places red value in left most bits, clears bits to the right.
41 @ example: q8 = 1001 1000 0000 0000
46 @ Places blue value in right most bits, leaving bits to the left unchanged.
47 @ example: q8 = 1001 1000 0001 1111
52 @ Sets green value from shifted BGR color by apply a mask.
53 @ example: q15 = 0000 0111 1100 0000
54 @ q8 = 1001 1100 1001 1111
69 @ handle the remainder (reasonably rare)
96 @ note: may overflow source
97 FUNCTION(bgr555_to_rgb565_b): @ dst, src, bytes, int brightness2k // 0-0x0800
108 vand.u16 q10, q2, q14
109 vand.u16 q11, q3, q14
112 vmul.u16 q6, q10, q15
113 vmul.u16 q7, q11, q15
134 vshr.u16 q10, q2, #10
135 vshr.u16 q11, q3, #10
146 vsri.u16 q6, q10, #11
147 vsri.u16 q7, q11, #11
177 FUNCTION(bgr888_to_rgb888): @ dst, src, bytes
186 vld3.8 {d0-d2}, [r1, :64]!
187 vld3.8 {d3-d5}, [r1, :64]!
190 vst3.8 {d0-d2}, [r0, :64]!
191 vst3.8 {d3-d5}, [r0, :64]!
198 FUNCTION(bgr888_to_rgb565): @ dst, src, bytes
210 vld3.8 {d1-d3}, [r1, :64]!
211 vld3.8 {d5-d7}, [r1, :64]!
213 vshll.u8 q8, d2, #3 @ g
215 vshr.u8 d0, d3, #3 @ b
230 FUNCTION(rgb888_to_rgb565): @ dst, src, bytes
242 vld3.8 {d1-d3}, [r1, :64]!
243 vld3.8 {d5-d7}, [r1, :64]!
245 vshll.u8 q8, d2, #3 @ g
247 vshr.u8 d2, d1, #3 @ b
262 @ vim:filetype=armasm