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
41 @ Pulls 15-bit BGR color values (which are actually 16 bits) into q0-q3.
42 @ example: q0 = 0111 1110 0101 0011
44 @ Shift BGR color 1 bit to the left, discarding MSB and preparing for vbit.
45 @ MSB is used for transparency (not needed here, and can mess with green).
46 @ example: q0 = 1111 1100 1010 0110
51 @ Places red value in left most bits, clears bits to the right.
52 @ example: q8 = 1001 1000 0000 0000
57 @ Places blue value in right most bits, leaving bits to the left unchanged.
58 @ example: q8 = 1001 1000 0001 1111
63 @ Sets green value from shifted BGR color by apply a mask.
64 @ example: q15 = 0000 0111 1100 0000
65 @ q8 = 1001 1100 1001 1111
80 @ handle the remainder (reasonably rare)
107 @ note: may overflow source
108 FUNCTION(bgr555_to_rgb565_b): @ dst, src, bytes, int brightness2k // 0-0x0800
119 vand.u16 q10, q2, q14
120 vand.u16 q11, q3, q14
123 vmul.u16 q6, q10, q15
124 vmul.u16 q7, q11, q15
145 vshr.u16 q10, q2, #10
146 vshr.u16 q11, q3, #10
157 vsri.u16 q6, q10, #11
158 vsri.u16 q7, q11, #11
188 FUNCTION(bgr888_to_rgb888): @ dst, src, bytes
197 vld3.8 {d0-d2}, [r1]!
198 vld3.8 {d3-d5}, [r1]!
201 vst3.8 {d0-d2}, [r0, :64]!
202 vst3.8 {d3-d5}, [r0, :64]!
209 FUNCTION(bgr888_to_rgb565): @ dst, src, bytes
221 vld3.8 {d1-d3}, [r1]!
222 vld3.8 {d5-d7}, [r1]!
224 vshll.u8 q8, d2, #3 @ g
226 vshr.u8 d0, d3, #3 @ b
241 FUNCTION(rgb888_to_rgb565): @ dst, src, bytes
253 vld3.8 {d1-d3}, [r1, :64]!
254 vld3.8 {d5-d7}, [r1, :64]!
256 vshll.u8 q8, d2, #3 @ g
258 vshr.u8 d2, d1, #3 @ b
273 @ vim:filetype=armasm