Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: src/opts/SkFontHost_FreeType_common_opts_neon.cpp

Issue 892453002: neon code for bgra to rgba conversion for copyFTBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include <arm_neon.h>
2
3 void BGRA2RGBA_Neon(const uint8_t* src, uint8_t* dst, size_t height, const size_ t width, const size_t dstRowBytes, const int srcPitch)
reed1 2015/01/29 15:47:19 1. col max is 100 2. why is dst..rowBytes and src.
frederic.ma 2015/01/29 18:33:09 1. Col max fixed 2. dst..rowBytes and src..Pitch r
4 {
5 asm volatile (
6
7 "cmp %[height], #0 \n\t" // if (height == 0) exit
8 "beq End \n\t"
9
10 "RowLoop:"
11
12 "mov r1, %[width] \n\t" // reset r1 = width for each new line
13 "mov r2, %[src] \n\t"
14 "mov r3, %[dst] \n\t"
15
16 "ColumnBatchLoop:"
17
18 "cmp r1, #8 \n\t" // while (r1 >= 8)
19 "blt PixelLoopStart \n\t"
20
21 // load src, 8 pixels at a time, each pixel taking 32bit value
22 "vld4.8 {d0, d1, d2, d3}, [r2]! \n\t" //d0: B0B1B2B3...B7 d1: G0G1G2G3...G7 d2: R0R1R2R3...G7 d3: A0A1A2A3...A7
23 "vswp d0, d2 \n\t" //swap d0 and d2 so we have RGBA format
24 "vst4.8 {d0, d1, d2, d3}, [r3]! \n\t" //write back to dst
25
26 "sub r1, r1, #8 \n\t" //r1 -= 8 because we are processing 8 pixels at a time
27 "b ColumnBatchLoop \n\t"
28
29 "PixelLoopStart: \n\t"
30
31 "cmp r1, #0 \n\t" // while (r1 > 0)
32 "beq PixelLoopEnd \n\t"
33
34 "PixelLoop:"
35
36 "vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r2]! \n\t" //load 1 32bits pixel at a time and swap again
37 "vswp d0, d2 \n\t"
38 "vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r3]! \n\t"
39
40 "subs r1, r1, #1 \n\t" // pixel counter decrement
41 "bne PixelLoop \n\t"
42
43 "PixelLoopEnd: \n\t"
44
45 "add %[src], %[src], %[srcPitch] \n\t"
46 "add %[dst], %[dst], %[dstRowBytes] \n\t"
47
48 "subs %[height], %[height], #1 \n\t" // while (height)
49 "bne RowLoop \n\t" // process next line
50
51 "End: \n\t"
52
53 : [height] "+r" (height), [dst] "+r" (dst), [src] "+r" (src)
54 : [width] "r" (width), [srcPitch] "r" (srcPitch), [dstRowBytes] "r" (dstRowBytes)
55 : "cc", "memory",
56 "r1", "r2", "r3",
57 "d0", "d1", "d2", "d3");
58 }
59
60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698