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

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

Issue 7888012: Reorganize YUV scalers (Continued) (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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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
11 // 11 //
12 // YV12 is a full plane of Y and a half height, half width chroma planes 12 // YV12 is a full plane of Y and a half height, half width chroma planes
13 // YV16 is a full plane of Y and a full height, half width chroma planes 13 // YV16 is a full plane of Y and a full height, half width chroma planes
14 // 14 //
15 // ARGB pixel format is output, which on little endian is stored as BGRA. 15 // ARGB pixel format is output, which on little endian is stored as BGRA.
16 // The alpha is set to 255, allowing the application to use RGBA or RGB32. 16 // The alpha is set to 255, allowing the application to use RGBA or RGB32.
17 17
18 #include "media/base/yuv_convert.h" 18 #include "media/base/yuv_convert.h"
19 19
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "media/base/cpu_features.h" 22 #include "media/base/cpu_features.h"
23 #include "media/base/simd/convert_rgb_to_yuv.h" 23 #include "media/base/simd/convert_rgb_to_yuv.h"
24 #include "media/base/simd/convert_yuv_to_rgb.h" 24 #include "media/base/simd/convert_yuv_to_rgb.h"
25 #include "media/base/simd/filter_yuv.h" 25 #include "media/base/simd/filter_yuv.h"
26 #include "media/base/yuv_convert_internal.h"
27 #include "media/base/yuv_row.h"
28 26
29 #if defined(ARCH_CPU_X86_FAMILY) 27 #if defined(ARCH_CPU_X86_FAMILY)
30 #if defined(_MSC_VER) 28 #if defined(_MSC_VER)
31 #include <intrin.h> 29 #include <intrin.h>
32 #else 30 #else
33 #include <emmintrin.h> 31 #include <emmintrin.h>
34 #include <mmintrin.h> 32 #include <mmintrin.h>
35 #endif 33 #endif
36 #endif 34 #endif
37 35
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 rgbstride, ystride, uvstride); 334 rgbstride, ystride, uvstride);
337 #endif 335 #endif
338 } 336 }
339 337
340 void ConvertYUY2ToYUV(const uint8* src, 338 void ConvertYUY2ToYUV(const uint8* src,
341 uint8* yplane, 339 uint8* yplane,
342 uint8* uplane, 340 uint8* uplane,
343 uint8* vplane, 341 uint8* vplane,
344 int width, 342 int width,
345 int height) { 343 int height) {
346 ConvertYUY2ToYUV_C(src, yplane, uplane, vplane, width, height); 344 for (int i = 0; i < height / 2; ++i) {
345 for (int j = 0; j < (width / 2); ++j) {
346 yplane[0] = src[0];
347 *uplane = src[1];
348 yplane[1] = src[2];
349 *vplane = src[3];
350 src += 4;
351 yplane += 2;
352 uplane++;
353 vplane++;
354 }
355 for (int j = 0; j < (width / 2); ++j) {
356 yplane[0] = src[0];
357 yplane[1] = src[2];
358 src += 4;
359 yplane += 2;
360 }
361 }
347 } 362 }
348 363
349 void ConvertYUVToRGB32(const uint8* yplane, 364 void ConvertYUVToRGB32(const uint8* yplane,
350 const uint8* uplane, 365 const uint8* uplane,
351 const uint8* vplane, 366 const uint8* vplane,
352 uint8* rgbframe, 367 uint8* rgbframe,
353 int width, 368 int width,
354 int height, 369 int height,
355 int ystride, 370 int ystride,
356 int uvstride, 371 int uvstride,
(...skipping 12 matching lines...) Expand all
369 else 384 else
370 convert_proc = &ConvertYUVToRGB32_C; 385 convert_proc = &ConvertYUVToRGB32_C;
371 } 386 }
372 387
373 convert_proc(yplane, uplane, vplane, rgbframe, 388 convert_proc(yplane, uplane, vplane, rgbframe,
374 width, height, ystride, uvstride, rgbstride, yuv_type); 389 width, height, ystride, uvstride, rgbstride, yuv_type);
375 #endif 390 #endif
376 } 391 }
377 392
378 } // namespace media 393 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698