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

Unified Diff: source/row_common.cc

Issue 2277603004: Add SplitUVPlanes and MergeUVPlanes (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« source/planar_functions.cc ('K') | « source/planar_functions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/row_common.cc
diff --git a/source/row_common.cc b/source/row_common.cc
index 229da97527c440b5786f4560828e033aa90c3a6f..b5e42b3aec26b028eb10ff0bf52d0f3cd71e0dd1 100644
--- a/source/row_common.cc
+++ b/source/row_common.cc
@@ -13,6 +13,7 @@
#include <string.h> // For memcpy and memset.
#include "libyuv/basic_types.h"
+#include "libyuv/cpu_id.h"
#ifdef __cplusplus
namespace libyuv {
@@ -1800,6 +1801,37 @@ void SplitUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
}
}
+SplitUVRowFunction GetOptimizedSplitUVRowFunction(
fbarchard1 2016/08/24 23:04:11 these are not row functions... should remove or if
fbarchard1 2016/08/24 23:11:50 Done.
+ const uint8 *src_uv, int src_stride_uv,
+ const uint8 *dst_u, int dst_stride_u,
+ const uint8 *dst_v, int dst_stride_v,
+ int width) {
+#if defined(HAS_SPLITUVROW_DSPR2)
+ if (TestCpuFlag(kCpuHasDSPR2) &&
+ IS_ALIGNED(src_uv, 4) && IS_ALIGNED(src_stride_uv, 4) &&
+ IS_ALIGNED(dst_u, 4) && IS_ALIGNED(dst_stride_u, 4) &&
+ IS_ALIGNED(dst_v, 4) && IS_ALIGNED(dst_stride_v, 4)) {
+ return IS_ALIGNED(width, 16) ? SplitUVRow_DSPR2 : SplitUVRow_Any_DSPR2;
+ }
+#endif
+#if defined(HAS_SPLITUVROW_NEON)
+ if (TestCpuFlag(kCpuHasNEON)) {
+ return IS_ALIGNED(width, 16) ? SplitUVRow_NEON : SplitUVRow_Any_NEON;
+ }
+#endif
+#if defined(HAS_SPLITUVROW_AVX2)
+ if (TestCpuFlag(kCpuHasAVX2)) {
+ return IS_ALIGNED(width, 32) ? SplitUVRow_AVX2 : SplitUVRow_Any_AVX2;
+ }
+#endif
+#if defined(HAS_SPLITUVROW_SSE2)
+ if (TestCpuFlag(kCpuHasSSE2)) {
+ return IS_ALIGNED(width, 16) ? SplitUVRow_SSE2 : SplitUVRow_Any_SSE2;
+ }
+#endif
+ return SplitUVRow_C;
+}
+
void MergeUVRow_C(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
int width) {
int x;
@@ -1816,6 +1848,25 @@ void MergeUVRow_C(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
}
}
+MergeUVRowFunction GetOptimizedMergeUVRowFunction(int width) {
+#if defined(HAS_MERGEUVROW_NEON)
+ if (TestCpuFlag(kCpuHasNEON)) {
+ return IS_ALIGNED(width, 16) ? MergeUVRow_NEON : MergeUVRow_Any_NEON;
+ }
+#endif
+#if defined(HAS_MERGEUVROW_AVX2)
+ if (TestCpuFlag(kCpuHasAVX2)) {
+ return IS_ALIGNED(width, 32) ? MergeUVRow_AVX2 : MergeUVRow_Any_AVX2;
+ }
+#endif
+#if defined(HAS_MERGEUVROW_SSE2)
+ if (TestCpuFlag(kCpuHasSSE2)) {
+ return IS_ALIGNED(width, 16) ? MergeUVRow_SSE2 : MergeUVRow_Any_SSE2;
+ }
+#endif
+ return MergeUVRow_C;
+}
+
void CopyRow_C(const uint8* src, uint8* dst, int count) {
memcpy(dst, src, count);
}
« source/planar_functions.cc ('K') | « source/planar_functions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698