diff options
author | Frank Barchard <fbarchard@google.com> | 2017-11-21 11:38:38 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-11-21 20:37:01 +0000 |
commit | a98d6cdb17d62f1a6cf225bbd55ba9970c05d875 (patch) | |
tree | a5b9fbf54a473c7e249b777e983f76fe59b8018e /source/convert_from_argb.cc | |
parent | 19a126ddfad9806056fb1f2ff870db7204cd5b76 (diff) | |
download | libyuv-a98d6cdb17d62f1a6cf225bbd55ba9970c05d875.tar.gz |
ARGBToAR30 AVX2 conversion function
Bug: libyuv:751
Test: LibYUVConvertTest.ARGBToAR30_Opt
Change-Id: I09c13eb53ba5f1ce1740c013dc587f8300f1d9e0
Reviewed-on: https://chromium-review.googlesource.com/780437
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Diffstat (limited to 'source/convert_from_argb.cc')
-rw-r--r-- | source/convert_from_argb.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/convert_from_argb.cc b/source/convert_from_argb.cc index 88f38279..77c542b7 100644 --- a/source/convert_from_argb.cc +++ b/source/convert_from_argb.cc @@ -1308,6 +1308,47 @@ int ARGBToARGB4444(const uint8* src_argb, return 0; } +// Convert ARGB To AR30. +LIBYUV_API +int ARGBToAR30(const uint8* src_argb, + int src_stride_argb, + uint8* dst_ar30, + int dst_stride_ar30, + int width, + int height) { + int y; + void (*ARGBToAR30Row)(const uint8* src_argb, uint8* dst_rgb, int width) = + ARGBToAR30Row_C; + if (!src_argb || !dst_ar30 || width <= 0 || height == 0) { + return -1; + } + if (height < 0) { + height = -height; + src_argb = src_argb + (height - 1) * src_stride_argb; + src_stride_argb = -src_stride_argb; + } + // Coalesce rows. + if (src_stride_argb == width * 4 && dst_stride_ar30 == width * 4) { + width *= height; + height = 1; + src_stride_argb = dst_stride_ar30 = 0; + } +#if defined(HAS_ARGBTOAR30ROW_AVX2) + if (TestCpuFlag(kCpuHasAVX2)) { + ARGBToAR30Row = ARGBToAR30Row_Any_AVX2; + if (IS_ALIGNED(width, 8)) { + ARGBToAR30Row = ARGBToAR30Row_AVX2; + } + } +#endif + for (y = 0; y < height; ++y) { + ARGBToAR30Row(src_argb, dst_ar30, width); + src_argb += src_stride_argb; + dst_ar30 += dst_stride_ar30; + } + return 0; +} + // Convert ARGB to J420. (JPeg full range I420). LIBYUV_API int ARGBToJ420(const uint8* src_argb, |