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
40 @ Pulls 15-bit BGR color values (which are actually 16 bits) into q0-q3.
41 @ example: q0 = 0111 1110 0101 0011
43 @ Shift BGR color 1 bit to the left, discarding MSB and preparing for vbit.
44 @ MSB is used for transparency (not needed here, and can mess with green).
45 @ example: q0 = 1111 1100 1010 0110
50 @ Places red value in left most bits, clears bits to the right.
51 @ example: q8 = 1001 1000 0000 0000
56 @ Places blue value in right most bits, leaving bits to the left unchanged.
57 @ example: q8 = 1001 1000 0001 1111
62 @ Sets green value from shifted BGR color by apply a mask.
63 @ example: q15 = 0000 0111 1100 0000
64 @ q8 = 1001 1100 1001 1111
79 @ handle the remainder (reasonably rare)
106 @ note: may overflow source
107 FUNCTION(bgr555_to_rgb565_b): @ dst, src, bytes, int brightness2k // 0-0x0800
118 vand.u16 q10, q2, q14
119 vand.u16 q11, q3, q14
122 vmul.u16 q6, q10, q15
123 vmul.u16 q7, q11, q15
144 vshr.u16 q10, q2, #10
145 vshr.u16 q11, q3, #10
156 vsri.u16 q6, q10, #11
157 vsri.u16 q7, q11, #11
187 FUNCTION(bgr888_to_rgb888): @ dst, src, bytes
196 vld3.8 {d0-d2}, [r1]!
197 vld3.8 {d3-d5}, [r1]!
200 vst3.8 {d0-d2}, [r0, :64]!
201 vst3.8 {d3-d5}, [r0, :64]!
208 FUNCTION(bgr888_to_rgb565): @ dst, src, bytes
220 vld3.8 {d1-d3}, [r1]!
221 vld3.8 {d5-d7}, [r1]!
223 vshll.u8 q8, d2, #3 @ g
225 vshr.u8 d0, d3, #3 @ b
240 FUNCTION(rgb888_to_rgb565): @ dst, src, bytes
252 vld3.8 {d1-d3}, [r1, :64]!
253 vld3.8 {d5-d7}, [r1, :64]!
255 vshll.u8 q8, d2, #3 @ g
257 vshr.u8 d2, d1, #3 @ b
272 @ vim:filetype=armasm