diff --git a/README.chromium b/README.chromium index 7c42013b9..88c069734 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1677 +Version: 1678 License: BSD License File: LICENSE diff --git a/docs/formats.md b/docs/formats.md index cddfe027e..2b75d31ac 100644 --- a/docs/formats.md +++ b/docs/formats.md @@ -138,3 +138,10 @@ Some are channel order agnostic (e.g. ARGBScale). Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its a macro). ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha. Other functions don't care. + +# RGB24 and RAW + +There are 2 RGB layouts - RGB24 (aka 24BG) and RAW + +RGB24 is B,G,R in memory +RAW is R,G,B in memory diff --git a/include/libyuv/convert_from.h b/include/libyuv/convert_from.h index a050e4457..237f68f57 100644 --- a/include/libyuv/convert_from.h +++ b/include/libyuv/convert_from.h @@ -188,6 +188,30 @@ int I420ToRAW(const uint8* src_y, int width, int height); +LIBYUV_API +int H420ToRGB24(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_frame, + int dst_stride_frame, + int width, + int height); + +LIBYUV_API +int H420ToRAW(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_frame, + int dst_stride_frame, + int width, + int height); + LIBYUV_API int I420ToRGB565(const uint8* src_y, int src_stride_y, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 1b6fd773b..838c70f13 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1677 +#define LIBYUV_VERSION 1678 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/convert_from.cc b/source/convert_from.cc index d623731d9..0f52f9ef9 100644 --- a/source/convert_from.cc +++ b/source/convert_from.cc @@ -657,6 +657,42 @@ int I420ToRAW(const uint8* src_y, width, height); } +// Convert H420 to RGB24. +LIBYUV_API +int H420ToRGB24(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_rgb24, + int dst_stride_rgb24, + int width, + int height) { + return I420ToRGB24Matrix(src_y, src_stride_y, src_u, src_stride_u, src_v, + src_stride_v, dst_rgb24, dst_stride_rgb24, + &kYuvH709Constants, width, height); +} + +// Convert H420 to RAW. +LIBYUV_API +int H420ToRAW(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_raw, + int dst_stride_raw, + int width, + int height) { + return I420ToRGB24Matrix(src_y, src_stride_y, src_v, + src_stride_v, // Swap U and V + src_u, src_stride_u, dst_raw, dst_stride_raw, + &kYvuH709Constants, // Use Yvu matrix + width, height); +} + // Convert I420 to ARGB1555. LIBYUV_API int I420ToARGB1555(const uint8* src_y, @@ -1075,8 +1111,8 @@ int I420ToRGB565Dither(const uint8* src_y, for (y = 0; y < height; ++y) { I422ToARGBRow(src_y, src_u, src_v, row_argb, &kYuvI601Constants, width); ARGBToRGB565DitherRow(row_argb, dst_rgb565, - *(uint32*)(dither4x4 + ((y & 3) << 2)), - width); // NOLINT + *(uint32*)(dither4x4 + ((y & 3) << 2)), // NOLINT + width); // NOLINT dst_rgb565 += dst_stride_rgb565; src_y += src_stride_y; if (y & 1) { diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index deeb30e49..56b6364e5 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -572,6 +572,8 @@ TESTPLANARTOB(I420, 2, 2, ABGR, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, RGBA, 4, 4, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, RAW, 3, 3, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, RGB24, 3, 3, 1, 2, ARGB, 4) +TESTPLANARTOB(H420, 2, 2, RAW, 3, 3, 1, 2, ARGB, 4) +TESTPLANARTOB(H420, 2, 2, RGB24, 3, 3, 1, 2, ARGB, 4) TESTPLANARTOB(I420, 2, 2, RGB565, 2, 2, 1, 9, ARGB, 4) TESTPLANARTOB(I420, 2, 2, ARGB1555, 2, 2, 1, 9, ARGB, 4) TESTPLANARTOB(I420, 2, 2, ARGB4444, 2, 2, 1, 17, ARGB, 4) @@ -1798,6 +1800,11 @@ TESTPLANARTOE(I420, 2, 2, RAW, 1, 3, RGB24, 3) TESTPLANARTOE(I420, 2, 2, RGB24, 1, 3, RAW, 3) TESTPLANARTOE(I420, 2, 2, ARGB, 1, 4, RAW, 3) TESTPLANARTOE(I420, 2, 2, RAW, 1, 3, ARGB, 4) +TESTPLANARTOE(H420, 2, 2, RGB24, 1, 3, ARGB, 4) +TESTPLANARTOE(H420, 2, 2, RAW, 1, 3, RGB24, 3) +TESTPLANARTOE(H420, 2, 2, RGB24, 1, 3, RAW, 3) +TESTPLANARTOE(H420, 2, 2, ARGB, 1, 4, RAW, 3) +TESTPLANARTOE(H420, 2, 2, RAW, 1, 3, ARGB, 4) TESTPLANARTOE(I420, 2, 2, ARGB, 1, 4, RGB565, 2) TESTPLANARTOE(I420, 2, 2, ARGB, 1, 4, ARGB1555, 2) TESTPLANARTOE(I420, 2, 2, ARGB, 1, 4, ARGB4444, 2) diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index c72000ce8..c39211a16 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -153,7 +153,7 @@ static int TestFilter_16(int src_width, return 0; } - int i, j; + int i; int src_width_uv = (Abs(src_width) + 1) >> 1; int src_height_uv = (Abs(src_height) + 1) >> 1;