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

Side by Side Diff: media/base/simd/scale_yuv_to_rgb_sse2_x64.asm

Issue 7891039: Resubmit - Rewrite color space conversions suite using YASM" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/base/simd/scale_yuv_to_rgb_sse.asm ('k') | media/base/simd/x86inc.asm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "x86inc.asm"
6
7 ;
8 ; This file uses MMX, SSE2 and instructions.
9 ;
10 SECTION_TEXT
11 CPU SSE2
12
13 ; void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
14 ; const uint8* u_buf,
15 ; const uint8* v_buf,
16 ; uint8* rgb_buf,
17 ; int width,
18 ; int source_dx);
19 %define SYMBOL ScaleYUVToRGB32Row_SSE2_X64
20
21 global mangle(SYMBOL) PRIVATE
22 align function_align
23
24 mangle(SYMBOL):
25 %assign stack_offset 0
26 extern mangle(kCoefficientsRgbY)
27
28 ; Parameters are in the following order:
29 ; 1. Y plane
30 ; 2. U plane
31 ; 3. V plane
32 ; 4. ARGB frame
33 ; 5. Width
34 ; 6. Source dx
35
36 PROLOGUE 6, 7, 3, Y, U, V, ARGB, WIDTH, SOURCE_DX, COMP
37
38 %define TABLEq r10
39 %define Xq r11
40 %define INDEXq r12
41 PUSH r10
42 PUSH r11
43 PUSH r12
44
45 LOAD_SYM TABLEq, mangle(kCoefficientsRgbY)
46
47 ; Set Xq index to 0.
48 xor Xq, Xq
49 jmp .scaleend
50
51 .scaleloop:
52 ; Read UV pixels.
53 mov INDEXq, Xq
54 sar INDEXq, 17
55 movzx COMPd, BYTE [Uq + INDEXq]
56 movq xmm0, [TABLEq + 2048 + 8 * COMPq]
57 movzx COMPd, BYTE [Vq + INDEXq]
58 movq xmm1, [TABLEq + 4096 + 8 * COMPq]
59
60 ; Read first Y pixel.
61 lea INDEXq, [Xq + SOURCE_DXq] ; INDEXq nows points to next pixel.
62 sar Xq, 16
63 movzx COMPd, BYTE [Yq + Xq]
64 paddsw xmm0, xmm1 ; Hide a ADD after memory load.
65 movq xmm1, [TABLEq + 8 * COMPq]
66
67 ; Read next Y pixel.
68 lea Xq, [INDEXq + SOURCE_DXq] ; Xq now points to next pixel.
69 sar INDEXq, 16
70 movzx COMPd, BYTE [Yq + INDEXq]
71 movq xmm2, [TABLEq + 8 * COMPq]
72 paddsw xmm1, xmm0
73 paddsw xmm2, xmm0
74 shufps xmm1, xmm2, 0x44 ; Join two pixels into one XMM register
75 psraw xmm1, 6
76 packuswb xmm1, xmm1
77 movq QWORD [ARGBq], xmm1
78 add ARGBq, 8
79
80 .scaleend:
81 sub WIDTHq, 2
82 jns .scaleloop
83
84 and WIDTHq, 1 ; odd number of pixels?
85 jz .scaledone
86
87 ; Read U V components.
88 mov INDEXq, Xq
89 sar INDEXq, 17
90 movzx COMPd, BYTE [Uq + INDEXq]
91 movq xmm0, [TABLEq + 2048 + 8 * COMPq]
92 movzx COMPd, BYTE [Vq + INDEXq]
93 paddsw xmm0, [TABLEq + 4096 + 8 * COMPq]
94
95 ; Read one Y component.
96 mov INDEXq, Xq
97 sar INDEXq, 16
98 movzx COMPd, BYTE [Yq + INDEXq]
99 movq xmm1, [TABLEq + 8 * COMPq]
100 paddsw xmm1, xmm0
101 psraw xmm1, 6
102 packuswb xmm1, xmm1
103 movd DWORD [ARGBq], xmm1
104
105 .scaledone:
106 POP r12
107 POP r11
108 POP r10
109 RET
OLDNEW
« no previous file with comments | « media/base/simd/scale_yuv_to_rgb_sse.asm ('k') | media/base/simd/x86inc.asm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698