aboutsummaryrefslogtreecommitdiff
path: root/source/planar_functions.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2022-08-17 11:20:36 -0700
committerFrank Barchard <fbarchard@chromium.org>2022-08-17 18:39:05 +0000
commit3e38ce50589d9319badc0501f96d6c5b2b177472 (patch)
tree52ab2947f8d91d9463d6685099a0360e016a1421 /source/planar_functions.cc
parent65e7c9d5706a77d1949da59bfcb0817c252ef8d6 (diff)
downloadlibyuv-3e38ce50589d9319badc0501f96d6c5b2b177472.tar.gz
SSE2 MM21->YUY2 conversion
Add SSE2 optimization for MM21ToYUY2 conversion. Bug: b/238137982 Change-Id: I189f712514308322f651b082b496bce9c015c4ee Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3832525 Commit-Queue: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Justin Green <greenjustin@google.com>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r--source/planar_functions.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index fae8630e..1de71dbb 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -915,7 +915,7 @@ int NV21ToNV12(const uint8_t* src_y,
// tile width is 16 and assumed.
// tile_height is 16 or 32 for MM21.
// src_stride_y is bytes per row of source ignoring tiling. e.g. 640
-// TODO(fbarchard): More detile row functions.
+// TODO: More detile row functions.
LIBYUV_API
void DetilePlane(const uint8_t* src_y,
@@ -1074,6 +1074,15 @@ void DetileToYUY2(const uint8_t* src_y,
}
#endif
+#if defined(HAS_DETILETOYUY2_SSE2)
+ if (TestCpuFlag(kCpuHasSSE2)) {
+ DetileToYUY2 = DetileToYUY2_Any_SSE2;
+ if (IS_ALIGNED(width, 16)) {
+ DetileToYUY2 = DetileToYUY2_SSE2;
+ }
+ }
+#endif
+
// Detile plane
for (y = 0; y < height; ++y) {
DetileToYUY2(src_y, src_y_tile_stride, src_uv, src_uv_tile_stride,
@@ -1081,9 +1090,8 @@ void DetileToYUY2(const uint8_t* src_y,
dst_yuy2 += dst_stride_yuy2;
src_y += 16;
- if (y & 0x1) {
+ if (y & 0x1)
src_uv += 16;
- }
// Advance to next row of tiles.
if ((y & (tile_height - 1)) == (tile_height - 1)) {