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 instructions.
14 ;void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
19 ; ptrdiff_t source_dx);
20 %define SYMBOL LinearScaleYUVToRGB32Row_MMX_X64
25 %assign stack_offset
0
26 extern mangle
(kCoefficientsRgbY
)
28 ; Parameters are in the following order:
35 ; 7. Conversion lookup table
37 PROLOGUE
7, 7, 3, Y
, U
, V
, ARGB
, WIDTH, SOURCE_DX
, R1
65 imul WIDTHq
, SOURCE_DXq
; source_width = width * source_dx
67 cmp SOURCE_DXq
, 0x20000
69 mov Xq
, 0x8000 ; x = 0.5 for 1/2 or less
76 movzx COMPLd
, BYTE [Uq
+ INDEXq
]
77 movzx COMPRd
, BYTE [Uq
+ INDEXq
+ 1]
79 and FRACTIONq
, 0x1fffe
80 imul COMPRq
, FRACTIONq
81 xor FRACTIONq
, 0x1fffe
82 imul COMPLq
, FRACTIONq
85 movq mm0
, [TABLEq
+ 2048 + 8 * COMPLq
]
88 movzx COMPLd
, BYTE [Vq
+ INDEXq
]
89 movzx COMPRd
, BYTE [Vq
+ INDEXq
+ 1]
90 ; Trick here to imul COMPL first then COMPR.
91 ; Saves two instruction. :)
92 imul COMPLq
, FRACTIONq
93 xor FRACTIONq
, 0x1fffe
94 imul COMPRq
, FRACTIONq
97 paddsw mm0
, [TABLEq
+ 4096 + 8 * COMPLq
]
99 ; Interpolate first Y1.
100 lea INDEXq
, [Xq
+ SOURCE_DXq
] ; INDEXq now points to next pixel.
101 ; Xq points to current pixel.
104 movzx COMPLd
, BYTE [Yq
+ Xq
]
105 movzx COMPRd
, BYTE [Yq
+ Xq
+ 1]
106 and FRACTIONq
, 0xffff
107 imul COMPRq
, FRACTIONq
108 xor FRACTIONq
, 0xffff
109 imul COMPLq
, FRACTIONq
112 movq mm1
, [TABLEq
+ 8 * COMPLq
]
114 ; Interpolate Y2 if available.
118 lea Xq
, [INDEXq
+ SOURCE_DXq
] ; Xq points to next pixel.
119 ; INDEXq points to current pixel.
120 mov FRACTIONq
, INDEXq
122 movzx COMPLd
, BYTE [Yq
+ INDEXq
]
123 movzx COMPRd
, BYTE [Yq
+ INDEXq
+ 1]
124 and FRACTIONq
, 0xffff
125 imul COMPRq
, FRACTIONq
126 xor FRACTIONq
, 0xffff
127 imul COMPLq
, FRACTIONq
130 movq mm2
, [TABLEq
+ 8 * COMPLq
]