-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb_arm4l.S | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb_arm4l.S b/noncore/multimedia/opieplayer2/yuv2rgb_arm4l.S index f4a3395..521bcaa 100644 --- a/noncore/multimedia/opieplayer2/yuv2rgb_arm4l.S +++ b/noncore/multimedia/opieplayer2/yuv2rgb_arm4l.S | |||
@@ -1,64 +1,85 @@ | |||
1 | /* | ||
2 | Copyright (c) 2001 Lionel Ulmer (lionel.ulmer@free.fr / bbrox@bbrox.org) | ||
3 | |||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | of this software and associated documentation files (the "Software"), to deal | ||
6 | in the Software without restriction, including without limitation the rights | ||
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | copies of the Software, and to permit persons to whom the Software is | ||
9 | furnished to do so, subject to the following conditions: | ||
10 | |||
11 | The above copyright notice and this permission notice shall be included in | ||
12 | all copies or substantial portions of the Software. | ||
13 | |||
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
20 | */ | ||
21 | |||
1 | /* WARNING : this function only works when stride_U == stride_V (I use some hacks to | 22 | /* WARNING : this function only works when stride_U == stride_V (I use some hacks to |
2 | not have to do too many computations at line's end)... | 23 | not have to do too many computations at line's end)... |
3 | 24 | ||
4 | C-like prototype : | 25 | C-like prototype : |
5 | void convert_yuv420_rgb565(AVPicture *picture, unsigned char *results, int w, int h) ; | 26 | void convert_yuv420_rgb565(AVPicture *picture, unsigned char *results, int w, int h) ; |
6 | 27 | ||
7 | */ | 28 | */ |
8 | 29 | ||
9 | #ifdef __arm__ | 30 | #ifdef __arm__ |
10 | 31 | ||
11 | .text | 32 | .text |
12 | .align | 33 | .align |
13 | 34 | ||
14 | .global convert_yuv420_rgb565 | 35 | .global convert_yuv420_rgb565 |
15 | convert_yuv420_rgb565: | 36 | convert_yuv420_rgb565: |
16 | stmdb sp!, { r4 - r12, lr } @ all callee saved regs | 37 | stmdb sp!, { r4 - r12, lr } @ all callee saved regs |
17 | ldr r7, [r0, #0] @ Y ptr | 38 | ldr r7, [r0, #0] @ Y ptr |
18 | ldr r9, [r0, #4] @ U ptr | 39 | ldr r9, [r0, #4] @ U ptr |
19 | ldr r10, [r0, #8] @ V ptr | 40 | ldr r10, [r0, #8] @ V ptr |
20 | subs r10, r10, r9 @ V ptr - U ptr | 41 | subs r10, r10, r9 @ V ptr - U ptr |
21 | ldr r8, [r0, #12] | 42 | ldr r8, [r0, #12] |
22 | add r8, r8, r7 @ Y + stride_Y | 43 | add r8, r8, r7 @ Y + stride_Y |
23 | ldr r4, [r0, #12] @ Stride_Y | 44 | ldr r4, [r0, #12] @ Stride_Y |
24 | mov r4, r4, lsl #1 | 45 | mov r4, r4, lsl #1 |
25 | sub r4, r4, r2 @ (2 * Stride_Y) - width | 46 | sub r4, r4, r2 @ (2 * Stride_Y) - width |
26 | ldr r5, [r0, #16] @ Stride_U | 47 | ldr r5, [r0, #16] @ Stride_U |
27 | sub r5, r5, r2, lsr #1 @ Stride_U - (width / 2) | 48 | sub r5, r5, r2, lsr #1 @ Stride_U - (width / 2) |
28 | ldr r6, [r0, #20] @ Stride_V | 49 | ldr r6, [r0, #20] @ Stride_V |
29 | sub r6, r6, r2, lsr #1 @ Stride_V - (width / 2) | 50 | sub r6, r6, r2, lsr #1 @ Stride_V - (width / 2) |
30 | add r0, r1, r2, lsl #1 @ RGB + 1 | 51 | add r0, r1, r2, lsl #1 @ RGB + 1 |
31 | stmdb sp!, { r0-r10 } | 52 | stmdb sp!, { r0-r10 } |
32 | @ Stack description : | 53 | @ Stack description : |
33 | @ (sp+ 0) RGB + one line | 54 | @ (sp+ 0) RGB + one line |
34 | @ (sp+ 4) RGB | 55 | @ (sp+ 4) RGB |
35 | @ (sp+ 8) width (save) | 56 | @ (sp+ 8) width (save) |
36 | @ (sp+12) height | 57 | @ (sp+12) height |
37 | @ (sp+16) (2 * stride_Y) - width | 58 | @ (sp+16) (2 * stride_Y) - width |
38 | @ (sp+20) stride_U - (width / 2) | 59 | @ (sp+20) stride_U - (width / 2) |
39 | @ (sp+24) stride_V - (width / 2) !!! UNUSED !!! | 60 | @ (sp+24) stride_V - (width / 2) !!! UNUSED !!! |
40 | @ (sp+28) Y ptr | 61 | @ (sp+28) Y ptr |
41 | @ (sp+32) Y ptr + one line | 62 | @ (sp+32) Y ptr + one line |
42 | @ (sp+36) U ptr | 63 | @ (sp+36) U ptr |
43 | @ (sp+40) V - U | 64 | @ (sp+40) V - U |
44 | mov lr, r2 @ Initialize the width counter | 65 | mov lr, r2 @ Initialize the width counter |
45 | add r0, pc, #(const_storage-.-8) @ r0 = base pointer to the constants array | 66 | add r0, pc, #(const_storage-.-8) @ r0 = base pointer to the constants array |
46 | ldr r8, [r0, #(4*4)] @ r8 = multy | 67 | ldr r8, [r0, #(4*4)] @ r8 = multy |
47 | yuv_loop: | 68 | yuv_loop: |
48 | add r0, pc, #(const_storage-.-8) @ r0 = base pointer to the constants array | 69 | add r0, pc, #(const_storage-.-8) @ r0 = base pointer to the constants array |
49 | ldr r10, [sp, #28] @ r10 = Y | 70 | ldr r10, [sp, #28] @ r10 = Y |
50 | ldr r1, [sp, #36] @ r1 = U | 71 | ldr r1, [sp, #36] @ r1 = U |
51 | ldrb r9, [r10, #0] @ r9 = *Y | 72 | ldrb r9, [r10, #0] @ r9 = *Y |
52 | ldrb r11, [r1] @ r11 = *U | 73 | ldrb r11, [r1] @ r11 = *U |
53 | add r1, r1, #1 @ r1 = U++ | 74 | add r1, r1, #1 @ r1 = U++ |
54 | ldr r2, [sp, #40] @ r2 = V - U | 75 | ldr r2, [sp, #40] @ r2 = V - U |
55 | str r1, [sp, #36] @ store U++ | 76 | str r1, [sp, #36] @ store U++ |
56 | add r2, r1, r2 @ r2 = V+1 | 77 | add r2, r1, r2 @ r2 = V+1 |
57 | ldrb r12, [r2, #-1] @ r12 = *V | 78 | ldrb r12, [r2, #-1] @ r12 = *V |
58 | sub r11, r11, #128 @ r11 = *U - 128 | 79 | sub r11, r11, #128 @ r11 = *U - 128 |
59 | sub r12, r12, #128 @ r12 = *V - 128 | 80 | sub r12, r12, #128 @ r12 = *V - 128 |
60 | ldr r1, [r0, #(4*0)] @ r1 = crv | 81 | ldr r1, [r0, #(4*0)] @ r1 = crv |
61 | mov r7, #32768 @ r7 = 32768 (for additions in MLA) | 82 | mov r7, #32768 @ r7 = 32768 (for additions in MLA) |
62 | ldr r2, [r0, #(4*3)] @ r2 = -cgv | 83 | ldr r2, [r0, #(4*3)] @ r2 = -cgv |
63 | mla r6, r1, r12, r7 @ r6 = nonyc_r = crv * (*V - 128) + 32768 | 84 | mla r6, r1, r12, r7 @ r6 = nonyc_r = crv * (*V - 128) + 32768 |
64 | ldr r3, [r0, #(4*1)] @ r3 = cbu | 85 | ldr r3, [r0, #(4*1)] @ r3 = cbu |