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

Unified Diff: source/convert_argb.cc

Issue 1355733002: scale test (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: move abgr support to its own 32 bit intel specific ifdefs Created 5 years, 3 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
« no previous file with comments | « include/libyuv/version.h ('k') | source/row_any.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/convert_argb.cc
diff --git a/source/convert_argb.cc b/source/convert_argb.cc
index d282f598aafa117ada6199384c4e148dc5831d48..dec44deddeedf93c1e3028d7aa72eff692fe5173 100644
--- a/source/convert_argb.cc
+++ b/source/convert_argb.cc
@@ -112,6 +112,74 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
return 0;
}
+// Convert I444 to ABGR.
+LIBYUV_API
+int I444ToABGR(const uint8* src_y, int src_stride_y,
+ const uint8* src_u, int src_stride_u,
+ const uint8* src_v, int src_stride_v,
+ uint8* dst_abgr, int dst_stride_abgr,
+ int width, int height) {
+ int y;
+ void (*I444ToABGRRow)(const uint8* y_buf,
+ const uint8* u_buf,
+ const uint8* v_buf,
+ uint8* rgb_buf,
+ int width) = I444ToABGRRow_C;
+ if (!src_y || !src_u || !src_v ||
+ !dst_abgr ||
+ width <= 0 || height == 0) {
+ return -1;
+ }
+ // Negative height means invert the image.
+ if (height < 0) {
+ height = -height;
+ dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr;
+ dst_stride_abgr = -dst_stride_abgr;
+ }
+ // Coalesce rows.
+ if (src_stride_y == width &&
+ src_stride_u == width &&
+ src_stride_v == width &&
+ dst_stride_abgr == width * 4) {
+ width *= height;
+ height = 1;
+ src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0;
+ }
+#if defined(HAS_I444TOABGRROW_SSSE3)
+ if (TestCpuFlag(kCpuHasSSSE3)) {
+ I444ToABGRRow = I444ToABGRRow_Any_SSSE3;
+ if (IS_ALIGNED(width, 8)) {
+ I444ToABGRRow = I444ToABGRRow_SSSE3;
+ }
+ }
+#endif
+#if defined(HAS_I444TOABGRROW_AVX2)
+ if (TestCpuFlag(kCpuHasAVX2)) {
+ I444ToABGRRow = I444ToABGRRow_Any_AVX2;
+ if (IS_ALIGNED(width, 16)) {
+ I444ToABGRRow = I444ToABGRRow_AVX2;
+ }
+ }
+#endif
+#if defined(HAS_I444TOABGRROW_NEON)
+ if (TestCpuFlag(kCpuHasNEON)) {
+ I444ToABGRRow = I444ToABGRRow_Any_NEON;
+ if (IS_ALIGNED(width, 8)) {
+ I444ToABGRRow = I444ToABGRRow_NEON;
+ }
+ }
+#endif
+
+ for (y = 0; y < height; ++y) {
+ I444ToABGRRow(src_y, src_u, src_v, dst_abgr, width);
+ dst_abgr += dst_stride_abgr;
+ src_y += src_stride_y;
+ src_u += src_stride_u;
+ src_v += src_stride_v;
+ }
+ return 0;
+}
+
// Convert I422 to ARGB.
LIBYUV_API
int I422ToARGB(const uint8* src_y, int src_stride_y,
« no previous file with comments | « include/libyuv/version.h ('k') | source/row_any.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698