Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: media/base/simd/linear_scale_yuv_to_rgb_mmx.inc

Issue 2694113002: Delete media/base/yuv_convert and dependents. Prefer libyuv. (Closed)
Patch Set: Fix media_unittests. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 %include "media/base/simd/media_export.asm"
6
7 EXPORT SYMBOL
8 align function_align
9
10 mangle(SYMBOL):
11 %assign stack_offset 0
12
13 ; Parameters are in the following order:
14 ; 1. Y plane
15 ; 2. U plane
16 ; 3. V plane
17 ; 4. ARGB frame
18 ; 5. Width
19 ; 6. Source dx
20 ; 7. Conversion lookup table
21
22 PROLOGUE 7, 7, 3, Y, R0, R1, ARGB, R2, TEMP, R3
23
24 %if gprsize == 8
25 %define WORD_SIZE QWORD
26 %else
27 %define WORD_SIZE DWORD
28 %endif
29
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
38
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
45
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]
50
51 ; Define stack usage.
52 PUSH U_ARG_REGq
53 PUSH V_ARG_REGq
54 PUSH SOURCE_DX_ARG_REGq
55 imul WIDTH_ARG_REGq, SOURCE_DX_ARG_REGq ; source_width = width * source_ dx
56 PUSH WIDTH_ARG_REGq
57
58 %macro EPILOGUE 0
59 ADD rsp, 4 * gprsize
60 %endmacro
61
62 xor Xq, Xq ; x = 0
63 cmp SOURCE_DX_ARG_REGq, 0x20000
64 jl .lscaleend
65 mov Xq, 0x8000 ; x = 0.5 for 1/2 or less
66 jmp .lscaleend
67
68 .lscaleloop:
69 mov Uq, U_PLANE
70
71 ; Define macros for scaling YUV components since they are reused.
72 %macro SCALEUV 1
73 mov TEMPq, Xq
74 sar TEMPq, 0x11
75 movzx COMPLd, BYTE [%1 + TEMPq]
76 movzx COMPRd, BYTE [%1 + TEMPq + 1]
77 mov TEMPq, Xq
78 and TEMPq, 0x1fffe
79 imul COMPRq, TEMPq
80 xor TEMPq, 0x1fffe
81 imul COMPLq, TEMPq
82 add COMPLq, COMPRq
83 shr COMPLq, 17
84 %endmacro
85 SCALEUV Uq ; Use the above macro to scale U
86 movq mm0, [TABLE + 2048 + 8 * COMPLq]
87
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]
91
92 %macro SCALEY 0
93 mov TEMPq, Xq
94 sar TEMPq, 0x10
95 movzx COMPLd, BYTE [Yq + TEMPq]
96 movzx COMPRd, BYTE [Yq + TEMPq + 1]
97 mov TEMPq, Xq
98 add Xq, SOURCE_DX ; Add source_dx from stack
99 and TEMPq, 0xffff
100 imul COMPRq, TEMPq
101 xor TEMPq, 0xffff
102 imul COMPLq, TEMPq
103 add COMPLq, COMPRq
104 shr COMPLq, 16
105 %endmacro
106 SCALEY ; Use the above macro to scale Y1
107 movq mm1, [TABLE + 8 * COMPLq]
108
109 cmp Xq, SOURCE_WIDTH ; Compare source_width from stack
110 jge .lscalelastpixel
111
112 SCALEY ; Use the above macro to sacle Y2
113 movq mm2, [TABLE + 8 * COMPLq]
114
115 paddsw mm1, mm0
116 paddsw mm2, mm0
117 psraw mm1, 0x6
118 psraw mm2, 0x6
119 packuswb mm1, mm2
120 MOVQ [ARGBq], mm1
121 add ARGBq, 0x8
122
123 .lscaleend:
124 cmp Xq, SOURCE_WIDTH ; Compare source_width from stack
125 jl .lscaleloop
126 EPILOGUE
127 RET
128
129 .lscalelastpixel:
130 paddsw mm1, mm0
131 psraw mm1, 6
132 packuswb mm1, mm1
133 movd [ARGBq], mm1
134 EPILOGUE
135 RET
OLDNEW
« no previous file with comments | « media/base/simd/linear_scale_yuv_to_rgb_mmx.asm ('k') | media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698