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

Side by Side Diff: media/base/yuv_convert.cc

Issue 174442: mmx for linux yuv convert function.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « no previous file | media/base/yuv_row.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This webpage shows layout of YV12 and other YUV formats 5 // This webpage shows layout of YV12 and other YUV formats
6 // http://www.fourcc.org/yuv.php 6 // http://www.fourcc.org/yuv.php
7 // The actual conversion is best described here 7 // The actual conversion is best described here
8 // http://en.wikipedia.org/wiki/YUV 8 // http://en.wikipedia.org/wiki/YUV
9 // An article on optimizing YUV conversion using tables instead of multiplies 9 // An article on optimizing YUV conversion using tables instead of multiplies
10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf 10 // http://lestourtereaux.free.fr/papers/data/yuvrgb.pdf
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 } 125 }
126 126
127 for (int y = 0; y < scaled_height; ++y) { 127 for (int y = 0; y < scaled_height; ++y) {
128 uint8* dest_pixel = rgb_buf + y * rgb_pitch; 128 uint8* dest_pixel = rgb_buf + y * rgb_pitch;
129 int scaled_y = (y * height / scaled_height); 129 int scaled_y = (y * height / scaled_height);
130 const uint8* y_ptr = y_buf + scaled_y * y_pitch; 130 const uint8* y_ptr = y_buf + scaled_y * y_pitch;
131 const uint8* u_ptr = u_buf + (scaled_y >> y_shift) * uv_pitch; 131 const uint8* u_ptr = u_buf + (scaled_y >> y_shift) * uv_pitch;
132 const uint8* v_ptr = v_buf + (scaled_y >> y_shift) * uv_pitch; 132 const uint8* v_ptr = v_buf + (scaled_y >> y_shift) * uv_pitch;
133 133
134 #if USE_MMX 134 #if USE_MMX && defined(_MSC_VER)
135 if (scaled_width == (width * 2)) { 135 if (scaled_width == (width * 2)) {
136 DoubleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, 136 DoubleYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
137 dest_pixel, scaled_width); 137 dest_pixel, scaled_width);
138 } else if ((scaled_dx & 15) == 0) { // Scaling by integer scale factor. 138 } else if ((scaled_dx & 15) == 0) { // Scaling by integer scale factor.
139 if (scaled_dx_uv == scaled_dx) { // Not rotated. 139 if (scaled_dx_uv == scaled_dx) { // Not rotated.
140 if (scaled_dx == 16) { // Not scaled 140 if (scaled_dx == 16) { // Not scaled
141 FastConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, 141 FastConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
142 dest_pixel, scaled_width); 142 dest_pixel, scaled_width);
143 } else { // Simple scale down. ie half 143 } else { // Simple scale down. ie half
144 ConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr, 144 ConvertYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
(...skipping 13 matching lines...) Expand all
158 ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr, 158 ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
159 dest_pixel, scaled_width, scaled_dx); 159 dest_pixel, scaled_width, scaled_dx);
160 } 160 }
161 } 161 }
162 162
163 // MMX used for FastConvertYUVToRGB32Row requires emms instruction. 163 // MMX used for FastConvertYUVToRGB32Row requires emms instruction.
164 EMMS(); 164 EMMS();
165 } 165 }
166 166
167 } // namespace media 167 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/yuv_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698