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

Side by Side Diff: media/base/simd/convert_yuv_to_rgb_x86.cc

Issue 242643011: Add correct support for videos with YUVJ420P color format, in the software conversion path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yuvnopic
Patch Set: YUVJ browsertest now passes, update expectation Created 6 years, 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #if defined(_MSC_VER) 5 #if defined(_MSC_VER)
6 #include <intrin.h> 6 #include <intrin.h>
7 #else 7 #else
8 #include <mmintrin.h> 8 #include <mmintrin.h>
9 #endif 9 #endif
10 10
11 #include "media/base/simd/convert_yuv_to_rgb.h" 11 #include "media/base/simd/convert_yuv_to_rgb.h"
12 #include "media/base/simd/yuv_to_rgb_table.h"
12 #include "media/base/yuv_convert.h" 13 #include "media/base/yuv_convert.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 void ConvertYUVToRGB32_MMX(const uint8* yplane, 17 void ConvertYUVToRGB32_MMX(const uint8* yplane,
17 const uint8* uplane, 18 const uint8* uplane,
18 const uint8* vplane, 19 const uint8* vplane,
19 uint8* rgbframe, 20 uint8* rgbframe,
20 int width, 21 int width,
21 int height, 22 int height,
22 int ystride, 23 int ystride,
23 int uvstride, 24 int uvstride,
24 int rgbstride, 25 int rgbstride,
25 YUVType yuv_type) { 26 YUVType yuv_type) {
26 unsigned int y_shift = yuv_type; 27 unsigned int y_shift = GetVerticalShift(yuv_type);
27 for (int y = 0; y < height; ++y) { 28 for (int y = 0; y < height; ++y) {
28 uint8* rgb_row = rgbframe + y * rgbstride; 29 uint8* rgb_row = rgbframe + y * rgbstride;
29 const uint8* y_ptr = yplane + y * ystride; 30 const uint8* y_ptr = yplane + y * ystride;
30 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; 31 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride;
31 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; 32 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride;
32 33
33 ConvertYUVToRGB32Row_MMX(y_ptr, 34 ConvertYUVToRGB32Row_MMX(y_ptr,
34 u_ptr, 35 u_ptr,
35 v_ptr, 36 v_ptr,
36 rgb_row, 37 rgb_row,
37 width); 38 width,
39 GetLookupTable(yuv_type));
38 } 40 }
39 41
40 EmptyRegisterState(); 42 EmptyRegisterState();
41 } 43 }
42 44
43 void ConvertYUVAToARGB_MMX(const uint8* yplane, 45 void ConvertYUVAToARGB_MMX(const uint8* yplane,
44 const uint8* uplane, 46 const uint8* uplane,
45 const uint8* vplane, 47 const uint8* vplane,
46 const uint8* aplane, 48 const uint8* aplane,
47 uint8* rgbframe, 49 uint8* rgbframe,
48 int width, 50 int width,
49 int height, 51 int height,
50 int ystride, 52 int ystride,
51 int uvstride, 53 int uvstride,
52 int astride, 54 int astride,
53 int rgbstride, 55 int rgbstride,
54 YUVType yuv_type) { 56 YUVType yuv_type) {
55 unsigned int y_shift = yuv_type; 57 unsigned int y_shift = GetVerticalShift(yuv_type);
56 for (int y = 0; y < height; ++y) { 58 for (int y = 0; y < height; ++y) {
57 uint8* rgb_row = rgbframe + y * rgbstride; 59 uint8* rgb_row = rgbframe + y * rgbstride;
58 const uint8* y_ptr = yplane + y * ystride; 60 const uint8* y_ptr = yplane + y * ystride;
59 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; 61 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride;
60 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; 62 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride;
61 const uint8* a_ptr = aplane + y * astride; 63 const uint8* a_ptr = aplane + y * astride;
62 64
63 ConvertYUVAToARGBRow_MMX(y_ptr, 65 ConvertYUVAToARGBRow_MMX(y_ptr,
64 u_ptr, 66 u_ptr,
65 v_ptr, 67 v_ptr,
66 a_ptr, 68 a_ptr,
67 rgb_row, 69 rgb_row,
68 width); 70 width,
71 GetLookupTable(yuv_type));
69 } 72 }
70 73
71 EmptyRegisterState(); 74 EmptyRegisterState();
72 } 75 }
73 76
74 void ConvertYUVToRGB32_SSE(const uint8* yplane, 77 void ConvertYUVToRGB32_SSE(const uint8* yplane,
75 const uint8* uplane, 78 const uint8* uplane,
76 const uint8* vplane, 79 const uint8* vplane,
77 uint8* rgbframe, 80 uint8* rgbframe,
78 int width, 81 int width,
79 int height, 82 int height,
80 int ystride, 83 int ystride,
81 int uvstride, 84 int uvstride,
82 int rgbstride, 85 int rgbstride,
83 YUVType yuv_type) { 86 YUVType yuv_type) {
84 unsigned int y_shift = yuv_type; 87 unsigned int y_shift = GetVerticalShift(yuv_type);
85 for (int y = 0; y < height; ++y) { 88 for (int y = 0; y < height; ++y) {
86 uint8* rgb_row = rgbframe + y * rgbstride; 89 uint8* rgb_row = rgbframe + y * rgbstride;
87 const uint8* y_ptr = yplane + y * ystride; 90 const uint8* y_ptr = yplane + y * ystride;
88 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride; 91 const uint8* u_ptr = uplane + (y >> y_shift) * uvstride;
89 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride; 92 const uint8* v_ptr = vplane + (y >> y_shift) * uvstride;
90 93
91 ConvertYUVToRGB32Row_SSE(y_ptr, 94 ConvertYUVToRGB32Row_SSE(y_ptr,
92 u_ptr, 95 u_ptr,
93 v_ptr, 96 v_ptr,
94 rgb_row, 97 rgb_row,
95 width); 98 width,
99 GetLookupTable(yuv_type));
96 } 100 }
97 101
98 EmptyRegisterState(); 102 EmptyRegisterState();
99 } 103 }
100 104
101 } // namespace media 105 } // namespace media
OLDNEW
« no previous file with comments | « media/base/simd/convert_yuv_to_rgb_sse.asm ('k') | media/base/simd/convert_yuva_to_argb_mmx.asm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698