mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
I210ToAR30 support for 422 10 bit to 10 bit RGB
BUG=960620, libyuv:845, b/129864744 Change-Id: I43b152568b7f297f81624d47e56a334c127be17b Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1901465 Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
1f12946068
commit
6502179e4c
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 1740
|
Version: 1741
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -362,19 +362,6 @@ int I010ToARGB(const uint16_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
// Convert I010 to ARGB.
|
|
||||||
LIBYUV_API
|
|
||||||
int I010ToARGB(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);
|
|
||||||
|
|
||||||
// Convert I010 to ABGR.
|
// Convert I010 to ABGR.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I010ToABGR(const uint16_t* src_y,
|
int I010ToABGR(const uint16_t* src_y,
|
||||||
@ -439,6 +426,85 @@ int U010ToABGR(const uint16_t* src_y,
|
|||||||
int dst_stride_abgr,
|
int dst_stride_abgr,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
// Convert I210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToARGB(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);
|
||||||
|
|
||||||
|
// Convert I210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
|
// Convert H210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToARGB(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);
|
||||||
|
|
||||||
|
// Convert H210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
|
// Convert U210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToARGB(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);
|
||||||
|
|
||||||
|
// Convert U210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
// Convert I420 with Alpha to preattenuated ARGB.
|
// Convert I420 with Alpha to preattenuated ARGB.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I420AlphaToARGB(const uint8_t* src_y,
|
int I420AlphaToARGB(const uint8_t* src_y,
|
||||||
@ -618,19 +684,6 @@ int UYVYToARGB(const uint8_t* src_uyvy,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
// Convert H010 to ARGB.
|
|
||||||
LIBYUV_API
|
|
||||||
int H010ToARGB(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);
|
|
||||||
|
|
||||||
// Convert I010 to AR30.
|
// Convert I010 to AR30.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I010ToAR30(const uint16_t* src_y,
|
int I010ToAR30(const uint16_t* src_y,
|
||||||
@ -644,32 +697,6 @@ int I010ToAR30(const uint16_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
// Convert H010 to AR30.
|
|
||||||
LIBYUV_API
|
|
||||||
int H010ToAR30(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 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.
|
// Convert I010 to AB30.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I010ToAB30(const uint16_t* src_y,
|
int I010ToAB30(const uint16_t* src_y,
|
||||||
@ -683,6 +710,19 @@ int I010ToAB30(const uint16_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
// Convert H010 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int H010ToAR30(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 H010 to AB30.
|
// Convert H010 to AB30.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int H010ToAB30(const uint16_t* src_y,
|
int H010ToAB30(const uint16_t* src_y,
|
||||||
@ -696,6 +736,19 @@ int H010ToAB30(const uint16_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
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 U010 to AB30.
|
// Convert U010 to AB30.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int U010ToAB30(const uint16_t* src_y,
|
int U010ToAB30(const uint16_t* src_y,
|
||||||
@ -709,6 +762,84 @@ int U010ToAB30(const uint16_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
// Convert I210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToAR30(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 I210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToAB30(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);
|
||||||
|
|
||||||
|
// Convert H210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToAR30(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 H210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToAB30(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);
|
||||||
|
|
||||||
|
// Convert U210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToAR30(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 U210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToAB30(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.
|
// BGRA little endian (argb in memory) to ARGB.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int BGRAToARGB(const uint8_t* src_bgra,
|
int BGRAToARGB(const uint8_t* src_bgra,
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 1740
|
#define LIBYUV_VERSION 1741
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|||||||
@ -59,9 +59,8 @@ enum FourCC {
|
|||||||
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
|
||||||
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
|
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
|
||||||
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
|
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
|
||||||
FOURCC_H010 = FOURCC('H', '0', '1', '0'), // unofficial fourcc. 10 bit lsb
|
FOURCC_I010 = FOURCC('I', '0', '1', '0'), // bt.601 10 bit 420
|
||||||
FOURCC_U010 = FOURCC('U', '0', '1', '0'), // bt.2020, unofficial fourcc.
|
FOURCC_I210 = FOURCC('I', '0', '1', '0'), // bt.601 10 bit 422
|
||||||
// 10 bit lsb
|
|
||||||
|
|
||||||
// 1 Secondary YUV format: row biplanar.
|
// 1 Secondary YUV format: row biplanar.
|
||||||
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
|
FOURCC_M420 = FOURCC('M', '4', '2', '0'),
|
||||||
@ -97,6 +96,10 @@ enum FourCC {
|
|||||||
FOURCC_U420 = FOURCC('U', '4', '2', '0'), // bt.2020, unofficial fourcc
|
FOURCC_U420 = FOURCC('U', '4', '2', '0'), // bt.2020, unofficial fourcc
|
||||||
FOURCC_U422 = FOURCC('U', '4', '2', '2'), // bt.2020, unofficial fourcc
|
FOURCC_U422 = FOURCC('U', '4', '2', '2'), // bt.2020, unofficial fourcc
|
||||||
FOURCC_U444 = FOURCC('U', '4', '4', '4'), // bt.2020, unofficial fourcc
|
FOURCC_U444 = FOURCC('U', '4', '4', '4'), // bt.2020, unofficial fourcc
|
||||||
|
FOURCC_H010 = FOURCC('H', '0', '1', '0'), // bt.709 10 bit 420
|
||||||
|
FOURCC_U010 = FOURCC('U', '0', '1', '0'), // bt.2020 10 bit 420
|
||||||
|
FOURCC_H210 = FOURCC('H', '0', '1', '0'), // bt.709 10 bit 422
|
||||||
|
FOURCC_U210 = FOURCC('U', '0', '1', '0'), // bt.2020 10 bit 422
|
||||||
|
|
||||||
// 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
|
// 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
|
||||||
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
|
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
|
||||||
|
|||||||
@ -884,6 +884,162 @@ int U010ToAB30(const uint16_t* src_y,
|
|||||||
&kYuv2020Constants, width, height);
|
&kYuv2020Constants, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert 10 bit YUV to ARGB with matrix
|
||||||
|
// TODO(fbarchard): Consider passing scale multiplier to I210ToARGB to
|
||||||
|
// multiply 10 bit yuv into high bits to allow any number of bits.
|
||||||
|
static int I210ToAR30Matrix(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,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
int y;
|
||||||
|
void (*I210ToAR30Row)(const uint16_t* y_buf, const uint16_t* u_buf,
|
||||||
|
const uint16_t* v_buf, uint8_t* rgb_buf,
|
||||||
|
const struct YuvConstants* yuvconstants, int width) =
|
||||||
|
I210ToAR30Row_C;
|
||||||
|
if (!src_y || !src_u || !src_v || !dst_ar30 || width <= 0 || height == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// Negative height means invert the image.
|
||||||
|
if (height < 0) {
|
||||||
|
height = -height;
|
||||||
|
dst_ar30 = dst_ar30 + (height - 1) * dst_stride_ar30;
|
||||||
|
dst_stride_ar30 = -dst_stride_ar30;
|
||||||
|
}
|
||||||
|
#if defined(HAS_I210TOAR30ROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||||
|
I210ToAR30Row = I210ToAR30Row_Any_SSSE3;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I210ToAR30Row = I210ToAR30Row_SSSE3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I210TOAR30ROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
I210ToAR30Row = I210ToAR30Row_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 16)) {
|
||||||
|
I210ToAR30Row = I210ToAR30Row_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
I210ToAR30Row(src_y, src_u, src_v, dst_ar30, yuvconstants, width);
|
||||||
|
dst_ar30 += dst_stride_ar30;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToAR30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_ar30, dst_stride_ar30,
|
||||||
|
&kYuvI601Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert H210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToAR30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_ar30, dst_stride_ar30,
|
||||||
|
&kYuvH709Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert U210 to AR30.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToAR30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_ar30, dst_stride_ar30,
|
||||||
|
&kYuv2020Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToAB30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_v, src_stride_v, src_u,
|
||||||
|
src_stride_u, dst_ab30, dst_stride_ab30,
|
||||||
|
&kYvuI601Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert H210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToAB30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_v, src_stride_v, src_u,
|
||||||
|
src_stride_u, dst_ab30, dst_stride_ab30,
|
||||||
|
&kYvuH709Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert U210 to AB30.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToAB30(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) {
|
||||||
|
return I210ToAR30Matrix(src_y, src_stride_y, src_v, src_stride_v, src_u,
|
||||||
|
src_stride_u, dst_ab30, dst_stride_ab30,
|
||||||
|
&kYuv2020Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
// Convert 10 bit YUV to ARGB with matrix
|
// Convert 10 bit YUV to ARGB with matrix
|
||||||
static int I010ToARGBMatrix(const uint16_t* src_y,
|
static int I010ToARGBMatrix(const uint16_t* src_y,
|
||||||
int src_stride_y,
|
int src_stride_y,
|
||||||
@ -999,23 +1155,6 @@ int H010ToARGB(const uint16_t* src_y,
|
|||||||
&kYuvH709Constants, width, height);
|
&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.
|
// Convert H010 to ABGR.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int H010ToABGR(const uint16_t* src_y,
|
int H010ToABGR(const uint16_t* src_y,
|
||||||
@ -1035,6 +1174,23 @@ int H010ToABGR(const uint16_t* src_y,
|
|||||||
width, height);
|
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 U010 to ABGR.
|
// Convert U010 to ABGR.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int U010ToABGR(const uint16_t* src_y,
|
int U010ToABGR(const uint16_t* src_y,
|
||||||
@ -1054,6 +1210,177 @@ int U010ToABGR(const uint16_t* src_y,
|
|||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert 10 bit 422 YUV to ARGB with matrix
|
||||||
|
static int I210ToARGBMatrix(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,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
int y;
|
||||||
|
void (*I210ToARGBRow)(const uint16_t* y_buf, const uint16_t* u_buf,
|
||||||
|
const uint16_t* v_buf, uint8_t* rgb_buf,
|
||||||
|
const struct YuvConstants* yuvconstants, int width) =
|
||||||
|
I210ToARGBRow_C;
|
||||||
|
if (!src_y || !src_u || !src_v || !dst_argb || width <= 0 || height == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// Negative height means invert the image.
|
||||||
|
if (height < 0) {
|
||||||
|
height = -height;
|
||||||
|
dst_argb = dst_argb + (height - 1) * dst_stride_argb;
|
||||||
|
dst_stride_argb = -dst_stride_argb;
|
||||||
|
}
|
||||||
|
#if defined(HAS_I210TOARGBROW_SSSE3)
|
||||||
|
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_Any_SSSE3;
|
||||||
|
if (IS_ALIGNED(width, 8)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_SSSE3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I210TOARGBROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 16)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I210TOARGBROW_MMI)
|
||||||
|
if (TestCpuFlag(kCpuHasMMI)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_Any_MMI;
|
||||||
|
if (IS_ALIGNED(width, 4)) {
|
||||||
|
I210ToARGBRow = I210ToARGBRow_MMI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
I210ToARGBRow(src_y, src_u, src_v, dst_argb, yuvconstants, width);
|
||||||
|
dst_argb += dst_stride_argb;
|
||||||
|
src_y += src_stride_y;
|
||||||
|
src_u += src_stride_u;
|
||||||
|
src_v += src_stride_v;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Convert I210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToARGB(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 I210ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_argb, dst_stride_argb,
|
||||||
|
&kYuvI601Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert I210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int I210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
return I210ToARGBMatrix(src_y, src_stride_y, src_v,
|
||||||
|
src_stride_v, // Swap U and V
|
||||||
|
src_u, src_stride_u, dst_abgr, dst_stride_abgr,
|
||||||
|
&kYvuI601Constants, // Use Yvu matrix
|
||||||
|
width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert H210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToARGB(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 I210ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_argb, dst_stride_argb,
|
||||||
|
&kYuvH709Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert H210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int H210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
return I210ToARGBMatrix(src_y, src_stride_y, src_v,
|
||||||
|
src_stride_v, // Swap U and V
|
||||||
|
src_u, src_stride_u, dst_abgr, dst_stride_abgr,
|
||||||
|
&kYvuH709Constants, // Use Yvu matrix
|
||||||
|
width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert U210 to ARGB.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToARGB(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 I210ToARGBMatrix(src_y, src_stride_y, src_u, src_stride_u, src_v,
|
||||||
|
src_stride_v, dst_argb, dst_stride_argb,
|
||||||
|
&kYuv2020Constants, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert U210 to ABGR.
|
||||||
|
LIBYUV_API
|
||||||
|
int U210ToABGR(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_abgr,
|
||||||
|
int dst_stride_abgr,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
return I210ToARGBMatrix(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 I420 with Alpha to preattenuated ARGB.
|
// Convert I420 with Alpha to preattenuated ARGB.
|
||||||
static int I420AlphaToARGBMatrix(const uint8_t* src_y,
|
static int I420AlphaToARGBMatrix(const uint8_t* src_y,
|
||||||
int src_stride_y,
|
int src_stride_y,
|
||||||
|
|||||||
@ -2923,6 +2923,12 @@ TESTPLANAR16TOB(H010, 2, 2, ARGB, 4, 4, 1, 2)
|
|||||||
TESTPLANAR16TOB(H010, 2, 2, ABGR, 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, ARGB, 4, 4, 1, 2)
|
||||||
TESTPLANAR16TOB(U010, 2, 2, ABGR, 4, 4, 1, 2)
|
TESTPLANAR16TOB(U010, 2, 2, ABGR, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(I210, 2, 1, ARGB, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(I210, 2, 1, ABGR, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(H210, 2, 1, ARGB, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(H210, 2, 1, ABGR, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(U210, 2, 1, ARGB, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(U210, 2, 1, ABGR, 4, 4, 1, 2)
|
||||||
#ifdef LITTLE_ENDIAN_TEST
|
#ifdef LITTLE_ENDIAN_TEST
|
||||||
TESTPLANAR16TOB(I010, 2, 2, AR30, 4, 4, 1, 2)
|
TESTPLANAR16TOB(I010, 2, 2, AR30, 4, 4, 1, 2)
|
||||||
TESTPLANAR16TOB(I010, 2, 2, AB30, 4, 4, 1, 2)
|
TESTPLANAR16TOB(I010, 2, 2, AB30, 4, 4, 1, 2)
|
||||||
@ -2930,6 +2936,12 @@ TESTPLANAR16TOB(H010, 2, 2, AR30, 4, 4, 1, 2)
|
|||||||
TESTPLANAR16TOB(H010, 2, 2, AB30, 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, AR30, 4, 4, 1, 2)
|
||||||
TESTPLANAR16TOB(U010, 2, 2, AB30, 4, 4, 1, 2)
|
TESTPLANAR16TOB(U010, 2, 2, AB30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(I210, 2, 1, AR30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(I210, 2, 1, AB30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(H210, 2, 1, AR30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(H210, 2, 1, AB30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(U210, 2, 1, AR30, 4, 4, 1, 2)
|
||||||
|
TESTPLANAR16TOB(U210, 2, 1, AB30, 4, 4, 1, 2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int Clamp(int y) {
|
static int Clamp(int y) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user