| 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 | |
| 15 ; Parameters are in the following order: | 13 ; Parameters are in the following order: |
| 16 ; 1. Y plane | 14 ; 1. Y plane |
| 17 ; 2. U plane | 15 ; 2. U plane |
| 18 ; 3. V plane | 16 ; 3. V plane |
| 19 ; 4. ARGB frame | 17 ; 4. ARGB frame |
| 20 ; 5. Width | 18 ; 5. Width |
| 21 ; 6. Source dx | 19 ; 6. Source dx |
| 20 ; 7. Conversion lookup table |
| 22 | 21 |
| 23 PROLOGUE 6, 7, 3, Y, R0, R1, ARGB, R2, R3, TEMP | 22 PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3 |
| 24 | 23 |
| 25 %if gprsize == 8 | 24 %if gprsize == 8 |
| 26 %define WORD_SIZE QWORD | 25 %define WORD_SIZE QWORD |
| 27 %else | 26 %else |
| 28 %define WORD_SIZE DWORD | 27 %define WORD_SIZE DWORD |
| 29 %endif | 28 %endif |
| 30 | 29 |
| 31 ; Define register aliases. | 30 ; Define register aliases. |
| 32 %define Xq R1q ; Current X position | 31 %define Xq R1q ; Current X position |
| 33 %define COMPLq R2q ; Component A value | 32 %define COMPLq R2q ; Component A value |
| 34 %define COMPLd R2d ; Component A value | 33 %define COMPLd R2d ; Component A value |
| 35 %define U_ARG_REGq R0q ; U plane address argument | 34 %define U_ARG_REGq R0q ; U plane address argument |
| 36 %define V_ARG_REGq R1q ; V plane address argument | 35 %define V_ARG_REGq R1q ; V plane address argument |
| 37 %define SOURCE_DX_ARG_REGq R3q ; Source dx argument | 36 %define SOURCE_DX_ARG_REGq TEMPq ; Source dx argument |
| 38 %define WIDTH_ARG_REGq R2q ; Width argument | 37 %define WIDTH_ARG_REGq R2q ; Width argument |
| 39 | 38 |
| 40 %define COMPRq R0q ; Component B value | 39 %define COMPRq R0q ; Component B value |
| 41 %define COMPRd R0d ; Component B value | 40 %define COMPRd R0d ; Component B value |
| 42 %define Uq R0q ; U plane address | 41 %define Uq R0q ; U plane address |
| 43 %define Vq R0q ; V plane address | 42 %define Vq R0q ; V plane address |
| 44 %define U_PLANE WORD_SIZE [rsp + 3 * gprsize] | 43 %define U_PLANE WORD_SIZE [rsp + 3 * gprsize] |
| 45 %define TABLE R3q ; Address of the table | 44 %define TABLE R3q ; Address of the table |
| 46 | 45 |
| 47 ; Defines for stack variables. | 46 ; Defines for stack variables. |
| 48 %define V_PLANE WORD_SIZE [rsp + 2 * gprsize] | 47 %define V_PLANE WORD_SIZE [rsp + 2 * gprsize] |
| 49 %define SOURCE_DX WORD_SIZE [rsp + gprsize] | 48 %define SOURCE_DX WORD_SIZE [rsp + gprsize] |
| 50 %define SOURCE_WIDTH WORD_SIZE [rsp] | 49 %define SOURCE_WIDTH WORD_SIZE [rsp] |
| 51 | 50 |
| 52 ; Define stack usage. | 51 ; Define stack usage. |
| 53 PUSH U_ARG_REGq | 52 PUSH U_ARG_REGq |
| 54 PUSH V_ARG_REGq | 53 PUSH V_ARG_REGq |
| 55 PUSH SOURCE_DX_ARG_REGq | 54 PUSH SOURCE_DX_ARG_REGq |
| 56 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_
dx | 55 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_
dx |
| 57 PUSH WIDTH_ARG_REGq | 56 PUSH WIDTH_ARG_REGq |
| 58 | 57 |
| 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 | |
| 64 %macro EPILOGUE 0 | 58 %macro EPILOGUE 0 |
| 65 ADD rsp, 4 * gprsize | 59 ADD rsp, 4 * gprsize |
| 66 %endmacro | 60 %endmacro |
| 67 | 61 |
| 68 xor Xq, Xq ; x = 0 | 62 xor Xq, Xq ; x = 0 |
| 69 cmp SOURCE_DX_ARG_REGq, 0x20000 | 63 cmp SOURCE_DX_ARG_REGq, 0x20000 |
| 70 jl .lscaleend | 64 jl .lscaleend |
| 71 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less | 65 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less |
| 72 jmp .lscaleend | 66 jmp .lscaleend |
| 73 | 67 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 EPILOGUE | 126 EPILOGUE |
| 133 RET | 127 RET |
| 134 | 128 |
| 135 .lscalelastpixel: | 129 .lscalelastpixel: |
| 136 paddsw mm1, mm0 | 130 paddsw mm1, mm0 |
| 137 psraw mm1, 6 | 131 psraw mm1, 6 |
| 138 packuswb mm1, mm1 | 132 packuswb mm1, mm1 |
| 139 movd [ARGBq], mm1 | 133 movd [ARGBq], mm1 |
| 140 EPILOGUE | 134 EPILOGUE |
| 141 RET | 135 RET |
| OLD | NEW |