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"
6 %include "third_party/x86inc/x86inc.asm"
9 ; This file uses MMX, SSE2 and instructions.
14 ; void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
19 ; ptrdiff_t source_dx);
20 %define SYMBOL ScaleYUVToRGB32Row_SSE2_X64
25 %assign stack_offset
0
27 ; Parameters are in the following order:
36 PROLOGUE
7, 7, 3, Y
, U
, V
, ARGB
, WIDTH, SOURCE_DX
, R1
58 movzx COMPd
, BYTE [Uq
+ INDEXq
]
59 movq xmm0
, [TABLEq
+ 2048 + 8 * COMPq
]
60 movzx COMPd
, BYTE [Vq
+ INDEXq
]
61 movq xmm1
, [TABLEq
+ 4096 + 8 * COMPq
]
64 lea INDEXq
, [Xq
+ SOURCE_DXq
] ; INDEXq nows points to next pixel.
66 movzx COMPd
, BYTE [Yq
+ Xq
]
67 paddsw xmm0
, xmm1
; Hide a ADD after memory load.
68 movq xmm1
, [TABLEq
+ 8 * COMPq
]
71 lea Xq
, [INDEXq
+ SOURCE_DXq
] ; Xq now points to next pixel.
73 movzx COMPd
, BYTE [Yq
+ INDEXq
]
74 movq xmm2
, [TABLEq
+ 8 * COMPq
]
77 shufps xmm1
, xmm2
, 0x44 ; Join two pixels into one XMM register
80 movq
QWORD [ARGBq
], xmm1
87 and WIDTHq
, 1 ; odd number of pixels?
90 ; Read U V components.
93 movzx COMPd
, BYTE [Uq
+ INDEXq
]
94 movq xmm0
, [TABLEq
+ 2048 + 8 * COMPq
]
95 movzx COMPd
, BYTE [Vq
+ INDEXq
]
96 movq xmm1
, [TABLEq
+ 4096 + 8 * COMPq
]
99 ; Read one Y component.
102 movzx COMPd
, BYTE [Yq
+ INDEXq
]
103 movq xmm1
, [TABLEq
+ 8 * COMPq
]
107 movd
DWORD [ARGBq
], xmm1