diff --git a/README.chromium b/README.chromium index 25e0a1f38..5046019d4 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1738 +Version: 1739 License: BSD License File: LICENSE diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h index 1ff137255..9e12d1127 100644 --- a/include/libyuv/convert_argb.h +++ b/include/libyuv/convert_argb.h @@ -37,6 +37,7 @@ int ARGBCopy(const uint8_t* src_argb, int width, int height); + // Convert I420 to ARGB. LIBYUV_API int I420ToARGB(const uint8_t* src_y, @@ -50,7 +51,7 @@ int I420ToARGB(const uint8_t* src_y, int width, int height); -// Duplicate prototype for function in convert_from.h for remoting. +// Convert I420 to ABGR. LIBYUV_API int I420ToABGR(const uint8_t* src_y, int src_stride_y, @@ -63,6 +64,84 @@ int I420ToABGR(const uint8_t* src_y, int width, int height); +// Convert J420 to ARGB. +LIBYUV_API +int J420ToARGB(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_argb, + int dst_stride_argb, + int width, + int height); + +// Convert J420 to ABGR. +LIBYUV_API +int J420ToABGR(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_abgr, + int dst_stride_abgr, + int width, + int height); + +// Convert H420 to ARGB. +LIBYUV_API +int H420ToARGB(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_argb, + int dst_stride_argb, + int width, + int height); + +// Convert H420 to ABGR. +LIBYUV_API +int H420ToABGR(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_abgr, + int dst_stride_abgr, + int width, + int height); + +// Convert U420 to ARGB. +LIBYUV_API +int U420ToARGB(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_argb, + int dst_stride_argb, + int width, + int height); + +// Convert U420 to ABGR. +LIBYUV_API +int U420ToABGR(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_abgr, + int dst_stride_abgr, + int width, + int height); + // Convert I010 to ARGB. LIBYUV_API int I010ToARGB(const uint16_t* src_y, @@ -398,19 +477,6 @@ int UYVYToARGB(const uint8_t* src_uyvy, int width, int height); -// Convert J420 to ARGB. -LIBYUV_API -int J420ToARGB(const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, - int width, - int height); - // Convert J422 to ARGB. LIBYUV_API int J422ToARGB(const uint8_t* src_y, @@ -424,19 +490,6 @@ int J422ToARGB(const uint8_t* src_y, int width, int height); -// Convert J420 to ABGR. -LIBYUV_API -int J420ToABGR(const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_abgr, - int dst_stride_abgr, - int width, - int height); - // Convert J422 to ABGR. LIBYUV_API int J422ToABGR(const uint8_t* src_y, @@ -450,32 +503,6 @@ int J422ToABGR(const uint8_t* src_y, int width, int height); -// Convert H420 to ARGB. -LIBYUV_API -int H420ToARGB(const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, - int width, - int height); - -// Convert U420 to ARGB. -LIBYUV_API -int U420ToARGB(const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, - int width, - int height); - // Convert H422 to ARGB. LIBYUV_API int H422ToARGB(const uint8_t* src_y, @@ -502,19 +529,6 @@ int U422ToARGB(const uint8_t* src_y, int width, int height); -// Convert H420 to ABGR. -LIBYUV_API -int H420ToABGR(const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_abgr, - int dst_stride_abgr, - int width, - int height); - // Convert H422 to ABGR. LIBYUV_API int H422ToABGR(const uint8_t* src_y, @@ -567,6 +581,19 @@ int H010ToAR30(const uint16_t* src_y, int width, int height); +// Convert U010 to AR30. +LIBYUV_API +int U010ToAR30(const uint16_t* src_y, + int src_stride_y, + const uint16_t* src_u, + int src_stride_u, + const uint16_t* src_v, + int src_stride_v, + uint8_t* dst_ar30, + int dst_stride_ar30, + int width, + int height); + // Convert I010 to AB30. LIBYUV_API int I010ToAB30(const uint16_t* src_y, @@ -593,6 +620,19 @@ int H010ToAB30(const uint16_t* src_y, int width, int height); +// Convert U010 to AB30. +LIBYUV_API +int U010ToAB30(const uint16_t* src_y, + int src_stride_y, + const uint16_t* src_u, + int src_stride_u, + const uint16_t* src_v, + int src_stride_v, + uint8_t* dst_ab30, + int dst_stride_ab30, + int width, + int height); + // BGRA little endian (argb in memory) to ARGB. LIBYUV_API int BGRAToARGB(const uint8_t* src_bgra, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index ad9a784c4..5e26e34a6 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 1738 +#define LIBYUV_VERSION 1739 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/convert_argb.cc b/source/convert_argb.cc index 47fed0a36..32c5ae0ea 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc @@ -251,6 +251,25 @@ int U420ToARGB(const uint8_t* src_y, &kYuv2020Constants, width, height); } +// Convert U420 to ABGR. +LIBYUV_API +int U420ToABGR(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_abgr, + int dst_stride_abgr, + int width, + int height) { + return I420ToARGBMatrix(src_y, src_stride_y, src_v, + src_stride_v, // Swap U and V + src_u, src_stride_u, dst_abgr, dst_stride_abgr, + &kYvu2020Constants, // Use Yvu matrix + width, height); +} + // Convert I422 to ARGB with matrix static int I422ToARGBMatrix(const uint8_t* src_y, int src_stride_y, @@ -424,6 +443,23 @@ int H422ToARGB(const uint8_t* src_y, &kYuvH709Constants, width, height); } +// Convert U422 to ARGB. +LIBYUV_API +int U422ToARGB(const uint8_t* src_y, + int src_stride_y, + const uint8_t* src_u, + int src_stride_u, + const uint8_t* src_v, + int src_stride_v, + uint8_t* dst_argb, + int dst_stride_argb, + int width, + int height) { + return I422ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v, + src_stride_v, dst_argb, dst_stride_argb, + &kYuv2020Constants, width, height); +} + // Convert H422 to ABGR. LIBYUV_API int H422ToABGR(const uint8_t* src_y, @@ -716,6 +752,23 @@ int H010ToARGB(const uint16_t* src_y, &kYuvH709Constants, width, height); } +// Convert U010 to ARGB. +LIBYUV_API +int U010ToARGB(const uint16_t* src_y, + int src_stride_y, + const uint16_t* src_u, + int src_stride_u, + const uint16_t* src_v, + int src_stride_v, + uint8_t* dst_argb, + int dst_stride_argb, + int width, + int height) { + return I010ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v, + src_stride_v, dst_argb, dst_stride_argb, + &kYuv2020Constants, width, height); +} + // Convert H010 to ABGR. LIBYUV_API int H010ToABGR(const uint16_t* src_y, @@ -735,21 +788,23 @@ int H010ToABGR(const uint16_t* src_y, width, height); } -// Convert U422 to ARGB. +// Convert U010 to ABGR. LIBYUV_API -int U422ToARGB(const uint8_t* src_y, +int U010ToABGR(const uint16_t* src_y, int src_stride_y, - const uint8_t* src_u, + const uint16_t* src_u, int src_stride_u, - const uint8_t* src_v, + const uint16_t* src_v, int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, + uint8_t* dst_abgr, + int dst_stride_abgr, int width, int height) { - return I422ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v, - src_stride_v, dst_argb, dst_stride_argb, - &kYuv2020Constants, width, height); + return I010ToARGBMatrix(src_y, src_stride_y, src_v, + src_stride_v, // Swap U and V + src_u, src_stride_u, dst_abgr, dst_stride_abgr, + &kYvu2020Constants, // Use Yvu matrix + width, height); } // Convert I444 to ARGB with matrix diff --git a/source/convert_to_argb.cc b/source/convert_to_argb.cc index bde1aa889..bf0e05ed9 100644 --- a/source/convert_to_argb.cc +++ b/source/convert_to_argb.cc @@ -208,6 +208,19 @@ int ConvertToARGB(const uint8_t* sample, break; } + case FOURCC_J420: { + int halfwidth = (src_width + 1) / 2; + int halfheight = (abs_src_height + 1) / 2; + const uint8_t* src_y = sample + (src_width * crop_y + crop_x); + const uint8_t* src_u = sample + src_width * abs_src_height + + (halfwidth * crop_y + crop_x) / 2; + const uint8_t* src_v = sample + src_width * abs_src_height + + halfwidth * (halfheight + crop_y / 2) + crop_x / 2; + r = J420ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth, + dst_argb, dst_stride_argb, crop_width, inv_crop_height); + break; + } + case FOURCC_H420: { int halfwidth = (src_width + 1) / 2; int halfheight = (abs_src_height + 1) / 2; @@ -221,7 +234,7 @@ int ConvertToARGB(const uint8_t* sample, break; } - case FOURCC_J420: { + case FOURCC_U420: { int halfwidth = (src_width + 1) / 2; int halfheight = (abs_src_height + 1) / 2; const uint8_t* src_y = sample + (src_width * crop_y + crop_x); @@ -229,7 +242,7 @@ int ConvertToARGB(const uint8_t* sample, (halfwidth * crop_y + crop_x) / 2; const uint8_t* src_v = sample + src_width * abs_src_height + halfwidth * (halfheight + crop_y / 2) + crop_x / 2; - r = J420ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth, + r = U420ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth, dst_argb, dst_stride_argb, crop_width, inv_crop_height); break; } diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 2c8eae509..321652b7b 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -680,6 +680,8 @@ TESTPLANARTOB(J420, 2, 2, ARGB, 4, 4, 1) TESTPLANARTOB(J420, 2, 2, ABGR, 4, 4, 1) TESTPLANARTOB(H420, 2, 2, ARGB, 4, 4, 1) TESTPLANARTOB(H420, 2, 2, ABGR, 4, 4, 1) +TESTPLANARTOB(U420, 2, 2, ARGB, 4, 4, 1) +TESTPLANARTOB(U420, 2, 2, ABGR, 4, 4, 1) TESTPLANARTOB(I420, 2, 2, BGRA, 4, 4, 1) TESTPLANARTOB(I420, 2, 2, ABGR, 4, 4, 1) TESTPLANARTOB(I420, 2, 2, RGBA, 4, 4, 1) @@ -702,11 +704,15 @@ TESTPLANARTOB(J422, 2, 1, ARGB, 4, 4, 1) TESTPLANARTOB(J422, 2, 1, ABGR, 4, 4, 1) TESTPLANARTOB(H422, 2, 1, ARGB, 4, 4, 1) TESTPLANARTOB(H422, 2, 1, ABGR, 4, 4, 1) +TESTPLANARTOB(U422, 2, 1, ARGB, 4, 4, 1) +//TESTPLANARTOB(U422, 2, 1, ABGR, 4, 4, 1) TESTPLANARTOB(I422, 2, 1, BGRA, 4, 4, 1) TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4, 1) TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4, 1) TESTPLANARTOB(I444, 1, 1, ARGB, 4, 4, 1) TESTPLANARTOB(J444, 1, 1, ARGB, 4, 4, 1) +//TESTPLANARTOB(H444, 1, 1, ARGB, 4, 4, 1) +TESTPLANARTOB(U444, 1, 1, ARGB, 4, 4, 1) TESTPLANARTOB(I444, 1, 1, ABGR, 4, 4, 1) TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4, 1) TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1) @@ -2567,6 +2573,8 @@ TESTPLANARTOE(J420, 2, 2, ARGB, 1, 4, ARGB, 4) TESTPLANARTOE(J420, 2, 2, ABGR, 1, 4, ARGB, 4) TESTPLANARTOE(H420, 2, 2, ARGB, 1, 4, ARGB, 4) TESTPLANARTOE(H420, 2, 2, ABGR, 1, 4, ARGB, 4) +TESTPLANARTOE(U420, 2, 2, ARGB, 1, 4, ARGB, 4) +TESTPLANARTOE(U420, 2, 2, ABGR, 1, 4, ARGB, 4) TESTPLANARTOE(I420, 2, 2, BGRA, 1, 4, ARGB, 4) TESTPLANARTOE(I420, 2, 2, ABGR, 1, 4, ARGB, 4) TESTPLANARTOE(I420, 2, 2, RGBA, 1, 4, ARGB, 4) @@ -2900,15 +2908,17 @@ TEST_F(LibYUVConvertTest, ABGRToAR30Row_Opt) { TESTPLANAR16TOB(I010, 2, 2, ARGB, 4, 4, 1, 2) TESTPLANAR16TOB(I010, 2, 2, ABGR, 4, 4, 1, 2) +TESTPLANAR16TOB(H010, 2, 2, ARGB, 4, 4, 1, 2) +TESTPLANAR16TOB(H010, 2, 2, ABGR, 4, 4, 1, 2) +TESTPLANAR16TOB(U010, 2, 2, ARGB, 4, 4, 1, 2) +TESTPLANAR16TOB(U010, 2, 2, ABGR, 4, 4, 1, 2) #ifdef LITTLE_ENDIAN_TEST TESTPLANAR16TOB(I010, 2, 2, AR30, 4, 4, 1, 2) TESTPLANAR16TOB(I010, 2, 2, AB30, 4, 4, 1, 2) -#endif -TESTPLANAR16TOB(H010, 2, 2, ARGB, 4, 4, 1, 2) -TESTPLANAR16TOB(H010, 2, 2, ABGR, 4, 4, 1, 2) -#ifdef LITTLE_ENDIAN_TEST TESTPLANAR16TOB(H010, 2, 2, AR30, 4, 4, 1, 2) TESTPLANAR16TOB(H010, 2, 2, AB30, 4, 4, 1, 2) +TESTPLANAR16TOB(U010, 2, 2, AR30, 4, 4, 1, 2) +TESTPLANAR16TOB(U010, 2, 2, AB30, 4, 4, 1, 2) #endif static int Clamp(int y) {