summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 23:47:34 +0000
committerdalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 23:47:34 +0000
commit14b45ec2315b8f30607b6583b5dd762958ca7ebf (patch)
tree01c544a3ddccdbf4611037c12ed1821d22874b9b
parent9f259e1f090de6ae995ec86eb6aff1660b11f4ec (diff)
downloadchromium_src-14b45ec2315b8f30607b6583b5dd762958ca7ebf.zip
chromium_src-14b45ec2315b8f30607b6583b5dd762958ca7ebf.tar.gz
chromium_src-14b45ec2315b8f30607b6583b5dd762958ca7ebf.tar.bz2
Streamline SIMD targets in media.gyp
Prevents duplicates of the media_sse and yuv_convert targets from ending up in both media and media_unittests during shared builds. - Removes the yuv_convert target since everyone who uses it already uses media. - Merges differ_block_sse2 and yuv_convert_simd_x86 into media_sse2. - Moves assembly into media_asm. - Moves incorrect mmx bundling from sse2 to new media_mmx target. - Introduces EXPORT macro to x86inc.asm - Introduces yasm_includes for non-.asm files in yasm_compile.gypi. - Fixes missing const on yuv constants table. BUG=none TEST=compiles, all unittests pass. TBR=fischman@chromium.org, kbr@chromium.org, sergeyu@chromium.org Review URL: https://codereview.chromium.org/15151002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202230 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/base/simd/convert_rgb_to_yuv.h108
-rw-r--r--media/base/simd/convert_rgb_to_yuv_ssse3.asm1
-rw-r--r--media/base/simd/convert_rgb_to_yuv_ssse3.inc2
-rw-r--r--media/base/simd/convert_yuv_to_rgb.h347
-rw-r--r--media/base/simd/convert_yuv_to_rgb_c.cc8
-rw-r--r--media/base/simd/convert_yuv_to_rgb_mmx.inc4
-rw-r--r--media/base/simd/convert_yuva_to_argb_mmx.inc4
-rw-r--r--media/base/simd/empty_register_state_mmx.asm3
-rw-r--r--media/base/simd/filter_yuv.h35
-rw-r--r--media/base/simd/linear_scale_yuv_to_rgb_mmx.inc4
-rw-r--r--media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm3
-rw-r--r--media/base/simd/media_export.asm48
-rw-r--r--media/base/simd/scale_yuv_to_rgb_mmx.inc6
-rw-r--r--media/base/simd/scale_yuv_to_rgb_sse2_x64.asm4
-rw-r--r--media/base/simd/yuv_to_rgb_table.cc2
-rw-r--r--media/base/simd/yuv_to_rgb_table.h2
-rw-r--r--media/base/yuv_convert.cc72
-rw-r--r--media/base/yuv_convert.h177
-rw-r--r--media/base/yuv_convert_unittest.cc4
-rw-r--r--media/media.gyp356
-rw-r--r--remoting/remoting.gyp1
-rw-r--r--third_party/x86inc/x86inc.asm20
-rw-r--r--third_party/yasm/yasm_compile.gypi8
-rw-r--r--ui/surface/surface.gyp2
-rw-r--r--webkit/media/webkit_media.gypi1
25 files changed, 625 insertions, 597 deletions
diff --git a/media/base/simd/convert_rgb_to_yuv.h b/media/base/simd/convert_rgb_to_yuv.h
index 03fe114..d3bb4ca 100644
--- a/media/base/simd/convert_rgb_to_yuv.h
+++ b/media/base/simd/convert_rgb_to_yuv.h
@@ -10,46 +10,50 @@
namespace media {
-// Converts an ARGB image to a YV12 image. This function calls ASM functions
-// implemented in "convert_rgb_to_yuv_ssse3.asm" to convert the specified ARGB
-// image to a YV12 image.
-void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
+// These methods are exported for testing purposes only. Library users should
+// only call the methods listed in yuv_convert.h.
-// Converts an RGB image to a YV12 image. This function is almost same as
-// ConvertRGB32ToYUV_SSSE3 except its first argument is a pointer to RGB pixels.
-void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
+MEDIA_EXPORT void ConvertRGB32ToYUV_SSSE3(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
-// SSE2 version of converting RGBA to YV12.
-void ConvertRGB32ToYUV_SSE2(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
+MEDIA_EXPORT void ConvertRGB24ToYUV_SSSE3(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
-// This is a C reference implementation of the above routine.
-// This method should only be used in unit test.
-// TODO(hclam): Should use this as the C version of RGB to YUV.
-void ConvertRGB32ToYUV_SSE2_Reference(const uint8* rgbframe,
+MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
+
+MEDIA_EXPORT void ConvertRGB32ToYUV_SSE2_Reference(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
+
+MEDIA_EXPORT void ConvertRGB32ToYUV_C(const uint8* rgbframe,
uint8* yplane,
uint8* uplane,
uint8* vplane,
@@ -59,27 +63,15 @@ void ConvertRGB32ToYUV_SSE2_Reference(const uint8* rgbframe,
int ystride,
int uvstride);
-// C version of converting RGBA to YV12.
-void ConvertRGB32ToYUV_C(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
-
-// C version of converting RGB24 to YV12.
-void ConvertRGB24ToYUV_C(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
+MEDIA_EXPORT void ConvertRGB24ToYUV_C(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
} // namespace media
diff --git a/media/base/simd/convert_rgb_to_yuv_ssse3.asm b/media/base/simd/convert_rgb_to_yuv_ssse3.asm
index b59362b..ffbcbbc 100644
--- a/media/base/simd/convert_rgb_to_yuv_ssse3.asm
+++ b/media/base/simd/convert_rgb_to_yuv_ssse3.asm
@@ -2,6 +2,7 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
+%include "media/base/simd/media_export.asm"
%include "third_party/x86inc/x86inc.asm"
;
diff --git a/media/base/simd/convert_rgb_to_yuv_ssse3.inc b/media/base/simd/convert_rgb_to_yuv_ssse3.inc
index 35c0db9..e49e922 100644
--- a/media/base/simd/convert_rgb_to_yuv_ssse3.inc
+++ b/media/base/simd/convert_rgb_to_yuv_ssse3.inc
@@ -27,7 +27,7 @@
; // pixels.
; }
;
- global mangle(SYMBOL) PRIVATE
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
diff --git a/media/base/simd/convert_yuv_to_rgb.h b/media/base/simd/convert_yuv_to_rgb.h
index 7db35b5..2991d56 100644
--- a/media/base/simd/convert_yuv_to_rgb.h
+++ b/media/base/simd/convert_yuv_to_rgb.h
@@ -10,88 +10,102 @@
namespace media {
-typedef void (*ConvertYUVToRGB32Proc)(const uint8*,
- const uint8*,
- const uint8*,
- uint8*,
- int,
- int,
- int,
- int,
- int,
- YUVType);
-
-typedef void (*ConvertYUVAToARGBProc)(const uint8*,
- const uint8*,
- const uint8*,
- const uint8*,
- uint8*,
- int,
- int,
- int,
- int,
- int,
- int,
- YUVType);
-
-void ConvertYUVToRGB32_C(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int rgbstride,
- YUVType yuv_type);
-
-void ConvertYUVAToARGB_C(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- const uint8* aplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int avstride,
- int rgbstride,
- YUVType yuv_type);
-
-void ConvertYUVToRGB32_SSE(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int rgbstride,
- YUVType yuv_type);
-
-void ConvertYUVToRGB32_MMX(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int rgbstride,
- YUVType yuv_type);
-
-void ConvertYUVAToARGB_MMX(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- const uint8* aplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int avstride,
- int rgbstride,
- YUVType yuv_type);
+// These methods are exported for testing purposes only. Library users should
+// only call the methods listed in yuv_convert.h.
+
+MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int rgbstride,
+ YUVType yuv_type);
+
+MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ ptrdiff_t width);
+
+MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ const uint8* aplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int avstride,
+ int rgbstride,
+ YUVType yuv_type);
+
+MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ const uint8* aplane,
+ uint8* rgbframe,
+ ptrdiff_t width);
+
+MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int rgbstride,
+ YUVType yuv_type);
+
+MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int rgbstride,
+ YUVType yuv_type);
+
+MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ const uint8* aplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int avstride,
+ int rgbstride,
+ YUVType yuv_type);
+
+MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ int dest_width,
+ int source_x,
+ int source_dx);
} // namespace media
@@ -105,121 +119,66 @@ extern "C" {
// issue on at least Win64. The C-equivalent RowProc versions' prototypes
// include the same change to ptrdiff_t to reuse the typedefs.
-typedef void (*ConvertYUVToRGB32RowProc)(const uint8*,
- const uint8*,
- const uint8*,
- uint8*,
- ptrdiff_t);
-
-typedef void (*ConvertYUVAToARGBRowProc)(const uint8*,
- const uint8*,
- const uint8*,
- const uint8*,
- uint8*,
- ptrdiff_t);
-
-typedef void (*ScaleYUVToRGB32RowProc)(const uint8*,
- const uint8*,
- const uint8*,
- uint8*,
- ptrdiff_t,
- ptrdiff_t);
-
-void ConvertYUVToRGB32Row_C(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- ptrdiff_t width);
-
-void ConvertYUVAToARGBRow_C(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- const uint8* aplane,
- uint8* rgbframe,
- ptrdiff_t width);
-
-void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- ptrdiff_t width);
-
-void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- const uint8* aplane,
- uint8* rgbframe,
- ptrdiff_t width);
-
-void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- ptrdiff_t width);
-
-void ScaleYUVToRGB32Row_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
+MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ ptrdiff_t width);
+
+MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ const uint8* aplane,
+ uint8* rgbframe,
+ ptrdiff_t width);
+
+MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ ptrdiff_t width);
+
+MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
- int dest_width,
- int source_x,
- int source_dx);
-
-void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
-
-void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
- const uint8* u_buf,
- const uint8* v_buf,
- uint8* rgb_buf,
- ptrdiff_t width,
- ptrdiff_t source_dx);
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
+
+MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ ptrdiff_t width,
+ ptrdiff_t source_dx);
} // extern "C"
diff --git a/media/base/simd/convert_yuv_to_rgb_c.cc b/media/base/simd/convert_yuv_to_rgb_c.cc
index e09ed13..f04a89d 100644
--- a/media/base/simd/convert_yuv_to_rgb_c.cc
+++ b/media/base/simd/convert_yuv_to_rgb_c.cc
@@ -5,6 +5,8 @@
#include "media/base/simd/convert_yuv_to_rgb.h"
#include "media/base/simd/yuv_to_rgb_table.h"
+namespace media {
+
#define packuswb(x) ((x) < 0 ? 0 : ((x) > 255 ? 255 : (x)))
#define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \
(((x) + (y)) > 32767 ? 32767 : ((x) + (y))))
@@ -67,8 +69,6 @@ static inline void ConvertYUVAToARGB_C(uint8 y,
*reinterpret_cast<uint32*>(rgb_buf) = b | (g << 8) | (r << 16) | (a << 24);
}
-extern "C" {
-
void ConvertYUVToRGB32Row_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
@@ -181,10 +181,6 @@ void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
}
}
-}
-
-namespace media {
-
void ConvertYUVToRGB32_C(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
diff --git a/media/base/simd/convert_yuv_to_rgb_mmx.inc b/media/base/simd/convert_yuv_to_rgb_mmx.inc
index b9555ce..e38794a 100644
--- a/media/base/simd/convert_yuv_to_rgb_mmx.inc
+++ b/media/base/simd/convert_yuv_to_rgb_mmx.inc
@@ -2,7 +2,9 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
- global mangle(SYMBOL) PRIVATE
+%include "media/base/simd/media_export.asm"
+
+ EXPORT SYMBOL
align function_align
; Non-PIC code is the fastest so use this if possible.
diff --git a/media/base/simd/convert_yuva_to_argb_mmx.inc b/media/base/simd/convert_yuva_to_argb_mmx.inc
index 621100e..bcafb38 100644
--- a/media/base/simd/convert_yuva_to_argb_mmx.inc
+++ b/media/base/simd/convert_yuva_to_argb_mmx.inc
@@ -2,7 +2,9 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
- global mangle(SYMBOL) PRIVATE
+%include "media/base/simd/media_export.asm"
+
+ EXPORT SYMBOL
align function_align
; Non-PIC code is the fastest so use this if possible.
diff --git a/media/base/simd/empty_register_state_mmx.asm b/media/base/simd/empty_register_state_mmx.asm
index 151318e..d0028b5 100644
--- a/media/base/simd/empty_register_state_mmx.asm
+++ b/media/base/simd/empty_register_state_mmx.asm
@@ -2,6 +2,7 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
+%include "media/base/simd/media_export.asm"
%include "third_party/x86inc/x86inc.asm"
;
@@ -14,7 +15,7 @@
CPU MMX
%define SYMBOL EmptyRegisterState_MMX
- global mangle(SYMBOL) PRIVATE
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
diff --git a/media/base/simd/filter_yuv.h b/media/base/simd/filter_yuv.h
index 5a9cf11..a656f89 100644
--- a/media/base/simd/filter_yuv.h
+++ b/media/base/simd/filter_yuv.h
@@ -6,23 +6,30 @@
#define MEDIA_BASE_SIMD_FILTER_YUV_H_
#include "base/basictypes.h"
+#include "media/base/media_export.h"
namespace media {
-typedef void (*FilterYUVRowsProc)(uint8*,
- const uint8*,
- const uint8*,
- int,
- int);
-
-void FilterYUVRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr,
- int source_width, int source_y_fraction);
-
-void FilterYUVRows_MMX(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr,
- int source_width, int source_y_fraction);
-
-void FilterYUVRows_SSE2(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr,
- int source_width, int source_y_fraction);
+// These methods are exported for testing purposes only. Library users should
+// only call the methods listed in yuv_convert.h.
+
+MEDIA_EXPORT void FilterYUVRows_C(uint8* ybuf,
+ const uint8* y0_ptr,
+ const uint8* y1_ptr,
+ int source_width,
+ int source_y_fraction);
+
+MEDIA_EXPORT void FilterYUVRows_MMX(uint8* ybuf,
+ const uint8* y0_ptr,
+ const uint8* y1_ptr,
+ int source_width,
+ int source_y_fraction);
+
+MEDIA_EXPORT void FilterYUVRows_SSE2(uint8* ybuf,
+ const uint8* y0_ptr,
+ const uint8* y1_ptr,
+ int source_width,
+ int source_y_fraction);
} // namespace media
diff --git a/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc b/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc
index 91c06a5..493e9b3 100644
--- a/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc
+++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx.inc
@@ -2,7 +2,9 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
- global mangle(SYMBOL) PRIVATE
+%include "media/base/simd/media_export.asm"
+
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
diff --git a/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm b/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm
index b6e8bb0..f7e1d90 100644
--- a/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm
+++ b/media/base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm
@@ -2,6 +2,7 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
+%include "media/base/simd/media_export.asm"
%include "third_party/x86inc/x86inc.asm"
;
@@ -17,7 +18,7 @@
; ptrdiff_t width,
; ptrdiff_t source_dx);
%define SYMBOL LinearScaleYUVToRGB32Row_MMX_X64
- global mangle(SYMBOL) PRIVATE
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
diff --git a/media/base/simd/media_export.asm b/media/base/simd/media_export.asm
new file mode 100644
index 0000000..e82be8d
--- /dev/null
+++ b/media/base/simd/media_export.asm
@@ -0,0 +1,48 @@
+; Copyright 2013 The Chromium Authors. All rights reserved.
+; Use of this source code is governed by a BSD-style license that can be
+; found in the LICENSE file.
+;
+; A set of helper macros for controlling symbol visibility.
+;
+
+%ifndef MEDIA_BASE_SIMD_MEDIA_EXPORT_ASM_
+%define MEDIA_BASE_SIMD_MEDIA_EXPORT_ASM_
+
+; Necessary for the mangle() macro.
+%include "third_party/x86inc/x86inc.asm"
+
+;
+; PRIVATE
+; A flag representing the specified symbol is a private symbol. This define adds
+; a hidden flag on Linux and a private_extern flag on Mac. (We can use this
+; private_extern flag only on the latest yasm.)
+;
+%ifdef MACHO
+%define PRIVATE :private_extern
+%elifdef ELF
+%define PRIVATE :hidden
+%else
+%define PRIVATE
+%endif
+
+;
+; EXPORT %1
+; Designates a symbol as PRIVATE if EXPORT_SYMBOLS is not set.
+;
+%macro EXPORT 1
+%ifdef EXPORT_SYMBOLS
+global mangle(%1)
+
+; Windows needs an additional export declaration.
+%ifidn __OUTPUT_FORMAT__,win32
+export mangle(%1)
+%elifidn __OUTPUT_FORMAT__,win64
+export mangle(%1)
+%endif
+
+%else
+global mangle(%1) PRIVATE
+%endif
+%endmacro
+
+%endif ; MEDIA_BASE_SIMD_MEDIA_EXPORT_ASM_
diff --git a/media/base/simd/scale_yuv_to_rgb_mmx.inc b/media/base/simd/scale_yuv_to_rgb_mmx.inc
index 94c101c..2026390 100644
--- a/media/base/simd/scale_yuv_to_rgb_mmx.inc
+++ b/media/base/simd/scale_yuv_to_rgb_mmx.inc
@@ -2,7 +2,9 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
- global mangle(SYMBOL) PRIVATE
+%include "media/base/simd/media_export.asm"
+
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
@@ -37,7 +39,7 @@ PROLOGUE 6, 7, 3, Y, U, V, ARGB, R1, R2, TEMP
%ifdef PIC
LOAD_SYM R1q, mangle(kCoefficientsRgbY)
%define WIDTH WORD_SIZE [rsp + gprsize]
-%define TABLE R1q
+%define TABLE R1q
%define Xq R2q
; Non-PIC code.
diff --git a/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm b/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm
index bdb80c1..d678687 100644
--- a/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm
+++ b/media/base/simd/scale_yuv_to_rgb_sse2_x64.asm
@@ -2,6 +2,7 @@
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.
+%include "media/base/simd/media_export.asm"
%include "third_party/x86inc/x86inc.asm"
;
@@ -17,8 +18,7 @@
; ptrdiff_t width,
; ptrdiff_t source_dx);
%define SYMBOL ScaleYUVToRGB32Row_SSE2_X64
-
- global mangle(SYMBOL) PRIVATE
+ EXPORT SYMBOL
align function_align
mangle(SYMBOL):
diff --git a/media/base/simd/yuv_to_rgb_table.cc b/media/base/simd/yuv_to_rgb_table.cc
index 3789969..0073565 100644
--- a/media/base/simd/yuv_to_rgb_table.cc
+++ b/media/base/simd/yuv_to_rgb_table.cc
@@ -43,7 +43,7 @@ extern "C" {
// These tables are aligned and kept adjacent to optimize for
// SIMD and cacheing.
-SIMD_ALIGNED(int16 kCoefficientsRgbY[256 * 4][4]) = {
+SIMD_ALIGNED(const int16 kCoefficientsRgbY[256 * 4][4]) = {
RGBY(0x00), RGBY(0x01), RGBY(0x02), RGBY(0x03),
RGBY(0x04), RGBY(0x05), RGBY(0x06), RGBY(0x07),
RGBY(0x08), RGBY(0x09), RGBY(0x0A), RGBY(0x0B),
diff --git a/media/base/simd/yuv_to_rgb_table.h b/media/base/simd/yuv_to_rgb_table.h
index 3ed7bd9..aebf1b20 100644
--- a/media/base/simd/yuv_to_rgb_table.h
+++ b/media/base/simd/yuv_to_rgb_table.h
@@ -19,7 +19,7 @@ extern "C" {
#endif
// Align the table to 16-bytes to allow faster reading.
-extern SIMD_ALIGNED(int16 kCoefficientsRgbY[256 * 4][4]);
+extern SIMD_ALIGNED(const int16 kCoefficientsRgbY[256 * 4][4]);
} // extern "C"
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc
index 1d09a24..2183b1f 100644
--- a/media/base/yuv_convert.cc
+++ b/media/base/yuv_convert.cc
@@ -40,6 +40,52 @@ void EmptyRegisterState_MMX();
namespace media {
+typedef void (*FilterYUVRowsProc)(uint8*, const uint8*, const uint8*, int, int);
+
+typedef void (*ConvertYUVToRGB32Proc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ int,
+ int,
+ int,
+ int,
+ int,
+ YUVType);
+
+typedef void (*ConvertYUVAToARGBProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ YUVType);
+
+typedef void (*ConvertYUVToRGB32RowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t);
+
+typedef void (*ConvertYUVAToARGBRowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t);
+
+typedef void (*ScaleYUVToRGB32RowProc)(const uint8*,
+ const uint8*,
+ const uint8*,
+ uint8*,
+ ptrdiff_t,
+ ptrdiff_t);
+
static FilterYUVRowsProc ChooseFilterYUVRowsProc() {
#if defined(ARCH_CPU_X86_FAMILY)
base::CPU cpu;
@@ -66,32 +112,42 @@ static ConvertYUVToRGB32RowProc ChooseConvertYUVToRGB32RowProc() {
}
static ScaleYUVToRGB32RowProc ChooseScaleYUVToRGB32RowProc() {
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
#if defined(ARCH_CPU_X86_64)
// Use 64-bits version if possible.
- return &ScaleYUVToRGB32Row_SSE2_X64;
-#elif defined(ARCH_CPU_X86_FAMILY)
- base::CPU cpu;
+ // TODO(dalecurtis): Fix this to directly return X64 version. All x64 procs
+ // have SSE2, this is a hack to prevent MSVC from optimizing exports out in
+ // the shared library build which are used by unittests.
+ if (cpu.has_sse2())
+ return &ScaleYUVToRGB32Row_SSE2_X64;
+#endif // defined(ARCH_CPU_X86_64)
// Choose the best one on 32-bits system.
if (cpu.has_sse())
return &ScaleYUVToRGB32Row_SSE;
if (cpu.has_mmx())
return &ScaleYUVToRGB32Row_MMX;
-#endif // defined(ARCH_CPU_X86_64)
+#endif // defined(ARCH_CPU_X86_FAMILY)
return &ScaleYUVToRGB32Row_C;
}
static ScaleYUVToRGB32RowProc ChooseLinearScaleYUVToRGB32RowProc() {
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
#if defined(ARCH_CPU_X86_64)
// Use 64-bits version if possible.
- return &LinearScaleYUVToRGB32Row_MMX_X64;
-#elif defined(ARCH_CPU_X86_FAMILY)
- base::CPU cpu;
+ // TODO(dalecurtis): Fix this to directly return X64 version. All x64 procs
+ // have SSE2, this is a hack to prevent MSVC from optimizing exports out in
+ // the shared library build which are used by unittests.
+ if (cpu.has_sse2())
+ return &LinearScaleYUVToRGB32Row_MMX_X64;
+#endif // defined(ARCH_CPU_X86_64)
// 32-bits system.
if (cpu.has_sse())
return &LinearScaleYUVToRGB32Row_SSE;
if (cpu.has_mmx())
return &LinearScaleYUVToRGB32Row_MMX;
-#endif // defined(ARCH_CPU_X86_64)
+#endif // defined(ARCH_CPU_X86_FAMILY)
return &LinearScaleYUVToRGB32Row_C;
}
diff --git a/media/base/yuv_convert.h b/media/base/yuv_convert.h
index 0e53193..29c7aa3 100644
--- a/media/base/yuv_convert.h
+++ b/media/base/yuv_convert.h
@@ -6,6 +6,7 @@
#define MEDIA_BASE_YUV_CONVERT_H_
#include "base/basictypes.h"
+#include "media/base/media_export.h"
// Visual Studio 2010 does not support MMX intrinsics on x64.
// Some win64 yuv_convert code paths use SSE+MMX yasm, so without rewriting
@@ -22,8 +23,8 @@ namespace media {
// Type of YUV surface.
// The value of these enums matter as they are used to shift vertical indices.
enum YUVType {
- YV16 = 0, // YV16 is half width and full height chroma channels.
- YV12 = 1, // YV12 is half width and half height chroma channels.
+ YV16 = 0, // YV16 is half width and full height chroma channels.
+ YV12 = 1, // YV12 is half width and half height chroma channels.
};
// Mirror means flip the image horizontally, as in looking in a mirror.
@@ -49,104 +50,104 @@ enum ScaleFilter {
// Convert a frame of YUV to 32 bit ARGB.
// Pass in YV16/YV12 depending on source format
-void ConvertYUVToRGB32(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int rgbstride,
- YUVType yuv_type);
+MEDIA_EXPORT void ConvertYUVToRGB32(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int rgbstride,
+ YUVType yuv_type);
// Convert a frame of YUVA to 32 bit ARGB.
// Pass in YV12A
-void ConvertYUVAToARGB(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- const uint8* aplane,
- uint8* rgbframe,
- int width,
- int height,
- int ystride,
- int uvstride,
- int astride,
- int rgbstride,
- YUVType yuv_type);
+MEDIA_EXPORT void ConvertYUVAToARGB(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ const uint8* aplane,
+ uint8* rgbframe,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int astride,
+ int rgbstride,
+ YUVType yuv_type);
// Scale a frame of YUV to 32 bit ARGB.
// Supports rotation and mirroring.
-void ScaleYUVToRGB32(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int source_width,
- int source_height,
- int width,
- int height,
- int ystride,
- int uvstride,
- int rgbstride,
- YUVType yuv_type,
- Rotate view_rotate,
- ScaleFilter filter);
+MEDIA_EXPORT void ScaleYUVToRGB32(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int source_width,
+ int source_height,
+ int width,
+ int height,
+ int ystride,
+ int uvstride,
+ int rgbstride,
+ YUVType yuv_type,
+ Rotate view_rotate,
+ ScaleFilter filter);
// Biliner Scale a frame of YV12 to 32 bits ARGB on a specified rectangle.
// |yplane|, etc and |rgbframe| should point to the top-left pixels of the
// source and destination buffers.
-void ScaleYUVToRGB32WithRect(const uint8* yplane,
- const uint8* uplane,
- const uint8* vplane,
- uint8* rgbframe,
- int source_width,
- int source_height,
- int dest_width,
- int dest_height,
- int dest_rect_left,
- int dest_rect_top,
- int dest_rect_right,
- int dest_rect_bottom,
- int ystride,
- int uvstride,
- int rgbstride);
-
-void ConvertRGB32ToYUV(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
-
-void ConvertRGB24ToYUV(const uint8* rgbframe,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height,
- int rgbstride,
- int ystride,
- int uvstride);
-
-void ConvertYUY2ToYUV(const uint8* src,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height);
-
-void ConvertNV21ToYUV(const uint8* src,
- uint8* yplane,
- uint8* uplane,
- uint8* vplane,
- int width,
- int height);
+MEDIA_EXPORT void ScaleYUVToRGB32WithRect(const uint8* yplane,
+ const uint8* uplane,
+ const uint8* vplane,
+ uint8* rgbframe,
+ int source_width,
+ int source_height,
+ int dest_width,
+ int dest_height,
+ int dest_rect_left,
+ int dest_rect_top,
+ int dest_rect_right,
+ int dest_rect_bottom,
+ int ystride,
+ int uvstride,
+ int rgbstride);
+
+MEDIA_EXPORT void ConvertRGB32ToYUV(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
+
+MEDIA_EXPORT void ConvertRGB24ToYUV(const uint8* rgbframe,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height,
+ int rgbstride,
+ int ystride,
+ int uvstride);
+
+MEDIA_EXPORT void ConvertYUY2ToYUV(const uint8* src,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height);
+
+MEDIA_EXPORT void ConvertNV21ToYUV(const uint8* src,
+ uint8* yplane,
+ uint8* uplane,
+ uint8* vplane,
+ int width,
+ int height);
// Empty SIMD register state after calling optimized scaler functions.
-void EmptyRegisterState();
+MEDIA_EXPORT void EmptyRegisterState();
} // namespace media
diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc
index 1fbceb9..1ac2a2d 100644
--- a/media/base/yuv_convert_unittest.cc
+++ b/media/base/yuv_convert_unittest.cc
@@ -76,6 +76,8 @@ static void ReadYUY2Data(scoped_ptr<uint8[]>* data) {
ReadData(FILE_PATH_LITERAL("bali_640x360_YUY2.yuv"), kYUY2Size, data);
}
+namespace media {
+
TEST(YUVConvertTest, YV12) {
// Allocate all surfaces.
scoped_ptr<uint8[]> yuv_bytes;
@@ -939,3 +941,5 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) {
#endif // defined(ARCH_CPU_X86_64)
#endif // defined(ARCH_CPU_X86_FAMILY)
+
+} // namespace media
diff --git a/media/media.gyp b/media/media.gyp
index bb2ab75..cf1e7f3 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -12,12 +12,12 @@
# detection of ABI mismatches and prevents silent errors.
'linux_link_pulseaudio%': 0,
'conditions': [
- ['OS == "android" or OS == "ios"', {
+ ['OS=="android" or OS=="ios"', {
# Android and iOS don't use ffmpeg.
'media_use_ffmpeg%': 0,
# Android and iOS don't use libvpx.
'media_use_libvpx%': 0,
- }, { # 'OS != "android" and OS != "ios"'
+ }, { # 'OS!="android" and OS!="ios"'
'media_use_ffmpeg%': 1,
'media_use_libvpx%': 1,
}],
@@ -33,7 +33,7 @@
}, {
'use_alsa%': 0,
}],
- ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and chromeos != 1', {
+ ['os_posix==1 and OS!="mac" and OS!="ios" and OS!="android" and chromeos!=1', {
'use_pulseaudio%': 1,
}, {
'use_pulseaudio%': 0,
@@ -282,6 +282,14 @@
'base/seekable_buffer.h',
'base/serial_runner.cc',
'base/serial_runner.h',
+ 'base/simd/convert_rgb_to_yuv.h',
+ 'base/simd/convert_rgb_to_yuv_c.cc',
+ 'base/simd/convert_yuv_to_rgb.h',
+ 'base/simd/convert_yuv_to_rgb_c.cc',
+ 'base/simd/filter_yuv.h',
+ 'base/simd/filter_yuv_c.cc',
+ 'base/simd/yuv_to_rgb_table.cc',
+ 'base/simd/yuv_to_rgb_table.h',
'base/sinc_resampler.cc',
'base/sinc_resampler.h',
'base/stream_parser.cc',
@@ -299,6 +307,8 @@
'base/video_renderer.h',
'base/video_util.cc',
'base/video_util.h',
+ 'base/yuv_convert.cc',
+ 'base/yuv_convert.h',
'crypto/aes_decryptor.cc',
'crypto/aes_decryptor.h',
'ffmpeg/ffmpeg_common.cc',
@@ -454,28 +464,27 @@
],
},
'conditions': [
- ['arm_neon == 1', {
+ ['arm_neon==1', {
'defines': [
'USE_NEON'
],
}],
- ['OS != "linux" or use_x11 == 1', {
+ ['OS!="linux" or use_x11==1', {
'sources!': [
'video/capture/screen/screen_capturer_null.cc',
]
}],
- ['OS != "ios"', {
+ ['OS!="ios"', {
'dependencies': [
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'shared_memory_support',
- 'yuv_convert',
],
}],
- ['media_use_ffmpeg == 1', {
+ ['media_use_ffmpeg==1', {
'dependencies': [
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
- }, { # media_use_ffmpeg == 0
+ }, { # media_use_ffmpeg==0
# Exclude the sources that depend on ffmpeg.
'sources!': [
'base/media_posix.cc',
@@ -497,11 +506,11 @@
'filters/ffmpeg_video_decoder.h',
],
}],
- ['media_use_libvpx == 1', {
+ ['media_use_libvpx==1', {
'dependencies': [
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
- }, { # media_use_libvpx == 0
+ }, { # media_use_libvpx==0
'direct_dependent_settings': {
'defines': [
'MEDIA_DISABLE_LIBVPX',
@@ -513,7 +522,7 @@
'filters/vpx_video_decoder.h',
],
}],
- ['OS == "ios"', {
+ ['OS=="ios"', {
'includes': [
# For shared_memory_support_sources variable.
'shared_memory_support.gypi',
@@ -555,7 +564,7 @@
],
},
}],
- ['OS == "android"', {
+ ['OS=="android"', {
'link_settings': {
'libraries': [
'-lOpenSLES',
@@ -574,7 +583,7 @@
'base/media.h',
],
'conditions': [
- ['android_webview_build == 0', {
+ ['android_webview_build==0', {
'dependencies': [
'media_java',
],
@@ -615,8 +624,8 @@
],
},
}, { # use_alsa==0
- 'sources/': [ ['exclude', '/alsa_' ],
- ['exclude', '/audio_manager_linux' ] ],
+ 'sources/': [ ['exclude', '/alsa_'],
+ ['exclude', '/audio_manager_linux'] ],
}],
['OS!="openbsd"', {
'sources!': [
@@ -635,7 +644,7 @@
],
},
'conditions': [
- ['use_x11 == 1', {
+ ['use_x11==1', {
'link_settings': {
'libraries': [
'-lX11',
@@ -645,7 +654,7 @@
],
},
}],
- ['use_cras == 1', {
+ ['use_cras==1', {
'cflags': [
'<!@(<(pkg-config) --cflags libcras)',
],
@@ -657,7 +666,7 @@
'defines': [
'USE_CRAS',
],
- }, { # else: use_cras == 0
+ }, { # else: use_cras==0
'sources!': [
'audio/cras/audio_manager_cras.cc',
'audio/cras/audio_manager_cras.h',
@@ -732,7 +741,7 @@
],
'conditions': [
# Linux/Solaris need libdl for dlopen() and friends.
- ['OS == "linux" or OS == "solaris"', {
+ ['OS=="linux" or OS=="solaris"', {
'link_settings': {
'libraries': [
'-ldl',
@@ -765,7 +774,7 @@
'audio/pulse/pulse_util.h',
],
}],
- ['os_posix == 1', {
+ ['os_posix==1', {
'sources!': [
'video/capture/video_capture_device_dummy.cc',
'video/capture/video_capture_device_dummy.h',
@@ -821,7 +830,7 @@
# TODO(wolenetz): Fix size_t to int truncations in win64. See
# http://crbug.com/171009
'conditions': [
- ['target_arch == "x64"', {
+ ['target_arch=="x64"', {
'msvs_disabled_warnings': [ 4267, ],
}],
],
@@ -848,7 +857,7 @@
'mp4/track_run_iterator.h',
],
}],
- [ 'screen_capture_supported==1', {
+ ['screen_capture_supported==1', {
'dependencies': [
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
],
@@ -857,30 +866,31 @@
['exclude', '^video/capture/screen/'],
],
}],
- [ 'screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {
- 'dependencies': [
- 'differ_block_sse2',
- ],
- }],
['toolkit_uses_gtk==1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
],
}],
# ios check is necessary due to http://crbug.com/172682.
- ['OS != "ios" and (target_arch == "ia32" or target_arch == "x64")', {
+ ['OS!="ios" and (target_arch=="ia32" or target_arch=="x64")', {
'dependencies': [
+ 'media_asm',
+ 'media_mmx',
'media_sse',
+ 'media_sse2',
+ ],
+ 'sources': [
+ 'base/simd/convert_yuv_to_rgb_x86.cc',
],
}],
- ['google_tv == 1', {
+ ['google_tv==1', {
'defines': [
'ENABLE_EAC3_PLAYBACK',
],
}],
],
'target_conditions': [
- ['OS == "ios"', {
+ ['OS=="ios"', {
'sources/': [
# Pull in specific Mac files for iOS (which have been filtered out
# by file name rules).
@@ -1009,18 +1019,17 @@
'webm/webm_webvtt_parser_unittest.cc',
],
'conditions': [
- ['arm_neon == 1', {
+ ['arm_neon==1', {
'defines': [
'USE_NEON'
],
}],
- ['OS != "ios"', {
+ ['OS!="ios"', {
'dependencies': [
'shared_memory_support',
- 'yuv_convert',
],
}],
- ['media_use_ffmpeg == 1', {
+ ['media_use_ffmpeg==1', {
'dependencies': [
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
@@ -1034,7 +1043,7 @@
}],
],
}],
- ['OS == "ios"', {
+ ['OS=="ios"', {
'sources/': [
['exclude', '.*'],
['include', '^audio/audio_input_controller_unittest\\.cc$'],
@@ -1065,7 +1074,7 @@
'webm/webm_cluster_parser_unittest.cc',
],
'conditions': [
- ['gtest_target_type == "shared_library"', {
+ ['gtest_target_type=="shared_library"', {
'dependencies': [
'../testing/android/native_test.gyp:native_test_native_code',
'player_android',
@@ -1073,9 +1082,9 @@
}],
],
}],
- ['OS == "linux"', {
+ ['OS=="linux"', {
'conditions': [
- ['use_cras == 1', {
+ ['use_cras==1', {
'sources': [
'audio/cras/cras_input_unittest.cc',
'audio/cras/cras_unified_unittest.cc',
@@ -1092,13 +1101,10 @@
'audio/audio_low_latency_input_output_unittest.cc',
],
}],
- ['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {
+ ['OS!="ios" and (target_arch=="ia32" or target_arch=="x64")', {
'sources': [
'base/simd/convert_rgb_to_yuv_unittest.cc',
],
- 'dependencies': [
- 'media_sse',
- ],
}],
['screen_capture_supported==1', {
'dependencies': [
@@ -1159,7 +1165,7 @@
'video/capture/screen/screen_capturer_mock_objects.h',
],
'conditions': [
- [ 'screen_capture_supported == 1', {
+ ['screen_capture_supported==1', {
'dependencies': [
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
],
@@ -1172,75 +1178,39 @@
},
],
'conditions': [
- ['OS != "ios" and target_arch != "arm"', {
+ ['OS!="ios" and target_arch!="arm"', {
'targets': [
- {
- 'target_name': 'yuv_convert_simd_x86',
+ {
+ 'target_name': 'media_asm',
'type': 'static_library',
- 'include_dirs': [
- '..',
- ],
'sources': [
- 'base/simd/convert_rgb_to_yuv_c.cc',
- 'base/simd/convert_rgb_to_yuv_sse2.cc',
'base/simd/convert_rgb_to_yuv_ssse3.asm',
- 'base/simd/convert_rgb_to_yuv_ssse3.cc',
- 'base/simd/convert_rgb_to_yuv_ssse3.inc',
- 'base/simd/convert_yuv_to_rgb_c.cc',
'base/simd/convert_yuv_to_rgb_mmx.asm',
- 'base/simd/convert_yuv_to_rgb_mmx.inc',
'base/simd/convert_yuv_to_rgb_sse.asm',
- 'base/simd/convert_yuv_to_rgb_x86.cc',
'base/simd/convert_yuva_to_argb_mmx.asm',
- 'base/simd/convert_yuva_to_argb_mmx.inc',
'base/simd/empty_register_state_mmx.asm',
- 'base/simd/filter_yuv.h',
- 'base/simd/filter_yuv_c.cc',
- 'base/simd/filter_yuv_sse2.cc',
'base/simd/linear_scale_yuv_to_rgb_mmx.asm',
- 'base/simd/linear_scale_yuv_to_rgb_mmx.inc',
'base/simd/linear_scale_yuv_to_rgb_sse.asm',
'base/simd/scale_yuv_to_rgb_mmx.asm',
- 'base/simd/scale_yuv_to_rgb_mmx.inc',
'base/simd/scale_yuv_to_rgb_sse.asm',
- 'base/simd/yuv_to_rgb_table.cc',
- 'base/simd/yuv_to_rgb_table.h',
],
'conditions': [
- # TODO(jschuh): Get MMX enabled on Win64. crbug.com/179657
- [ 'OS!="win" or target_arch=="ia32"', {
- 'sources': [
- 'base/simd/filter_yuv_mmx.cc',
- ],
+ ['component=="shared_library"', {
+ 'variables': {
+ 'yasm_flags': ['-DEXPORT_SYMBOLS'],
+ },
}],
- [ 'target_arch == "x64"', {
+ ['target_arch=="x64"', {
# Source files optimized for X64 systems.
'sources': [
'base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm',
'base/simd/scale_yuv_to_rgb_sse2_x64.asm',
],
'variables': {
- 'yasm_flags': [
- '-DARCH_X86_64',
- ],
+ 'yasm_flags': ['-DARCH_X86_64'],
},
}],
- [ 'os_posix == 1 and OS != "mac" and OS != "android"', {
- 'cflags': [
- '-msse2',
- ],
- }],
- [ 'OS == "mac"', {
- 'configurations': {
- 'Debug': {
- 'xcode_settings': {
- # gcc on the mac builds horribly unoptimized sse code in
- # debug mode. Since this is rarely going to be debugged,
- # run with full optimizations in Debug as well as Release.
- 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
- },
- },
- },
+ ['OS=="mac"', {
'variables': {
'yasm_flags': [
'-DPREFIX',
@@ -1248,10 +1218,10 @@
],
},
}],
- [ 'os_posix==1 and OS!="mac"', {
+ ['os_posix==1 and OS!="mac"', {
'variables': {
'conditions': [
- [ 'target_arch=="ia32"', {
+ ['target_arch=="ia32"', {
'yasm_flags': [
'-DX86_32',
'-DELF',
@@ -1274,15 +1244,97 @@
# search path be relative to src/ per Chromium policy.
'-I..',
],
+ 'yasm_includes': [
+ '../third_party/x86inc/x86inc.asm',
+ 'base/simd/convert_rgb_to_yuv_ssse3.inc',
+ 'base/simd/convert_yuv_to_rgb_mmx.inc',
+ 'base/simd/convert_yuva_to_argb_mmx.inc',
+ 'base/simd/linear_scale_yuv_to_rgb_mmx.inc',
+ 'base/simd/media_export.asm',
+ 'base/simd/scale_yuv_to_rgb_mmx.inc',
+ ],
},
'msvs_2010_disable_uldi_when_referenced': 1,
'includes': [
'../third_party/yasm/yasm_compile.gypi',
],
},
+ {
+ 'target_name': 'media_mmx',
+ 'type': 'static_library',
+ 'cflags': [
+ '-mmmx',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'defines': [
+ 'MEDIA_IMPLEMENTATION',
+ ],
+ 'conditions': [
+ # TODO(jschuh): Get MMX enabled on Win64. crbug.com/179657
+ ['OS!="win" or target_arch=="ia32"', {
+ 'sources': [
+ 'base/simd/filter_yuv_mmx.cc',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'media_sse',
+ 'type': 'static_library',
+ 'cflags': [
+ '-msse',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'defines': [
+ 'MEDIA_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'base/simd/sinc_resampler_sse.cc',
+ ],
+ },
+ {
+ 'target_name': 'media_sse2',
+ 'type': 'static_library',
+ 'cflags': [
+ '-msse2',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'defines': [
+ 'MEDIA_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'base/simd/convert_rgb_to_yuv_sse2.cc',
+ 'base/simd/convert_rgb_to_yuv_ssse3.cc',
+ 'base/simd/filter_yuv_sse2.cc',
+ 'video/capture/screen/differ_block_sse2.cc',
+ 'video/capture/screen/differ_block_sse2.h',
+ ],
+ },
+ {
+ 'target_name': 'shared_memory_support_sse',
+ 'type': 'static_library',
+ 'cflags': [
+ '-msse',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'defines': [
+ 'MEDIA_IMPLEMENTATION',
+ ],
+ 'sources': [
+ 'base/simd/vector_math_sse.cc',
+ ],
+ },
], # targets
}],
- ['OS != "ios"', {
+ ['OS!="ios"', {
'targets': [
{
# Minimal target for NaCl and other renderer side media clients which
@@ -1306,57 +1358,17 @@
'<@(shared_memory_support_sources)',
],
'conditions': [
- [ 'target_arch == "ia32" or target_arch == "x64"', {
- 'dependencies': [
- 'media_sse',
- ],
- }],
- ['arm_neon == 1', {
+ ['arm_neon==1', {
'defines': [
'USE_NEON'
],
}],
- ],
- },
- {
- 'target_name': 'yuv_convert',
- 'type': 'static_library',
- 'include_dirs': [
- '..',
- ],
- 'conditions': [
- [ 'target_arch == "ia32" or target_arch == "x64"', {
- 'dependencies': [
- 'yuv_convert_simd_x86',
- ],
- }],
- [ 'target_arch == "arm" or target_arch == "mipsel"', {
+ ['target_arch=="ia32" or target_arch=="x64"', {
'dependencies': [
- 'yuv_convert_simd_c',
+ 'shared_memory_support_sse'
],
}],
],
- 'sources': [
- 'base/yuv_convert.cc',
- 'base/yuv_convert.h',
- ],
- },
- {
- 'target_name': 'yuv_convert_simd_c',
- 'type': 'static_library',
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- 'base/simd/convert_rgb_to_yuv.h',
- 'base/simd/convert_rgb_to_yuv_c.cc',
- 'base/simd/convert_yuv_to_rgb.h',
- 'base/simd/convert_yuv_to_rgb_c.cc',
- 'base/simd/filter_yuv.h',
- 'base/simd/filter_yuv_c.cc',
- 'base/simd/yuv_to_rgb_table.cc',
- 'base/simd/yuv_to_rgb_table.h',
- ],
},
{
'target_name': 'seek_tester',
@@ -1384,14 +1396,13 @@
},
],
}],
- ['(OS == "win" or toolkit_uses_gtk == 1) and use_aura != 1', {
+ ['(OS=="win" or toolkit_uses_gtk==1) and use_aura!=1', {
'targets': [
{
'target_name': 'shader_bench',
'type': 'executable',
'dependencies': [
'media',
- 'yuv_convert',
'../base/base.gyp:base',
'../ui/gl/gl.gyp:gl',
'../ui/ui.gyp:ui',
@@ -1410,7 +1421,7 @@
'tools/shader_bench/window.h',
],
'conditions': [
- ['toolkit_uses_gtk == 1', {
+ ['toolkit_uses_gtk==1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
],
@@ -1439,14 +1450,13 @@
},
],
}],
- ['use_x11 == 1', {
+ ['use_x11==1', {
'targets': [
{
'target_name': 'player_x11',
'type': 'executable',
'dependencies': [
'media',
- 'yuv_convert',
'../base/base.gyp:base',
'../ui/gl/gl.gyp:gl',
'../ui/ui.gyp:ui',
@@ -1473,7 +1483,7 @@
}],
# Special target to wrap a gtest_target_type==shared_library
# media_unittests into an android apk for execution.
- ['OS == "android" and gtest_target_type == "shared_library"', {
+ ['OS=="android" and gtest_target_type=="shared_library"', {
'targets': [
{
'target_name': 'media_unittests_apk',
@@ -1486,11 +1496,11 @@
'test_suite_name': 'media_unittests',
'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)media_unittests<(SHARED_LIB_SUFFIX)',
},
- 'includes': [ '../build/apk_test.gypi' ],
+ 'includes': ['../build/apk_test.gypi'],
},
],
}],
- ['OS == "android"', {
+ ['OS=="android"', {
'targets': [
{
'target_name': 'media_player_jni_headers',
@@ -1499,7 +1509,7 @@
'jni_gen_package': 'media',
'input_java_class': 'android/media/MediaPlayer.class',
},
- 'includes': [ '../build/jar_file_jni_generator.gypi' ],
+ 'includes': ['../build/jar_file_jni_generator.gypi'],
},
{
'target_name': 'media_android_jni_headers',
@@ -1517,7 +1527,7 @@
'variables': {
'jni_gen_package': 'media',
},
- 'includes': [ '../build/jni_generator.gypi' ],
+ 'includes': ['../build/jni_generator.gypi'],
},
{
'target_name': 'video_capture_android_jni_headers',
@@ -1528,7 +1538,7 @@
'variables': {
'jni_gen_package': 'media',
},
- 'includes': [ '../build/jni_generator.gypi' ],
+ 'includes': ['../build/jni_generator.gypi'],
},
{
'target_name': 'media_format_jni_headers',
@@ -1537,7 +1547,7 @@
'jni_gen_package': 'media',
'input_java_class': 'android/media/MediaFormat.class',
},
- 'includes': [ '../build/jar_file_jni_generator.gypi' ],
+ 'includes': ['../build/jar_file_jni_generator.gypi'],
},
{
'target_name': 'player_android',
@@ -1580,12 +1590,12 @@
'variables': {
'java_in_dir': 'base/android/java',
},
- 'includes': [ '../build/java.gypi' ],
+ 'includes': ['../build/java.gypi'],
},
],
}],
- ['media_use_ffmpeg == 1', {
+ ['media_use_ffmpeg==1', {
'targets': [
{
'target_name': 'ffmpeg_unittests',
@@ -1604,7 +1614,7 @@
'ffmpeg/ffmpeg_unittest.cc',
],
'conditions': [
- ['toolkit_uses_gtk == 1', {
+ ['toolkit_uses_gtk==1', {
'dependencies': [
# Needed for the following #include chain:
# base/run_all_unittests.cc
@@ -1681,49 +1691,5 @@
},
],
}],
- [ 'screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {
- 'targets': [
- {
- 'target_name': 'differ_block_sse2',
- 'type': 'static_library',
- 'conditions': [
- [ 'os_posix == 1 and OS != "mac"', {
- 'cflags': [
- '-msse2',
- ],
- }],
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- 'video/capture/screen/differ_block_sse2.cc',
- 'video/capture/screen/differ_block_sse2.h',
- ],
- }, # end of target differ_block_sse2
- ],
- }],
- # ios check is necessary due to http://crbug.com/172682.
- ['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {
- 'targets': [
- {
- 'target_name': 'media_sse',
- 'type': 'static_library',
- 'cflags': [
- '-msse',
- ],
- 'include_dirs': [
- '..',
- ],
- 'defines': [
- 'MEDIA_IMPLEMENTATION',
- ],
- 'sources': [
- 'base/simd/sinc_resampler_sse.cc',
- 'base/simd/vector_math_sse.cc',
- ],
- }, # end of target media_sse
- ],
- }],
],
}
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index b883868..31c6be8 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -2261,7 +2261,6 @@
'../third_party/speex/speex.gyp:libspeex',
'../media/media.gyp:media',
'../media/media.gyp:shared_memory_support',
- '../media/media.gyp:yuv_convert',
'remoting_jingle_glue',
'remoting_resources',
'proto/chromotocol.gyp:chromotocol_proto_lib',
diff --git a/third_party/x86inc/x86inc.asm b/third_party/x86inc/x86inc.asm
index fe7f3d2..7c57f8f 100644
--- a/third_party/x86inc/x86inc.asm
+++ b/third_party/x86inc/x86inc.asm
@@ -33,8 +33,8 @@
; as this feature might be useful for others as well. Send patches or ideas
; to x264-devel@videolan.org .
-%ifndef MEDIA_BASE_SIMD_X86INC_ASM_
-%define MEDIA_BASE_SIMD_X86INC_ASM_
+%ifndef THIRD_PARTY_X86INC_X86INC_ASM_
+%define THIRD_PARTY_X86INC_X86INC_ASM_
; TODO(wolenetz): Consider either updating this customized version to base from
; a more recent original, or switching to using third_party/ffmpeg's version of
@@ -999,20 +999,6 @@ AVX_INSTR pfmul, 1, 0
%endif
%endmacro
-;
-; PRIVATE
-; A flag representing the specified symbol is a private symbol. This define adds
-; a hidden flag on Linux and a private_extern flag on Mac. (We can use this
-; private_extern flag only on the latest yasm.)
-;
-%ifdef MACHO
-%define PRIVATE :private_extern
-%elifdef ELF
-%define PRIVATE :hidden
-%else
-%define PRIVATE
-%endif
-
%endif ; CHROMIUM
-%endif ; MEDIA_BASE_SIMD_X86INC_ASM_
+%endif ; THIRD_PARTY_X86INC_X86INC_ASM_
diff --git a/third_party/yasm/yasm_compile.gypi b/third_party/yasm/yasm_compile.gypi
index 0d9263ffd..58a0dfb 100644
--- a/third_party/yasm/yasm_compile.gypi
+++ b/third_party/yasm/yasm_compile.gypi
@@ -6,9 +6,11 @@
#
# Files to be compiled with YASM should have an extension of .asm.
#
-# There are two variables for this include:
+# There are three variables for this include:
# yasm_flags : Pass additional flags into YASM.
# yasm_output_path : Output directory for the compiled object files.
+# yasm_includes : Includes used by .asm code. Changes to which should force
+# recompilation.
#
# Sample usage:
# 'sources': [
@@ -19,6 +21,7 @@
# '-I', 'assembly_include',
# ],
# 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project',
+# 'yasm_includes': ['ultra_optimized_awesome.inc']
# },
# 'includes': [
# 'third_party/yasm/yasm_compile.gypi'
@@ -27,6 +30,7 @@
{
'variables': {
'yasm_flags': [],
+ 'yasm_includes': [],
'conditions': [
[ 'use_system_yasm==0', {
@@ -98,7 +102,7 @@
{
'rule_name': 'assemble',
'extension': 'asm',
- 'inputs': [ '<(yasm_path)', ],
+ 'inputs': [ '<(yasm_path)', '<@(yasm_includes)'],
'outputs': [
'<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)',
],
diff --git a/ui/surface/surface.gyp b/ui/surface/surface.gyp
index 25945c0..2c7ba5e 100644
--- a/ui/surface/surface.gyp
+++ b/ui/surface/surface.gyp
@@ -99,7 +99,7 @@
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:run_all_unittests',
- '<(DEPTH)/media/media.gyp:yuv_convert',
+ '<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/ui/ui.gyp:ui',
diff --git a/webkit/media/webkit_media.gypi b/webkit/media/webkit_media.gypi
index 64342c1..448bec2 100644
--- a/webkit/media/webkit_media.gypi
+++ b/webkit/media/webkit_media.gypi
@@ -32,7 +32,6 @@
'<(DEPTH)/cc/cc.gyp:cc',
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/media/media.gyp:shared_memory_support',
- '<(DEPTH)/media/media.gyp:yuv_convert',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit',
'<(DEPTH)/third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',