OLD | NEW |
1 ; Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 ; Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 ; Use of this source code is governed by a BSD-style license that can be | 2 ; Use of this source code is governed by a BSD-style license that can be |
3 ; found in the LICENSE file. | 3 ; found in the LICENSE file. |
4 | 4 |
5 %include "media/base/simd/media_export.asm" | 5 %include "media/base/simd/media_export.asm" |
6 | 6 |
7 EXPORT SYMBOL | 7 EXPORT SYMBOL |
8 align function_align | 8 align function_align |
9 | 9 |
10 mangle(SYMBOL): | 10 mangle(SYMBOL): |
11 %assign stack_offset 0 | 11 %assign stack_offset 0 |
12 | 12 |
| 13 extern mangle(kCoefficientsRgbY) |
| 14 |
13 ; Parameters are in the following order: | 15 ; Parameters are in the following order: |
14 ; 1. Y plane | 16 ; 1. Y plane |
15 ; 2. U plane | 17 ; 2. U plane |
16 ; 3. V plane | 18 ; 3. V plane |
17 ; 4. ARGB frame | 19 ; 4. ARGB frame |
18 ; 5. Width | 20 ; 5. Width |
19 ; 6. Source dx | 21 ; 6. Source dx |
20 ; 7. Conversion lookup table | |
21 | 22 |
22 PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 | 23 PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP |
23 | 24 |
24 %if gprsize == 8 | 25 %if gprsize == 8 |
25 %define WORD_SIZE QWORD | 26 %define WORD_SIZE QWORD |
26 %else | 27 %else |
27 %define WORD_SIZE DWORD | 28 %define WORD_SIZE DWORD |
28 %endif | 29 %endif |
29 | 30 |
30 ; Define register aliases. | 31 ; Define register aliases. |
31 %define Xq R1q ; Current X position | 32 %define Xq R1q ; Current X position |
32 %define COMPLq R2q ; Component A value | 33 %define COMPLq R2q ; Component A value |
33 %define COMPLd R2d ; Component A value | 34 %define COMPLd R2d ; Component A value |
34 %define U_ARG_REGq R0q ; U plane address argument | 35 %define U_ARG_REGq R0q ; U plane address argument |
35 %define V_ARG_REGq R1q ; V plane address argument | 36 %define V_ARG_REGq R1q ; V plane address argument |
36 %define SOURCE_DX_ARG_REGq TEMPq ; Source dx argument | 37 %define SOURCE_DX_ARG_REGq R3q ; Source dx argument |
37 %define WIDTH_ARG_REGq R2q ; Width argument | 38 %define WIDTH_ARG_REGq R2q ; Width argument |
38 | 39 |
39 %define COMPRq R0q ; Component B value | 40 %define COMPRq R0q ; Component B value |
40 %define COMPRd R0d ; Component B value | 41 %define COMPRd R0d ; Component B value |
41 %define Uq R0q ; U plane address | 42 %define Uq R0q ; U plane address |
42 %define Vq R0q ; V plane address | 43 %define Vq R0q ; V plane address |
43 %define U_PLANE WORD_SIZE [rsp + 3 * gprsize] | 44 %define U_PLANE WORD_SIZE [rsp + 3 * gprsize] |
44 %define TABLE R3q ; Address of the table | 45 %define TABLE R3q ; Address of the table |
45 | 46 |
46 ; Defines for stack variables. | 47 ; Defines for stack variables. |
47 %define V_PLANE WORD_SIZE [rsp + 2 * gprsize] | 48 %define V_PLANE WORD_SIZE [rsp + 2 * gprsize] |
48 %define SOURCE_DX WORD_SIZE [rsp + gprsize] | 49 %define SOURCE_DX WORD_SIZE [rsp + gprsize] |
49 %define SOURCE_WIDTH WORD_SIZE [rsp] | 50 %define SOURCE_WIDTH WORD_SIZE [rsp] |
50 | 51 |
51 ; Define stack usage. | 52 ; Define stack usage. |
52 PUSH U_ARG_REGq | 53 PUSH U_ARG_REGq |
53 PUSH V_ARG_REGq | 54 PUSH V_ARG_REGq |
54 PUSH SOURCE_DX_ARG_REGq | 55 PUSH SOURCE_DX_ARG_REGq |
55 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_
dx | 56 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_
dx |
56 PUSH WIDTH_ARG_REGq | 57 PUSH WIDTH_ARG_REGq |
57 | 58 |
| 59 ; Load the address of kCoefficientsRgbY into TABLE |
| 60 mov TEMPq, SOURCE_DX_ARG_REGq ; Need to save source_dx first |
| 61 LOAD_SYM TABLE, mangle(kCoefficientsRgbY) |
| 62 %define SOURCE_DX_ARG_REGq TEMPq ; Overwrite SOURCE_DX_ARG_REGq to TEMPq |
| 63 |
58 %macro EPILOGUE 0 | 64 %macro EPILOGUE 0 |
59 ADD rsp, 4 * gprsize | 65 ADD rsp, 4 * gprsize |
60 %endmacro | 66 %endmacro |
61 | 67 |
62 xor Xq, Xq ; x = 0 | 68 xor Xq, Xq ; x = 0 |
63 cmp SOURCE_DX_ARG_REGq, 0x20000 | 69 cmp SOURCE_DX_ARG_REGq, 0x20000 |
64 jl .lscaleend | 70 jl .lscaleend |
65 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less | 71 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less |
66 jmp .lscaleend | 72 jmp .lscaleend |
67 | 73 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 EPILOGUE | 132 EPILOGUE |
127 RET | 133 RET |
128 | 134 |
129 .lscalelastpixel: | 135 .lscalelastpixel: |
130 paddsw mm1, mm0 | 136 paddsw mm1, mm0 |
131 psraw mm1, 6 | 137 psraw mm1, 6 |
132 packuswb mm1, mm1 | 138 packuswb mm1, mm1 |
133 movd [ARGBq], mm1 | 139 movd [ARGBq], mm1 |
134 EPILOGUE | 140 EPILOGUE |
135 RET | 141 RET |
OLD | NEW |