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
3 ; found in the LICENSE file.
5 %include "media/base/simd/media_export.asm"
11 %assign stack_offset 0
13 ; Parameters are in the following order:
20 ; 7. Conversion lookup table
22 PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3
25 %define WORD_SIZE QWORD
27 %define WORD_SIZE DWORD
30 ; Define register aliases.
31 %define Xq R1q ; Current X position
32 %define COMPLq R2q ; Component A value
33 %define COMPLd R2d ; Component A value
34 %define U_ARG_REGq R0q ; U plane address argument
35 %define V_ARG_REGq R1q ; V plane address argument
36 %define SOURCE_DX_ARG_REGq TEMPq ; Source dx argument
37 %define WIDTH_ARG_REGq R2q ; Width argument
39 %define COMPRq R0q ; Component B value
40 %define COMPRd R0d ; Component B value
41 %define Uq R0q ; U plane address
42 %define Vq R0q ; V plane address
43 %define U_PLANE WORD_SIZE [rsp + 3 * gprsize]
44 %define TABLE R3q ; Address of the table
46 ; Defines for stack variables.
47 %define V_PLANE WORD_SIZE [rsp + 2 * gprsize]
48 %define SOURCE_DX WORD_SIZE [rsp + gprsize]
49 %define SOURCE_WIDTH WORD_SIZE [rsp]
54 PUSH SOURCE_DX_ARG_REGq
55 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_dx
63 cmp SOURCE_DX_ARG_REGq, 0x20000
65 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less
71 ; Define macros for scaling YUV components since they are reused.
75 movzx COMPLd, BYTE [%1 + TEMPq]
76 movzx COMPRd, BYTE [%1 + TEMPq + 1]
85 SCALEUV Uq ; Use the above macro to scale U
86 movq mm0, [TABLE + 2048 + 8 * COMPLq]
88 mov Vq, V_PLANE ; Read V address from stack
89 SCALEUV Vq ; Use the above macro to scale V
90 paddsw mm0, [TABLE + 4096 + 8 * COMPLq]
95 movzx COMPLd, BYTE [Yq + TEMPq]
96 movzx COMPRd, BYTE [Yq + TEMPq + 1]
98 add Xq, SOURCE_DX ; Add source_dx from stack
106 SCALEY ; Use the above macro to scale Y1
107 movq mm1, [TABLE + 8 * COMPLq]
109 cmp Xq, SOURCE_WIDTH ; Compare source_width from stack
112 SCALEY ; Use the above macro to sacle Y2
113 movq mm2, [TABLE + 8 * COMPLq]
124 cmp Xq, SOURCE_WIDTH ; Compare source_width from stack