mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 08:46:47 +08:00
Switch to C99 types
Append _t to all sized types. uint64 becomes uint64_t etc Bug: libyuv:774 Test: try bots build on all platforms Change-Id: Ide273d7f8012313d6610415d514a956d6f3a8cac Reviewed-on: https://chromium-review.googlesource.com/879922 Reviewed-by: Miguel Casas <mcasas@chromium.org>
This commit is contained in:
parent
13771ffaad
commit
7e389884a1
@ -23,23 +23,23 @@
|
||||
#ifndef INT_TYPES_DEFINED
|
||||
#define INT_TYPES_DEFINED
|
||||
#ifdef COMPILER_MSVC
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
#else // COMPILER_MSVC
|
||||
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||
typedef unsigned long uint64; // NOLINT
|
||||
typedef long int64; // NOLINT
|
||||
typedef unsigned long uint64_t; // NOLINT
|
||||
typedef long int64_t; // NOLINT
|
||||
#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||
typedef unsigned long long uint64; // NOLINT
|
||||
typedef long long int64; // NOLINT
|
||||
typedef unsigned long long uint64_t; // NOLINT
|
||||
typedef long long int64_t; // NOLINT
|
||||
#endif // __LP64__
|
||||
#endif // COMPILER_MSVC
|
||||
typedef unsigned int uint32;
|
||||
typedef int int32;
|
||||
typedef unsigned short uint16; // NOLINT
|
||||
typedef short int16; // NOLINT
|
||||
typedef unsigned char uint8;
|
||||
typedef signed char int8;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t; // NOLINT
|
||||
typedef short int16_t; // NOLINT
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
#endif // INT_TYPES_DEFINED
|
||||
#endif // GG_LONGLONG
|
||||
|
||||
|
||||
@ -20,27 +20,27 @@ extern "C" {
|
||||
|
||||
// Compute a hash for specified memory. Seed of 5381 recommended.
|
||||
LIBYUV_API
|
||||
uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed);
|
||||
uint32_t HashDjb2(const uint8_t* src, uint64_t count, uint32_t seed);
|
||||
|
||||
// Hamming Distance
|
||||
LIBYUV_API
|
||||
uint64 ComputeHammingDistance(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint64_t ComputeHammingDistance(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count);
|
||||
|
||||
// Scan an opaque argb image and return fourcc based on alpha offset.
|
||||
// Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
|
||||
LIBYUV_API
|
||||
uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
|
||||
uint32_t ARGBDetect(const uint8_t* argb, int stride_argb, int width, int height);
|
||||
|
||||
// Sum Square Error - used to compute Mean Square Error or PSNR.
|
||||
LIBYUV_API
|
||||
uint64 ComputeSumSquareError(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint64_t ComputeSumSquareError(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
|
||||
LIBYUV_API
|
||||
uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
|
||||
uint64_t ComputeSumSquareErrorPlane(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height);
|
||||
@ -48,52 +48,52 @@ uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
|
||||
static const int kMaxPsnr = 128;
|
||||
|
||||
LIBYUV_API
|
||||
double SumSquareErrorToPsnr(uint64 sse, uint64 count);
|
||||
double SumSquareErrorToPsnr(uint64_t sse, uint64_t count);
|
||||
|
||||
LIBYUV_API
|
||||
double CalcFramePsnr(const uint8* src_a,
|
||||
double CalcFramePsnr(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
double I420Psnr(const uint8* src_y_a,
|
||||
double I420Psnr(const uint8_t* src_y_a,
|
||||
int stride_y_a,
|
||||
const uint8* src_u_a,
|
||||
const uint8_t* src_u_a,
|
||||
int stride_u_a,
|
||||
const uint8* src_v_a,
|
||||
const uint8_t* src_v_a,
|
||||
int stride_v_a,
|
||||
const uint8* src_y_b,
|
||||
const uint8_t* src_y_b,
|
||||
int stride_y_b,
|
||||
const uint8* src_u_b,
|
||||
const uint8_t* src_u_b,
|
||||
int stride_u_b,
|
||||
const uint8* src_v_b,
|
||||
const uint8_t* src_v_b,
|
||||
int stride_v_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
double CalcFrameSsim(const uint8* src_a,
|
||||
double CalcFrameSsim(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
double I420Ssim(const uint8* src_y_a,
|
||||
double I420Ssim(const uint8_t* src_y_a,
|
||||
int stride_y_a,
|
||||
const uint8* src_u_a,
|
||||
const uint8_t* src_u_a,
|
||||
int stride_u_a,
|
||||
const uint8* src_v_a,
|
||||
const uint8_t* src_v_a,
|
||||
int stride_v_a,
|
||||
const uint8* src_y_b,
|
||||
const uint8_t* src_y_b,
|
||||
int stride_y_b,
|
||||
const uint8* src_u_b,
|
||||
const uint8_t* src_u_b,
|
||||
int stride_u_b,
|
||||
const uint8* src_v_b,
|
||||
const uint8_t* src_v_b,
|
||||
int stride_v_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -90,22 +90,22 @@ extern "C" {
|
||||
#define HAS_SUMSQUAREERROR_MSA
|
||||
#endif
|
||||
|
||||
uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 HammingDistance_SSE42(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 HammingDistance_SSSE3(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 HammingDistance_AVX2(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 HammingDistance_MSA(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32_t HammingDistance_C(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t HammingDistance_SSE42(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t HammingDistance_SSSE3(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t HammingDistance_AVX2(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t HammingDistance_NEON(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t HammingDistance_MSA(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
|
||||
uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32 SumSquareError_MSA(const uint8* src_a, const uint8* src_b, int count);
|
||||
uint32_t SumSquareError_C(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t SumSquareError_SSE2(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t SumSquareError_AVX2(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t SumSquareError_NEON(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
uint32_t SumSquareError_MSA(const uint8_t* src_a, const uint8_t* src_b, int count);
|
||||
|
||||
uint32 HashDjb2_C(const uint8* src, int count, uint32 seed);
|
||||
uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed);
|
||||
uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed);
|
||||
uint32_t HashDjb2_C(const uint8_t* src, int count, uint32_t seed);
|
||||
uint32_t HashDjb2_SSE41(const uint8_t* src, int count, uint32_t seed);
|
||||
uint32_t HashDjb2_AVX2(const uint8_t* src, int count, uint32_t seed);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -27,34 +27,34 @@ extern "C" {
|
||||
|
||||
// Convert I444 to I420.
|
||||
LIBYUV_API
|
||||
int I444ToI420(const uint8* src_y,
|
||||
int I444ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to I420.
|
||||
LIBYUV_API
|
||||
int I422ToI420(const uint8* src_y,
|
||||
int I422ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -62,17 +62,17 @@ int I422ToI420(const uint8* src_y,
|
||||
// Copy I420 to I420.
|
||||
#define I420ToI420 I420Copy
|
||||
LIBYUV_API
|
||||
int I420Copy(const uint8* src_y,
|
||||
int I420Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -81,17 +81,17 @@ int I420Copy(const uint8* src_y,
|
||||
#define I010ToI010 I010Copy
|
||||
#define H010ToH010 I010Copy
|
||||
LIBYUV_API
|
||||
int I010Copy(const uint16* src_y,
|
||||
int I010Copy(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -99,30 +99,30 @@ int I010Copy(const uint16* src_y,
|
||||
// Convert 10 bit YUV to 8 bit
|
||||
#define H010ToH420 I010ToI420
|
||||
LIBYUV_API
|
||||
int I010ToI420(const uint16* src_y,
|
||||
int I010ToI420(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I400 (grey) to I420.
|
||||
LIBYUV_API
|
||||
int I400ToI420(const uint8* src_y,
|
||||
int I400ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -131,204 +131,204 @@ int I400ToI420(const uint8* src_y,
|
||||
|
||||
// Convert NV12 to I420.
|
||||
LIBYUV_API
|
||||
int NV12ToI420(const uint8* src_y,
|
||||
int NV12ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert NV21 to I420.
|
||||
LIBYUV_API
|
||||
int NV21ToI420(const uint8* src_y,
|
||||
int NV21ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_vu,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert YUY2 to I420.
|
||||
LIBYUV_API
|
||||
int YUY2ToI420(const uint8* src_yuy2,
|
||||
int YUY2ToI420(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert UYVY to I420.
|
||||
LIBYUV_API
|
||||
int UYVYToI420(const uint8* src_uyvy,
|
||||
int UYVYToI420(const uint8_t* src_uyvy,
|
||||
int src_stride_uyvy,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert M420 to I420.
|
||||
LIBYUV_API
|
||||
int M420ToI420(const uint8* src_m420,
|
||||
int M420ToI420(const uint8_t* src_m420,
|
||||
int src_stride_m420,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert Android420 to I420.
|
||||
LIBYUV_API
|
||||
int Android420ToI420(const uint8* src_y,
|
||||
int Android420ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int pixel_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ARGB little endian (bgra in memory) to I420.
|
||||
LIBYUV_API
|
||||
int ARGBToI420(const uint8* src_frame,
|
||||
int ARGBToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// BGRA little endian (argb in memory) to I420.
|
||||
LIBYUV_API
|
||||
int BGRAToI420(const uint8* src_frame,
|
||||
int BGRAToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ABGR little endian (rgba in memory) to I420.
|
||||
LIBYUV_API
|
||||
int ABGRToI420(const uint8* src_frame,
|
||||
int ABGRToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGBA little endian (abgr in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RGBAToI420(const uint8* src_frame,
|
||||
int RGBAToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB little endian (bgr in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RGB24ToI420(const uint8* src_frame,
|
||||
int RGB24ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB big endian (rgb in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RAWToI420(const uint8* src_frame,
|
||||
int RAWToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB16 (RGBP fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int RGB565ToI420(const uint8* src_frame,
|
||||
int RGB565ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB15 (RGBO fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToI420(const uint8* src_frame,
|
||||
int ARGB1555ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB12 (R444 fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToI420(const uint8* src_frame,
|
||||
int ARGB4444ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -337,13 +337,13 @@ int ARGB4444ToI420(const uint8* src_frame,
|
||||
// src_width/height provided by capture.
|
||||
// dst_width/height for clipping determine final size.
|
||||
LIBYUV_API
|
||||
int MJPGToI420(const uint8* sample,
|
||||
int MJPGToI420(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
@ -352,7 +352,7 @@ int MJPGToI420(const uint8* sample,
|
||||
|
||||
// Query size of MJPG in pixels.
|
||||
LIBYUV_API
|
||||
int MJPGSize(const uint8* sample, size_t sample_size, int* width, int* height);
|
||||
int MJPGSize(const uint8_t* sample, size_t sample_size, int* width, int* height);
|
||||
#endif
|
||||
|
||||
// Convert camera sample to I420 with cropping, rotation and vertical flip.
|
||||
@ -378,13 +378,13 @@ int MJPGSize(const uint8* sample, size_t sample_size, int* width, int* height);
|
||||
// "format" is a fourcc. ie 'I420', 'YUY2'
|
||||
// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
|
||||
LIBYUV_API
|
||||
int ConvertToI420(const uint8* src_frame,
|
||||
int ConvertToI420(const uint8_t* src_frame,
|
||||
size_t src_size,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
@ -393,7 +393,7 @@ int ConvertToI420(const uint8* src_frame,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32 format);
|
||||
uint32_t format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -30,167 +30,167 @@ extern "C" {
|
||||
|
||||
// Copy ARGB to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBCopy(const uint8* src_argb,
|
||||
int ARGBCopy(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I420 to ARGB.
|
||||
LIBYUV_API
|
||||
int I420ToARGB(const uint8* src_y,
|
||||
int I420ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Duplicate prototype for function in convert_from.h for remoting.
|
||||
LIBYUV_API
|
||||
int I420ToABGR(const uint8* src_y,
|
||||
int I420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I010 to ARGB.
|
||||
LIBYUV_API
|
||||
int I010ToARGB(const uint16* src_y,
|
||||
int I010ToARGB(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I010 to ARGB.
|
||||
LIBYUV_API
|
||||
int I010ToARGB(const uint16* src_y,
|
||||
int I010ToARGB(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I010 to ABGR.
|
||||
LIBYUV_API
|
||||
int I010ToABGR(const uint16* src_y,
|
||||
int I010ToABGR(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H010 to ARGB.
|
||||
LIBYUV_API
|
||||
int H010ToARGB(const uint16* src_y,
|
||||
int H010ToARGB(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H010 to ABGR.
|
||||
LIBYUV_API
|
||||
int H010ToABGR(const uint16* src_y,
|
||||
int H010ToABGR(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to ARGB.
|
||||
LIBYUV_API
|
||||
int I422ToARGB(const uint8* src_y,
|
||||
int I422ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I444 to ARGB.
|
||||
LIBYUV_API
|
||||
int I444ToARGB(const uint8* src_y,
|
||||
int I444ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J444 to ARGB.
|
||||
LIBYUV_API
|
||||
int J444ToARGB(const uint8* src_y,
|
||||
int J444ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I444 to ABGR.
|
||||
LIBYUV_API
|
||||
int I444ToABGR(const uint8* src_y,
|
||||
int I444ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I420 with Alpha to preattenuated ARGB.
|
||||
LIBYUV_API
|
||||
int I420AlphaToARGB(const uint8* src_y,
|
||||
int I420AlphaToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
const uint8* src_a,
|
||||
const uint8_t* src_a,
|
||||
int src_stride_a,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height,
|
||||
@ -198,15 +198,15 @@ int I420AlphaToARGB(const uint8* src_y,
|
||||
|
||||
// Convert I420 with Alpha to preattenuated ABGR.
|
||||
LIBYUV_API
|
||||
int I420AlphaToABGR(const uint8* src_y,
|
||||
int I420AlphaToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
const uint8* src_a,
|
||||
const uint8_t* src_a,
|
||||
int src_stride_a,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height,
|
||||
@ -214,18 +214,18 @@ int I420AlphaToABGR(const uint8* src_y,
|
||||
|
||||
// Convert I400 (grey) to ARGB. Reverse of ARGBToI400.
|
||||
LIBYUV_API
|
||||
int I400ToARGB(const uint8* src_y,
|
||||
int I400ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J400 (jpeg grey) to ARGB.
|
||||
LIBYUV_API
|
||||
int J400ToARGB(const uint8* src_y,
|
||||
int J400ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
@ -235,240 +235,240 @@ int J400ToARGB(const uint8* src_y,
|
||||
|
||||
// Convert NV12 to ARGB.
|
||||
LIBYUV_API
|
||||
int NV12ToARGB(const uint8* src_y,
|
||||
int NV12ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert NV21 to ARGB.
|
||||
LIBYUV_API
|
||||
int NV21ToARGB(const uint8* src_y,
|
||||
int NV21ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_vu,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert NV12 to ABGR.
|
||||
int NV12ToABGR(const uint8* src_y,
|
||||
int NV12ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert NV21 to ABGR.
|
||||
LIBYUV_API
|
||||
int NV21ToABGR(const uint8* src_y,
|
||||
int NV21ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert M420 to ARGB.
|
||||
LIBYUV_API
|
||||
int M420ToARGB(const uint8* src_m420,
|
||||
int M420ToARGB(const uint8_t* src_m420,
|
||||
int src_stride_m420,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert YUY2 to ARGB.
|
||||
LIBYUV_API
|
||||
int YUY2ToARGB(const uint8* src_yuy2,
|
||||
int YUY2ToARGB(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert UYVY to ARGB.
|
||||
LIBYUV_API
|
||||
int UYVYToARGB(const uint8* src_uyvy,
|
||||
int UYVYToARGB(const uint8_t* src_uyvy,
|
||||
int src_stride_uyvy,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J420 to ARGB.
|
||||
LIBYUV_API
|
||||
int J420ToARGB(const uint8* src_y,
|
||||
int J420ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J422 to ARGB.
|
||||
LIBYUV_API
|
||||
int J422ToARGB(const uint8* src_y,
|
||||
int J422ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J420 to ABGR.
|
||||
LIBYUV_API
|
||||
int J420ToABGR(const uint8* src_y,
|
||||
int J420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert J422 to ABGR.
|
||||
LIBYUV_API
|
||||
int J422ToABGR(const uint8* src_y,
|
||||
int J422ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H420 to ARGB.
|
||||
LIBYUV_API
|
||||
int H420ToARGB(const uint8* src_y,
|
||||
int H420ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H422 to ARGB.
|
||||
LIBYUV_API
|
||||
int H422ToARGB(const uint8* src_y,
|
||||
int H422ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H420 to ABGR.
|
||||
LIBYUV_API
|
||||
int H420ToABGR(const uint8* src_y,
|
||||
int H420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H422 to ABGR.
|
||||
LIBYUV_API
|
||||
int H422ToABGR(const uint8* src_y,
|
||||
int H422ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H010 to ARGB.
|
||||
LIBYUV_API
|
||||
int H010ToARGB(const uint16* src_y,
|
||||
int H010ToARGB(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I010 to AR30.
|
||||
LIBYUV_API
|
||||
int I010ToAR30(const uint16* src_y,
|
||||
int I010ToAR30(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert H010 to AR30.
|
||||
LIBYUV_API
|
||||
int H010ToAR30(const uint16* src_y,
|
||||
int H010ToAR30(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// BGRA little endian (argb in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int BGRAToARGB(const uint8* src_frame,
|
||||
int BGRAToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// ABGR little endian (rgba in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int ABGRToARGB(const uint8* src_frame,
|
||||
int ABGRToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGBA little endian (abgr in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RGBAToARGB(const uint8* src_frame,
|
||||
int RGBAToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
@ -478,54 +478,54 @@ int RGBAToARGB(const uint8* src_frame,
|
||||
|
||||
// RGB little endian (bgr in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RGB24ToARGB(const uint8* src_frame,
|
||||
int RGB24ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB big endian (rgb in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RAWToARGB(const uint8* src_frame,
|
||||
int RAWToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB16 (RGBP fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int RGB565ToARGB(const uint8* src_frame,
|
||||
int RGB565ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB15 (RGBO fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToARGB(const uint8* src_frame,
|
||||
int ARGB1555ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// RGB12 (R444 fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToARGB(const uint8* src_frame,
|
||||
int ARGB4444ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert AR30 To ARGB.
|
||||
LIBYUV_API
|
||||
int AR30ToARGB(const uint8* src_ar30,
|
||||
int AR30ToARGB(const uint8_t* src_ar30,
|
||||
int src_stride_ar30,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
@ -534,9 +534,9 @@ int AR30ToARGB(const uint8* src_ar30,
|
||||
// src_width/height provided by capture
|
||||
// dst_width/height for clipping determine final size.
|
||||
LIBYUV_API
|
||||
int MJPGToARGB(const uint8* sample,
|
||||
int MJPGToARGB(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
@ -546,28 +546,28 @@ int MJPGToARGB(const uint8* sample,
|
||||
|
||||
// Convert Android420 to ARGB.
|
||||
LIBYUV_API
|
||||
int Android420ToARGB(const uint8* src_y,
|
||||
int Android420ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_pixel_stride_uv,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert Android420 to ABGR.
|
||||
LIBYUV_API
|
||||
int Android420ToABGR(const uint8* src_y,
|
||||
int Android420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_pixel_stride_uv,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
@ -595,9 +595,9 @@ int Android420ToABGR(const uint8* src_y,
|
||||
// "format" is a fourcc. ie 'I420', 'YUY2'
|
||||
// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
|
||||
LIBYUV_API
|
||||
int ConvertToARGB(const uint8* src_frame,
|
||||
int ConvertToARGB(const uint8_t* src_frame,
|
||||
size_t src_size,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
@ -606,7 +606,7 @@ int ConvertToARGB(const uint8* src_frame,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32 format);
|
||||
uint32_t format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -23,230 +23,230 @@ extern "C" {
|
||||
|
||||
// Convert 8 bit YUV to 10 bit.
|
||||
#define H420ToH010 I420ToI010
|
||||
int I420ToI010(const uint8* src_y,
|
||||
int I420ToI010(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToI422(const uint8* src_y,
|
||||
int I420ToI422(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToI444(const uint8* src_y,
|
||||
int I420ToI444(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21.
|
||||
LIBYUV_API
|
||||
int I400Copy(const uint8* src_y,
|
||||
int I400Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToNV12(const uint8* src_y,
|
||||
int I420ToNV12(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToNV21(const uint8* src_y,
|
||||
int I420ToNV21(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_vu,
|
||||
uint8_t* dst_vu,
|
||||
int dst_stride_vu,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToYUY2(const uint8* src_y,
|
||||
int I420ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToUYVY(const uint8* src_y,
|
||||
int I420ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToARGB(const uint8* src_y,
|
||||
int I420ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToBGRA(const uint8* src_y,
|
||||
int I420ToBGRA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToABGR(const uint8* src_y,
|
||||
int I420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToRGBA(const uint8* src_y,
|
||||
int I420ToRGBA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToRGB24(const uint8* src_y,
|
||||
int I420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToRAW(const uint8* src_y,
|
||||
int I420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int H420ToRGB24(const uint8* src_y,
|
||||
int H420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int H420ToRAW(const uint8* src_y,
|
||||
int H420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToRGB565(const uint8* src_y,
|
||||
int I420ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I422ToRGB565(const uint8* src_y,
|
||||
int I422ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
@ -256,50 +256,50 @@ int I422ToRGB565(const uint8* src_y,
|
||||
// The order of the dither matrix is first byte is upper left.
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToRGB565Dither(const uint8* src_y,
|
||||
int I420ToRGB565Dither(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
const uint8* dither4x4,
|
||||
const uint8_t* dither4x4,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToARGB1555(const uint8* src_y,
|
||||
int I420ToARGB1555(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToARGB4444(const uint8* src_y,
|
||||
int I420ToARGB4444(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
// Convert I420 to AR30.
|
||||
LIBYUV_API
|
||||
int I420ToAR30(const uint8* src_y,
|
||||
int I420ToAR30(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height);
|
||||
@ -308,17 +308,17 @@ int I420ToAR30(const uint8* src_y,
|
||||
// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
|
||||
// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
|
||||
LIBYUV_API
|
||||
int ConvertFromI420(const uint8* y,
|
||||
int ConvertFromI420(const uint8_t* y,
|
||||
int y_stride,
|
||||
const uint8* u,
|
||||
const uint8_t* u,
|
||||
int u_stride,
|
||||
const uint8* v,
|
||||
const uint8_t* v,
|
||||
int v_stride,
|
||||
uint8* dst_sample,
|
||||
uint8_t* dst_sample,
|
||||
int dst_sample_stride,
|
||||
int width,
|
||||
int height,
|
||||
uint32 format);
|
||||
uint32_t format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -21,72 +21,72 @@ extern "C" {
|
||||
// Copy ARGB to ARGB.
|
||||
#define ARGBToARGB ARGBCopy
|
||||
LIBYUV_API
|
||||
int ARGBCopy(const uint8* src_argb,
|
||||
int ARGBCopy(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To BGRA.
|
||||
LIBYUV_API
|
||||
int ARGBToBGRA(const uint8* src_argb,
|
||||
int ARGBToBGRA(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_bgra,
|
||||
uint8_t* dst_bgra,
|
||||
int dst_stride_bgra,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To ABGR.
|
||||
LIBYUV_API
|
||||
int ARGBToABGR(const uint8* src_argb,
|
||||
int ARGBToABGR(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To RGBA.
|
||||
LIBYUV_API
|
||||
int ARGBToRGBA(const uint8* src_argb,
|
||||
int ARGBToRGBA(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To AR30.
|
||||
LIBYUV_API
|
||||
int ARGBToAR30(const uint8* src_argb,
|
||||
int ARGBToAR30(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To RGB24.
|
||||
LIBYUV_API
|
||||
int ARGBToRGB24(const uint8* src_argb,
|
||||
int ARGBToRGB24(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To RAW.
|
||||
LIBYUV_API
|
||||
int ARGBToRAW(const uint8* src_argb,
|
||||
int ARGBToRAW(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb,
|
||||
uint8_t* dst_rgb,
|
||||
int dst_stride_rgb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To RGB565.
|
||||
LIBYUV_API
|
||||
int ARGBToRGB565(const uint8* src_argb,
|
||||
int ARGBToRGB565(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height);
|
||||
@ -95,173 +95,173 @@ int ARGBToRGB565(const uint8* src_argb,
|
||||
// Values in dither matrix from 0 to 7 recommended.
|
||||
// The order of the dither matrix is first byte is upper left.
|
||||
// TODO(fbarchard): Consider pointer to 2d array for dither4x4.
|
||||
// const uint8(*dither)[4][4];
|
||||
// const uint8_t(*dither)[4][4];
|
||||
LIBYUV_API
|
||||
int ARGBToRGB565Dither(const uint8* src_argb,
|
||||
int ARGBToRGB565Dither(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
const uint8* dither4x4,
|
||||
const uint8_t* dither4x4,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To ARGB1555.
|
||||
LIBYUV_API
|
||||
int ARGBToARGB1555(const uint8* src_argb,
|
||||
int ARGBToARGB1555(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb1555,
|
||||
uint8_t* dst_argb1555,
|
||||
int dst_stride_argb1555,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To ARGB4444.
|
||||
LIBYUV_API
|
||||
int ARGBToARGB4444(const uint8* src_argb,
|
||||
int ARGBToARGB4444(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb4444,
|
||||
uint8_t* dst_argb4444,
|
||||
int dst_stride_argb4444,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To I444.
|
||||
LIBYUV_API
|
||||
int ARGBToI444(const uint8* src_argb,
|
||||
int ARGBToI444(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To I422.
|
||||
LIBYUV_API
|
||||
int ARGBToI422(const uint8* src_argb,
|
||||
int ARGBToI422(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To I420. (also in convert.h)
|
||||
LIBYUV_API
|
||||
int ARGBToI420(const uint8* src_argb,
|
||||
int ARGBToI420(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB to J420. (JPeg full range I420).
|
||||
LIBYUV_API
|
||||
int ARGBToJ420(const uint8* src_argb,
|
||||
int ARGBToJ420(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB to J422.
|
||||
LIBYUV_API
|
||||
int ARGBToJ422(const uint8* src_argb,
|
||||
int ARGBToJ422(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB to J400. (JPeg full range).
|
||||
LIBYUV_API
|
||||
int ARGBToJ400(const uint8* src_argb,
|
||||
int ARGBToJ400(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB to I400.
|
||||
LIBYUV_API
|
||||
int ARGBToI400(const uint8* src_argb,
|
||||
int ARGBToI400(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB)
|
||||
LIBYUV_API
|
||||
int ARGBToG(const uint8* src_argb,
|
||||
int ARGBToG(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_g,
|
||||
uint8_t* dst_g,
|
||||
int dst_stride_g,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To NV12.
|
||||
LIBYUV_API
|
||||
int ARGBToNV12(const uint8* src_argb,
|
||||
int ARGBToNV12(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To NV21.
|
||||
LIBYUV_API
|
||||
int ARGBToNV21(const uint8* src_argb,
|
||||
int ARGBToNV21(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_vu,
|
||||
uint8_t* dst_vu,
|
||||
int dst_stride_vu,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To NV21.
|
||||
LIBYUV_API
|
||||
int ARGBToNV21(const uint8* src_argb,
|
||||
int ARGBToNV21(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_vu,
|
||||
uint8_t* dst_vu,
|
||||
int dst_stride_vu,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To YUY2.
|
||||
LIBYUV_API
|
||||
int ARGBToYUY2(const uint8* src_argb,
|
||||
int ARGBToYUY2(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yuy2,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert ARGB To UYVY.
|
||||
LIBYUV_API
|
||||
int ARGBToUYVY(const uint8* src_argb,
|
||||
int ARGBToUYVY(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_uyvy,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
#if (__mips_isa_rev >= 6)
|
||||
#define LW(psrc) \
|
||||
({ \
|
||||
uint8* psrc_lw_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint32 val_m; \
|
||||
uint8_t* psrc_lw_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint32_t val_m; \
|
||||
asm volatile("lw %[val_m], %[psrc_lw_m] \n" \
|
||||
: [val_m] "=r"(val_m) \
|
||||
: [psrc_lw_m] "m"(*psrc_lw_m)); \
|
||||
@ -29,8 +29,8 @@
|
||||
#if (__mips == 64)
|
||||
#define LD(psrc) \
|
||||
({ \
|
||||
uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint64 val_m = 0; \
|
||||
uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint64_t val_m = 0; \
|
||||
asm volatile("ld %[val_m], %[psrc_ld_m] \n" \
|
||||
: [val_m] "=r"(val_m) \
|
||||
: [psrc_ld_m] "m"(*psrc_ld_m)); \
|
||||
@ -39,14 +39,14 @@
|
||||
#else // !(__mips == 64)
|
||||
#define LD(psrc) \
|
||||
({ \
|
||||
uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint32 val0_m, val1_m; \
|
||||
uint64 val_m = 0; \
|
||||
uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint32_t val0_m, val1_m; \
|
||||
uint64_t val_m = 0; \
|
||||
val0_m = LW(psrc_ld_m); \
|
||||
val1_m = LW(psrc_ld_m + 4); \
|
||||
val_m = (uint64)(val1_m); /* NOLINT */ \
|
||||
val_m = (uint64)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
|
||||
val_m = (uint64)(val_m | (uint64)val0_m); /* NOLINT */ \
|
||||
val_m = (uint64_t)(val1_m); /* NOLINT */ \
|
||||
val_m = (uint64_t)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
|
||||
val_m = (uint64_t)(val_m | (uint64_t)val0_m); /* NOLINT */ \
|
||||
val_m; \
|
||||
})
|
||||
#endif // (__mips == 64)
|
||||
@ -83,8 +83,8 @@
|
||||
#else // !(__mips_isa_rev >= 6)
|
||||
#define LW(psrc) \
|
||||
({ \
|
||||
uint8* psrc_lw_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint32 val_m; \
|
||||
uint8_t* psrc_lw_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint32_t val_m; \
|
||||
asm volatile("ulw %[val_m], %[psrc_lw_m] \n" \
|
||||
: [val_m] "=r"(val_m) \
|
||||
: [psrc_lw_m] "m"(*psrc_lw_m)); \
|
||||
@ -94,8 +94,8 @@
|
||||
#if (__mips == 64)
|
||||
#define LD(psrc) \
|
||||
({ \
|
||||
uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint64 val_m = 0; \
|
||||
uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint64_t val_m = 0; \
|
||||
asm volatile("uld %[val_m], %[psrc_ld_m] \n" \
|
||||
: [val_m] "=r"(val_m) \
|
||||
: [psrc_ld_m] "m"(*psrc_ld_m)); \
|
||||
@ -104,14 +104,14 @@
|
||||
#else // !(__mips == 64)
|
||||
#define LD(psrc) \
|
||||
({ \
|
||||
uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
|
||||
uint32 val0_m, val1_m; \
|
||||
uint64 val_m = 0; \
|
||||
uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
|
||||
uint32_t val0_m, val1_m; \
|
||||
uint64_t val_m = 0; \
|
||||
val0_m = LW(psrc_ld_m); \
|
||||
val1_m = LW(psrc_ld_m + 4); \
|
||||
val_m = (uint64)(val1_m); /* NOLINT */ \
|
||||
val_m = (uint64)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
|
||||
val_m = (uint64)(val_m | (uint64)val0_m); /* NOLINT */ \
|
||||
val_m = (uint64_t)(val1_m); /* NOLINT */ \
|
||||
val_m = (uint64_t)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
|
||||
val_m = (uint64_t)(val_m | (uint64_t)val0_m); /* NOLINT */ \
|
||||
val_m; \
|
||||
})
|
||||
#endif // (__mips == 64)
|
||||
|
||||
@ -26,13 +26,13 @@ namespace libyuv {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size);
|
||||
LIBYUV_BOOL ValidateJpeg(const uint8_t* sample, size_t sample_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
static const uint32 kUnknownDataSize = 0xFFFFFFFF;
|
||||
static const uint32_t kUnknownDataSize = 0xFFFFFFFF;
|
||||
|
||||
enum JpegSubsamplingType {
|
||||
kJpegYuv420,
|
||||
@ -43,7 +43,7 @@ enum JpegSubsamplingType {
|
||||
};
|
||||
|
||||
struct Buffer {
|
||||
const uint8* data;
|
||||
const uint8_t* data;
|
||||
int len;
|
||||
};
|
||||
|
||||
@ -65,7 +65,7 @@ struct SetJmpErrorMgr;
|
||||
class LIBYUV_API MJpegDecoder {
|
||||
public:
|
||||
typedef void (*CallbackFunction)(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows);
|
||||
|
||||
@ -85,7 +85,7 @@ class LIBYUV_API MJpegDecoder {
|
||||
// If return value is LIBYUV_TRUE, then the values for all the following
|
||||
// getters are populated.
|
||||
// src_len is the size of the compressed mjpeg frame in bytes.
|
||||
LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len);
|
||||
LIBYUV_BOOL LoadFrame(const uint8_t* src, size_t src_len);
|
||||
|
||||
// Returns width of the last loaded frame in pixels.
|
||||
int GetWidth();
|
||||
@ -138,7 +138,7 @@ class LIBYUV_API MJpegDecoder {
|
||||
// at least GetComponentSize(i). The pointers in planes are incremented
|
||||
// to point to after the end of the written data.
|
||||
// TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
|
||||
LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height);
|
||||
LIBYUV_BOOL DecodeToBuffers(uint8_t** planes, int dst_width, int dst_height);
|
||||
|
||||
// Decodes the entire image and passes the data via repeated calls to a
|
||||
// callback function. Each call will get the data for a whole number of
|
||||
@ -162,7 +162,7 @@ class LIBYUV_API MJpegDecoder {
|
||||
LIBYUV_BOOL StartDecode();
|
||||
LIBYUV_BOOL FinishDecode();
|
||||
|
||||
void SetScanlinePointers(uint8** data);
|
||||
void SetScanlinePointers(uint8_t** data);
|
||||
LIBYUV_BOOL DecodeImcuRow();
|
||||
|
||||
int GetComponentScanlinePadding(int component);
|
||||
@ -181,11 +181,11 @@ class LIBYUV_API MJpegDecoder {
|
||||
|
||||
// Temporaries used to point to scanline outputs.
|
||||
int num_outbufs_; // Outermost size of all arrays below.
|
||||
uint8*** scanlines_;
|
||||
uint8_t*** scanlines_;
|
||||
int* scanlines_sizes_;
|
||||
// Temporary buffer used for decoding when we can't decode directly to the
|
||||
// output buffers. Large enough for just one iMCU row.
|
||||
uint8** databuf_;
|
||||
uint8_t** databuf_;
|
||||
int* databuf_strides_;
|
||||
};
|
||||
|
||||
|
||||
@ -42,34 +42,34 @@ extern "C" {
|
||||
|
||||
// Copy a plane of data.
|
||||
LIBYUV_API
|
||||
void CopyPlane(const uint8* src_y,
|
||||
void CopyPlane(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void CopyPlane_16(const uint16* src_y,
|
||||
void CopyPlane_16(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void Convert16To8Plane(const uint16* src_y,
|
||||
void Convert16To8Plane(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int scale, // 16384 for 10 bits
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void Convert8To16Plane(const uint8* src_y,
|
||||
void Convert8To16Plane(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int scale, // 1024 for 10 bits
|
||||
int width,
|
||||
@ -77,65 +77,65 @@ void Convert8To16Plane(const uint8* src_y,
|
||||
|
||||
// Set a plane of data to a 32 bit value.
|
||||
LIBYUV_API
|
||||
void SetPlane(uint8* dst_y,
|
||||
void SetPlane(uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height,
|
||||
uint32 value);
|
||||
uint32_t value);
|
||||
|
||||
// Split interleaved UV plane into separate U and V planes.
|
||||
LIBYUV_API
|
||||
void SplitUVPlane(const uint8* src_uv,
|
||||
void SplitUVPlane(const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Merge separate U and V planes into one interleaved UV plane.
|
||||
LIBYUV_API
|
||||
void MergeUVPlane(const uint8* src_u,
|
||||
void MergeUVPlane(const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Split interleaved RGB plane into separate R, G and B planes.
|
||||
LIBYUV_API
|
||||
void SplitRGBPlane(const uint8* src_rgb,
|
||||
void SplitRGBPlane(const uint8_t* src_rgb,
|
||||
int src_stride_rgb,
|
||||
uint8* dst_r,
|
||||
uint8_t* dst_r,
|
||||
int dst_stride_r,
|
||||
uint8* dst_g,
|
||||
uint8_t* dst_g,
|
||||
int dst_stride_g,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Merge separate R, G and B planes into one interleaved RGB plane.
|
||||
LIBYUV_API
|
||||
void MergeRGBPlane(const uint8* src_r,
|
||||
void MergeRGBPlane(const uint8_t* src_r,
|
||||
int src_stride_r,
|
||||
const uint8* src_g,
|
||||
const uint8_t* src_g,
|
||||
int src_stride_g,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int src_stride_b,
|
||||
uint8* dst_rgb,
|
||||
uint8_t* dst_rgb,
|
||||
int dst_stride_rgb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Copy I400. Supports inverting.
|
||||
LIBYUV_API
|
||||
int I400ToI400(const uint8* src_y,
|
||||
int I400ToI400(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
@ -145,17 +145,17 @@ int I400ToI400(const uint8* src_y,
|
||||
// Copy I422 to I422.
|
||||
#define I422ToI422 I422Copy
|
||||
LIBYUV_API
|
||||
int I422Copy(const uint8* src_y,
|
||||
int I422Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -163,84 +163,84 @@ int I422Copy(const uint8* src_y,
|
||||
// Copy I444 to I444.
|
||||
#define I444ToI444 I444Copy
|
||||
LIBYUV_API
|
||||
int I444Copy(const uint8* src_y,
|
||||
int I444Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert YUY2 to I422.
|
||||
LIBYUV_API
|
||||
int YUY2ToI422(const uint8* src_yuy2,
|
||||
int YUY2ToI422(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert UYVY to I422.
|
||||
LIBYUV_API
|
||||
int UYVYToI422(const uint8* src_uyvy,
|
||||
int UYVYToI422(const uint8_t* src_uyvy,
|
||||
int src_stride_uyvy,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int YUY2ToNV12(const uint8* src_yuy2,
|
||||
int YUY2ToNV12(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int UYVYToNV12(const uint8* src_uyvy,
|
||||
int UYVYToNV12(const uint8_t* src_uyvy,
|
||||
int src_stride_uyvy,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
int YUY2ToY(const uint8* src_yuy2,
|
||||
int YUY2ToY(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I420 to I400. (calls CopyPlane ignoring u/v).
|
||||
LIBYUV_API
|
||||
int I420ToI400(const uint8* src_y,
|
||||
int I420ToI400(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
@ -251,17 +251,17 @@ int I420ToI400(const uint8* src_y,
|
||||
|
||||
// I420 mirror.
|
||||
LIBYUV_API
|
||||
int I420Mirror(const uint8* src_y,
|
||||
int I420Mirror(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
@ -272,9 +272,9 @@ int I420Mirror(const uint8* src_y,
|
||||
// I400 mirror. A single plane is mirrored horizontally.
|
||||
// Pass negative height to achieve 180 degree rotation.
|
||||
LIBYUV_API
|
||||
int I400Mirror(const uint8* src_y,
|
||||
int I400Mirror(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
@ -284,20 +284,20 @@ int I400Mirror(const uint8* src_y,
|
||||
|
||||
// ARGB mirror.
|
||||
LIBYUV_API
|
||||
int ARGBMirror(const uint8* src_argb,
|
||||
int ARGBMirror(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert NV12 to RGB565.
|
||||
LIBYUV_API
|
||||
int NV12ToRGB565(const uint8* src_y,
|
||||
int NV12ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height);
|
||||
@ -305,39 +305,39 @@ int NV12ToRGB565(const uint8* src_y,
|
||||
// I422ToARGB is in convert_argb.h
|
||||
// Convert I422 to BGRA.
|
||||
LIBYUV_API
|
||||
int I422ToBGRA(const uint8* src_y,
|
||||
int I422ToBGRA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_bgra,
|
||||
uint8_t* dst_bgra,
|
||||
int dst_stride_bgra,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to ABGR.
|
||||
LIBYUV_API
|
||||
int I422ToABGR(const uint8* src_y,
|
||||
int I422ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_abgr,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to RGBA.
|
||||
LIBYUV_API
|
||||
int I422ToRGBA(const uint8* src_y,
|
||||
int I422ToRGBA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
int width,
|
||||
int height);
|
||||
@ -346,20 +346,20 @@ int I422ToRGBA(const uint8* src_y,
|
||||
#define RGB24ToRAW RAWToRGB24
|
||||
|
||||
LIBYUV_API
|
||||
int RAWToRGB24(const uint8* src_raw,
|
||||
int RAWToRGB24(const uint8_t* src_raw,
|
||||
int src_stride_raw,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Draw a rectangle into I420.
|
||||
LIBYUV_API
|
||||
int I420Rect(uint8* dst_y,
|
||||
int I420Rect(uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int x,
|
||||
int y,
|
||||
@ -371,26 +371,26 @@ int I420Rect(uint8* dst_y,
|
||||
|
||||
// Draw a rectangle into ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBRect(uint8* dst_argb,
|
||||
int ARGBRect(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32 value);
|
||||
uint32_t value);
|
||||
|
||||
// Convert ARGB to gray scale ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBGrayTo(const uint8* src_argb,
|
||||
int ARGBGrayTo(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Make a rectangle of ARGB gray scale.
|
||||
LIBYUV_API
|
||||
int ARGBGray(uint8* dst_argb,
|
||||
int ARGBGray(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
@ -399,7 +399,7 @@ int ARGBGray(uint8* dst_argb,
|
||||
|
||||
// Make a rectangle of ARGB Sepia tone.
|
||||
LIBYUV_API
|
||||
int ARGBSepia(uint8* dst_argb,
|
||||
int ARGBSepia(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
@ -413,11 +413,11 @@ int ARGBSepia(uint8* dst_argb,
|
||||
// The next 4 coefficients apply to B, G, R, A and produce R of the output.
|
||||
// The last 4 coefficients apply to B, G, R, A and produce A of the output.
|
||||
LIBYUV_API
|
||||
int ARGBColorMatrix(const uint8* src_argb,
|
||||
int ARGBColorMatrix(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const int8* matrix_argb,
|
||||
const int8_t* matrix_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -428,9 +428,9 @@ int ARGBColorMatrix(const uint8* src_argb,
|
||||
// The next 4 coefficients apply to B, G, R, A and produce G of the output.
|
||||
// The last 4 coefficients apply to B, G, R, A and produce R of the output.
|
||||
LIBYUV_API
|
||||
int RGBColorMatrix(uint8* dst_argb,
|
||||
int RGBColorMatrix(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const int8* matrix_rgb,
|
||||
const int8_t* matrix_rgb,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
@ -439,9 +439,9 @@ int RGBColorMatrix(uint8* dst_argb,
|
||||
// Apply a color table each ARGB pixel.
|
||||
// Table contains 256 ARGB values.
|
||||
LIBYUV_API
|
||||
int ARGBColorTable(uint8* dst_argb,
|
||||
int ARGBColorTable(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8* table_argb,
|
||||
const uint8_t* table_argb,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
@ -450,9 +450,9 @@ int ARGBColorTable(uint8* dst_argb,
|
||||
// Apply a color table each ARGB pixel but preserve destination alpha.
|
||||
// Table contains 256 ARGB values.
|
||||
LIBYUV_API
|
||||
int RGBColorTable(uint8* dst_argb,
|
||||
int RGBColorTable(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8* table_argb,
|
||||
const uint8_t* table_argb,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
@ -462,11 +462,11 @@ int RGBColorTable(uint8* dst_argb,
|
||||
// Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from
|
||||
// RGB (YJ style) and C is an 8 bit color component (R, G or B).
|
||||
LIBYUV_API
|
||||
int ARGBLumaColorTable(const uint8* src_argb,
|
||||
int ARGBLumaColorTable(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8* luma_rgb_table,
|
||||
const uint8_t* luma_rgb_table,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -479,9 +479,9 @@ int ARGBLumaColorTable(const uint8* src_argb,
|
||||
// A polynomial approximation can be dirived using software such as 'R'.
|
||||
|
||||
LIBYUV_API
|
||||
int ARGBPolynomial(const uint8* src_argb,
|
||||
int ARGBPolynomial(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const float* poly,
|
||||
int width,
|
||||
@ -490,9 +490,9 @@ int ARGBPolynomial(const uint8* src_argb,
|
||||
// Convert plane of 16 bit shorts to half floats.
|
||||
// Source values are multiplied by scale before storing as half float.
|
||||
LIBYUV_API
|
||||
int HalfFloatPlane(const uint16* src_y,
|
||||
int HalfFloatPlane(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
float scale,
|
||||
int width,
|
||||
@ -503,7 +503,7 @@ int HalfFloatPlane(const uint16* src_y,
|
||||
// interval_size should be a value between 1 and 255.
|
||||
// interval_offset should be a value between 0 and 255.
|
||||
LIBYUV_API
|
||||
int ARGBQuantize(uint8* dst_argb,
|
||||
int ARGBQuantize(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int scale,
|
||||
int interval_size,
|
||||
@ -515,43 +515,43 @@ int ARGBQuantize(uint8* dst_argb,
|
||||
|
||||
// Copy ARGB to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBCopy(const uint8* src_argb,
|
||||
int ARGBCopy(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Copy Alpha channel of ARGB to alpha of ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBCopyAlpha(const uint8* src_argb,
|
||||
int ARGBCopyAlpha(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Extract the alpha channel from ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBExtractAlpha(const uint8* src_argb,
|
||||
int ARGBExtractAlpha(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Copy Y channel to Alpha of ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBCopyYToAlpha(const uint8* src_y,
|
||||
int ARGBCopyYToAlpha(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
typedef void (*ARGBBlendRow)(const uint8* src_argb0,
|
||||
const uint8* src_argb1,
|
||||
uint8* dst_argb,
|
||||
typedef void (*ARGBBlendRow)(const uint8_t* src_argb0,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width);
|
||||
|
||||
// Get function to Alpha Blend ARGB pixels and store to destination.
|
||||
@ -562,11 +562,11 @@ ARGBBlendRow GetARGBBlend();
|
||||
// Source is pre-multiplied by alpha using ARGBAttenuate.
|
||||
// Alpha of destination is set to 255.
|
||||
LIBYUV_API
|
||||
int ARGBBlend(const uint8* src_argb0,
|
||||
int ARGBBlend(const uint8_t* src_argb0,
|
||||
int src_stride_argb0,
|
||||
const uint8* src_argb1,
|
||||
const uint8_t* src_argb1,
|
||||
int src_stride_argb1,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
@ -574,13 +574,13 @@ int ARGBBlend(const uint8* src_argb0,
|
||||
// Alpha Blend plane and store to destination.
|
||||
// Source is not pre-multiplied by alpha.
|
||||
LIBYUV_API
|
||||
int BlendPlane(const uint8* src_y0,
|
||||
int BlendPlane(const uint8_t* src_y0,
|
||||
int src_stride_y0,
|
||||
const uint8* src_y1,
|
||||
const uint8_t* src_y1,
|
||||
int src_stride_y1,
|
||||
const uint8* alpha,
|
||||
const uint8_t* alpha,
|
||||
int alpha_stride,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
@ -589,102 +589,102 @@ int BlendPlane(const uint8* src_y0,
|
||||
// Source is not pre-multiplied by alpha.
|
||||
// Alpha is full width x height and subsampled to half size to apply to UV.
|
||||
LIBYUV_API
|
||||
int I420Blend(const uint8* src_y0,
|
||||
int I420Blend(const uint8_t* src_y0,
|
||||
int src_stride_y0,
|
||||
const uint8* src_u0,
|
||||
const uint8_t* src_u0,
|
||||
int src_stride_u0,
|
||||
const uint8* src_v0,
|
||||
const uint8_t* src_v0,
|
||||
int src_stride_v0,
|
||||
const uint8* src_y1,
|
||||
const uint8_t* src_y1,
|
||||
int src_stride_y1,
|
||||
const uint8* src_u1,
|
||||
const uint8_t* src_u1,
|
||||
int src_stride_u1,
|
||||
const uint8* src_v1,
|
||||
const uint8_t* src_v1,
|
||||
int src_stride_v1,
|
||||
const uint8* alpha,
|
||||
const uint8_t* alpha,
|
||||
int alpha_stride,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255.
|
||||
LIBYUV_API
|
||||
int ARGBMultiply(const uint8* src_argb0,
|
||||
int ARGBMultiply(const uint8_t* src_argb0,
|
||||
int src_stride_argb0,
|
||||
const uint8* src_argb1,
|
||||
const uint8_t* src_argb1,
|
||||
int src_stride_argb1,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Add ARGB image with ARGB image. Saturates to 255.
|
||||
LIBYUV_API
|
||||
int ARGBAdd(const uint8* src_argb0,
|
||||
int ARGBAdd(const uint8_t* src_argb0,
|
||||
int src_stride_argb0,
|
||||
const uint8* src_argb1,
|
||||
const uint8_t* src_argb1,
|
||||
int src_stride_argb1,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0.
|
||||
LIBYUV_API
|
||||
int ARGBSubtract(const uint8* src_argb0,
|
||||
int ARGBSubtract(const uint8_t* src_argb0,
|
||||
int src_stride_argb0,
|
||||
const uint8* src_argb1,
|
||||
const uint8_t* src_argb1,
|
||||
int src_stride_argb1,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to YUY2.
|
||||
LIBYUV_API
|
||||
int I422ToYUY2(const uint8* src_y,
|
||||
int I422ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert I422 to UYVY.
|
||||
LIBYUV_API
|
||||
int I422ToUYVY(const uint8* src_y,
|
||||
int I422ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_frame,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert unattentuated ARGB to preattenuated ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBAttenuate(const uint8* src_argb,
|
||||
int ARGBAttenuate(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Convert preattentuated ARGB to unattenuated ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBUnattenuate(const uint8* src_argb,
|
||||
int ARGBUnattenuate(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
@ -693,9 +693,9 @@ int ARGBUnattenuate(const uint8* src_argb,
|
||||
// Computes table of cumulative sum for image where the value is the sum
|
||||
// of all values above and to the left of the entry. Used by ARGBBlur.
|
||||
LIBYUV_API
|
||||
int ARGBComputeCumulativeSum(const uint8* src_argb,
|
||||
int ARGBComputeCumulativeSum(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int32* dst_cumsum,
|
||||
int32_t* dst_cumsum,
|
||||
int dst_stride32_cumsum,
|
||||
int width,
|
||||
int height);
|
||||
@ -707,11 +707,11 @@ int ARGBComputeCumulativeSum(const uint8* src_argb,
|
||||
// radius is number of pixels around the center. e.g. 1 = 3x3. 2=5x5.
|
||||
// Blur is optimized for radius of 5 (11x11) or less.
|
||||
LIBYUV_API
|
||||
int ARGBBlur(const uint8* src_argb,
|
||||
int ARGBBlur(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int32* dst_cumsum,
|
||||
int32_t* dst_cumsum,
|
||||
int dst_stride32_cumsum,
|
||||
int width,
|
||||
int height,
|
||||
@ -719,24 +719,24 @@ int ARGBBlur(const uint8* src_argb,
|
||||
|
||||
// Multiply ARGB image by ARGB value.
|
||||
LIBYUV_API
|
||||
int ARGBShade(const uint8* src_argb,
|
||||
int ARGBShade(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height,
|
||||
uint32 value);
|
||||
uint32_t value);
|
||||
|
||||
// Interpolate between two images using specified amount of interpolation
|
||||
// (0 to 255) and store to destination.
|
||||
// 'interpolation' is specified as 8 bit fraction where 0 means 100% src0
|
||||
// and 255 means 1% src0 and 99% src1.
|
||||
LIBYUV_API
|
||||
int InterpolatePlane(const uint8* src0,
|
||||
int InterpolatePlane(const uint8_t* src0,
|
||||
int src_stride0,
|
||||
const uint8* src1,
|
||||
const uint8_t* src1,
|
||||
int src_stride1,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height,
|
||||
@ -745,11 +745,11 @@ int InterpolatePlane(const uint8* src0,
|
||||
// Interpolate between two ARGB images using specified amount of interpolation
|
||||
// Internally calls InterpolatePlane with width * 4 (bpp).
|
||||
LIBYUV_API
|
||||
int ARGBInterpolate(const uint8* src_argb0,
|
||||
int ARGBInterpolate(const uint8_t* src_argb0,
|
||||
int src_stride_argb0,
|
||||
const uint8* src_argb1,
|
||||
const uint8_t* src_argb1,
|
||||
int src_stride_argb1,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height,
|
||||
@ -759,23 +759,23 @@ int ARGBInterpolate(const uint8* src_argb0,
|
||||
// Internally calls InterpolatePlane on each plane where the U and V planes
|
||||
// are half width and half height.
|
||||
LIBYUV_API
|
||||
int I420Interpolate(const uint8* src0_y,
|
||||
int I420Interpolate(const uint8_t* src0_y,
|
||||
int src0_stride_y,
|
||||
const uint8* src0_u,
|
||||
const uint8_t* src0_u,
|
||||
int src0_stride_u,
|
||||
const uint8* src0_v,
|
||||
const uint8_t* src0_v,
|
||||
int src0_stride_v,
|
||||
const uint8* src1_y,
|
||||
const uint8_t* src1_y,
|
||||
int src1_stride_y,
|
||||
const uint8* src1_u,
|
||||
const uint8_t* src1_u,
|
||||
int src1_stride_u,
|
||||
const uint8* src1_v,
|
||||
const uint8_t* src1_v,
|
||||
int src1_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height,
|
||||
@ -784,53 +784,53 @@ int I420Interpolate(const uint8* src0_y,
|
||||
// Row function for copying pixels from a source with a slope to a row
|
||||
// of destination. Useful for scaling, rotation, mirror, texture mapping.
|
||||
LIBYUV_API
|
||||
void ARGBAffineRow_C(const uint8* src_argb,
|
||||
void ARGBAffineRow_C(const uint8_t* src_argb,
|
||||
int src_argb_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
const float* uv_dudv,
|
||||
int width);
|
||||
// TODO(fbarchard): Move ARGBAffineRow_SSE2 to row.h
|
||||
LIBYUV_API
|
||||
void ARGBAffineRow_SSE2(const uint8* src_argb,
|
||||
void ARGBAffineRow_SSE2(const uint8_t* src_argb,
|
||||
int src_argb_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
const float* uv_dudv,
|
||||
int width);
|
||||
|
||||
// Shuffle ARGB channel order. e.g. BGRA to ARGB.
|
||||
// shuffler is 16 bytes and must be aligned.
|
||||
LIBYUV_API
|
||||
int ARGBShuffle(const uint8* src_bgra,
|
||||
int ARGBShuffle(const uint8_t* src_bgra,
|
||||
int src_stride_bgra,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8* shuffler,
|
||||
const uint8_t* shuffler,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Sobel ARGB effect with planar output.
|
||||
LIBYUV_API
|
||||
int ARGBSobelToPlane(const uint8* src_argb,
|
||||
int ARGBSobelToPlane(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Sobel ARGB effect.
|
||||
LIBYUV_API
|
||||
int ARGBSobel(const uint8* src_argb,
|
||||
int ARGBSobel(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
// Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBSobelXY(const uint8* src_argb,
|
||||
int ARGBSobelXY(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -33,17 +33,17 @@ typedef enum RotationMode {
|
||||
|
||||
// Rotate I420 frame.
|
||||
LIBYUV_API
|
||||
int I420Rotate(const uint8* src_y,
|
||||
int I420Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
@ -51,15 +51,15 @@ int I420Rotate(const uint8* src_y,
|
||||
|
||||
// Rotate NV12 input and store in I420.
|
||||
LIBYUV_API
|
||||
int NV12ToI420Rotate(const uint8* src_y,
|
||||
int NV12ToI420Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
@ -67,9 +67,9 @@ int NV12ToI420Rotate(const uint8* src_y,
|
||||
|
||||
// Rotate a plane by 0, 90, 180, or 270.
|
||||
LIBYUV_API
|
||||
int RotatePlane(const uint8* src,
|
||||
int RotatePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
@ -77,35 +77,35 @@ int RotatePlane(const uint8* src,
|
||||
|
||||
// Rotate planes by 90, 180, 270. Deprecated.
|
||||
LIBYUV_API
|
||||
void RotatePlane90(const uint8* src,
|
||||
void RotatePlane90(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void RotatePlane180(const uint8* src,
|
||||
void RotatePlane180(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void RotatePlane270(const uint8* src,
|
||||
void RotatePlane270(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void RotateUV90(const uint8* src,
|
||||
void RotateUV90(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
@ -115,21 +115,21 @@ void RotateUV90(const uint8* src,
|
||||
// split the data into two buffers while
|
||||
// rotating them. Deprecated.
|
||||
LIBYUV_API
|
||||
void RotateUV180(const uint8* src,
|
||||
void RotateUV180(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void RotateUV270(const uint8* src,
|
||||
void RotateUV270(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
@ -139,19 +139,19 @@ void RotateUV270(const uint8* src,
|
||||
// order will result in a rotation by +- 90 degrees.
|
||||
// Deprecated.
|
||||
LIBYUV_API
|
||||
void TransposePlane(const uint8* src,
|
||||
void TransposePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
LIBYUV_API
|
||||
void TransposeUV(const uint8* src,
|
||||
void TransposeUV(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -21,9 +21,9 @@ extern "C" {
|
||||
|
||||
// Rotate ARGB frame
|
||||
LIBYUV_API
|
||||
int ARGBRotate(const uint8* src_argb,
|
||||
int ARGBRotate(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
|
||||
@ -60,129 +60,129 @@ extern "C" {
|
||||
#define HAS_TRANSPOSEUVWX16_MSA
|
||||
#endif
|
||||
|
||||
void TransposeWxH_C(const uint8* src,
|
||||
void TransposeWxH_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void TransposeWx8_C(const uint8* src,
|
||||
void TransposeWx8_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx16_C(const uint8* src,
|
||||
void TransposeWx16_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx8_NEON(const uint8* src,
|
||||
void TransposeWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx8_SSSE3(const uint8* src,
|
||||
void TransposeWx8_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx8_Fast_SSSE3(const uint8* src,
|
||||
void TransposeWx8_Fast_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx16_MSA(const uint8* src,
|
||||
void TransposeWx16_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
|
||||
void TransposeWx8_Any_NEON(const uint8* src,
|
||||
void TransposeWx8_Any_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx8_Any_SSSE3(const uint8* src,
|
||||
void TransposeWx8_Any_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx8_Fast_Any_SSSE3(const uint8* src,
|
||||
void TransposeWx8_Fast_Any_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
void TransposeWx16_Any_MSA(const uint8* src,
|
||||
void TransposeWx16_Any_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width);
|
||||
|
||||
void TransposeUVWxH_C(const uint8* src,
|
||||
void TransposeUVWxH_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void TransposeUVWx8_C(const uint8* src,
|
||||
void TransposeUVWx8_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx16_C(const uint8* src,
|
||||
void TransposeUVWx16_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx8_SSE2(const uint8* src,
|
||||
void TransposeUVWx8_SSE2(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx8_NEON(const uint8* src,
|
||||
void TransposeUVWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx16_MSA(const uint8* src,
|
||||
void TransposeUVWx16_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
|
||||
void TransposeUVWx8_Any_SSE2(const uint8* src,
|
||||
void TransposeUVWx8_Any_SSE2(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx8_Any_NEON(const uint8* src,
|
||||
void TransposeUVWx8_Any_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
void TransposeUVWx16_Any_MSA(const uint8* src,
|
||||
void TransposeUVWx16_Any_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width);
|
||||
|
||||
|
||||
3432
include/libyuv/row.h
3432
include/libyuv/row.h
File diff suppressed because it is too large
Load Diff
@ -28,22 +28,22 @@ typedef enum FilterMode {
|
||||
|
||||
// Scale a YUV plane.
|
||||
LIBYUV_API
|
||||
void ScalePlane(const uint8* src,
|
||||
void ScalePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
enum FilterMode filtering);
|
||||
|
||||
LIBYUV_API
|
||||
void ScalePlane_16(const uint16* src,
|
||||
void ScalePlane_16(const uint16_t* src,
|
||||
int src_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_stride,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -60,38 +60,38 @@ void ScalePlane_16(const uint16* src,
|
||||
// Returns 0 if successful.
|
||||
|
||||
LIBYUV_API
|
||||
int I420Scale(const uint8* src_y,
|
||||
int I420Scale(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
enum FilterMode filtering);
|
||||
|
||||
LIBYUV_API
|
||||
int I420Scale_16(const uint16* src_y,
|
||||
int I420Scale_16(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -100,17 +100,17 @@ int I420Scale_16(const uint16* src_y,
|
||||
#ifdef __cplusplus
|
||||
// Legacy API. Deprecated.
|
||||
LIBYUV_API
|
||||
int Scale(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
int Scale(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_y,
|
||||
int src_stride_u,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_y,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_y,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_y,
|
||||
int dst_stride_u,
|
||||
int dst_stride_v,
|
||||
@ -120,10 +120,10 @@ int Scale(const uint8* src_y,
|
||||
|
||||
// Legacy API. Deprecated.
|
||||
LIBYUV_API
|
||||
int ScaleOffset(const uint8* src_i420,
|
||||
int ScaleOffset(const uint8_t* src_i420,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_i420,
|
||||
uint8_t* dst_i420,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int dst_yoffset,
|
||||
|
||||
@ -20,11 +20,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
LIBYUV_API
|
||||
int ARGBScale(const uint8* src_argb,
|
||||
int ARGBScale(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -32,11 +32,11 @@ int ARGBScale(const uint8* src_argb,
|
||||
|
||||
// Clipped scale takes destination rectangle coordinates for clip values.
|
||||
LIBYUV_API
|
||||
int ARGBScaleClip(const uint8* src_argb,
|
||||
int ARGBScaleClip(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -48,18 +48,18 @@ int ARGBScaleClip(const uint8* src_argb,
|
||||
|
||||
// Scale with YUV conversion to ARGB and clipping.
|
||||
LIBYUV_API
|
||||
int YUVToARGBScaleClip(const uint8* src_y,
|
||||
int YUVToARGBScaleClip(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint32 src_fourcc,
|
||||
uint32_t src_fourcc,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
uint32 dst_fourcc,
|
||||
uint32_t dst_fourcc,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int clip_x,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -29,12 +29,12 @@ extern "C" {
|
||||
// constants are used in a switch.
|
||||
#ifdef __cplusplus
|
||||
#define FOURCC(a, b, c, d) \
|
||||
((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
|
||||
(static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
|
||||
((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \
|
||||
(static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24))
|
||||
#else
|
||||
#define FOURCC(a, b, c, d) \
|
||||
(((uint32)(a)) | ((uint32)(b) << 8) | /* NOLINT */ \
|
||||
((uint32)(c) << 16) | ((uint32)(d) << 24)) /* NOLINT */
|
||||
(((uint32_t)(a)) | ((uint32_t)(b) << 8) | /* NOLINT */ \
|
||||
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) /* NOLINT */
|
||||
#endif
|
||||
|
||||
// Some pages discussing FourCC codes:
|
||||
@ -176,7 +176,7 @@ enum FourCCBpp {
|
||||
};
|
||||
|
||||
// Converts fourcc aliases into canonical ones.
|
||||
LIBYUV_API uint32 CanonicalFourCC(uint32 fourcc);
|
||||
LIBYUV_API uint32_t CanonicalFourCC(uint32_t fourcc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -29,10 +29,10 @@ extern "C" {
|
||||
|
||||
// hash seed of 5381 recommended.
|
||||
LIBYUV_API
|
||||
uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) {
|
||||
uint32_t HashDjb2(const uint8_t* src, uint64_t count, uint32_t seed) {
|
||||
const int kBlockSize = 1 << 15; // 32768;
|
||||
int remainder;
|
||||
uint32 (*HashDjb2_SSE)(const uint8* src, int count, uint32 seed) = HashDjb2_C;
|
||||
uint32_t (*HashDjb2_SSE)(const uint8_t* src, int count, uint32_t seed) = HashDjb2_C;
|
||||
#if defined(HAS_HASHDJB2_SSE41)
|
||||
if (TestCpuFlag(kCpuHasSSE41)) {
|
||||
HashDjb2_SSE = HashDjb2_SSE41;
|
||||
@ -44,7 +44,7 @@ uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) {
|
||||
}
|
||||
#endif
|
||||
|
||||
while (count >= (uint64)(kBlockSize)) {
|
||||
while (count >= (uint64_t)(kBlockSize)) {
|
||||
seed = HashDjb2_SSE(src, kBlockSize, seed);
|
||||
src += kBlockSize;
|
||||
count -= kBlockSize;
|
||||
@ -62,7 +62,7 @@ uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) {
|
||||
return seed;
|
||||
}
|
||||
|
||||
static uint32 ARGBDetectRow_C(const uint8* argb, int width) {
|
||||
static uint32_t ARGBDetectRow_C(const uint8_t* argb, int width) {
|
||||
int x;
|
||||
for (x = 0; x < width - 1; x += 2) {
|
||||
if (argb[0] != 255) { // First byte is not Alpha of 255, so not ARGB.
|
||||
@ -93,8 +93,8 @@ static uint32 ARGBDetectRow_C(const uint8* argb, int width) {
|
||||
// Scan an opaque argb image and return fourcc based on alpha offset.
|
||||
// Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
|
||||
LIBYUV_API
|
||||
uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height) {
|
||||
uint32 fourcc = 0;
|
||||
uint32_t ARGBDetect(const uint8_t* argb, int stride_argb, int width, int height) {
|
||||
uint32_t fourcc = 0;
|
||||
int h;
|
||||
|
||||
// Coalesce rows.
|
||||
@ -114,16 +114,16 @@ uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height) {
|
||||
// So actual maximum is 1 less loop, which is 64436 - 32 bytes.
|
||||
|
||||
LIBYUV_API
|
||||
uint64 ComputeHammingDistance(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint64_t ComputeHammingDistance(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
const int kBlockSize = 1 << 15; // 32768;
|
||||
const int kSimdSize = 64;
|
||||
// SIMD for multiple of 64, and C for remainder
|
||||
int remainder = count & (kBlockSize - 1) & ~(kSimdSize - 1);
|
||||
uint64 diff = 0;
|
||||
uint64_t diff = 0;
|
||||
int i;
|
||||
uint32 (*HammingDistance)(const uint8* src_a, const uint8* src_b, int count) =
|
||||
uint32_t (*HammingDistance)(const uint8_t* src_a, const uint8_t* src_b, int count) =
|
||||
HammingDistance_C;
|
||||
#if defined(HAS_HAMMINGDISTANCE_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
@ -172,17 +172,17 @@ uint64 ComputeHammingDistance(const uint8* src_a,
|
||||
|
||||
// TODO(fbarchard): Refactor into row function.
|
||||
LIBYUV_API
|
||||
uint64 ComputeSumSquareError(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint64_t ComputeSumSquareError(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
// SumSquareError returns values 0 to 65535 for each squared difference.
|
||||
// Up to 65536 of those can be summed and remain within a uint32.
|
||||
// After each block of 65536 pixels, accumulate into a uint64.
|
||||
// Up to 65536 of those can be summed and remain within a uint32_t.
|
||||
// After each block of 65536 pixels, accumulate into a uint64_t.
|
||||
const int kBlockSize = 65536;
|
||||
int remainder = count & (kBlockSize - 1) & ~31;
|
||||
uint64 sse = 0;
|
||||
uint64_t sse = 0;
|
||||
int i;
|
||||
uint32 (*SumSquareError)(const uint8* src_a, const uint8* src_b, int count) =
|
||||
uint32_t (*SumSquareError)(const uint8_t* src_a, const uint8_t* src_b, int count) =
|
||||
SumSquareError_C;
|
||||
#if defined(HAS_SUMSQUAREERROR_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
@ -227,13 +227,13 @@ uint64 ComputeSumSquareError(const uint8* src_a,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
|
||||
uint64_t ComputeSumSquareErrorPlane(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
uint64 sse = 0;
|
||||
uint64_t sse = 0;
|
||||
int h;
|
||||
// Coalesce rows.
|
||||
if (stride_a == width && stride_b == width) {
|
||||
@ -250,7 +250,7 @@ uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
double SumSquareErrorToPsnr(uint64 sse, uint64 count) {
|
||||
double SumSquareErrorToPsnr(uint64_t sse, uint64_t count) {
|
||||
double psnr;
|
||||
if (sse > 0) {
|
||||
double mse = (double)count / (double)sse;
|
||||
@ -266,59 +266,59 @@ double SumSquareErrorToPsnr(uint64 sse, uint64 count) {
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
double CalcFramePsnr(const uint8* src_a,
|
||||
double CalcFramePsnr(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
const uint64 samples = (uint64)width * (uint64)height;
|
||||
const uint64 sse = ComputeSumSquareErrorPlane(src_a, stride_a, src_b,
|
||||
const uint64_t samples = (uint64_t)width * (uint64_t)height;
|
||||
const uint64_t sse = ComputeSumSquareErrorPlane(src_a, stride_a, src_b,
|
||||
stride_b, width, height);
|
||||
return SumSquareErrorToPsnr(sse, samples);
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
double I420Psnr(const uint8* src_y_a,
|
||||
double I420Psnr(const uint8_t* src_y_a,
|
||||
int stride_y_a,
|
||||
const uint8* src_u_a,
|
||||
const uint8_t* src_u_a,
|
||||
int stride_u_a,
|
||||
const uint8* src_v_a,
|
||||
const uint8_t* src_v_a,
|
||||
int stride_v_a,
|
||||
const uint8* src_y_b,
|
||||
const uint8_t* src_y_b,
|
||||
int stride_y_b,
|
||||
const uint8* src_u_b,
|
||||
const uint8_t* src_u_b,
|
||||
int stride_u_b,
|
||||
const uint8* src_v_b,
|
||||
const uint8_t* src_v_b,
|
||||
int stride_v_b,
|
||||
int width,
|
||||
int height) {
|
||||
const uint64 sse_y = ComputeSumSquareErrorPlane(src_y_a, stride_y_a, src_y_b,
|
||||
const uint64_t sse_y = ComputeSumSquareErrorPlane(src_y_a, stride_y_a, src_y_b,
|
||||
stride_y_b, width, height);
|
||||
const int width_uv = (width + 1) >> 1;
|
||||
const int height_uv = (height + 1) >> 1;
|
||||
const uint64 sse_u = ComputeSumSquareErrorPlane(
|
||||
const uint64_t sse_u = ComputeSumSquareErrorPlane(
|
||||
src_u_a, stride_u_a, src_u_b, stride_u_b, width_uv, height_uv);
|
||||
const uint64 sse_v = ComputeSumSquareErrorPlane(
|
||||
const uint64_t sse_v = ComputeSumSquareErrorPlane(
|
||||
src_v_a, stride_v_a, src_v_b, stride_v_b, width_uv, height_uv);
|
||||
const uint64 samples = (uint64)width * (uint64)height +
|
||||
2 * ((uint64)width_uv * (uint64)height_uv);
|
||||
const uint64 sse = sse_y + sse_u + sse_v;
|
||||
const uint64_t samples = (uint64_t)width * (uint64_t)height +
|
||||
2 * ((uint64_t)width_uv * (uint64_t)height_uv);
|
||||
const uint64_t sse = sse_y + sse_u + sse_v;
|
||||
return SumSquareErrorToPsnr(sse, samples);
|
||||
}
|
||||
|
||||
static const int64 cc1 = 26634; // (64^2*(.01*255)^2
|
||||
static const int64 cc2 = 239708; // (64^2*(.03*255)^2
|
||||
static const int64_t cc1 = 26634; // (64^2*(.01*255)^2
|
||||
static const int64_t cc2 = 239708; // (64^2*(.03*255)^2
|
||||
|
||||
static double Ssim8x8_C(const uint8* src_a,
|
||||
static double Ssim8x8_C(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b) {
|
||||
int64 sum_a = 0;
|
||||
int64 sum_b = 0;
|
||||
int64 sum_sq_a = 0;
|
||||
int64 sum_sq_b = 0;
|
||||
int64 sum_axb = 0;
|
||||
int64_t sum_a = 0;
|
||||
int64_t sum_b = 0;
|
||||
int64_t sum_sq_a = 0;
|
||||
int64_t sum_sq_b = 0;
|
||||
int64_t sum_axb = 0;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
@ -336,20 +336,20 @@ static double Ssim8x8_C(const uint8* src_a,
|
||||
}
|
||||
|
||||
{
|
||||
const int64 count = 64;
|
||||
const int64_t count = 64;
|
||||
// scale the constants by number of pixels
|
||||
const int64 c1 = (cc1 * count * count) >> 12;
|
||||
const int64 c2 = (cc2 * count * count) >> 12;
|
||||
const int64_t c1 = (cc1 * count * count) >> 12;
|
||||
const int64_t c2 = (cc2 * count * count) >> 12;
|
||||
|
||||
const int64 sum_a_x_sum_b = sum_a * sum_b;
|
||||
const int64_t sum_a_x_sum_b = sum_a * sum_b;
|
||||
|
||||
const int64 ssim_n = (2 * sum_a_x_sum_b + c1) *
|
||||
const int64_t ssim_n = (2 * sum_a_x_sum_b + c1) *
|
||||
(2 * count * sum_axb - 2 * sum_a_x_sum_b + c2);
|
||||
|
||||
const int64 sum_a_sq = sum_a * sum_a;
|
||||
const int64 sum_b_sq = sum_b * sum_b;
|
||||
const int64_t sum_a_sq = sum_a * sum_a;
|
||||
const int64_t sum_b_sq = sum_b * sum_b;
|
||||
|
||||
const int64 ssim_d =
|
||||
const int64_t ssim_d =
|
||||
(sum_a_sq + sum_b_sq + c1) *
|
||||
(count * sum_sq_a - sum_a_sq + count * sum_sq_b - sum_b_sq + c2);
|
||||
|
||||
@ -364,15 +364,15 @@ static double Ssim8x8_C(const uint8* src_a,
|
||||
// on the 4x4 pixel grid. Such arrangement allows the windows to overlap
|
||||
// block boundaries to penalize blocking artifacts.
|
||||
LIBYUV_API
|
||||
double CalcFrameSsim(const uint8* src_a,
|
||||
double CalcFrameSsim(const uint8_t* src_a,
|
||||
int stride_a,
|
||||
const uint8* src_b,
|
||||
const uint8_t* src_b,
|
||||
int stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
int samples = 0;
|
||||
double ssim_total = 0;
|
||||
double (*Ssim8x8)(const uint8* src_a, int stride_a, const uint8* src_b,
|
||||
double (*Ssim8x8)(const uint8_t* src_a, int stride_a, const uint8_t* src_b,
|
||||
int stride_b) = Ssim8x8_C;
|
||||
|
||||
// sample point start with each 4x4 location
|
||||
@ -393,17 +393,17 @@ double CalcFrameSsim(const uint8* src_a,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
double I420Ssim(const uint8* src_y_a,
|
||||
double I420Ssim(const uint8_t* src_y_a,
|
||||
int stride_y_a,
|
||||
const uint8* src_u_a,
|
||||
const uint8_t* src_u_a,
|
||||
int stride_u_a,
|
||||
const uint8* src_v_a,
|
||||
const uint8_t* src_v_a,
|
||||
int stride_v_a,
|
||||
const uint8* src_y_b,
|
||||
const uint8_t* src_y_b,
|
||||
int stride_y_b,
|
||||
const uint8* src_u_b,
|
||||
const uint8_t* src_u_b,
|
||||
int stride_u_b,
|
||||
const uint8* src_v_b,
|
||||
const uint8_t* src_v_b,
|
||||
int stride_v_b,
|
||||
int width,
|
||||
int height) {
|
||||
|
||||
@ -18,8 +18,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if ORIGINAL_OPT
|
||||
uint32 HammingDistance_C1(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t HammingDistance_C1(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff = 0u;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
@ -46,13 +46,13 @@ uint32 HammingDistance_C1(const uint8* src_a, const uint8* src_b, int count) {
|
||||
#endif
|
||||
|
||||
// Hakmem method for hamming distance.
|
||||
uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t HammingDistance_C(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff = 0u;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count - 3; i += 4) {
|
||||
uint32 x = *((uint32*)src_a) ^ *((uint32*)src_b);
|
||||
uint32 u = x - ((x >> 1) & 0x55555555);
|
||||
uint32_t x = *((uint32_t*)src_a) ^ *((uint32_t*)src_b);
|
||||
uint32_t u = x - ((x >> 1) & 0x55555555);
|
||||
u = ((u >> 2) & 0x33333333) + (u & 0x33333333);
|
||||
diff += ((((u + (u >> 4)) & 0x0f0f0f0f) * 0x01010101) >> 24);
|
||||
src_a += 4;
|
||||
@ -60,8 +60,8 @@ uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
|
||||
}
|
||||
|
||||
for (; i < count; ++i) {
|
||||
uint32 x = *src_a ^ *src_b;
|
||||
uint32 u = x - ((x >> 1) & 0x55);
|
||||
uint32_t x = *src_a ^ *src_b;
|
||||
uint32_t u = x - ((x >> 1) & 0x55);
|
||||
u = ((u >> 2) & 0x33) + (u & 0x33);
|
||||
diff += (u + (u >> 4)) & 0x0f;
|
||||
src_a += 1;
|
||||
@ -71,20 +71,20 @@ uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
|
||||
return diff;
|
||||
}
|
||||
|
||||
uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 sse = 0u;
|
||||
uint32_t SumSquareError_C(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t sse = 0u;
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
int diff = src_a[i] - src_b[i];
|
||||
sse += (uint32)(diff * diff);
|
||||
sse += (uint32_t)(diff * diff);
|
||||
}
|
||||
return sse;
|
||||
}
|
||||
|
||||
// hash seed of 5381 recommended.
|
||||
// Internal C version of HashDjb2 with int sized count for efficiency.
|
||||
uint32 HashDjb2_C(const uint8* src, int count, uint32 seed) {
|
||||
uint32 hash = seed;
|
||||
uint32_t HashDjb2_C(const uint8_t* src, int count, uint32_t seed) {
|
||||
uint32_t hash = seed;
|
||||
int i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
hash += (hash << 5) + src[i];
|
||||
|
||||
@ -23,10 +23,10 @@ extern "C" {
|
||||
(defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER)))
|
||||
|
||||
#if defined(__x86_64__)
|
||||
uint32 HammingDistance_SSE42(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint32_t HammingDistance_SSE42(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint64 diff = 0u;
|
||||
uint64_t diff = 0u;
|
||||
|
||||
asm volatile(
|
||||
"xor %3,%3 \n"
|
||||
@ -68,13 +68,13 @@ uint32 HammingDistance_SSE42(const uint8* src_a,
|
||||
:
|
||||
: "memory", "cc", "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10");
|
||||
|
||||
return static_cast<uint32>(diff);
|
||||
return static_cast<uint32_t>(diff);
|
||||
}
|
||||
#else
|
||||
uint32 HammingDistance_SSE42(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint32_t HammingDistance_SSE42(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t diff = 0u;
|
||||
|
||||
asm volatile(
|
||||
// Process 16 bytes per loop.
|
||||
@ -115,10 +115,10 @@ static const vec8 kNibbleMask = {15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15};
|
||||
static const vec8 kBitCount = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
|
||||
|
||||
uint32 HammingDistance_SSSE3(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint32_t HammingDistance_SSSE3(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t diff = 0u;
|
||||
|
||||
asm volatile(
|
||||
"movdqa %4,%%xmm2 \n"
|
||||
@ -174,8 +174,8 @@ uint32 HammingDistance_SSSE3(const uint8* src_a,
|
||||
}
|
||||
|
||||
#ifdef HAS_HAMMINGDISTANCE_AVX2
|
||||
uint32 HammingDistance_AVX2(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t HammingDistance_AVX2(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff = 0u;
|
||||
|
||||
asm volatile(
|
||||
"vbroadcastf128 %4,%%ymm2 \n"
|
||||
@ -227,8 +227,8 @@ uint32 HammingDistance_AVX2(const uint8* src_a, const uint8* src_b, int count) {
|
||||
}
|
||||
#endif // HAS_HAMMINGDISTANCE_AVX2
|
||||
|
||||
uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 sse;
|
||||
uint32_t SumSquareError_SSE2(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t sse;
|
||||
asm volatile (
|
||||
"pxor %%xmm0,%%xmm0 \n"
|
||||
"pxor %%xmm5,%%xmm5 \n"
|
||||
@ -293,8 +293,8 @@ static const uvec32 kHashMul3 = {
|
||||
0x00000001, // 33 ^ 0
|
||||
};
|
||||
|
||||
uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed) {
|
||||
uint32 hash;
|
||||
uint32_t HashDjb2_SSE41(const uint8_t* src, int count, uint32_t seed) {
|
||||
uint32_t hash;
|
||||
asm volatile (
|
||||
"movd %2,%%xmm0 \n"
|
||||
"pxor %%xmm7,%%xmm7 \n"
|
||||
|
||||
@ -22,8 +22,8 @@ namespace libyuv {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32 HammingDistance_MSA(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t HammingDistance_MSA(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff = 0u;
|
||||
int i;
|
||||
v16u8 src0, src1, src2, src3;
|
||||
v2i64 vec0 = {0}, vec1 = {0};
|
||||
@ -42,13 +42,13 @@ uint32 HammingDistance_MSA(const uint8* src_a, const uint8* src_b, int count) {
|
||||
}
|
||||
|
||||
vec0 += vec1;
|
||||
diff = (uint32)__msa_copy_u_w((v4i32)vec0, 0);
|
||||
diff += (uint32)__msa_copy_u_w((v4i32)vec0, 2);
|
||||
diff = (uint32_t)__msa_copy_u_w((v4i32)vec0, 0);
|
||||
diff += (uint32_t)__msa_copy_u_w((v4i32)vec0, 2);
|
||||
return diff;
|
||||
}
|
||||
|
||||
uint32 SumSquareError_MSA(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 sse = 0u;
|
||||
uint32_t SumSquareError_MSA(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t sse = 0u;
|
||||
int i;
|
||||
v16u8 src0, src1, src2, src3;
|
||||
v8i16 vec0, vec1, vec2, vec3;
|
||||
@ -80,8 +80,8 @@ uint32 SumSquareError_MSA(const uint8* src_a, const uint8* src_b, int count) {
|
||||
reg2 += reg3;
|
||||
reg0 += reg2;
|
||||
tmp0 = __msa_hadd_s_d(reg0, reg0);
|
||||
sse = (uint32)__msa_copy_u_w((v4i32)tmp0, 0);
|
||||
sse += (uint32)__msa_copy_u_w((v4i32)tmp0, 2);
|
||||
sse = (uint32_t)__msa_copy_u_w((v4i32)tmp0, 0);
|
||||
sse += (uint32_t)__msa_copy_u_w((v4i32)tmp0, 2);
|
||||
return sse;
|
||||
}
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@ extern "C" {
|
||||
|
||||
// 256 bits at a time
|
||||
// uses short accumulator which restricts count to 131 KB
|
||||
uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff;
|
||||
uint32_t HammingDistance_NEON(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff;
|
||||
|
||||
asm volatile(
|
||||
"vmov.u16 q4, #0 \n" // accumulator
|
||||
@ -52,8 +52,8 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
return diff;
|
||||
}
|
||||
|
||||
uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 sse;
|
||||
uint32_t SumSquareError_NEON(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t sse;
|
||||
asm volatile(
|
||||
"vmov.u8 q8, #0 \n"
|
||||
"vmov.u8 q10, #0 \n"
|
||||
|
||||
@ -22,8 +22,8 @@ extern "C" {
|
||||
|
||||
// 256 bits at a time
|
||||
// uses short accumulator which restricts count to 131 KB
|
||||
uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 diff;
|
||||
uint32_t HammingDistance_NEON(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t diff;
|
||||
asm volatile(
|
||||
"movi v4.8h, #0 \n"
|
||||
|
||||
@ -47,8 +47,8 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
return diff;
|
||||
}
|
||||
|
||||
uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
|
||||
uint32 sse;
|
||||
uint32_t SumSquareError_NEON(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
uint32_t sse;
|
||||
asm volatile(
|
||||
"eor v16.16b, v16.16b, v16.16b \n"
|
||||
"eor v18.16b, v18.16b, v18.16b \n"
|
||||
|
||||
@ -25,14 +25,14 @@ extern "C" {
|
||||
// This module is for 32 bit Visual C x86 and clangcl
|
||||
#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && defined(_MSC_VER)
|
||||
|
||||
uint32 HammingDistance_SSE42(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
uint32_t HammingDistance_SSE42(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 diff = 0u;
|
||||
uint32_t diff = 0u;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < count - 3; i += 4) {
|
||||
uint32 x = *((uint32*)src_a) ^ *((uint32*)src_b);
|
||||
uint32_t x = *((uint32_t*)src_a) ^ *((uint32_t*)src_b);
|
||||
src_a += 4;
|
||||
src_b += 4;
|
||||
diff += __popcnt(x);
|
||||
@ -40,8 +40,8 @@ uint32 HammingDistance_SSE42(const uint8* src_a,
|
||||
return diff;
|
||||
}
|
||||
|
||||
__declspec(naked) uint32
|
||||
SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count) {
|
||||
__declspec(naked) uint32_t
|
||||
SumSquareError_SSE2(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_a
|
||||
mov edx, [esp + 8] // src_b
|
||||
@ -81,8 +81,8 @@ __declspec(naked) uint32
|
||||
#if _MSC_VER >= 1700
|
||||
// C4752: found Intel(R) Advanced Vector Extensions; consider using /arch:AVX.
|
||||
#pragma warning(disable : 4752)
|
||||
__declspec(naked) uint32
|
||||
SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count) {
|
||||
__declspec(naked) uint32_t
|
||||
SumSquareError_AVX2(const uint8_t* src_a, const uint8_t* src_b, int count) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_a
|
||||
mov edx, [esp + 8] // src_b
|
||||
@ -146,8 +146,8 @@ uvec32 kHashMul3 = {
|
||||
0x00000001, // 33 ^ 0
|
||||
};
|
||||
|
||||
__declspec(naked) uint32
|
||||
HashDjb2_SSE41(const uint8* src, int count, uint32 seed) {
|
||||
__declspec(naked) uint32_t
|
||||
HashDjb2_SSE41(const uint8_t* src, int count, uint32_t seed) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov ecx, [esp + 8] // count
|
||||
@ -197,8 +197,8 @@ __declspec(naked) uint32
|
||||
|
||||
// Visual C 2012 required for AVX2.
|
||||
#if _MSC_VER >= 1700
|
||||
__declspec(naked) uint32
|
||||
HashDjb2_AVX2(const uint8* src, int count, uint32 seed) {
|
||||
__declspec(naked) uint32_t
|
||||
HashDjb2_AVX2(const uint8_t* src, int count, uint32_t seed) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov ecx, [esp + 8] // count
|
||||
|
||||
@ -28,17 +28,17 @@ static __inline int Abs(int v) {
|
||||
}
|
||||
|
||||
// Any I4xx To I420 format with mirroring.
|
||||
static int I4xxToI420(const uint8* src_y,
|
||||
static int I4xxToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_y_width,
|
||||
int src_y_height,
|
||||
@ -66,17 +66,17 @@ static int I4xxToI420(const uint8* src_y,
|
||||
// TODO(fbarchard): Use Scale plane which supports mirroring, but ensure
|
||||
// is does row coalescing.
|
||||
LIBYUV_API
|
||||
int I420Copy(const uint8* src_y,
|
||||
int I420Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -108,17 +108,17 @@ int I420Copy(const uint8* src_y,
|
||||
|
||||
// Copy I010 with optional flipping.
|
||||
LIBYUV_API
|
||||
int I010Copy(const uint16* src_y,
|
||||
int I010Copy(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -150,17 +150,17 @@ int I010Copy(const uint16* src_y,
|
||||
|
||||
// Convert 10 bit YUV to 8 bit.
|
||||
LIBYUV_API
|
||||
int I010ToI420(const uint16* src_y,
|
||||
int I010ToI420(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -195,17 +195,17 @@ int I010ToI420(const uint16* src_y,
|
||||
// 422 chroma is 1/2 width, 1x height
|
||||
// 420 chroma is 1/2 width, 1/2 height
|
||||
LIBYUV_API
|
||||
int I422ToI420(const uint8* src_y,
|
||||
int I422ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -218,17 +218,17 @@ int I422ToI420(const uint8* src_y,
|
||||
// 444 chroma is 1x width, 1x height
|
||||
// 420 chroma is 1/2 width, 1/2 height
|
||||
LIBYUV_API
|
||||
int I444ToI420(const uint8* src_y,
|
||||
int I444ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -239,13 +239,13 @@ int I444ToI420(const uint8* src_y,
|
||||
|
||||
// I400 is greyscale typically used in MJPG
|
||||
LIBYUV_API
|
||||
int I400ToI420(const uint8* src_y,
|
||||
int I400ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -269,15 +269,15 @@ int I400ToI420(const uint8* src_y,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CopyPlane2(const uint8* src,
|
||||
static void CopyPlane2(const uint8_t* src,
|
||||
int src_stride_0,
|
||||
int src_stride_1,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C;
|
||||
void (*CopyRow)(const uint8_t* src, uint8_t* dst, int width) = CopyRow_C;
|
||||
#if defined(HAS_COPYROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2)) {
|
||||
CopyRow = IS_ALIGNED(width, 32) ? CopyRow_SSE2 : CopyRow_Any_SSE2;
|
||||
@ -320,16 +320,16 @@ static void CopyPlane2(const uint8* src,
|
||||
// src_stride_m420 is row planar. Normally this will be the width in pixels.
|
||||
// The UV plane is half width, but 2 values, so src_stride_m420 applies to
|
||||
// this as well as the two Y planes.
|
||||
static int X420ToI420(const uint8* src_y,
|
||||
static int X420ToI420(const uint8_t* src_y,
|
||||
int src_stride_y0,
|
||||
int src_stride_y1,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -384,15 +384,15 @@ static int X420ToI420(const uint8* src_y,
|
||||
|
||||
// Convert NV12 to I420.
|
||||
LIBYUV_API
|
||||
int NV12ToI420(const uint8* src_y,
|
||||
int NV12ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -403,15 +403,15 @@ int NV12ToI420(const uint8* src_y,
|
||||
|
||||
// Convert NV21 to I420. Same as NV12 but u and v pointers swapped.
|
||||
LIBYUV_API
|
||||
int NV21ToI420(const uint8* src_y,
|
||||
int NV21ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_vu,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -422,13 +422,13 @@ int NV21ToI420(const uint8* src_y,
|
||||
|
||||
// Convert M420 to I420.
|
||||
LIBYUV_API
|
||||
int M420ToI420(const uint8* src_m420,
|
||||
int M420ToI420(const uint8_t* src_m420,
|
||||
int src_stride_m420,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -440,20 +440,20 @@ int M420ToI420(const uint8* src_m420,
|
||||
|
||||
// Convert YUY2 to I420.
|
||||
LIBYUV_API
|
||||
int YUY2ToI420(const uint8* src_yuy2,
|
||||
int YUY2ToI420(const uint8_t* src_yuy2,
|
||||
int src_stride_yuy2,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*YUY2ToUVRow)(const uint8* src_yuy2, int src_stride_yuy2, uint8* dst_u,
|
||||
uint8* dst_v, int width) = YUY2ToUVRow_C;
|
||||
void (*YUY2ToYRow)(const uint8* src_yuy2, uint8* dst_y, int width) =
|
||||
void (*YUY2ToUVRow)(const uint8_t* src_yuy2, int src_stride_yuy2, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = YUY2ToUVRow_C;
|
||||
void (*YUY2ToYRow)(const uint8_t* src_yuy2, uint8_t* dst_y, int width) =
|
||||
YUY2ToYRow_C;
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
@ -520,20 +520,20 @@ int YUY2ToI420(const uint8* src_yuy2,
|
||||
|
||||
// Convert UYVY to I420.
|
||||
LIBYUV_API
|
||||
int UYVYToI420(const uint8* src_uyvy,
|
||||
int UYVYToI420(const uint8_t* src_uyvy,
|
||||
int src_stride_uyvy,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*UYVYToUVRow)(const uint8* src_uyvy, int src_stride_uyvy, uint8* dst_u,
|
||||
uint8* dst_v, int width) = UYVYToUVRow_C;
|
||||
void (*UYVYToYRow)(const uint8* src_uyvy, uint8* dst_y, int width) =
|
||||
void (*UYVYToUVRow)(const uint8_t* src_uyvy, int src_stride_uyvy, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = UYVYToUVRow_C;
|
||||
void (*UYVYToYRow)(const uint8_t* src_uyvy, uint8_t* dst_y, int width) =
|
||||
UYVYToYRow_C;
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
@ -600,20 +600,20 @@ int UYVYToI420(const uint8* src_uyvy,
|
||||
|
||||
// Convert ARGB to I420.
|
||||
LIBYUV_API
|
||||
int ARGBToI420(const uint8* src_argb,
|
||||
int ARGBToI420(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -695,20 +695,20 @@ int ARGBToI420(const uint8* src_argb,
|
||||
|
||||
// Convert BGRA to I420.
|
||||
LIBYUV_API
|
||||
int BGRAToI420(const uint8* src_bgra,
|
||||
int BGRAToI420(const uint8_t* src_bgra,
|
||||
int src_stride_bgra,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*BGRAToUVRow)(const uint8* src_bgra0, int src_stride_bgra, uint8* dst_u,
|
||||
uint8* dst_v, int width) = BGRAToUVRow_C;
|
||||
void (*BGRAToYRow)(const uint8* src_bgra, uint8* dst_y, int width) =
|
||||
void (*BGRAToUVRow)(const uint8_t* src_bgra0, int src_stride_bgra, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = BGRAToUVRow_C;
|
||||
void (*BGRAToYRow)(const uint8_t* src_bgra, uint8_t* dst_y, int width) =
|
||||
BGRAToYRow_C;
|
||||
if (!src_bgra || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -780,20 +780,20 @@ int BGRAToI420(const uint8* src_bgra,
|
||||
|
||||
// Convert ABGR to I420.
|
||||
LIBYUV_API
|
||||
int ABGRToI420(const uint8* src_abgr,
|
||||
int ABGRToI420(const uint8_t* src_abgr,
|
||||
int src_stride_abgr,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ABGRToUVRow)(const uint8* src_abgr0, int src_stride_abgr, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ABGRToUVRow_C;
|
||||
void (*ABGRToYRow)(const uint8* src_abgr, uint8* dst_y, int width) =
|
||||
void (*ABGRToUVRow)(const uint8_t* src_abgr0, int src_stride_abgr, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ABGRToUVRow_C;
|
||||
void (*ABGRToYRow)(const uint8_t* src_abgr, uint8_t* dst_y, int width) =
|
||||
ABGRToYRow_C;
|
||||
if (!src_abgr || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -865,20 +865,20 @@ int ABGRToI420(const uint8* src_abgr,
|
||||
|
||||
// Convert RGBA to I420.
|
||||
LIBYUV_API
|
||||
int RGBAToI420(const uint8* src_rgba,
|
||||
int RGBAToI420(const uint8_t* src_rgba,
|
||||
int src_stride_rgba,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*RGBAToUVRow)(const uint8* src_rgba0, int src_stride_rgba, uint8* dst_u,
|
||||
uint8* dst_v, int width) = RGBAToUVRow_C;
|
||||
void (*RGBAToYRow)(const uint8* src_rgba, uint8* dst_y, int width) =
|
||||
void (*RGBAToUVRow)(const uint8_t* src_rgba0, int src_stride_rgba, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = RGBAToUVRow_C;
|
||||
void (*RGBAToYRow)(const uint8_t* src_rgba, uint8_t* dst_y, int width) =
|
||||
RGBAToYRow_C;
|
||||
if (!src_rgba || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -950,28 +950,28 @@ int RGBAToI420(const uint8* src_rgba,
|
||||
|
||||
// Convert RGB24 to I420.
|
||||
LIBYUV_API
|
||||
int RGB24ToI420(const uint8* src_rgb24,
|
||||
int RGB24ToI420(const uint8_t* src_rgb24,
|
||||
int src_stride_rgb24,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
#if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA))
|
||||
void (*RGB24ToUVRow)(const uint8* src_rgb24, int src_stride_rgb24,
|
||||
uint8* dst_u, uint8* dst_v, int width) = RGB24ToUVRow_C;
|
||||
void (*RGB24ToYRow)(const uint8* src_rgb24, uint8* dst_y, int width) =
|
||||
void (*RGB24ToUVRow)(const uint8_t* src_rgb24, int src_stride_rgb24,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) = RGB24ToUVRow_C;
|
||||
void (*RGB24ToYRow)(const uint8_t* src_rgb24, uint8_t* dst_y, int width) =
|
||||
RGB24ToYRow_C;
|
||||
#else
|
||||
void (*RGB24ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
|
||||
void (*RGB24ToARGBRow)(const uint8_t* src_rgb, uint8_t* dst_argb, int width) =
|
||||
RGB24ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
#endif
|
||||
if (!src_rgb24 || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
@ -1080,28 +1080,28 @@ int RGB24ToI420(const uint8* src_rgb24,
|
||||
|
||||
// Convert RAW to I420.
|
||||
LIBYUV_API
|
||||
int RAWToI420(const uint8* src_raw,
|
||||
int RAWToI420(const uint8_t* src_raw,
|
||||
int src_stride_raw,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
#if (defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA))
|
||||
void (*RAWToUVRow)(const uint8* src_raw, int src_stride_raw, uint8* dst_u,
|
||||
uint8* dst_v, int width) = RAWToUVRow_C;
|
||||
void (*RAWToYRow)(const uint8* src_raw, uint8* dst_y, int width) =
|
||||
void (*RAWToUVRow)(const uint8_t* src_raw, int src_stride_raw, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = RAWToUVRow_C;
|
||||
void (*RAWToYRow)(const uint8_t* src_raw, uint8_t* dst_y, int width) =
|
||||
RAWToYRow_C;
|
||||
#else
|
||||
void (*RAWToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
|
||||
void (*RAWToARGBRow)(const uint8_t* src_rgb, uint8_t* dst_argb, int width) =
|
||||
RAWToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
#endif
|
||||
if (!src_raw || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
@ -1210,29 +1210,29 @@ int RAWToI420(const uint8* src_raw,
|
||||
|
||||
// Convert RGB565 to I420.
|
||||
LIBYUV_API
|
||||
int RGB565ToI420(const uint8* src_rgb565,
|
||||
int RGB565ToI420(const uint8_t* src_rgb565,
|
||||
int src_stride_rgb565,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
#if (defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA))
|
||||
void (*RGB565ToUVRow)(const uint8* src_rgb565, int src_stride_rgb565,
|
||||
uint8* dst_u, uint8* dst_v, int width) =
|
||||
void (*RGB565ToUVRow)(const uint8_t* src_rgb565, int src_stride_rgb565,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) =
|
||||
RGB565ToUVRow_C;
|
||||
void (*RGB565ToYRow)(const uint8* src_rgb565, uint8* dst_y, int width) =
|
||||
void (*RGB565ToYRow)(const uint8_t* src_rgb565, uint8_t* dst_y, int width) =
|
||||
RGB565ToYRow_C;
|
||||
#else
|
||||
void (*RGB565ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
|
||||
void (*RGB565ToARGBRow)(const uint8_t* src_rgb, uint8_t* dst_argb, int width) =
|
||||
RGB565ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
#endif
|
||||
if (!src_rgb565 || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
@ -1347,29 +1347,29 @@ int RGB565ToI420(const uint8* src_rgb565,
|
||||
|
||||
// Convert ARGB1555 to I420.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToI420(const uint8* src_argb1555,
|
||||
int ARGB1555ToI420(const uint8_t* src_argb1555,
|
||||
int src_stride_argb1555,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
#if (defined(HAS_ARGB1555TOYROW_NEON) || defined(HAS_ARGB1555TOYROW_MSA))
|
||||
void (*ARGB1555ToUVRow)(const uint8* src_argb1555, int src_stride_argb1555,
|
||||
uint8* dst_u, uint8* dst_v, int width) =
|
||||
void (*ARGB1555ToUVRow)(const uint8_t* src_argb1555, int src_stride_argb1555,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) =
|
||||
ARGB1555ToUVRow_C;
|
||||
void (*ARGB1555ToYRow)(const uint8* src_argb1555, uint8* dst_y, int width) =
|
||||
void (*ARGB1555ToYRow)(const uint8_t* src_argb1555, uint8_t* dst_y, int width) =
|
||||
ARGB1555ToYRow_C;
|
||||
#else
|
||||
void (*ARGB1555ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
|
||||
void (*ARGB1555ToARGBRow)(const uint8_t* src_rgb, uint8_t* dst_argb, int width) =
|
||||
ARGB1555ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
#endif
|
||||
if (!src_argb1555 || !dst_y || !dst_u || !dst_v || width <= 0 ||
|
||||
@ -1488,29 +1488,29 @@ int ARGB1555ToI420(const uint8* src_argb1555,
|
||||
|
||||
// Convert ARGB4444 to I420.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToI420(const uint8* src_argb4444,
|
||||
int ARGB4444ToI420(const uint8_t* src_argb4444,
|
||||
int src_stride_argb4444,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
#if defined(HAS_ARGB4444TOYROW_NEON)
|
||||
void (*ARGB4444ToUVRow)(const uint8* src_argb4444, int src_stride_argb4444,
|
||||
uint8* dst_u, uint8* dst_v, int width) =
|
||||
void (*ARGB4444ToUVRow)(const uint8_t* src_argb4444, int src_stride_argb4444,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) =
|
||||
ARGB4444ToUVRow_C;
|
||||
void (*ARGB4444ToYRow)(const uint8* src_argb4444, uint8* dst_y, int width) =
|
||||
void (*ARGB4444ToYRow)(const uint8_t* src_argb4444, uint8_t* dst_y, int width) =
|
||||
ARGB4444ToYRow_C;
|
||||
#else
|
||||
void (*ARGB4444ToARGBRow)(const uint8* src_rgb, uint8* dst_argb, int width) =
|
||||
void (*ARGB4444ToARGBRow)(const uint8_t* src_rgb, uint8_t* dst_argb, int width) =
|
||||
ARGB4444ToARGBRow_C;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
#endif
|
||||
if (!src_argb4444 || !dst_y || !dst_u || !dst_v || width <= 0 ||
|
||||
@ -1639,9 +1639,9 @@ int ARGB4444ToI420(const uint8* src_argb4444,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SplitPixels(const uint8* src_u,
|
||||
static void SplitPixels(const uint8_t* src_u,
|
||||
int src_pixel_stride_uv,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int width) {
|
||||
int i;
|
||||
for (i = 0; i < width; ++i) {
|
||||
@ -1653,18 +1653,18 @@ static void SplitPixels(const uint8* src_u,
|
||||
|
||||
// Convert Android420 to I420.
|
||||
LIBYUV_API
|
||||
int Android420ToI420(const uint8* src_y,
|
||||
int Android420ToI420(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_pixel_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -30,17 +30,17 @@ static __inline int Abs(int v) {
|
||||
}
|
||||
|
||||
// I420 To any I4xx YUV format with mirroring.
|
||||
static int I420ToI4xx(const uint8* src_y,
|
||||
static int I420ToI4xx(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_y_width,
|
||||
int src_y_height,
|
||||
@ -67,17 +67,17 @@ static int I420ToI4xx(const uint8* src_y,
|
||||
|
||||
// Convert 8 bit YUV to 10 bit.
|
||||
LIBYUV_API
|
||||
int I420ToI010(const uint8* src_y,
|
||||
int I420ToI010(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -112,17 +112,17 @@ int I420ToI010(const uint8* src_y,
|
||||
// 420 chroma is 1/2 width, 1/2 height
|
||||
// 422 chroma is 1/2 width, 1x height
|
||||
LIBYUV_API
|
||||
int I420ToI422(const uint8* src_y,
|
||||
int I420ToI422(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -137,17 +137,17 @@ int I420ToI422(const uint8* src_y,
|
||||
// 420 chroma is 1/2 width, 1/2 height
|
||||
// 444 chroma is 1x width, 1x height
|
||||
LIBYUV_API
|
||||
int I420ToI444(const uint8* src_y,
|
||||
int I420ToI444(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
@ -161,9 +161,9 @@ int I420ToI444(const uint8* src_y,
|
||||
|
||||
// Copy to I400. Source can be I420,422,444,400,NV12,NV21
|
||||
LIBYUV_API
|
||||
int I400Copy(const uint8* src_y,
|
||||
int I400Copy(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height) {
|
||||
@ -181,19 +181,19 @@ int I400Copy(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I422ToYUY2(const uint8* src_y,
|
||||
int I422ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_yuy2,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
void (*I422ToYUY2Row)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_yuy2 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -239,19 +239,19 @@ int I422ToYUY2(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToYUY2(const uint8* src_y,
|
||||
int I420ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_yuy2,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
void (*I422ToYUY2Row)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_yuy2 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -303,19 +303,19 @@ int I420ToYUY2(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I422ToUYVY(const uint8* src_y,
|
||||
int I422ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_uyvy,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
void (*I422ToUYVYRow)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_uyvy || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -369,19 +369,19 @@ int I422ToUYVY(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToUYVY(const uint8* src_y,
|
||||
int I420ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_uyvy,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
void (*I422ToUYVYRow)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_uyvy || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -434,15 +434,15 @@ int I420ToUYVY(const uint8* src_y,
|
||||
|
||||
// TODO(fbarchard): test negative height for invert.
|
||||
LIBYUV_API
|
||||
int I420ToNV12(const uint8* src_y,
|
||||
int I420ToNV12(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height) {
|
||||
@ -461,15 +461,15 @@ int I420ToNV12(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I420ToNV21(const uint8* src_y,
|
||||
int I420ToNV21(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_vu,
|
||||
uint8_t* dst_vu,
|
||||
int dst_stride_vu,
|
||||
int width,
|
||||
int height) {
|
||||
@ -479,20 +479,20 @@ int I420ToNV21(const uint8* src_y,
|
||||
}
|
||||
|
||||
// Convert I422 to RGBA with matrix
|
||||
static int I420ToRGBAMatrix(const uint8* src_y,
|
||||
static int I420ToRGBAMatrix(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToRGBARow)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToRGBARow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToRGBARow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgba || width <= 0 || height == 0) {
|
||||
@ -551,13 +551,13 @@ static int I420ToRGBAMatrix(const uint8* src_y,
|
||||
|
||||
// Convert I420 to RGBA.
|
||||
LIBYUV_API
|
||||
int I420ToRGBA(const uint8* src_y,
|
||||
int I420ToRGBA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
int width,
|
||||
int height) {
|
||||
@ -568,13 +568,13 @@ int I420ToRGBA(const uint8* src_y,
|
||||
|
||||
// Convert I420 to BGRA.
|
||||
LIBYUV_API
|
||||
int I420ToBGRA(const uint8* src_y,
|
||||
int I420ToBGRA(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_bgra,
|
||||
uint8_t* dst_bgra,
|
||||
int dst_stride_bgra,
|
||||
int width,
|
||||
int height) {
|
||||
@ -586,20 +586,20 @@ int I420ToBGRA(const uint8* src_y,
|
||||
}
|
||||
|
||||
// Convert I420 to RGB24 with matrix
|
||||
static int I420ToRGB24Matrix(const uint8* src_y,
|
||||
static int I420ToRGB24Matrix(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToRGB24Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToRGB24Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToRGB24Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb24 || width <= 0 || height == 0) {
|
||||
@ -658,13 +658,13 @@ static int I420ToRGB24Matrix(const uint8* src_y,
|
||||
|
||||
// Convert I420 to RGB24.
|
||||
LIBYUV_API
|
||||
int I420ToRGB24(const uint8* src_y,
|
||||
int I420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height) {
|
||||
@ -675,13 +675,13 @@ int I420ToRGB24(const uint8* src_y,
|
||||
|
||||
// Convert I420 to RAW.
|
||||
LIBYUV_API
|
||||
int I420ToRAW(const uint8* src_y,
|
||||
int I420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_raw,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height) {
|
||||
@ -694,13 +694,13 @@ int I420ToRAW(const uint8* src_y,
|
||||
|
||||
// Convert H420 to RGB24.
|
||||
LIBYUV_API
|
||||
int H420ToRGB24(const uint8* src_y,
|
||||
int H420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height) {
|
||||
@ -711,13 +711,13 @@ int H420ToRGB24(const uint8* src_y,
|
||||
|
||||
// Convert H420 to RAW.
|
||||
LIBYUV_API
|
||||
int H420ToRAW(const uint8* src_y,
|
||||
int H420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_raw,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height) {
|
||||
@ -730,19 +730,19 @@ int H420ToRAW(const uint8* src_y,
|
||||
|
||||
// Convert I420 to ARGB1555.
|
||||
LIBYUV_API
|
||||
int I420ToARGB1555(const uint8* src_y,
|
||||
int I420ToARGB1555(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb1555,
|
||||
uint8_t* dst_argb1555,
|
||||
int dst_stride_argb1555,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToARGB1555Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToARGB1555Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) = I422ToARGB1555Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_argb1555 || width <= 0 ||
|
||||
@ -803,19 +803,19 @@ int I420ToARGB1555(const uint8* src_y,
|
||||
|
||||
// Convert I420 to ARGB4444.
|
||||
LIBYUV_API
|
||||
int I420ToARGB4444(const uint8* src_y,
|
||||
int I420ToARGB4444(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_argb4444,
|
||||
uint8_t* dst_argb4444,
|
||||
int dst_stride_argb4444,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToARGB4444Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToARGB4444Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) = I422ToARGB4444Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_argb4444 || width <= 0 ||
|
||||
@ -876,19 +876,19 @@ int I420ToARGB4444(const uint8* src_y,
|
||||
|
||||
// Convert I420 to RGB565.
|
||||
LIBYUV_API
|
||||
int I420ToRGB565(const uint8* src_y,
|
||||
int I420ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToRGB565Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToRGB565Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToRGB565Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
@ -947,19 +947,19 @@ int I420ToRGB565(const uint8* src_y,
|
||||
|
||||
// Convert I422 to RGB565.
|
||||
LIBYUV_API
|
||||
int I422ToRGB565(const uint8* src_y,
|
||||
int I422ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToRGB565Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToRGB565Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToRGB565Row_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
@ -1015,30 +1015,30 @@ int I422ToRGB565(const uint8* src_y,
|
||||
}
|
||||
|
||||
// Ordered 8x8 dither for 888 to 565. Values from 0 to 7.
|
||||
static const uint8 kDither565_4x4[16] = {
|
||||
static const uint8_t kDither565_4x4[16] = {
|
||||
0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2,
|
||||
};
|
||||
|
||||
// Convert I420 to RGB565 with dithering.
|
||||
LIBYUV_API
|
||||
int I420ToRGB565Dither(const uint8* src_y,
|
||||
int I420ToRGB565Dither(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
const uint8* dither4x4,
|
||||
const uint8_t* dither4x4,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToARGBRow)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToARGBRow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToARGBRow_C;
|
||||
void (*ARGBToRGB565DitherRow)(const uint8* src_argb, uint8* dst_rgb,
|
||||
const uint32 dither4, int width) =
|
||||
void (*ARGBToRGB565DitherRow)(const uint8_t* src_argb, uint8_t* dst_rgb,
|
||||
const uint32_t dither4, int width) =
|
||||
ARGBToRGB565DitherRow_C;
|
||||
if (!src_y || !src_u || !src_v || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1122,7 +1122,7 @@ 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)), // NOLINT
|
||||
*(uint32_t*)(dither4x4 + ((y & 3) << 2)), // NOLINT
|
||||
width); // NOLINT
|
||||
dst_rgb565 += dst_stride_rgb565;
|
||||
src_y += src_stride_y;
|
||||
@ -1137,20 +1137,20 @@ int I420ToRGB565Dither(const uint8* src_y,
|
||||
}
|
||||
|
||||
// Convert I420 to AR30 with matrix
|
||||
static int I420ToAR30Matrix(const uint8* src_y,
|
||||
static int I420ToAR30Matrix(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*I422ToAR30Row)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf,
|
||||
void (*I422ToAR30Row)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) =
|
||||
I422ToAR30Row_C;
|
||||
|
||||
@ -1195,13 +1195,13 @@ static int I420ToAR30Matrix(const uint8* src_y,
|
||||
|
||||
// Convert I420 to AR30.
|
||||
LIBYUV_API
|
||||
int I420ToAR30(const uint8* src_y,
|
||||
int I420ToAR30(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height) {
|
||||
@ -1212,18 +1212,18 @@ int I420ToAR30(const uint8* src_y,
|
||||
|
||||
// Convert I420 to specified format
|
||||
LIBYUV_API
|
||||
int ConvertFromI420(const uint8* y,
|
||||
int ConvertFromI420(const uint8_t* y,
|
||||
int y_stride,
|
||||
const uint8* u,
|
||||
const uint8_t* u,
|
||||
int u_stride,
|
||||
const uint8* v,
|
||||
const uint8_t* v,
|
||||
int v_stride,
|
||||
uint8* dst_sample,
|
||||
uint8_t* dst_sample,
|
||||
int dst_sample_stride,
|
||||
int width,
|
||||
int height,
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
uint32_t fourcc) {
|
||||
uint32_t format = CanonicalFourCC(fourcc);
|
||||
int r = 0;
|
||||
if (!y || !u || !v || !dst_sample || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1296,7 +1296,7 @@ int ConvertFromI420(const uint8* y,
|
||||
height);
|
||||
break;
|
||||
case FOURCC_NV12: {
|
||||
uint8* dst_uv = dst_sample + width * height;
|
||||
uint8_t* dst_uv = dst_sample + width * height;
|
||||
r = I420ToNV12(y, y_stride, u, u_stride, v, v_stride, dst_sample,
|
||||
dst_sample_stride ? dst_sample_stride : width, dst_uv,
|
||||
dst_sample_stride ? dst_sample_stride : width, width,
|
||||
@ -1304,7 +1304,7 @@ int ConvertFromI420(const uint8* y,
|
||||
break;
|
||||
}
|
||||
case FOURCC_NV21: {
|
||||
uint8* dst_vu = dst_sample + width * height;
|
||||
uint8_t* dst_vu = dst_sample + width * height;
|
||||
r = I420ToNV21(y, y_stride, u, u_stride, v, v_stride, dst_sample,
|
||||
dst_sample_stride ? dst_sample_stride : width, dst_vu,
|
||||
dst_sample_stride ? dst_sample_stride : width, width,
|
||||
@ -1318,8 +1318,8 @@ int ConvertFromI420(const uint8* y,
|
||||
dst_sample_stride = dst_sample_stride ? dst_sample_stride : width;
|
||||
int halfstride = (dst_sample_stride + 1) / 2;
|
||||
int halfheight = (height + 1) / 2;
|
||||
uint8* dst_u;
|
||||
uint8* dst_v;
|
||||
uint8_t* dst_u;
|
||||
uint8_t* dst_v;
|
||||
if (format == FOURCC_YV12) {
|
||||
dst_v = dst_sample + dst_sample_stride * height;
|
||||
dst_u = dst_v + halfstride * halfheight;
|
||||
@ -1336,8 +1336,8 @@ int ConvertFromI420(const uint8* y,
|
||||
case FOURCC_YV16: {
|
||||
dst_sample_stride = dst_sample_stride ? dst_sample_stride : width;
|
||||
int halfstride = (dst_sample_stride + 1) / 2;
|
||||
uint8* dst_u;
|
||||
uint8* dst_v;
|
||||
uint8_t* dst_u;
|
||||
uint8_t* dst_v;
|
||||
if (format == FOURCC_YV16) {
|
||||
dst_v = dst_sample + dst_sample_stride * height;
|
||||
dst_u = dst_v + halfstride * height;
|
||||
@ -1353,8 +1353,8 @@ int ConvertFromI420(const uint8* y,
|
||||
case FOURCC_I444:
|
||||
case FOURCC_YV24: {
|
||||
dst_sample_stride = dst_sample_stride ? dst_sample_stride : width;
|
||||
uint8* dst_u;
|
||||
uint8* dst_v;
|
||||
uint8_t* dst_u;
|
||||
uint8_t* dst_v;
|
||||
if (format == FOURCC_YV24) {
|
||||
dst_v = dst_sample + dst_sample_stride * height;
|
||||
dst_u = dst_v + dst_sample_stride * height;
|
||||
|
||||
@ -22,20 +22,20 @@ extern "C" {
|
||||
|
||||
// ARGB little endian (bgra in memory) to I444
|
||||
LIBYUV_API
|
||||
int ARGBToI444(const uint8* src_argb,
|
||||
int ARGBToI444(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
|
||||
void (*ARGBToUV444Row)(const uint8_t* src_argb, uint8_t* dst_u, uint8_t* dst_v,
|
||||
int width) = ARGBToUV444Row_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -122,20 +122,20 @@ int ARGBToI444(const uint8* src_argb,
|
||||
|
||||
// ARGB little endian (bgra in memory) to I422
|
||||
LIBYUV_API
|
||||
int ARGBToI422(const uint8* src_argb,
|
||||
int ARGBToI422(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -219,21 +219,21 @@ int ARGBToI422(const uint8* src_argb,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int ARGBToNV12(const uint8* src_argb,
|
||||
int ARGBToNV12(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
void (*MergeUVRow_)(const uint8_t* src_u, const uint8_t* src_v, uint8_t* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
if (!src_argb || !dst_y || !dst_uv || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -331,7 +331,7 @@ int ARGBToNV12(const uint8* src_argb,
|
||||
{
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 31) & ~31) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 31) & ~31);
|
||||
uint8_t* row_v = row_u + ((halfwidth + 31) & ~31);
|
||||
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
|
||||
@ -354,21 +354,21 @@ int ARGBToNV12(const uint8* src_argb,
|
||||
|
||||
// Same as NV12 but U and V swapped.
|
||||
LIBYUV_API
|
||||
int ARGBToNV21(const uint8* src_argb,
|
||||
int ARGBToNV21(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_uv,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb0, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8* src_u, const uint8* src_v, uint8* dst_uv,
|
||||
void (*MergeUVRow_)(const uint8_t* src_u, const uint8_t* src_v, uint8_t* dst_uv,
|
||||
int width) = MergeUVRow_C;
|
||||
if (!src_argb || !dst_y || !dst_uv || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -466,7 +466,7 @@ int ARGBToNV21(const uint8* src_argb,
|
||||
{
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 31) & ~31) * 2);
|
||||
uint8* row_v = row_u + ((halfwidth + 31) & ~31);
|
||||
uint8_t* row_v = row_u + ((halfwidth + 31) & ~31);
|
||||
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
|
||||
@ -489,19 +489,19 @@ int ARGBToNV21(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to YUY2.
|
||||
LIBYUV_API
|
||||
int ARGBToYUY2(const uint8* src_argb,
|
||||
int ARGBToYUY2(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yuy2,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*I422ToYUY2Row)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_yuy2, int width) =
|
||||
void (*I422ToYUY2Row)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_yuy2, int width) =
|
||||
I422ToYUY2Row_C;
|
||||
|
||||
if (!src_argb || !dst_yuy2 || width <= 0 || height == 0) {
|
||||
@ -599,8 +599,8 @@ int ARGBToYUY2(const uint8* src_argb,
|
||||
{
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
uint8_t* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8_t* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUVRow(src_argb, 0, row_u, row_v, width);
|
||||
@ -617,19 +617,19 @@ int ARGBToYUY2(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to UYVY.
|
||||
LIBYUV_API
|
||||
int ARGBToUYVY(const uint8* src_argb,
|
||||
int ARGBToUYVY(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_uyvy,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVRow)(const uint8* src_argb, int src_stride_argb, uint8* dst_u,
|
||||
uint8* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToUVRow)(const uint8_t* src_argb, int src_stride_argb, uint8_t* dst_u,
|
||||
uint8_t* dst_v, int width) = ARGBToUVRow_C;
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*I422ToUYVYRow)(const uint8* src_y, const uint8* src_u,
|
||||
const uint8* src_v, uint8* dst_uyvy, int width) =
|
||||
void (*I422ToUYVYRow)(const uint8_t* src_y, const uint8_t* src_u,
|
||||
const uint8_t* src_v, uint8_t* dst_uyvy, int width) =
|
||||
I422ToUYVYRow_C;
|
||||
|
||||
if (!src_argb || !dst_uyvy || width <= 0 || height == 0) {
|
||||
@ -727,8 +727,8 @@ int ARGBToUYVY(const uint8* src_argb,
|
||||
{
|
||||
// Allocate a rows of yuv.
|
||||
align_buffer_64(row_y, ((width + 63) & ~63) * 2);
|
||||
uint8* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
uint8_t* row_u = row_y + ((width + 63) & ~63);
|
||||
uint8_t* row_v = row_u + ((width + 63) & ~63) / 2;
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToUVRow(src_argb, 0, row_u, row_v, width);
|
||||
@ -745,14 +745,14 @@ int ARGBToUYVY(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to I400.
|
||||
LIBYUV_API
|
||||
int ARGBToI400(const uint8* src_argb,
|
||||
int ARGBToI400(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int width) =
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
if (!src_argb || !dst_y || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -815,26 +815,26 @@ static const uvec8 kShuffleMaskARGBToRGBA = {
|
||||
|
||||
// Convert ARGB to RGBA.
|
||||
LIBYUV_API
|
||||
int ARGBToRGBA(const uint8* src_argb,
|
||||
int ARGBToRGBA(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgba,
|
||||
uint8_t* dst_rgba,
|
||||
int dst_stride_rgba,
|
||||
int width,
|
||||
int height) {
|
||||
return ARGBShuffle(src_argb, src_stride_argb, dst_rgba, dst_stride_rgba,
|
||||
(const uint8*)(&kShuffleMaskARGBToRGBA), width, height);
|
||||
(const uint8_t*)(&kShuffleMaskARGBToRGBA), width, height);
|
||||
}
|
||||
|
||||
// Convert ARGB To RGB24.
|
||||
LIBYUV_API
|
||||
int ARGBToRGB24(const uint8* src_argb,
|
||||
int ARGBToRGB24(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb24,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToRGB24Row)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToRGB24Row)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToRGB24Row_C;
|
||||
if (!src_argb || !dst_rgb24 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -885,14 +885,14 @@ int ARGBToRGB24(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB To RAW.
|
||||
LIBYUV_API
|
||||
int ARGBToRAW(const uint8* src_argb,
|
||||
int ARGBToRAW(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_raw,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToRAWRow)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToRAWRow)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToRAWRow_C;
|
||||
if (!src_argb || !dst_raw || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -942,22 +942,22 @@ int ARGBToRAW(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Ordered 8x8 dither for 888 to 565. Values from 0 to 7.
|
||||
static const uint8 kDither565_4x4[16] = {
|
||||
static const uint8_t kDither565_4x4[16] = {
|
||||
0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2,
|
||||
};
|
||||
|
||||
// Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes).
|
||||
LIBYUV_API
|
||||
int ARGBToRGB565Dither(const uint8* src_argb,
|
||||
int ARGBToRGB565Dither(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
const uint8* dither4x4,
|
||||
const uint8_t* dither4x4,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToRGB565DitherRow)(const uint8* src_argb, uint8* dst_rgb,
|
||||
const uint32 dither4, int width) =
|
||||
void (*ARGBToRGB565DitherRow)(const uint8_t* src_argb, uint8_t* dst_rgb,
|
||||
const uint32_t dither4, int width) =
|
||||
ARGBToRGB565DitherRow_C;
|
||||
if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1005,7 +1005,7 @@ int ARGBToRGB565Dither(const uint8* src_argb,
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
ARGBToRGB565DitherRow(src_argb, dst_rgb565,
|
||||
*(uint32*)(dither4x4 + ((y & 3) << 2)),
|
||||
*(uint32_t*)(dither4x4 + ((y & 3) << 2)),
|
||||
width); /* NOLINT */
|
||||
src_argb += src_stride_argb;
|
||||
dst_rgb565 += dst_stride_rgb565;
|
||||
@ -1016,14 +1016,14 @@ int ARGBToRGB565Dither(const uint8* src_argb,
|
||||
// Convert ARGB To RGB565.
|
||||
// TODO(fbarchard): Consider using dither function low level with zeros.
|
||||
LIBYUV_API
|
||||
int ARGBToRGB565(const uint8* src_argb,
|
||||
int ARGBToRGB565(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_rgb565,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToRGB565Row)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToRGB565Row)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToRGB565Row_C;
|
||||
if (!src_argb || !dst_rgb565 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1082,14 +1082,14 @@ int ARGBToRGB565(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB To ARGB1555.
|
||||
LIBYUV_API
|
||||
int ARGBToARGB1555(const uint8* src_argb,
|
||||
int ARGBToARGB1555(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb1555,
|
||||
uint8_t* dst_argb1555,
|
||||
int dst_stride_argb1555,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToARGB1555Row)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToARGB1555Row)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToARGB1555Row_C;
|
||||
if (!src_argb || !dst_argb1555 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1148,14 +1148,14 @@ int ARGBToARGB1555(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB To ARGB4444.
|
||||
LIBYUV_API
|
||||
int ARGBToARGB4444(const uint8* src_argb,
|
||||
int ARGBToARGB4444(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb4444,
|
||||
uint8_t* dst_argb4444,
|
||||
int dst_stride_argb4444,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToARGB4444Row)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToARGB4444Row)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToARGB4444Row_C;
|
||||
if (!src_argb || !dst_argb4444 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1214,14 +1214,14 @@ int ARGBToARGB4444(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB To AR30.
|
||||
LIBYUV_API
|
||||
int ARGBToAR30(const uint8* src_argb,
|
||||
int ARGBToAR30(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_ar30,
|
||||
uint8_t* dst_ar30,
|
||||
int dst_stride_ar30,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToAR30Row)(const uint8* src_argb, uint8* dst_rgb, int width) =
|
||||
void (*ARGBToAR30Row)(const uint8_t* src_argb, uint8_t* dst_rgb, int width) =
|
||||
ARGBToAR30Row_C;
|
||||
if (!src_argb || !dst_ar30 || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1263,20 +1263,20 @@ int ARGBToAR30(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to J420. (JPeg full range I420).
|
||||
LIBYUV_API
|
||||
int ARGBToJ420(const uint8* src_argb,
|
||||
int ARGBToJ420(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int width) =
|
||||
void (*ARGBToUVJRow)(const uint8_t* src_argb0, int src_stride_argb,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8_t* src_argb, uint8_t* dst_yj, int width) =
|
||||
ARGBToYJRow_C;
|
||||
if (!src_argb || !dst_yj || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1356,20 +1356,20 @@ int ARGBToJ420(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to J422. (JPeg full range I422).
|
||||
LIBYUV_API
|
||||
int ARGBToJ422(const uint8* src_argb,
|
||||
int ARGBToJ422(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToUVJRow)(const uint8* src_argb0, int src_stride_argb,
|
||||
uint8* dst_u, uint8* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int width) =
|
||||
void (*ARGBToUVJRow)(const uint8_t* src_argb0, int src_stride_argb,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) = ARGBToUVJRow_C;
|
||||
void (*ARGBToYJRow)(const uint8_t* src_argb, uint8_t* dst_yj, int width) =
|
||||
ARGBToYJRow_C;
|
||||
if (!src_argb || !dst_yj || !dst_u || !dst_v || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
@ -1451,14 +1451,14 @@ int ARGBToJ422(const uint8* src_argb,
|
||||
|
||||
// Convert ARGB to J400.
|
||||
LIBYUV_API
|
||||
int ARGBToJ400(const uint8* src_argb,
|
||||
int ARGBToJ400(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_yj,
|
||||
uint8_t* dst_yj,
|
||||
int dst_stride_yj,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBToYJRow)(const uint8* src_argb, uint8* dst_yj, int width) =
|
||||
void (*ARGBToYJRow)(const uint8_t* src_argb, uint8_t* dst_yj, int width) =
|
||||
ARGBToYJRow_C;
|
||||
if (!src_argb || !dst_yj || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
|
||||
@ -22,18 +22,18 @@ extern "C" {
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
struct I420Buffers {
|
||||
uint8* y;
|
||||
uint8_t* y;
|
||||
int y_stride;
|
||||
uint8* u;
|
||||
uint8_t* u;
|
||||
int u_stride;
|
||||
uint8* v;
|
||||
uint8_t* v;
|
||||
int v_stride;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
static void JpegCopyI420(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
I420Buffers* dest = (I420Buffers*)(opaque);
|
||||
@ -47,7 +47,7 @@ static void JpegCopyI420(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI422ToI420(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
I420Buffers* dest = (I420Buffers*)(opaque);
|
||||
@ -61,7 +61,7 @@ static void JpegI422ToI420(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI444ToI420(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
I420Buffers* dest = (I420Buffers*)(opaque);
|
||||
@ -75,7 +75,7 @@ static void JpegI444ToI420(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI400ToI420(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
I420Buffers* dest = (I420Buffers*)(opaque);
|
||||
@ -89,7 +89,7 @@ static void JpegI400ToI420(void* opaque,
|
||||
|
||||
// Query size of MJPG in pixels.
|
||||
LIBYUV_API
|
||||
int MJPGSize(const uint8* sample, size_t sample_size, int* width, int* height) {
|
||||
int MJPGSize(const uint8_t* sample, size_t sample_size, int* width, int* height) {
|
||||
MJpegDecoder mjpeg_decoder;
|
||||
LIBYUV_BOOL ret = mjpeg_decoder.LoadFrame(sample, sample_size);
|
||||
if (ret) {
|
||||
@ -103,13 +103,13 @@ int MJPGSize(const uint8* sample, size_t sample_size, int* width, int* height) {
|
||||
// MJPG (Motion JPeg) to I420
|
||||
// TODO(fbarchard): review w and h requirement. dw and dh may be enough.
|
||||
LIBYUV_API
|
||||
int MJPGToI420(const uint8* sample,
|
||||
int MJPGToI420(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* y,
|
||||
uint8_t* y,
|
||||
int y_stride,
|
||||
uint8* u,
|
||||
uint8_t* u,
|
||||
int u_stride,
|
||||
uint8* v,
|
||||
uint8_t* v,
|
||||
int v_stride,
|
||||
int w,
|
||||
int h,
|
||||
@ -183,14 +183,14 @@ int MJPGToI420(const uint8* sample,
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
struct ARGBBuffers {
|
||||
uint8* argb;
|
||||
uint8_t* argb;
|
||||
int argb_stride;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
static void JpegI420ToARGB(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
ARGBBuffers* dest = (ARGBBuffers*)(opaque);
|
||||
@ -201,7 +201,7 @@ static void JpegI420ToARGB(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI422ToARGB(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
ARGBBuffers* dest = (ARGBBuffers*)(opaque);
|
||||
@ -212,7 +212,7 @@ static void JpegI422ToARGB(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI444ToARGB(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
ARGBBuffers* dest = (ARGBBuffers*)(opaque);
|
||||
@ -223,7 +223,7 @@ static void JpegI444ToARGB(void* opaque,
|
||||
}
|
||||
|
||||
static void JpegI400ToARGB(void* opaque,
|
||||
const uint8* const* data,
|
||||
const uint8_t* const* data,
|
||||
const int* strides,
|
||||
int rows) {
|
||||
ARGBBuffers* dest = (ARGBBuffers*)(opaque);
|
||||
@ -235,9 +235,9 @@ static void JpegI400ToARGB(void* opaque,
|
||||
// MJPG (Motion JPeg) to ARGB
|
||||
// TODO(fbarchard): review w and h requirement. dw and dh may be enough.
|
||||
LIBYUV_API
|
||||
int MJPGToARGB(const uint8* sample,
|
||||
int MJPGToARGB(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* argb,
|
||||
uint8_t* argb,
|
||||
int argb_stride,
|
||||
int w,
|
||||
int h,
|
||||
|
||||
@ -29,9 +29,9 @@ extern "C" {
|
||||
// sample_size is measured in bytes and is the size of the frame.
|
||||
// With MJPEG it is the compressed size of the frame.
|
||||
LIBYUV_API
|
||||
int ConvertToARGB(const uint8* sample,
|
||||
int ConvertToARGB(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* crop_argb,
|
||||
uint8_t* crop_argb,
|
||||
int argb_stride,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
@ -40,11 +40,11 @@ int ConvertToARGB(const uint8* sample,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
uint32_t fourcc) {
|
||||
uint32_t format = CanonicalFourCC(fourcc);
|
||||
int aligned_src_width = (src_width + 1) & ~1;
|
||||
const uint8* src;
|
||||
const uint8* src_uv;
|
||||
const uint8_t* src;
|
||||
const uint8_t* src_uv;
|
||||
int abs_src_height = (src_height < 0) ? -src_height : src_height;
|
||||
int inv_crop_height = (crop_height < 0) ? -crop_height : crop_height;
|
||||
int r = 0;
|
||||
@ -56,9 +56,9 @@ int ConvertToARGB(const uint8* sample,
|
||||
// also enable temporary buffer.
|
||||
LIBYUV_BOOL need_buf =
|
||||
(rotation && format != FOURCC_ARGB) || crop_argb == sample;
|
||||
uint8* dest_argb = crop_argb;
|
||||
uint8_t* dest_argb = crop_argb;
|
||||
int dest_argb_stride = argb_stride;
|
||||
uint8* rotate_buffer = NULL;
|
||||
uint8_t* rotate_buffer = NULL;
|
||||
int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
|
||||
|
||||
if (crop_argb == NULL || sample == NULL || src_width <= 0 ||
|
||||
@ -71,7 +71,7 @@ int ConvertToARGB(const uint8* sample,
|
||||
|
||||
if (need_buf) {
|
||||
int argb_size = crop_width * 4 * abs_crop_height;
|
||||
rotate_buffer = (uint8*)malloc(argb_size); /* NOLINT */
|
||||
rotate_buffer = (uint8_t*)malloc(argb_size); /* NOLINT */
|
||||
if (!rotate_buffer) {
|
||||
return 1; // Out of memory runtime error.
|
||||
}
|
||||
@ -166,9 +166,9 @@ int ConvertToARGB(const uint8* sample,
|
||||
// Triplanar formats
|
||||
case FOURCC_I420:
|
||||
case FOURCC_YV12: {
|
||||
const uint8* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
int halfwidth = (src_width + 1) / 2;
|
||||
int halfheight = (abs_src_height + 1) / 2;
|
||||
if (format == FOURCC_YV12) {
|
||||
@ -188,9 +188,9 @@ int ConvertToARGB(const uint8* sample,
|
||||
}
|
||||
|
||||
case FOURCC_J420: {
|
||||
const uint8* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
int halfwidth = (src_width + 1) / 2;
|
||||
int halfheight = (abs_src_height + 1) / 2;
|
||||
src_u = sample + src_width * abs_src_height +
|
||||
@ -204,9 +204,9 @@ int ConvertToARGB(const uint8* sample,
|
||||
|
||||
case FOURCC_I422:
|
||||
case FOURCC_YV16: {
|
||||
const uint8* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
int halfwidth = (src_width + 1) / 2;
|
||||
if (format == FOURCC_YV16) {
|
||||
src_v = sample + src_width * abs_src_height + halfwidth * crop_y +
|
||||
@ -225,9 +225,9 @@ int ConvertToARGB(const uint8* sample,
|
||||
}
|
||||
case FOURCC_I444:
|
||||
case FOURCC_YV24: {
|
||||
const uint8* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
if (format == FOURCC_YV24) {
|
||||
src_v = sample + src_width * (abs_src_height + crop_y) + crop_x;
|
||||
src_u = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
|
||||
|
||||
@ -25,13 +25,13 @@ extern "C" {
|
||||
// sample_size is measured in bytes and is the size of the frame.
|
||||
// With MJPEG it is the compressed size of the frame.
|
||||
LIBYUV_API
|
||||
int ConvertToI420(const uint8* sample,
|
||||
int ConvertToI420(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8* y,
|
||||
uint8_t* y,
|
||||
int y_stride,
|
||||
uint8* u,
|
||||
uint8_t* u,
|
||||
int u_stride,
|
||||
uint8* v,
|
||||
uint8_t* v,
|
||||
int v_stride,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
@ -40,11 +40,11 @@ int ConvertToI420(const uint8* sample,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
uint32_t fourcc) {
|
||||
uint32_t format = CanonicalFourCC(fourcc);
|
||||
int aligned_src_width = (src_width + 1) & ~1;
|
||||
const uint8* src;
|
||||
const uint8* src_uv;
|
||||
const uint8_t* src;
|
||||
const uint8_t* src_uv;
|
||||
const int abs_src_height = (src_height < 0) ? -src_height : src_height;
|
||||
// TODO(nisse): Why allow crop_height < 0?
|
||||
const int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
|
||||
@ -53,13 +53,13 @@ int ConvertToI420(const uint8* sample,
|
||||
(rotation && format != FOURCC_I420 && format != FOURCC_NV12 &&
|
||||
format != FOURCC_NV21 && format != FOURCC_YV12) ||
|
||||
y == sample;
|
||||
uint8* tmp_y = y;
|
||||
uint8* tmp_u = u;
|
||||
uint8* tmp_v = v;
|
||||
uint8_t* tmp_y = y;
|
||||
uint8_t* tmp_u = u;
|
||||
uint8_t* tmp_v = v;
|
||||
int tmp_y_stride = y_stride;
|
||||
int tmp_u_stride = u_stride;
|
||||
int tmp_v_stride = v_stride;
|
||||
uint8* rotate_buffer = NULL;
|
||||
uint8_t* rotate_buffer = NULL;
|
||||
const int inv_crop_height =
|
||||
(src_height < 0) ? -abs_crop_height : abs_crop_height;
|
||||
|
||||
@ -76,7 +76,7 @@ int ConvertToI420(const uint8* sample,
|
||||
if (need_buf) {
|
||||
int y_size = crop_width * abs_crop_height;
|
||||
int uv_size = ((crop_width + 1) / 2) * ((abs_crop_height + 1) / 2);
|
||||
rotate_buffer = (uint8*)malloc(y_size + uv_size * 2); /* NOLINT */
|
||||
rotate_buffer = (uint8_t*)malloc(y_size + uv_size * 2); /* NOLINT */
|
||||
if (!rotate_buffer) {
|
||||
return 1; // Out of memory runtime error.
|
||||
}
|
||||
@ -175,9 +175,9 @@ int ConvertToI420(const uint8* sample,
|
||||
// Triplanar formats
|
||||
case FOURCC_I420:
|
||||
case FOURCC_YV12: {
|
||||
const uint8* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + (src_width * crop_y + crop_x);
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
int halfwidth = (src_width + 1) / 2;
|
||||
int halfheight = (abs_src_height + 1) / 2;
|
||||
if (format == FOURCC_YV12) {
|
||||
@ -198,9 +198,9 @@ int ConvertToI420(const uint8* sample,
|
||||
}
|
||||
case FOURCC_I422:
|
||||
case FOURCC_YV16: {
|
||||
const uint8* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
int halfwidth = (src_width + 1) / 2;
|
||||
if (format == FOURCC_YV16) {
|
||||
src_v = sample + src_width * abs_src_height + halfwidth * crop_y +
|
||||
@ -220,9 +220,9 @@ int ConvertToI420(const uint8* sample,
|
||||
}
|
||||
case FOURCC_I444:
|
||||
case FOURCC_YV24: {
|
||||
const uint8* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8* src_u;
|
||||
const uint8* src_v;
|
||||
const uint8_t* src_y = sample + src_width * crop_y + crop_x;
|
||||
const uint8_t* src_u;
|
||||
const uint8_t* src_v;
|
||||
if (format == FOURCC_YV24) {
|
||||
src_v = sample + src_width * (abs_src_height + crop_y) + crop_x;
|
||||
src_u = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
|
||||
|
||||
@ -102,7 +102,7 @@ MJpegDecoder::~MJpegDecoder() {
|
||||
DestroyOutputBuffers();
|
||||
}
|
||||
|
||||
LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
|
||||
LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8_t* src, size_t src_len) {
|
||||
if (!ValidateJpeg(src, src_len)) {
|
||||
return LIBYUV_FALSE;
|
||||
}
|
||||
@ -129,7 +129,7 @@ LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
|
||||
if (scanlines_[i]) {
|
||||
delete scanlines_[i];
|
||||
}
|
||||
scanlines_[i] = new uint8*[scanlines_size];
|
||||
scanlines_[i] = new uint8_t*[scanlines_size];
|
||||
scanlines_sizes_[i] = scanlines_size;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ LIBYUV_BOOL MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
|
||||
if (databuf_[i]) {
|
||||
delete databuf_[i];
|
||||
}
|
||||
databuf_[i] = new uint8[databuf_size];
|
||||
databuf_[i] = new uint8_t[databuf_size];
|
||||
databuf_strides_[i] = databuf_stride;
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ LIBYUV_BOOL MJpegDecoder::UnloadFrame() {
|
||||
}
|
||||
|
||||
// TODO(fbarchard): Allow rectangle to be specified: x, y, width, height.
|
||||
LIBYUV_BOOL MJpegDecoder::DecodeToBuffers(uint8** planes,
|
||||
LIBYUV_BOOL MJpegDecoder::DecodeToBuffers(uint8_t** planes,
|
||||
int dst_width,
|
||||
int dst_height) {
|
||||
if (dst_width != GetWidth() || dst_height > GetHeight()) {
|
||||
@ -469,9 +469,9 @@ void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {
|
||||
// it.
|
||||
DestroyOutputBuffers();
|
||||
|
||||
scanlines_ = new uint8**[num_outbufs];
|
||||
scanlines_ = new uint8_t**[num_outbufs];
|
||||
scanlines_sizes_ = new int[num_outbufs];
|
||||
databuf_ = new uint8*[num_outbufs];
|
||||
databuf_ = new uint8_t*[num_outbufs];
|
||||
databuf_strides_ = new int[num_outbufs];
|
||||
|
||||
for (int i = 0; i < num_outbufs; ++i) {
|
||||
@ -527,9 +527,9 @@ LIBYUV_BOOL MJpegDecoder::FinishDecode() {
|
||||
return LIBYUV_TRUE;
|
||||
}
|
||||
|
||||
void MJpegDecoder::SetScanlinePointers(uint8** data) {
|
||||
void MJpegDecoder::SetScanlinePointers(uint8_t** data) {
|
||||
for (int i = 0; i < num_outbufs_; ++i) {
|
||||
uint8* data_i = data[i];
|
||||
uint8_t* data_i = data[i];
|
||||
for (int j = 0; j < scanlines_sizes_[i]; ++j) {
|
||||
scanlines_[i][j] = data_i;
|
||||
data_i += GetComponentStride(i);
|
||||
|
||||
@ -18,13 +18,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Helper function to scan for EOI marker (0xff 0xd9).
|
||||
static LIBYUV_BOOL ScanEOI(const uint8* sample, size_t sample_size) {
|
||||
static LIBYUV_BOOL ScanEOI(const uint8_t* sample, size_t sample_size) {
|
||||
if (sample_size >= 2) {
|
||||
const uint8* end = sample + sample_size - 1;
|
||||
const uint8* it = sample;
|
||||
const uint8_t* end = sample + sample_size - 1;
|
||||
const uint8_t* it = sample;
|
||||
while (it < end) {
|
||||
// TODO(fbarchard): scan for 0xd9 instead.
|
||||
it = (const uint8*)(memchr(it, 0xff, end - it));
|
||||
it = (const uint8_t*)(memchr(it, 0xff, end - it));
|
||||
if (it == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -39,7 +39,7 @@ static LIBYUV_BOOL ScanEOI(const uint8* sample, size_t sample_size) {
|
||||
}
|
||||
|
||||
// Helper function to validate the jpeg appears intact.
|
||||
LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size) {
|
||||
LIBYUV_BOOL ValidateJpeg(const uint8_t* sample, size_t sample_size) {
|
||||
// Maximum size that ValidateJpeg will consider valid.
|
||||
const size_t kMaxJpegSize = 0x7fffffffull;
|
||||
const size_t kBackSearchSize = 1024;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,18 +22,18 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
LIBYUV_API
|
||||
void TransposePlane(const uint8* src,
|
||||
void TransposePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
int i = height;
|
||||
#if defined(HAS_TRANSPOSEWX16_MSA)
|
||||
void (*TransposeWx16)(const uint8* src, int src_stride, uint8* dst,
|
||||
void (*TransposeWx16)(const uint8_t* src, int src_stride, uint8_t* dst,
|
||||
int dst_stride, int width) = TransposeWx16_C;
|
||||
#else
|
||||
void (*TransposeWx8)(const uint8* src, int src_stride, uint8* dst,
|
||||
void (*TransposeWx8)(const uint8_t* src, int src_stride, uint8_t* dst,
|
||||
int dst_stride, int width) = TransposeWx8_C;
|
||||
#endif
|
||||
#if defined(HAS_TRANSPOSEWX8_NEON)
|
||||
@ -90,9 +90,9 @@ void TransposePlane(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void RotatePlane90(const uint8* src,
|
||||
void RotatePlane90(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
@ -105,9 +105,9 @@ void RotatePlane90(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void RotatePlane270(const uint8* src,
|
||||
void RotatePlane270(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
@ -120,20 +120,20 @@ void RotatePlane270(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void RotatePlane180(const uint8* src,
|
||||
void RotatePlane180(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
// Swap first and last row and mirror the content. Uses a temporary row.
|
||||
align_buffer_64(row, width);
|
||||
const uint8* src_bot = src + src_stride * (height - 1);
|
||||
uint8* dst_bot = dst + dst_stride * (height - 1);
|
||||
const uint8_t* src_bot = src + src_stride * (height - 1);
|
||||
uint8_t* dst_bot = dst + dst_stride * (height - 1);
|
||||
int half_height = (height + 1) >> 1;
|
||||
int y;
|
||||
void (*MirrorRow)(const uint8* src, uint8* dst, int width) = MirrorRow_C;
|
||||
void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C;
|
||||
void (*MirrorRow)(const uint8_t* src, uint8_t* dst, int width) = MirrorRow_C;
|
||||
void (*CopyRow)(const uint8_t* src, uint8_t* dst, int width) = CopyRow_C;
|
||||
#if defined(HAS_MIRRORROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
MirrorRow = MirrorRow_Any_NEON;
|
||||
@ -201,22 +201,22 @@ void RotatePlane180(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void TransposeUV(const uint8* src,
|
||||
void TransposeUV(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
int i = height;
|
||||
#if defined(HAS_TRANSPOSEUVWX16_MSA)
|
||||
void (*TransposeUVWx16)(const uint8* src, int src_stride, uint8* dst_a,
|
||||
int dst_stride_a, uint8* dst_b, int dst_stride_b,
|
||||
void (*TransposeUVWx16)(const uint8_t* src, int src_stride, uint8_t* dst_a,
|
||||
int dst_stride_a, uint8_t* dst_b, int dst_stride_b,
|
||||
int width) = TransposeUVWx16_C;
|
||||
#else
|
||||
void (*TransposeUVWx8)(const uint8* src, int src_stride, uint8* dst_a,
|
||||
int dst_stride_a, uint8* dst_b, int dst_stride_b,
|
||||
void (*TransposeUVWx8)(const uint8_t* src, int src_stride, uint8_t* dst_a,
|
||||
int dst_stride_a, uint8_t* dst_b, int dst_stride_b,
|
||||
int width) = TransposeUVWx8_C;
|
||||
#endif
|
||||
#if defined(HAS_TRANSPOSEUVWX8_NEON)
|
||||
@ -270,11 +270,11 @@ void TransposeUV(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void RotateUV90(const uint8* src,
|
||||
void RotateUV90(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
@ -286,11 +286,11 @@ void RotateUV90(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void RotateUV270(const uint8* src,
|
||||
void RotateUV270(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
@ -305,16 +305,16 @@ void RotateUV270(const uint8* src,
|
||||
|
||||
// Rotate 180 is a horizontal and vertical flip.
|
||||
LIBYUV_API
|
||||
void RotateUV180(const uint8* src,
|
||||
void RotateUV180(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
int i;
|
||||
void (*MirrorUVRow)(const uint8* src, uint8* dst_u, uint8* dst_v, int width) =
|
||||
void (*MirrorUVRow)(const uint8_t* src, uint8_t* dst_u, uint8_t* dst_v, int width) =
|
||||
MirrorUVRow_C;
|
||||
#if defined(HAS_MIRRORUVROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
|
||||
@ -344,9 +344,9 @@ void RotateUV180(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int RotatePlane(const uint8* src,
|
||||
int RotatePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height,
|
||||
@ -383,17 +383,17 @@ int RotatePlane(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I420Rotate(const uint8* src_y,
|
||||
int I420Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height,
|
||||
@ -451,15 +451,15 @@ int I420Rotate(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int NV12ToI420Rotate(const uint8* src_y,
|
||||
int NV12ToI420Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_uv,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
@ -19,7 +19,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define TANY(NAMEANY, TPOS_SIMD, MASK) \
|
||||
void NAMEANY(const uint8* src, int src_stride, uint8* dst, int dst_stride, \
|
||||
void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst, int dst_stride, \
|
||||
int width) { \
|
||||
int r = width & MASK; \
|
||||
int n = width - r; \
|
||||
@ -44,8 +44,8 @@ TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
|
||||
#undef TANY
|
||||
|
||||
#define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
|
||||
void NAMEANY(const uint8* src, int src_stride, uint8* dst_a, \
|
||||
int dst_stride_a, uint8* dst_b, int dst_stride_b, int width) { \
|
||||
void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst_a, \
|
||||
int dst_stride_a, uint8_t* dst_b, int dst_stride_b, int width) { \
|
||||
int r = width & MASK; \
|
||||
int n = width - r; \
|
||||
if (n > 0) { \
|
||||
|
||||
@ -25,38 +25,38 @@ extern "C" {
|
||||
#if !defined(LIBYUV_DISABLE_X86) && \
|
||||
(defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
|
||||
#define HAS_SCALEARGBROWDOWNEVEN_SSE2
|
||||
void ScaleARGBRowDownEven_SSE2(const uint8* src_ptr,
|
||||
void ScaleARGBRowDownEven_SSE2(const uint8_t* src_ptr,
|
||||
int src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
#endif
|
||||
#if !defined(LIBYUV_DISABLE_NEON) && \
|
||||
(defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
|
||||
#define HAS_SCALEARGBROWDOWNEVEN_NEON
|
||||
void ScaleARGBRowDownEven_NEON(const uint8* src_ptr,
|
||||
void ScaleARGBRowDownEven_NEON(const uint8_t* src_ptr,
|
||||
int src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
#endif
|
||||
|
||||
void ScaleARGBRowDownEven_C(const uint8* src_ptr,
|
||||
void ScaleARGBRowDownEven_C(const uint8_t* src_ptr,
|
||||
int,
|
||||
int src_stepx,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
|
||||
static void ARGBTranspose(const uint8* src,
|
||||
static void ARGBTranspose(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
int i;
|
||||
int src_pixel_step = src_stride >> 2;
|
||||
void (*ScaleARGBRowDownEven)(const uint8* src_ptr, int src_stride,
|
||||
int src_step, uint8* dst_ptr, int dst_width) =
|
||||
void (*ScaleARGBRowDownEven)(const uint8_t* src_ptr, int src_stride,
|
||||
int src_step, uint8_t* dst_ptr, int dst_width) =
|
||||
ScaleARGBRowDownEven_C;
|
||||
#if defined(HAS_SCALEARGBROWDOWNEVEN_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(height, 4)) { // Width of dest.
|
||||
@ -76,9 +76,9 @@ static void ARGBTranspose(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
void ARGBRotate90(const uint8* src,
|
||||
void ARGBRotate90(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
@ -90,9 +90,9 @@ void ARGBRotate90(const uint8* src,
|
||||
ARGBTranspose(src, src_stride, dst, dst_stride, width, height);
|
||||
}
|
||||
|
||||
void ARGBRotate270(const uint8* src,
|
||||
void ARGBRotate270(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
@ -104,21 +104,21 @@ void ARGBRotate270(const uint8* src,
|
||||
ARGBTranspose(src, src_stride, dst, dst_stride, width, height);
|
||||
}
|
||||
|
||||
void ARGBRotate180(const uint8* src,
|
||||
void ARGBRotate180(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
// Swap first and last row and mirror the content. Uses a temporary row.
|
||||
align_buffer_64(row, width * 4);
|
||||
const uint8* src_bot = src + src_stride * (height - 1);
|
||||
uint8* dst_bot = dst + dst_stride * (height - 1);
|
||||
const uint8_t* src_bot = src + src_stride * (height - 1);
|
||||
uint8_t* dst_bot = dst + dst_stride * (height - 1);
|
||||
int half_height = (height + 1) >> 1;
|
||||
int y;
|
||||
void (*ARGBMirrorRow)(const uint8* src, uint8* dst, int width) =
|
||||
void (*ARGBMirrorRow)(const uint8_t* src, uint8_t* dst, int width) =
|
||||
ARGBMirrorRow_C;
|
||||
void (*CopyRow)(const uint8* src, uint8* dst, int width) = CopyRow_C;
|
||||
void (*CopyRow)(const uint8_t* src, uint8_t* dst, int width) = CopyRow_C;
|
||||
#if defined(HAS_ARGBMIRRORROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
ARGBMirrorRow = ARGBMirrorRow_Any_NEON;
|
||||
@ -186,9 +186,9 @@ void ARGBRotate180(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int ARGBRotate(const uint8* src_argb,
|
||||
int ARGBRotate(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
@ -16,9 +16,9 @@ namespace libyuv {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void TransposeWx8_C(const uint8* src,
|
||||
void TransposeWx8_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
int i;
|
||||
@ -36,11 +36,11 @@ void TransposeWx8_C(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
void TransposeUVWx8_C(const uint8* src,
|
||||
void TransposeUVWx8_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
int i;
|
||||
@ -67,9 +67,9 @@ void TransposeUVWx8_C(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
void TransposeWxH_C(const uint8* src,
|
||||
void TransposeWxH_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
@ -82,11 +82,11 @@ void TransposeWxH_C(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
void TransposeUVWxH_C(const uint8* src,
|
||||
void TransposeUVWxH_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width,
|
||||
int height) {
|
||||
|
||||
@ -22,9 +22,9 @@ extern "C" {
|
||||
|
||||
// Transpose 8x8. 32 or 64 bit, but not NaCL for 64 bit.
|
||||
#if defined(HAS_TRANSPOSEWX8_SSSE3)
|
||||
void TransposeWx8_SSSE3(const uint8* src,
|
||||
void TransposeWx8_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -112,9 +112,9 @@ void TransposeWx8_SSSE3(const uint8* src,
|
||||
|
||||
// Transpose 16x8. 64 bit
|
||||
#if defined(HAS_TRANSPOSEWX8_FAST_SSSE3)
|
||||
void TransposeWx8_Fast_SSSE3(const uint8* src,
|
||||
void TransposeWx8_Fast_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -255,11 +255,11 @@ void TransposeWx8_Fast_SSSE3(const uint8* src,
|
||||
|
||||
// Transpose UV 8x8. 64 bit.
|
||||
#if defined(HAS_TRANSPOSEUVWX8_SSE2)
|
||||
void TransposeUVWx8_SSE2(const uint8* src,
|
||||
void TransposeUVWx8_SSE2(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
asm volatile(
|
||||
|
||||
@ -51,9 +51,9 @@ extern "C" {
|
||||
out3 = (v16u8)__msa_ilvl_d((v2i64)in3, (v2i64)in2); \
|
||||
}
|
||||
|
||||
void TransposeWx16_C(const uint8* src,
|
||||
void TransposeWx16_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
TransposeWx8_C(src, src_stride, dst, dst_stride, width);
|
||||
@ -61,11 +61,11 @@ void TransposeWx16_C(const uint8* src,
|
||||
width);
|
||||
}
|
||||
|
||||
void TransposeUVWx16_C(const uint8* src,
|
||||
void TransposeUVWx16_C(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
TransposeUVWx8_C(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b,
|
||||
@ -74,13 +74,13 @@ void TransposeUVWx16_C(const uint8* src,
|
||||
dst_stride_a, (dst_b + 8), dst_stride_b, width);
|
||||
}
|
||||
|
||||
void TransposeWx16_MSA(const uint8* src,
|
||||
void TransposeWx16_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
int x;
|
||||
const uint8* s;
|
||||
const uint8_t* s;
|
||||
v16u8 src0, src1, src2, src3, dst0, dst1, dst2, dst3, vec0, vec1, vec2, vec3;
|
||||
v16u8 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
|
||||
v16u8 res0, res1, res2, res3, res4, res5, res6, res7, res8, res9;
|
||||
@ -153,15 +153,15 @@ void TransposeWx16_MSA(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
void TransposeUVWx16_MSA(const uint8* src,
|
||||
void TransposeUVWx16_MSA(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
int x;
|
||||
const uint8* s;
|
||||
const uint8_t* s;
|
||||
v16u8 src0, src1, src2, src3, dst0, dst1, dst2, dst3, vec0, vec1, vec2, vec3;
|
||||
v16u8 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
|
||||
v16u8 res0, res1, res2, res3, res4, res5, res6, res7, res8, res9;
|
||||
|
||||
@ -24,12 +24,12 @@ extern "C" {
|
||||
static const uvec8 kVTbl4x4Transpose = {0, 4, 8, 12, 1, 5, 9, 13,
|
||||
2, 6, 10, 14, 3, 7, 11, 15};
|
||||
|
||||
void TransposeWx8_NEON(const uint8* src,
|
||||
void TransposeWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
const uint8* src_temp;
|
||||
const uint8_t* src_temp;
|
||||
asm volatile(
|
||||
// loops are on blocks of 8. loop will stop when
|
||||
// counter gets to or below 0. starting the counter
|
||||
@ -192,14 +192,14 @@ void TransposeWx8_NEON(const uint8* src,
|
||||
static const uvec8 kVTbl4x4TransposeDi = {0, 8, 1, 9, 2, 10, 3, 11,
|
||||
4, 12, 5, 13, 6, 14, 7, 15};
|
||||
|
||||
void TransposeUVWx8_NEON(const uint8* src,
|
||||
void TransposeUVWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
const uint8* src_temp;
|
||||
const uint8_t* src_temp;
|
||||
asm volatile(
|
||||
// loops are on blocks of 8. loop will stop when
|
||||
// counter gets to or below 0. starting the counter
|
||||
|
||||
@ -24,12 +24,12 @@ extern "C" {
|
||||
static const uvec8 kVTbl4x4Transpose = {0, 4, 8, 12, 1, 5, 9, 13,
|
||||
2, 6, 10, 14, 3, 7, 11, 15};
|
||||
|
||||
void TransposeWx8_NEON(const uint8* src,
|
||||
void TransposeWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
const uint8* src_temp;
|
||||
const uint8_t* src_temp;
|
||||
asm volatile(
|
||||
// loops are on blocks of 8. loop will stop when
|
||||
// counter gets to or below 0. starting the counter
|
||||
@ -196,18 +196,18 @@ void TransposeWx8_NEON(const uint8* src,
|
||||
"v17", "v18", "v19", "v20", "v21", "v22", "v23");
|
||||
}
|
||||
|
||||
static const uint8 kVTbl4x4TransposeDi[32] = {
|
||||
static const uint8_t kVTbl4x4TransposeDi[32] = {
|
||||
0, 16, 32, 48, 2, 18, 34, 50, 4, 20, 36, 52, 6, 22, 38, 54,
|
||||
1, 17, 33, 49, 3, 19, 35, 51, 5, 21, 37, 53, 7, 23, 39, 55};
|
||||
|
||||
void TransposeUVWx8_NEON(const uint8* src,
|
||||
void TransposeUVWx8_NEON(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int width) {
|
||||
const uint8* src_temp;
|
||||
const uint8_t* src_temp;
|
||||
asm volatile(
|
||||
// loops are on blocks of 8. loop will stop when
|
||||
// counter gets to or below 0. starting the counter
|
||||
|
||||
@ -19,9 +19,9 @@ extern "C" {
|
||||
// This module is for 32 bit Visual C x86 and clangcl
|
||||
#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && defined(_MSC_VER)
|
||||
|
||||
__declspec(naked) void TransposeWx8_SSSE3(const uint8* src,
|
||||
__declspec(naked) void TransposeWx8_SSSE3(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int width) {
|
||||
__asm {
|
||||
@ -112,11 +112,11 @@ __declspec(naked) void TransposeWx8_SSSE3(const uint8* src,
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void TransposeUVWx8_SSE2(const uint8* src,
|
||||
__declspec(naked) void TransposeUVWx8_SSE2(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8* dst_a,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride_a,
|
||||
uint8* dst_b,
|
||||
uint8_t* dst_b,
|
||||
int dst_stride_b,
|
||||
int w) {
|
||||
__asm {
|
||||
|
||||
@ -32,10 +32,10 @@ extern "C" {
|
||||
|
||||
// Any 4 planes to 1 with yuvconstants
|
||||
#define ANY41C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \
|
||||
void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \
|
||||
const uint8* a_buf, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, \
|
||||
const uint8_t* a_buf, uint8_t* dst_ptr, \
|
||||
const struct YuvConstants* yuvconstants, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 5]); \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 5]); \
|
||||
memset(temp, 0, 64 * 4); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -68,9 +68,9 @@ ANY41C(I422AlphaToARGBRow_Any_MSA, I422AlphaToARGBRow_MSA, 1, 0, 4, 7)
|
||||
|
||||
// Any 3 planes to 1.
|
||||
#define ANY31(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \
|
||||
void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \
|
||||
uint8* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 4]); \
|
||||
void NAMEANY(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, \
|
||||
uint8_t* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 4]); \
|
||||
memset(temp, 0, 64 * 3); /* for YUY2 and msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -120,10 +120,10 @@ ANY31(BlendPlaneRow_Any_SSSE3, BlendPlaneRow_SSSE3, 0, 0, 1, 7)
|
||||
// on arm that subsamples 444 to 422 internally.
|
||||
// Any 3 planes to 1 with yuvconstants
|
||||
#define ANY31C(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, BPP, MASK) \
|
||||
void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \
|
||||
uint8* dst_ptr, const struct YuvConstants* yuvconstants, \
|
||||
void NAMEANY(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, \
|
||||
uint8_t* dst_ptr, const struct YuvConstants* yuvconstants, \
|
||||
int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 4]); \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 4]); \
|
||||
memset(temp, 0, 64 * 3); /* for YUY2 and msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -200,10 +200,10 @@ ANY31C(I422ToRGB565Row_Any_MSA, I422ToRGB565Row_MSA, 1, 0, 2, 7)
|
||||
// Any 3 planes of 16 bit to 1 with yuvconstants
|
||||
// TODO(fbarchard): consider sharing this code with ANY31C
|
||||
#define ANY31CT(NAMEANY, ANY_SIMD, UVSHIFT, DUVSHIFT, T, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const T* y_buf, const T* u_buf, const T* v_buf, uint8* dst_ptr, \
|
||||
void NAMEANY(const T* y_buf, const T* u_buf, const T* v_buf, uint8_t* dst_ptr, \
|
||||
const struct YuvConstants* yuvconstants, int width) { \
|
||||
SIMD_ALIGNED(T temp[16 * 3]); \
|
||||
SIMD_ALIGNED(uint8 out[64]); \
|
||||
SIMD_ALIGNED(uint8_t out[64]); \
|
||||
memset(temp, 0, 16 * 3 * SBPP); /* for YUY2 and msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -218,21 +218,21 @@ ANY31C(I422ToRGB565Row_Any_MSA, I422ToRGB565Row_MSA, 1, 0, 2, 7)
|
||||
}
|
||||
|
||||
#ifdef HAS_I210TOAR30ROW_SSSE3
|
||||
ANY31CT(I210ToAR30Row_Any_SSSE3, I210ToAR30Row_SSSE3, 1, 0, uint16, 2, 4, 7)
|
||||
ANY31CT(I210ToAR30Row_Any_SSSE3, I210ToAR30Row_SSSE3, 1, 0, uint16_t, 2, 4, 7)
|
||||
#endif
|
||||
#ifdef HAS_I210TOARGBROW_SSSE3
|
||||
ANY31CT(I210ToARGBRow_Any_SSSE3, I210ToARGBRow_SSSE3, 1, 0, uint16, 2, 4, 7)
|
||||
ANY31CT(I210ToARGBRow_Any_SSSE3, I210ToARGBRow_SSSE3, 1, 0, uint16_t, 2, 4, 7)
|
||||
#endif
|
||||
#ifdef HAS_I210TOARGBROW_AVX2
|
||||
ANY31CT(I210ToARGBRow_Any_AVX2, I210ToARGBRow_AVX2, 1, 0, uint16, 2, 4, 15)
|
||||
ANY31CT(I210ToARGBRow_Any_AVX2, I210ToARGBRow_AVX2, 1, 0, uint16_t, 2, 4, 15)
|
||||
#endif
|
||||
#undef ANY31CT
|
||||
|
||||
// Any 2 planes to 1.
|
||||
#define ANY21(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, SBPP2, BPP, MASK) \
|
||||
void NAMEANY(const uint8* y_buf, const uint8* uv_buf, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* y_buf, const uint8_t* uv_buf, uint8_t* dst_ptr, \
|
||||
int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 3]); \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 3]); \
|
||||
memset(temp, 0, 64 * 2); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -328,9 +328,9 @@ ANY21(SobelXYRow_Any_MSA, SobelXYRow_MSA, 0, 1, 1, 4, 15)
|
||||
|
||||
// Any 2 planes to 1 with yuvconstants
|
||||
#define ANY21C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, SBPP2, BPP, MASK) \
|
||||
void NAMEANY(const uint8* y_buf, const uint8* uv_buf, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* y_buf, const uint8_t* uv_buf, uint8_t* dst_ptr, \
|
||||
const struct YuvConstants* yuvconstants, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 3]); \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 3]); \
|
||||
memset(temp, 0, 64 * 2); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -385,8 +385,8 @@ ANY21C(NV12ToRGB565Row_Any_MSA, NV12ToRGB565Row_MSA, 1, 1, 2, 2, 7)
|
||||
|
||||
// Any 1 to 1.
|
||||
#define ANY11(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[128 * 2]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[128 * 2]); \
|
||||
memset(temp, 0, 128); /* for YUY2 and msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -640,8 +640,8 @@ ANY11(ARGBExtractAlphaRow_Any_MSA, ARGBExtractAlphaRow_MSA, 0, 4, 1, 15)
|
||||
|
||||
// Any 1 to 1 blended. Destination is read, modify, write.
|
||||
#define ANY11B(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 2]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 2]); \
|
||||
memset(temp, 0, 64 * 2); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -670,8 +670,8 @@ ANY11B(ARGBCopyYToAlphaRow_Any_SSE2, ARGBCopyYToAlphaRow_SSE2, 0, 1, 4, 7)
|
||||
|
||||
// Any 1 to 1 with parameter.
|
||||
#define ANY11P(NAMEANY, ANY_SIMD, T, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, T param, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 2]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_ptr, T param, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 2]); \
|
||||
memset(temp, 0, 64); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -686,7 +686,7 @@ ANY11B(ARGBCopyYToAlphaRow_Any_SSE2, ARGBCopyYToAlphaRow_SSE2, 0, 1, 4, 7)
|
||||
#if defined(HAS_ARGBTORGB565DITHERROW_SSE2)
|
||||
ANY11P(ARGBToRGB565DitherRow_Any_SSE2,
|
||||
ARGBToRGB565DitherRow_SSE2,
|
||||
const uint32,
|
||||
const uint32_t,
|
||||
4,
|
||||
2,
|
||||
3)
|
||||
@ -694,7 +694,7 @@ ANY11P(ARGBToRGB565DitherRow_Any_SSE2,
|
||||
#if defined(HAS_ARGBTORGB565DITHERROW_AVX2)
|
||||
ANY11P(ARGBToRGB565DitherRow_Any_AVX2,
|
||||
ARGBToRGB565DitherRow_AVX2,
|
||||
const uint32,
|
||||
const uint32_t,
|
||||
4,
|
||||
2,
|
||||
7)
|
||||
@ -702,7 +702,7 @@ ANY11P(ARGBToRGB565DitherRow_Any_AVX2,
|
||||
#if defined(HAS_ARGBTORGB565DITHERROW_NEON)
|
||||
ANY11P(ARGBToRGB565DitherRow_Any_NEON,
|
||||
ARGBToRGB565DitherRow_NEON,
|
||||
const uint32,
|
||||
const uint32_t,
|
||||
4,
|
||||
2,
|
||||
7)
|
||||
@ -710,22 +710,22 @@ ANY11P(ARGBToRGB565DitherRow_Any_NEON,
|
||||
#if defined(HAS_ARGBTORGB565DITHERROW_MSA)
|
||||
ANY11P(ARGBToRGB565DitherRow_Any_MSA,
|
||||
ARGBToRGB565DitherRow_MSA,
|
||||
const uint32,
|
||||
const uint32_t,
|
||||
4,
|
||||
2,
|
||||
7)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSHUFFLEROW_SSSE3
|
||||
ANY11P(ARGBShuffleRow_Any_SSSE3, ARGBShuffleRow_SSSE3, const uint8*, 4, 4, 7)
|
||||
ANY11P(ARGBShuffleRow_Any_SSSE3, ARGBShuffleRow_SSSE3, const uint8_t*, 4, 4, 7)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSHUFFLEROW_AVX2
|
||||
ANY11P(ARGBShuffleRow_Any_AVX2, ARGBShuffleRow_AVX2, const uint8*, 4, 4, 15)
|
||||
ANY11P(ARGBShuffleRow_Any_AVX2, ARGBShuffleRow_AVX2, const uint8_t*, 4, 4, 15)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSHUFFLEROW_NEON
|
||||
ANY11P(ARGBShuffleRow_Any_NEON, ARGBShuffleRow_NEON, const uint8*, 4, 4, 3)
|
||||
ANY11P(ARGBShuffleRow_Any_NEON, ARGBShuffleRow_NEON, const uint8_t*, 4, 4, 3)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSHUFFLEROW_MSA
|
||||
ANY11P(ARGBShuffleRow_Any_MSA, ARGBShuffleRow_MSA, const uint8*, 4, 4, 7)
|
||||
ANY11P(ARGBShuffleRow_Any_MSA, ARGBShuffleRow_MSA, const uint8_t*, 4, 4, 7)
|
||||
#endif
|
||||
#undef ANY11P
|
||||
|
||||
@ -750,25 +750,25 @@ ANY11C(Convert16To8Row_Any_SSSE3,
|
||||
Convert16To8Row_SSSE3,
|
||||
2,
|
||||
1,
|
||||
uint16,
|
||||
uint8,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
15)
|
||||
#endif
|
||||
#ifdef HAS_CONVERT16TO8ROW_AVX2
|
||||
ANY11C(Convert16To8Row_Any_AVX2, Convert16To8Row_AVX2, 2, 1, uint16, uint8, 31)
|
||||
ANY11C(Convert16To8Row_Any_AVX2, Convert16To8Row_AVX2, 2, 1, uint16_t, uint8_t, 31)
|
||||
#endif
|
||||
#ifdef HAS_CONVERT8TO16ROW_SSE2
|
||||
ANY11C(Convert8To16Row_Any_SSE2, Convert8To16Row_SSE2, 1, 2, uint8, uint16, 15)
|
||||
ANY11C(Convert8To16Row_Any_SSE2, Convert8To16Row_SSE2, 1, 2, uint8_t, uint16_t, 15)
|
||||
#endif
|
||||
#ifdef HAS_CONVERT8TO16ROW_AVX2
|
||||
ANY11C(Convert8To16Row_Any_AVX2, Convert8To16Row_AVX2, 1, 2, uint8, uint16, 31)
|
||||
ANY11C(Convert8To16Row_Any_AVX2, Convert8To16Row_AVX2, 1, 2, uint8_t, uint16_t, 31)
|
||||
#endif
|
||||
#undef ANY11C
|
||||
|
||||
// Any 1 to 1 with parameter and shorts to byte. BPP measures in shorts.
|
||||
#define ANY11P16(NAMEANY, ANY_SIMD, T, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const uint16* src_ptr, uint16* dst_ptr, T param, int width) { \
|
||||
SIMD_ALIGNED(uint16 temp[32 * 2]); \
|
||||
void NAMEANY(const uint16_t* src_ptr, uint16_t* dst_ptr, T param, int width) { \
|
||||
SIMD_ALIGNED(uint16_t temp[32 * 2]); \
|
||||
memset(temp, 0, 64); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -801,9 +801,9 @@ ANY11P16(HalfFloatRow_Any_MSA, HalfFloatRow_MSA, float, 2, 2, 31)
|
||||
|
||||
// Any 1 to 1 with yuvconstants
|
||||
#define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_ptr, \
|
||||
const struct YuvConstants* yuvconstants, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[128 * 2]); \
|
||||
SIMD_ALIGNED(uint8_t temp[128 * 2]); \
|
||||
memset(temp, 0, 128); /* for YUY2 and msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -834,9 +834,9 @@ ANY11C(UYVYToARGBRow_Any_MSA, UYVYToARGBRow_MSA, 1, 4, 4, 7)
|
||||
|
||||
// Any 1 to 1 interpolate. Takes 2 rows of source via stride.
|
||||
#define ANY11T(NAMEANY, ANY_SIMD, SBPP, BPP, MASK) \
|
||||
void NAMEANY(uint8* dst_ptr, const uint8* src_ptr, ptrdiff_t src_stride_ptr, \
|
||||
void NAMEANY(uint8_t* dst_ptr, const uint8_t* src_ptr, ptrdiff_t src_stride_ptr, \
|
||||
int width, int source_y_fraction) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 3]); \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 3]); \
|
||||
memset(temp, 0, 64 * 2); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -865,8 +865,8 @@ ANY11T(InterpolateRow_Any_MSA, InterpolateRow_MSA, 1, 1, 31)
|
||||
|
||||
// Any 1 to 1 mirror.
|
||||
#define ANY11M(NAMEANY, ANY_SIMD, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64 * 2]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_ptr, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[64 * 2]); \
|
||||
memset(temp, 0, 64); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -906,8 +906,8 @@ ANY11M(ARGBMirrorRow_Any_MSA, ARGBMirrorRow_MSA, 4, 15)
|
||||
|
||||
// Any 1 plane. (memset)
|
||||
#define ANY1(NAMEANY, ANY_SIMD, T, BPP, MASK) \
|
||||
void NAMEANY(uint8* dst_ptr, T v32, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[64]); \
|
||||
void NAMEANY(uint8_t* dst_ptr, T v32, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[64]); \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
if (n > 0) { \
|
||||
@ -918,23 +918,23 @@ ANY11M(ARGBMirrorRow_Any_MSA, ARGBMirrorRow_MSA, 4, 15)
|
||||
}
|
||||
|
||||
#ifdef HAS_SETROW_X86
|
||||
ANY1(SetRow_Any_X86, SetRow_X86, uint8, 1, 3)
|
||||
ANY1(SetRow_Any_X86, SetRow_X86, uint8_t, 1, 3)
|
||||
#endif
|
||||
#ifdef HAS_SETROW_NEON
|
||||
ANY1(SetRow_Any_NEON, SetRow_NEON, uint8, 1, 15)
|
||||
ANY1(SetRow_Any_NEON, SetRow_NEON, uint8_t, 1, 15)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSETROW_NEON
|
||||
ANY1(ARGBSetRow_Any_NEON, ARGBSetRow_NEON, uint32, 4, 3)
|
||||
ANY1(ARGBSetRow_Any_NEON, ARGBSetRow_NEON, uint32_t, 4, 3)
|
||||
#endif
|
||||
#ifdef HAS_ARGBSETROW_MSA
|
||||
ANY1(ARGBSetRow_Any_MSA, ARGBSetRow_MSA, uint32, 4, 3)
|
||||
ANY1(ARGBSetRow_Any_MSA, ARGBSetRow_MSA, uint32_t, 4, 3)
|
||||
#endif
|
||||
#undef ANY1
|
||||
|
||||
// Any 1 to 2. Outputs UV planes.
|
||||
#define ANY12(NAMEANY, ANY_SIMD, UVSHIFT, BPP, DUVSHIFT, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_u, uint8* dst_v, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[128 * 3]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_u, uint8_t* dst_v, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[128 * 3]); \
|
||||
memset(temp, 0, 128); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -984,9 +984,9 @@ ANY12(UYVYToUV422Row_Any_MSA, UYVYToUV422Row_MSA, 1, 4, 1, 31)
|
||||
|
||||
// Any 1 to 3. Outputs RGB planes.
|
||||
#define ANY13(NAMEANY, ANY_SIMD, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint8* dst_r, uint8* dst_g, uint8* dst_b, \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint8_t* dst_r, uint8_t* dst_g, uint8_t* dst_b, \
|
||||
int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[16 * 6]); \
|
||||
SIMD_ALIGNED(uint8_t temp[16 * 6]); \
|
||||
memset(temp, 0, 16 * 3); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
@ -1010,9 +1010,9 @@ ANY13(SplitRGBRow_Any_NEON, SplitRGBRow_NEON, 3, 15)
|
||||
// Any 1 to 2 with source stride (2 rows of source). Outputs UV planes.
|
||||
// 128 byte row allows for 32 avx ARGB pixels.
|
||||
#define ANY12S(NAMEANY, ANY_SIMD, UVSHIFT, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, int src_stride_ptr, uint8* dst_u, \
|
||||
uint8* dst_v, int width) { \
|
||||
SIMD_ALIGNED(uint8 temp[128 * 4]); \
|
||||
void NAMEANY(const uint8_t* src_ptr, int src_stride_ptr, uint8_t* dst_u, \
|
||||
uint8_t* dst_v, int width) { \
|
||||
SIMD_ALIGNED(uint8_t temp[128 * 4]); \
|
||||
memset(temp, 0, 128 * 2); /* for msan */ \
|
||||
int r = width & MASK; \
|
||||
int n = width & ~MASK; \
|
||||
|
||||
1274
source/row_common.cc
1274
source/row_common.cc
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -106,10 +106,10 @@ extern "C" {
|
||||
"vqshrun.s16 d22, q9, #6 \n" /* R */ \
|
||||
"vqshrun.s16 d21, q0, #6 \n" /* G */
|
||||
|
||||
void I444ToARGBRow_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_argb,
|
||||
void I444ToARGBRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -132,10 +132,10 @@ void I444ToARGBRow_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void I422ToARGBRow_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_argb,
|
||||
void I422ToARGBRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -158,11 +158,11 @@ void I422ToARGBRow_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void I422AlphaToARGBRow_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
const uint8* src_a,
|
||||
uint8* dst_argb,
|
||||
void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
const uint8_t* src_a,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -186,10 +186,10 @@ void I422AlphaToARGBRow_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void I422ToRGBARow_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_rgba,
|
||||
void I422ToRGBARow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_rgba,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -213,10 +213,10 @@ void I422ToRGBARow_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void I422ToRGB24Row_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_rgb24,
|
||||
void I422ToRGB24Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_rgb24,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -245,10 +245,10 @@ void I422ToRGB24Row_NEON(const uint8* src_y,
|
||||
"vsri.16 q0, q8, #5 \n" /* RG */ \
|
||||
"vsri.16 q0, q9, #11 \n" /* RGB */
|
||||
|
||||
void I422ToRGB565Row_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_rgb565,
|
||||
void I422ToRGB565Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_rgb565,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -279,10 +279,10 @@ void I422ToRGB565Row_NEON(const uint8* src_y,
|
||||
"vsri.16 q0, q9, #6 \n" /* ARG */ \
|
||||
"vsri.16 q0, q10, #11 \n" /* ARGB */
|
||||
|
||||
void I422ToARGB1555Row_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_argb1555,
|
||||
void I422ToARGB1555Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_argb1555,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -315,10 +315,10 @@ void I422ToARGB1555Row_NEON(const uint8* src_y,
|
||||
"vorr d1, d22, d23 \n" /* RA */ \
|
||||
"vzip.u8 d0, d1 \n" /* BGRA */
|
||||
|
||||
void I422ToARGB4444Row_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_argb4444,
|
||||
void I422ToARGB4444Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_argb4444,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -344,7 +344,7 @@ void I422ToARGB4444Row_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) {
|
||||
void I400ToARGBRow_NEON(const uint8_t* src_y, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
YUVTORGB_SETUP
|
||||
"vmov.u8 d23, #255 \n"
|
||||
@ -363,7 +363,7 @@ void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) {
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) {
|
||||
void J400ToARGBRow_NEON(const uint8_t* src_y, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d23, #255 \n"
|
||||
"1: \n"
|
||||
@ -380,9 +380,9 @@ void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width) {
|
||||
: "cc", "memory", "d20", "d21", "d22", "d23");
|
||||
}
|
||||
|
||||
void NV12ToARGBRow_NEON(const uint8* src_y,
|
||||
const uint8* src_uv,
|
||||
uint8* dst_argb,
|
||||
void NV12ToARGBRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_uv,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(YUVTORGB_SETUP
|
||||
@ -403,9 +403,9 @@ void NV12ToARGBRow_NEON(const uint8* src_y,
|
||||
"q10", "q11", "q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void NV21ToARGBRow_NEON(const uint8* src_y,
|
||||
const uint8* src_vu,
|
||||
uint8* dst_argb,
|
||||
void NV21ToARGBRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_vu,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(YUVTORGB_SETUP
|
||||
@ -426,9 +426,9 @@ void NV21ToARGBRow_NEON(const uint8* src_y,
|
||||
"q10", "q11", "q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void NV12ToRGB565Row_NEON(const uint8* src_y,
|
||||
const uint8* src_uv,
|
||||
uint8* dst_rgb565,
|
||||
void NV12ToRGB565Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_uv,
|
||||
uint8_t* dst_rgb565,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(
|
||||
@ -449,8 +449,8 @@ void NV12ToRGB565Row_NEON(const uint8* src_y,
|
||||
"q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
|
||||
uint8* dst_argb,
|
||||
void YUY2ToARGBRow_NEON(const uint8_t* src_yuy2,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(YUVTORGB_SETUP
|
||||
@ -470,8 +470,8 @@ void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
|
||||
"q10", "q11", "q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void UYVYToARGBRow_NEON(const uint8* src_uyvy,
|
||||
uint8* dst_argb,
|
||||
void UYVYToARGBRow_NEON(const uint8_t* src_uyvy,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
asm volatile(YUVTORGB_SETUP
|
||||
@ -492,9 +492,9 @@ void UYVYToARGBRow_NEON(const uint8* src_uyvy,
|
||||
}
|
||||
|
||||
// Reads 16 pairs of UV and write even values to dst_u and odd to dst_v.
|
||||
void SplitUVRow_NEON(const uint8* src_uv,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
void SplitUVRow_NEON(const uint8_t* src_uv,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -513,9 +513,9 @@ void SplitUVRow_NEON(const uint8* src_uv,
|
||||
}
|
||||
|
||||
// Reads 16 U's and V's and writes out 16 pairs of UV.
|
||||
void MergeUVRow_NEON(const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_uv,
|
||||
void MergeUVRow_NEON(const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_uv,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -534,10 +534,10 @@ void MergeUVRow_NEON(const uint8* src_u,
|
||||
}
|
||||
|
||||
// Reads 16 packed RGB and write to planar dst_r, dst_g, dst_b.
|
||||
void SplitRGBRow_NEON(const uint8* src_rgb,
|
||||
uint8* dst_r,
|
||||
uint8* dst_g,
|
||||
uint8* dst_b,
|
||||
void SplitRGBRow_NEON(const uint8_t* src_rgb,
|
||||
uint8_t* dst_r,
|
||||
uint8_t* dst_g,
|
||||
uint8_t* dst_b,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -559,10 +559,10 @@ void SplitRGBRow_NEON(const uint8* src_rgb,
|
||||
}
|
||||
|
||||
// Reads 16 planar R's, G's and B's and writes out 16 packed RGB at a time
|
||||
void MergeRGBRow_NEON(const uint8* src_r,
|
||||
const uint8* src_g,
|
||||
const uint8* src_b,
|
||||
uint8* dst_rgb,
|
||||
void MergeRGBRow_NEON(const uint8_t* src_r,
|
||||
const uint8_t* src_g,
|
||||
const uint8_t* src_b,
|
||||
uint8_t* dst_rgb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -584,7 +584,7 @@ void MergeRGBRow_NEON(const uint8* src_r,
|
||||
}
|
||||
|
||||
// Copy multiple of 32. vld4.8 allow unaligned and is fastest on a15.
|
||||
void CopyRow_NEON(const uint8* src, uint8* dst, int count) {
|
||||
void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int count) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld1.8 {d0, d1, d2, d3}, [%0]! \n" // load 32
|
||||
@ -600,7 +600,7 @@ void CopyRow_NEON(const uint8* src, uint8* dst, int count) {
|
||||
}
|
||||
|
||||
// SetRow writes 'count' bytes using an 8 bit value repeated.
|
||||
void SetRow_NEON(uint8* dst, uint8 v8, int count) {
|
||||
void SetRow_NEON(uint8_t* dst, uint8_t v8, int count) {
|
||||
asm volatile(
|
||||
"vdup.8 q0, %2 \n" // duplicate 16 bytes
|
||||
"1: \n"
|
||||
@ -614,7 +614,7 @@ void SetRow_NEON(uint8* dst, uint8 v8, int count) {
|
||||
}
|
||||
|
||||
// ARGBSetRow writes 'count' pixels using an 32 bit value repeated.
|
||||
void ARGBSetRow_NEON(uint8* dst, uint32 v32, int count) {
|
||||
void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int count) {
|
||||
asm volatile(
|
||||
"vdup.u32 q0, %2 \n" // duplicate 4 ints
|
||||
"1: \n"
|
||||
@ -627,7 +627,7 @@ void ARGBSetRow_NEON(uint8* dst, uint32 v32, int count) {
|
||||
: "cc", "memory", "q0");
|
||||
}
|
||||
|
||||
void MirrorRow_NEON(const uint8* src, uint8* dst, int width) {
|
||||
void MirrorRow_NEON(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
// Start at end of source row.
|
||||
"mov r3, #-16 \n"
|
||||
@ -648,9 +648,9 @@ void MirrorRow_NEON(const uint8* src, uint8* dst, int width) {
|
||||
: "cc", "memory", "r3", "q0");
|
||||
}
|
||||
|
||||
void MirrorUVRow_NEON(const uint8* src_uv,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
void MirrorUVRow_NEON(const uint8_t* src_uv,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
// Start at end of source row.
|
||||
@ -673,7 +673,7 @@ void MirrorUVRow_NEON(const uint8* src_uv,
|
||||
: "cc", "memory", "r12", "q0");
|
||||
}
|
||||
|
||||
void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width) {
|
||||
void ARGBMirrorRow_NEON(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
// Start at end of source row.
|
||||
"mov r3, #-16 \n"
|
||||
@ -694,7 +694,7 @@ void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width) {
|
||||
: "cc", "memory", "r3", "q0");
|
||||
}
|
||||
|
||||
void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int width) {
|
||||
void RGB24ToARGBRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #255 \n" // Alpha
|
||||
"1: \n"
|
||||
@ -710,7 +710,7 @@ void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int width) {
|
||||
void RAWToARGBRow_NEON(const uint8_t* src_raw, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #255 \n" // Alpha
|
||||
"1: \n"
|
||||
@ -727,7 +727,7 @@ void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void RAWToRGB24Row_NEON(const uint8* src_raw, uint8* dst_rgb24, int width) {
|
||||
void RAWToRGB24Row_NEON(const uint8_t* src_raw, uint8_t* dst_rgb24, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld3.8 {d1, d2, d3}, [%0]! \n" // load 8 pixels of RAW.
|
||||
@ -756,7 +756,7 @@ void RAWToRGB24Row_NEON(const uint8* src_raw, uint8* dst_rgb24, int width) {
|
||||
"vorr.u8 d2, d1, d5 \n" /* R */ \
|
||||
"vorr.u8 d1, d4, d6 \n" /* G */
|
||||
|
||||
void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width) {
|
||||
void RGB565ToARGBRow_NEON(const uint8_t* src_rgb565, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d3, #255 \n" // Alpha
|
||||
"1: \n"
|
||||
@ -800,8 +800,8 @@ void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width) {
|
||||
"vorr.u8 d2, d1, d5 \n" /* R */ \
|
||||
"vorr.u8 d1, d4, d6 \n" /* G */
|
||||
|
||||
void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555,
|
||||
uint8* dst_argb,
|
||||
void ARGB1555ToARGBRow_NEON(const uint8_t* src_argb1555,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d3, #255 \n" // Alpha
|
||||
@ -829,8 +829,8 @@ void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555,
|
||||
"vorr.u8 q1, q1, q2 \n" /* G,A GGGGGGGG */ \
|
||||
"vswp.u8 d1, d2 \n" /* B,R,G,A -> B,G,R,A */
|
||||
|
||||
void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444,
|
||||
uint8* dst_argb,
|
||||
void ARGB4444ToARGBRow_NEON(const uint8_t* src_argb4444,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d3, #255 \n" // Alpha
|
||||
@ -848,7 +848,7 @@ void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444,
|
||||
);
|
||||
}
|
||||
|
||||
void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb24, int width) {
|
||||
void ARGBToRGB24Row_NEON(const uint8_t* src_argb, uint8_t* dst_rgb24, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld4.8 {d1, d2, d3, d4}, [%0]! \n" // load 8 pixels of ARGB.
|
||||
@ -864,7 +864,7 @@ void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb24, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_raw, int width) {
|
||||
void ARGBToRAWRow_NEON(const uint8_t* src_argb, uint8_t* dst_raw, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld4.8 {d1, d2, d3, d4}, [%0]! \n" // load 8 pixels of ARGB.
|
||||
@ -880,7 +880,7 @@ void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_raw, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int width) {
|
||||
void YUY2ToYRow_NEON(const uint8_t* src_yuy2, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld2.8 {q0, q1}, [%0]! \n" // load 16 pixels of YUY2.
|
||||
@ -895,7 +895,7 @@ void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int width) {
|
||||
void UYVYToYRow_NEON(const uint8_t* src_uyvy, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld2.8 {q0, q1}, [%0]! \n" // load 16 pixels of UYVY.
|
||||
@ -910,9 +910,9 @@ void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void YUY2ToUV422Row_NEON(const uint8* src_yuy2,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
void YUY2ToUV422Row_NEON(const uint8_t* src_yuy2,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -930,9 +930,9 @@ void YUY2ToUV422Row_NEON(const uint8* src_yuy2,
|
||||
);
|
||||
}
|
||||
|
||||
void UYVYToUV422Row_NEON(const uint8* src_uyvy,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
void UYVYToUV422Row_NEON(const uint8_t* src_uyvy,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -950,10 +950,10 @@ void UYVYToUV422Row_NEON(const uint8* src_uyvy,
|
||||
);
|
||||
}
|
||||
|
||||
void YUY2ToUVRow_NEON(const uint8* src_yuy2,
|
||||
void YUY2ToUVRow_NEON(const uint8_t* src_yuy2,
|
||||
int stride_yuy2,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1 \n" // stride + src_yuy2
|
||||
@ -977,10 +977,10 @@ void YUY2ToUVRow_NEON(const uint8* src_yuy2,
|
||||
);
|
||||
}
|
||||
|
||||
void UYVYToUVRow_NEON(const uint8* src_uyvy,
|
||||
void UYVYToUVRow_NEON(const uint8_t* src_uyvy,
|
||||
int stride_uyvy,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1 \n" // stride + src_uyvy
|
||||
@ -1005,9 +1005,9 @@ void UYVYToUVRow_NEON(const uint8* src_uyvy,
|
||||
}
|
||||
|
||||
// For BGRAToARGB, ABGRToARGB, RGBAToARGB, and ARGBToRGBA.
|
||||
void ARGBShuffleRow_NEON(const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8* shuffler,
|
||||
void ARGBShuffleRow_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
const uint8_t* shuffler,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vld1.8 {q2}, [%3] \n" // shuffler
|
||||
@ -1026,10 +1026,10 @@ void ARGBShuffleRow_NEON(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void I422ToYUY2Row_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_yuy2,
|
||||
void I422ToYUY2Row_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_yuy2,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -1048,10 +1048,10 @@ void I422ToYUY2Row_NEON(const uint8* src_y,
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3");
|
||||
}
|
||||
|
||||
void I422ToUYVYRow_NEON(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_uyvy,
|
||||
void I422ToUYVYRow_NEON(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_uyvy,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -1070,7 +1070,7 @@ void I422ToUYVYRow_NEON(const uint8* src_y,
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3");
|
||||
}
|
||||
|
||||
void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb565, int width) {
|
||||
void ARGBToRGB565Row_NEON(const uint8_t* src_argb, uint8_t* dst_rgb565, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld4.8 {d20, d21, d22, d23}, [%0]! \n" // load 8 pixels of ARGB.
|
||||
@ -1085,9 +1085,9 @@ void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb565, int width) {
|
||||
: "cc", "memory", "q0", "q8", "q9", "q10", "q11");
|
||||
}
|
||||
|
||||
void ARGBToRGB565DitherRow_NEON(const uint8* src_argb,
|
||||
uint8* dst_rgb,
|
||||
const uint32 dither4,
|
||||
void ARGBToRGB565DitherRow_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_rgb,
|
||||
const uint32_t dither4,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vdup.32 d2, %2 \n" // dither4
|
||||
@ -1107,8 +1107,8 @@ void ARGBToRGB565DitherRow_NEON(const uint8* src_argb,
|
||||
: "cc", "memory", "q0", "q1", "q8", "q9", "q10", "q11");
|
||||
}
|
||||
|
||||
void ARGBToARGB1555Row_NEON(const uint8* src_argb,
|
||||
uint8* dst_argb1555,
|
||||
void ARGBToARGB1555Row_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_argb1555,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -1124,8 +1124,8 @@ void ARGBToARGB1555Row_NEON(const uint8* src_argb,
|
||||
: "cc", "memory", "q0", "q8", "q9", "q10", "q11");
|
||||
}
|
||||
|
||||
void ARGBToARGB4444Row_NEON(const uint8* src_argb,
|
||||
uint8* dst_argb4444,
|
||||
void ARGBToARGB4444Row_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_argb4444,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #0x0f \n" // bits to clear with
|
||||
@ -1143,7 +1143,7 @@ void ARGBToARGB4444Row_NEON(const uint8* src_argb,
|
||||
: "cc", "memory", "q0", "q8", "q9", "q10", "q11");
|
||||
}
|
||||
|
||||
void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
|
||||
void ARGBToYRow_NEON(const uint8_t* src_argb, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d25, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1166,7 +1166,7 @@ void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "q0", "q1", "q2", "q12", "q13");
|
||||
}
|
||||
|
||||
void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width) {
|
||||
void ARGBExtractAlphaRow_NEON(const uint8_t* src_argb, uint8_t* dst_a, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld4.8 {d0, d2, d4, d6}, [%0]! \n" // load 8 ARGB pixels
|
||||
@ -1182,7 +1182,7 @@ void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width) {
|
||||
);
|
||||
}
|
||||
|
||||
void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
|
||||
void ARGBToYJRow_NEON(const uint8_t* src_argb, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #15 \n" // B * 0.11400 coefficient
|
||||
"vmov.u8 d25, #75 \n" // G * 0.58700 coefficient
|
||||
@ -1204,9 +1204,9 @@ void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width) {
|
||||
}
|
||||
|
||||
// 8x1 pixels.
|
||||
void ARGBToUV444Row_NEON(const uint8* src_argb,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
void ARGBToUV444Row_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #112 \n" // UB / VR 0.875
|
||||
@ -1260,10 +1260,10 @@ void ARGBToUV444Row_NEON(const uint8* src_argb,
|
||||
// clang-format on
|
||||
|
||||
// TODO(fbarchard): Consider vhadd vertical, then vpaddl horizontal, avoid shr.
|
||||
void ARGBToUVRow_NEON(const uint8* src_argb,
|
||||
void ARGBToUVRow_NEON(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_argb
|
||||
@ -1306,10 +1306,10 @@ void ARGBToUVRow_NEON(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// TODO(fbarchard): Subsample match C code.
|
||||
void ARGBToUVJRow_NEON(const uint8* src_argb,
|
||||
void ARGBToUVJRow_NEON(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_argb
|
||||
@ -1351,10 +1351,10 @@ void ARGBToUVJRow_NEON(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void BGRAToUVRow_NEON(const uint8* src_bgra,
|
||||
void BGRAToUVRow_NEON(const uint8_t* src_bgra,
|
||||
int src_stride_bgra,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_bgra
|
||||
@ -1396,10 +1396,10 @@ void BGRAToUVRow_NEON(const uint8* src_bgra,
|
||||
);
|
||||
}
|
||||
|
||||
void ABGRToUVRow_NEON(const uint8* src_abgr,
|
||||
void ABGRToUVRow_NEON(const uint8_t* src_abgr,
|
||||
int src_stride_abgr,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_abgr
|
||||
@ -1441,10 +1441,10 @@ void ABGRToUVRow_NEON(const uint8* src_abgr,
|
||||
);
|
||||
}
|
||||
|
||||
void RGBAToUVRow_NEON(const uint8* src_rgba,
|
||||
void RGBAToUVRow_NEON(const uint8_t* src_rgba,
|
||||
int src_stride_rgba,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_rgba
|
||||
@ -1486,10 +1486,10 @@ void RGBAToUVRow_NEON(const uint8* src_rgba,
|
||||
);
|
||||
}
|
||||
|
||||
void RGB24ToUVRow_NEON(const uint8* src_rgb24,
|
||||
void RGB24ToUVRow_NEON(const uint8_t* src_rgb24,
|
||||
int src_stride_rgb24,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_rgb24
|
||||
@ -1531,10 +1531,10 @@ void RGB24ToUVRow_NEON(const uint8* src_rgb24,
|
||||
);
|
||||
}
|
||||
|
||||
void RAWToUVRow_NEON(const uint8* src_raw,
|
||||
void RAWToUVRow_NEON(const uint8_t* src_raw,
|
||||
int src_stride_raw,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile (
|
||||
"add %1, %0, %1 \n" // src_stride + src_raw
|
||||
@ -1577,10 +1577,10 @@ void RAWToUVRow_NEON(const uint8* src_raw,
|
||||
}
|
||||
|
||||
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
|
||||
void RGB565ToUVRow_NEON(const uint8* src_rgb565,
|
||||
void RGB565ToUVRow_NEON(const uint8_t* src_rgb565,
|
||||
int src_stride_rgb565,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1 \n" // src_stride + src_argb
|
||||
@ -1643,10 +1643,10 @@ void RGB565ToUVRow_NEON(const uint8* src_rgb565,
|
||||
}
|
||||
|
||||
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
|
||||
void ARGB1555ToUVRow_NEON(const uint8* src_argb1555,
|
||||
void ARGB1555ToUVRow_NEON(const uint8_t* src_argb1555,
|
||||
int src_stride_argb1555,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1 \n" // src_stride + src_argb
|
||||
@ -1709,10 +1709,10 @@ void ARGB1555ToUVRow_NEON(const uint8* src_argb1555,
|
||||
}
|
||||
|
||||
// 16x2 pixels -> 8x1. width is number of argb pixels. e.g. 16.
|
||||
void ARGB4444ToUVRow_NEON(const uint8* src_argb4444,
|
||||
void ARGB4444ToUVRow_NEON(const uint8_t* src_argb4444,
|
||||
int src_stride_argb4444,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1 \n" // src_stride + src_argb
|
||||
@ -1774,7 +1774,7 @@ void ARGB4444ToUVRow_NEON(const uint8* src_argb4444,
|
||||
"q9", "q10", "q11", "q12", "q13", "q14", "q15");
|
||||
}
|
||||
|
||||
void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width) {
|
||||
void RGB565ToYRow_NEON(const uint8_t* src_rgb565, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d25, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1798,7 +1798,7 @@ void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q12", "q13");
|
||||
}
|
||||
|
||||
void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width) {
|
||||
void ARGB1555ToYRow_NEON(const uint8_t* src_argb1555, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d25, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1822,7 +1822,7 @@ void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q12", "q13");
|
||||
}
|
||||
|
||||
void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width) {
|
||||
void ARGB4444ToYRow_NEON(const uint8_t* src_argb4444, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d25, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1846,7 +1846,7 @@ void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "q0", "q1", "q2", "q3", "q12", "q13");
|
||||
}
|
||||
|
||||
void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width) {
|
||||
void BGRAToYRow_NEON(const uint8_t* src_bgra, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #33 \n" // R * 0.2578 coefficient
|
||||
"vmov.u8 d5, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1869,7 +1869,7 @@ void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "q8");
|
||||
}
|
||||
|
||||
void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width) {
|
||||
void ABGRToYRow_NEON(const uint8_t* src_abgr, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #33 \n" // R * 0.2578 coefficient
|
||||
"vmov.u8 d5, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1892,7 +1892,7 @@ void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "q8");
|
||||
}
|
||||
|
||||
void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width) {
|
||||
void RGBAToYRow_NEON(const uint8_t* src_rgba, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d5, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1915,7 +1915,7 @@ void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "q8");
|
||||
}
|
||||
|
||||
void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width) {
|
||||
void RGB24ToYRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #13 \n" // B * 0.1016 coefficient
|
||||
"vmov.u8 d5, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1938,7 +1938,7 @@ void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width) {
|
||||
: "cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "q8");
|
||||
}
|
||||
|
||||
void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width) {
|
||||
void RAWToYRow_NEON(const uint8_t* src_raw, uint8_t* dst_y, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d4, #33 \n" // R * 0.2578 coefficient
|
||||
"vmov.u8 d5, #65 \n" // G * 0.5078 coefficient
|
||||
@ -1962,8 +1962,8 @@ void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width) {
|
||||
}
|
||||
|
||||
// Bilinear filter 16x2 -> 16x1
|
||||
void InterpolateRow_NEON(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void InterpolateRow_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int dst_width,
|
||||
int source_y_fraction) {
|
||||
@ -2021,9 +2021,9 @@ void InterpolateRow_NEON(uint8* dst_ptr,
|
||||
}
|
||||
|
||||
// dr * (256 - sa) / 256 + sr = dr - dr * sa / 256 + sr
|
||||
void ARGBBlendRow_NEON(const uint8* src_argb0,
|
||||
const uint8* src_argb1,
|
||||
uint8* dst_argb,
|
||||
void ARGBBlendRow_NEON(const uint8_t* src_argb0,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"subs %3, #8 \n"
|
||||
@ -2081,7 +2081,7 @@ void ARGBBlendRow_NEON(const uint8* src_argb0,
|
||||
}
|
||||
|
||||
// Attenuate 8 pixels at a time.
|
||||
void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
|
||||
void ARGBAttenuateRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
// Attenuate 8 pixels.
|
||||
"1: \n"
|
||||
@ -2104,7 +2104,7 @@ void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
|
||||
|
||||
// Quantize 8 ARGB pixels (32 bytes).
|
||||
// dst = (dst * scale >> 16) * interval_size + interval_offset;
|
||||
void ARGBQuantizeRow_NEON(uint8* dst_argb,
|
||||
void ARGBQuantizeRow_NEON(uint8_t* dst_argb,
|
||||
int scale,
|
||||
int interval_size,
|
||||
int interval_offset,
|
||||
@ -2147,10 +2147,10 @@ void ARGBQuantizeRow_NEON(uint8* dst_argb,
|
||||
// Shade 8 pixels at a time by specified value.
|
||||
// NOTE vqrdmulh.s16 q10, q10, d0[0] must use a scaler register from 0 to 8.
|
||||
// Rounding in vqrdmulh does +1 to high if high bit of low s16 is set.
|
||||
void ARGBShadeRow_NEON(const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
void ARGBShadeRow_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int width,
|
||||
uint32 value) {
|
||||
uint32_t value) {
|
||||
asm volatile(
|
||||
"vdup.u32 q0, %3 \n" // duplicate scale value.
|
||||
"vzip.u8 d0, d1 \n" // d0 aarrggbb.
|
||||
@ -2184,7 +2184,7 @@ void ARGBShadeRow_NEON(const uint8* src_argb,
|
||||
// Convert 8 ARGB pixels (64 bytes) to 8 Gray ARGB pixels
|
||||
// Similar to ARGBToYJ but stores ARGB.
|
||||
// C code is (15 * b + 75 * g + 38 * r + 64) >> 7;
|
||||
void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
|
||||
void ARGBGrayRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #15 \n" // B * 0.11400 coefficient
|
||||
"vmov.u8 d25, #75 \n" // G * 0.58700 coefficient
|
||||
@ -2211,7 +2211,7 @@ void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width) {
|
||||
// b = (r * 35 + g * 68 + b * 17) >> 7
|
||||
// g = (r * 45 + g * 88 + b * 22) >> 7
|
||||
// r = (r * 50 + g * 98 + b * 24) >> 7
|
||||
void ARGBSepiaRow_NEON(uint8* dst_argb, int width) {
|
||||
void ARGBSepiaRow_NEON(uint8_t* dst_argb, int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d20, #17 \n" // BB coefficient
|
||||
"vmov.u8 d21, #68 \n" // BG coefficient
|
||||
@ -2249,9 +2249,9 @@ void ARGBSepiaRow_NEON(uint8* dst_argb, int width) {
|
||||
// Tranform 8 ARGB pixels (32 bytes) with color matrix.
|
||||
// TODO(fbarchard): Was same as Sepia except matrix is provided. This function
|
||||
// needs to saturate. Consider doing a non-saturating version.
|
||||
void ARGBColorMatrixRow_NEON(const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const int8* matrix_argb,
|
||||
void ARGBColorMatrixRow_NEON(const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
const int8_t* matrix_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vld1.8 {q2}, [%3] \n" // load 3 ARGB vectors.
|
||||
@ -2308,9 +2308,9 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Multiply 2 rows of ARGB pixels together, 8 pixels at a time.
|
||||
void ARGBMultiplyRow_NEON(const uint8* src_argb0,
|
||||
const uint8* src_argb1,
|
||||
uint8* dst_argb,
|
||||
void ARGBMultiplyRow_NEON(const uint8_t* src_argb0,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
// 8 pixel loop.
|
||||
@ -2337,9 +2337,9 @@ void ARGBMultiplyRow_NEON(const uint8* src_argb0,
|
||||
}
|
||||
|
||||
// Add 2 rows of ARGB pixels together, 8 pixels at a time.
|
||||
void ARGBAddRow_NEON(const uint8* src_argb0,
|
||||
const uint8* src_argb1,
|
||||
uint8* dst_argb,
|
||||
void ARGBAddRow_NEON(const uint8_t* src_argb0,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
// 8 pixel loop.
|
||||
@ -2360,9 +2360,9 @@ void ARGBAddRow_NEON(const uint8* src_argb0,
|
||||
}
|
||||
|
||||
// Subtract 2 rows of ARGB pixels, 8 pixels at a time.
|
||||
void ARGBSubtractRow_NEON(const uint8* src_argb0,
|
||||
const uint8* src_argb1,
|
||||
uint8* dst_argb,
|
||||
void ARGBSubtractRow_NEON(const uint8_t* src_argb0,
|
||||
const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
// 8 pixel loop.
|
||||
@ -2387,9 +2387,9 @@ void ARGBSubtractRow_NEON(const uint8* src_argb0,
|
||||
// R = Sobel
|
||||
// G = Sobel
|
||||
// B = Sobel
|
||||
void SobelRow_NEON(const uint8* src_sobelx,
|
||||
const uint8* src_sobely,
|
||||
uint8* dst_argb,
|
||||
void SobelRow_NEON(const uint8_t* src_sobelx,
|
||||
const uint8_t* src_sobely,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d3, #255 \n" // alpha
|
||||
@ -2412,9 +2412,9 @@ void SobelRow_NEON(const uint8* src_sobelx,
|
||||
}
|
||||
|
||||
// Adds Sobel X and Sobel Y and stores Sobel into plane.
|
||||
void SobelToPlaneRow_NEON(const uint8* src_sobelx,
|
||||
const uint8* src_sobely,
|
||||
uint8* dst_y,
|
||||
void SobelToPlaneRow_NEON(const uint8_t* src_sobelx,
|
||||
const uint8_t* src_sobely,
|
||||
uint8_t* dst_y,
|
||||
int width) {
|
||||
asm volatile(
|
||||
// 16 pixel loop.
|
||||
@ -2438,9 +2438,9 @@ void SobelToPlaneRow_NEON(const uint8* src_sobelx,
|
||||
// R = Sobel X
|
||||
// G = Sobel
|
||||
// B = Sobel Y
|
||||
void SobelXYRow_NEON(const uint8* src_sobelx,
|
||||
const uint8* src_sobely,
|
||||
uint8* dst_argb,
|
||||
void SobelXYRow_NEON(const uint8_t* src_sobelx,
|
||||
const uint8_t* src_sobely,
|
||||
uint8_t* dst_argb,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d3, #255 \n" // alpha
|
||||
@ -2464,10 +2464,10 @@ void SobelXYRow_NEON(const uint8* src_sobelx,
|
||||
// -1 0 1
|
||||
// -2 0 2
|
||||
// -1 0 1
|
||||
void SobelXRow_NEON(const uint8* src_y0,
|
||||
const uint8* src_y1,
|
||||
const uint8* src_y2,
|
||||
uint8* dst_sobelx,
|
||||
void SobelXRow_NEON(const uint8_t* src_y0,
|
||||
const uint8_t* src_y1,
|
||||
const uint8_t* src_y2,
|
||||
uint8_t* dst_sobelx,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -2503,9 +2503,9 @@ void SobelXRow_NEON(const uint8* src_y0,
|
||||
// -1 -2 -1
|
||||
// 0 0 0
|
||||
// 1 2 1
|
||||
void SobelYRow_NEON(const uint8* src_y0,
|
||||
const uint8* src_y1,
|
||||
uint8* dst_sobely,
|
||||
void SobelYRow_NEON(const uint8_t* src_y0,
|
||||
const uint8_t* src_y1,
|
||||
uint8_t* dst_sobely,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
@ -2536,7 +2536,7 @@ void SobelYRow_NEON(const uint8* src_y0,
|
||||
);
|
||||
}
|
||||
|
||||
void HalfFloat1Row_NEON(const uint16* src, uint16* dst, float, int width) {
|
||||
void HalfFloat1Row_NEON(const uint16_t* src, uint16_t* dst, float, int width) {
|
||||
asm volatile(
|
||||
"vdup.32 q0, %3 \n"
|
||||
|
||||
@ -2561,7 +2561,7 @@ void HalfFloat1Row_NEON(const uint16* src, uint16* dst, float, int width) {
|
||||
}
|
||||
|
||||
// TODO(fbarchard): multiply by element.
|
||||
void HalfFloatRow_NEON(const uint16* src, uint16* dst, float scale, int width) {
|
||||
void HalfFloatRow_NEON(const uint16_t* src, uint16_t* dst, float scale, int width) {
|
||||
asm volatile(
|
||||
"vdup.32 q0, %3 \n"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
260
source/scale.cc
260
source/scale.cc
@ -39,12 +39,12 @@ static void ScalePlaneDown2(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown2)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width) =
|
||||
void (*ScaleRowDown2)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width) =
|
||||
filtering == kFilterNone
|
||||
? ScaleRowDown2_C
|
||||
: (filtering == kFilterLinear ? ScaleRowDown2Linear_C
|
||||
@ -136,12 +136,12 @@ static void ScalePlaneDown2_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown2)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width) =
|
||||
void (*ScaleRowDown2)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width) =
|
||||
filtering == kFilterNone
|
||||
? ScaleRowDown2_16_C
|
||||
: (filtering == kFilterLinear ? ScaleRowDown2Linear_16_C
|
||||
@ -191,12 +191,12 @@ static void ScalePlaneDown4(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown4)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width) =
|
||||
void (*ScaleRowDown4)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width) =
|
||||
filtering ? ScaleRowDown4Box_C : ScaleRowDown4_C;
|
||||
int row_stride = src_stride << 2;
|
||||
(void)src_width;
|
||||
@ -258,12 +258,12 @@ static void ScalePlaneDown4_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown4)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width) =
|
||||
void (*ScaleRowDown4)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width) =
|
||||
filtering ? ScaleRowDown4Box_16_C : ScaleRowDown4_16_C;
|
||||
int row_stride = src_stride << 2;
|
||||
(void)src_width;
|
||||
@ -302,14 +302,14 @@ static void ScalePlaneDown34(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown34_0)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_1)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_0)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_1)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width);
|
||||
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
|
||||
(void)src_width;
|
||||
(void)src_height;
|
||||
@ -411,14 +411,14 @@ static void ScalePlaneDown34_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown34_0)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_1)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_0)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown34_1)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width);
|
||||
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
|
||||
(void)src_width;
|
||||
(void)src_height;
|
||||
@ -497,14 +497,14 @@ static void ScalePlaneDown38(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown38_3)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_2)(const uint8* src_ptr, ptrdiff_t src_stride,
|
||||
uint8* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_3)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_2)(const uint8_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr, int dst_width);
|
||||
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
|
||||
assert(dst_width % 3 == 0);
|
||||
(void)src_width;
|
||||
@ -606,14 +606,14 @@ static void ScalePlaneDown38_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int y;
|
||||
void (*ScaleRowDown38_3)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_2)(const uint16* src_ptr, ptrdiff_t src_stride,
|
||||
uint16* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_3)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width);
|
||||
void (*ScaleRowDown38_2)(const uint16_t* src_ptr, ptrdiff_t src_stride,
|
||||
uint16_t* dst_ptr, int dst_width);
|
||||
const int filter_stride = (filtering == kFilterLinear) ? 0 : src_stride;
|
||||
(void)src_width;
|
||||
(void)src_height;
|
||||
@ -673,8 +673,8 @@ static void ScalePlaneDown38_16(int src_width,
|
||||
|
||||
#define MIN1(x) ((x) < 1 ? 1 : (x))
|
||||
|
||||
static __inline uint32 SumPixels(int iboxwidth, const uint16* src_ptr) {
|
||||
uint32 sum = 0u;
|
||||
static __inline uint32_t SumPixels(int iboxwidth, const uint16_t* src_ptr) {
|
||||
uint32_t sum = 0u;
|
||||
int x;
|
||||
assert(iboxwidth > 0);
|
||||
for (x = 0; x < iboxwidth; ++x) {
|
||||
@ -683,8 +683,8 @@ static __inline uint32 SumPixels(int iboxwidth, const uint16* src_ptr) {
|
||||
return sum;
|
||||
}
|
||||
|
||||
static __inline uint32 SumPixels_16(int iboxwidth, const uint32* src_ptr) {
|
||||
uint32 sum = 0u;
|
||||
static __inline uint32_t SumPixels_16(int iboxwidth, const uint32_t* src_ptr) {
|
||||
uint32_t sum = 0u;
|
||||
int x;
|
||||
assert(iboxwidth > 0);
|
||||
for (x = 0; x < iboxwidth; ++x) {
|
||||
@ -697,8 +697,8 @@ static void ScaleAddCols2_C(int dst_width,
|
||||
int boxheight,
|
||||
int x,
|
||||
int dx,
|
||||
const uint16* src_ptr,
|
||||
uint8* dst_ptr) {
|
||||
const uint16_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int i;
|
||||
int scaletbl[2];
|
||||
int minboxwidth = dx >> 16;
|
||||
@ -719,8 +719,8 @@ static void ScaleAddCols2_16_C(int dst_width,
|
||||
int boxheight,
|
||||
int x,
|
||||
int dx,
|
||||
const uint32* src_ptr,
|
||||
uint16* dst_ptr) {
|
||||
const uint32_t* src_ptr,
|
||||
uint16_t* dst_ptr) {
|
||||
int i;
|
||||
int scaletbl[2];
|
||||
int minboxwidth = dx >> 16;
|
||||
@ -741,8 +741,8 @@ static void ScaleAddCols0_C(int dst_width,
|
||||
int boxheight,
|
||||
int x,
|
||||
int dx,
|
||||
const uint16* src_ptr,
|
||||
uint8* dst_ptr) {
|
||||
const uint16_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int scaleval = 65536 / boxheight;
|
||||
int i;
|
||||
(void)dx;
|
||||
@ -756,8 +756,8 @@ static void ScaleAddCols1_C(int dst_width,
|
||||
int boxheight,
|
||||
int x,
|
||||
int dx,
|
||||
const uint16* src_ptr,
|
||||
uint8* dst_ptr) {
|
||||
const uint16_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int boxwidth = MIN1(dx >> 16);
|
||||
int scaleval = 65536 / (boxwidth * boxheight);
|
||||
int i;
|
||||
@ -772,8 +772,8 @@ static void ScaleAddCols1_16_C(int dst_width,
|
||||
int boxheight,
|
||||
int x,
|
||||
int dx,
|
||||
const uint32* src_ptr,
|
||||
uint16* dst_ptr) {
|
||||
const uint32_t* src_ptr,
|
||||
uint16_t* dst_ptr) {
|
||||
int boxwidth = MIN1(dx >> 16);
|
||||
int scaleval = 65536 / (boxwidth * boxheight);
|
||||
int i;
|
||||
@ -796,8 +796,8 @@ static void ScalePlaneBox(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr) {
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int j, k;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -809,13 +809,13 @@ static void ScalePlaneBox(int src_width,
|
||||
&dx, &dy);
|
||||
src_width = Abs(src_width);
|
||||
{
|
||||
// Allocate a row buffer of uint16.
|
||||
// Allocate a row buffer of uint16_t.
|
||||
align_buffer_64(row16, src_width * 2);
|
||||
void (*ScaleAddCols)(int dst_width, int boxheight, int x, int dx,
|
||||
const uint16* src_ptr, uint8* dst_ptr) =
|
||||
const uint16_t* src_ptr, uint8_t* dst_ptr) =
|
||||
(dx & 0xffff) ? ScaleAddCols2_C
|
||||
: ((dx != 0x10000) ? ScaleAddCols1_C : ScaleAddCols0_C);
|
||||
void (*ScaleAddRow)(const uint8* src_ptr, uint16* dst_ptr, int src_width) =
|
||||
void (*ScaleAddRow)(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) =
|
||||
ScaleAddRow_C;
|
||||
#if defined(HAS_SCALEADDROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2)) {
|
||||
@ -853,7 +853,7 @@ static void ScalePlaneBox(int src_width,
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
int boxheight;
|
||||
int iy = y >> 16;
|
||||
const uint8* src = src_ptr + iy * src_stride;
|
||||
const uint8_t* src = src_ptr + iy * src_stride;
|
||||
y += dy;
|
||||
if (y > max_y) {
|
||||
y = max_y;
|
||||
@ -861,10 +861,10 @@ static void ScalePlaneBox(int src_width,
|
||||
boxheight = MIN1((y >> 16) - iy);
|
||||
memset(row16, 0, src_width * 2);
|
||||
for (k = 0; k < boxheight; ++k) {
|
||||
ScaleAddRow(src, (uint16*)(row16), src_width);
|
||||
ScaleAddRow(src, (uint16_t*)(row16), src_width);
|
||||
src += src_stride;
|
||||
}
|
||||
ScaleAddCols(dst_width, boxheight, x, dx, (uint16*)(row16), dst_ptr);
|
||||
ScaleAddCols(dst_width, boxheight, x, dx, (uint16_t*)(row16), dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
}
|
||||
free_aligned_buffer_64(row16);
|
||||
@ -877,8 +877,8 @@ static void ScalePlaneBox_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr) {
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr) {
|
||||
int j, k;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -890,12 +890,12 @@ static void ScalePlaneBox_16(int src_width,
|
||||
&dx, &dy);
|
||||
src_width = Abs(src_width);
|
||||
{
|
||||
// Allocate a row buffer of uint32.
|
||||
// Allocate a row buffer of uint32_t.
|
||||
align_buffer_64(row32, src_width * 4);
|
||||
void (*ScaleAddCols)(int dst_width, int boxheight, int x, int dx,
|
||||
const uint32* src_ptr, uint16* dst_ptr) =
|
||||
const uint32_t* src_ptr, uint16_t* dst_ptr) =
|
||||
(dx & 0xffff) ? ScaleAddCols2_16_C : ScaleAddCols1_16_C;
|
||||
void (*ScaleAddRow)(const uint16* src_ptr, uint32* dst_ptr, int src_width) =
|
||||
void (*ScaleAddRow)(const uint16_t* src_ptr, uint32_t* dst_ptr, int src_width) =
|
||||
ScaleAddRow_16_C;
|
||||
|
||||
#if defined(HAS_SCALEADDROW_16_SSE2)
|
||||
@ -907,7 +907,7 @@ static void ScalePlaneBox_16(int src_width,
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
int boxheight;
|
||||
int iy = y >> 16;
|
||||
const uint16* src = src_ptr + iy * src_stride;
|
||||
const uint16_t* src = src_ptr + iy * src_stride;
|
||||
y += dy;
|
||||
if (y > max_y) {
|
||||
y = max_y;
|
||||
@ -915,10 +915,10 @@ static void ScalePlaneBox_16(int src_width,
|
||||
boxheight = MIN1((y >> 16) - iy);
|
||||
memset(row32, 0, src_width * 4);
|
||||
for (k = 0; k < boxheight; ++k) {
|
||||
ScaleAddRow(src, (uint32*)(row32), src_width);
|
||||
ScaleAddRow(src, (uint32_t*)(row32), src_width);
|
||||
src += src_stride;
|
||||
}
|
||||
ScaleAddCols(dst_width, boxheight, x, dx, (uint32*)(row32), dst_ptr);
|
||||
ScaleAddCols(dst_width, boxheight, x, dx, (uint32_t*)(row32), dst_ptr);
|
||||
dst_ptr += dst_stride;
|
||||
}
|
||||
free_aligned_buffer_64(row32);
|
||||
@ -932,8 +932,8 @@ void ScalePlaneBilinearDown(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -946,10 +946,10 @@ void ScalePlaneBilinearDown(int src_width,
|
||||
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
int j;
|
||||
void (*ScaleFilterCols)(uint8 * dst_ptr, const uint8* src_ptr, int dst_width,
|
||||
void (*ScaleFilterCols)(uint8_t * dst_ptr, const uint8_t* src_ptr, int dst_width,
|
||||
int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleFilterCols64_C : ScaleFilterCols_C;
|
||||
void (*InterpolateRow)(uint8 * dst_ptr, const uint8* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1016,7 +1016,7 @@ void ScalePlaneBilinearDown(int src_width,
|
||||
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
int yi = y >> 16;
|
||||
const uint8* src = src_ptr + yi * src_stride;
|
||||
const uint8_t* src = src_ptr + yi * src_stride;
|
||||
if (filtering == kFilterLinear) {
|
||||
ScaleFilterCols(dst_ptr, src, dst_width, x, dx);
|
||||
} else {
|
||||
@ -1039,8 +1039,8 @@ void ScalePlaneBilinearDown_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -1053,10 +1053,10 @@ void ScalePlaneBilinearDown_16(int src_width,
|
||||
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
int j;
|
||||
void (*ScaleFilterCols)(uint16 * dst_ptr, const uint16* src_ptr,
|
||||
void (*ScaleFilterCols)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleFilterCols64_16_C : ScaleFilterCols_16_C;
|
||||
void (*InterpolateRow)(uint16 * dst_ptr, const uint16* src_ptr,
|
||||
void (*InterpolateRow)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1107,13 +1107,13 @@ void ScalePlaneBilinearDown_16(int src_width,
|
||||
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
int yi = y >> 16;
|
||||
const uint16* src = src_ptr + yi * src_stride;
|
||||
const uint16_t* src = src_ptr + yi * src_stride;
|
||||
if (filtering == kFilterLinear) {
|
||||
ScaleFilterCols(dst_ptr, src, dst_width, x, dx);
|
||||
} else {
|
||||
int yf = (y >> 8) & 255;
|
||||
InterpolateRow((uint16*)row, src, src_stride, src_width, yf);
|
||||
ScaleFilterCols(dst_ptr, (uint16*)row, dst_width, x, dx);
|
||||
InterpolateRow((uint16_t*)row, src, src_stride, src_width, yf);
|
||||
ScaleFilterCols(dst_ptr, (uint16_t*)row, dst_width, x, dx);
|
||||
}
|
||||
dst_ptr += dst_stride;
|
||||
y += dy;
|
||||
@ -1131,8 +1131,8 @@ void ScalePlaneBilinearUp(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
@ -1141,10 +1141,10 @@ void ScalePlaneBilinearUp(int src_width,
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
void (*InterpolateRow)(uint8 * dst_ptr, const uint8* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleFilterCols)(uint8 * dst_ptr, const uint8* src_ptr, int dst_width,
|
||||
void (*ScaleFilterCols)(uint8_t * dst_ptr, const uint8_t* src_ptr, int dst_width,
|
||||
int x, int dx) =
|
||||
filtering ? ScaleFilterCols_C : ScaleCols_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1214,13 +1214,13 @@ void ScalePlaneBilinearUp(int src_width,
|
||||
}
|
||||
{
|
||||
int yi = y >> 16;
|
||||
const uint8* src = src_ptr + yi * src_stride;
|
||||
const uint8_t* src = src_ptr + yi * src_stride;
|
||||
|
||||
// Allocate 2 row buffers.
|
||||
const int kRowSize = (dst_width + 31) & ~31;
|
||||
align_buffer_64(row, kRowSize * 2);
|
||||
|
||||
uint8* rowptr = row;
|
||||
uint8_t* rowptr = row;
|
||||
int rowstride = kRowSize;
|
||||
int lasty = yi;
|
||||
|
||||
@ -1266,8 +1266,8 @@ void ScalePlaneBilinearUp_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
@ -1276,10 +1276,10 @@ void ScalePlaneBilinearUp_16(int src_width,
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
void (*InterpolateRow)(uint16 * dst_ptr, const uint16* src_ptr,
|
||||
void (*InterpolateRow)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
void (*ScaleFilterCols)(uint16 * dst_ptr, const uint16* src_ptr,
|
||||
void (*ScaleFilterCols)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleFilterCols_16_C : ScaleCols_16_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1341,13 +1341,13 @@ void ScalePlaneBilinearUp_16(int src_width,
|
||||
}
|
||||
{
|
||||
int yi = y >> 16;
|
||||
const uint16* src = src_ptr + yi * src_stride;
|
||||
const uint16_t* src = src_ptr + yi * src_stride;
|
||||
|
||||
// Allocate 2 row buffers.
|
||||
const int kRowSize = (dst_width + 31) & ~31;
|
||||
align_buffer_64(row, kRowSize * 4);
|
||||
|
||||
uint16* rowptr = (uint16*)row;
|
||||
uint16_t* rowptr = (uint16_t*)row;
|
||||
int rowstride = kRowSize;
|
||||
int lasty = yi;
|
||||
|
||||
@ -1398,10 +1398,10 @@ static void ScalePlaneSimple(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_ptr,
|
||||
uint8* dst_ptr) {
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int i;
|
||||
void (*ScaleCols)(uint8 * dst_ptr, const uint8* src_ptr, int dst_width, int x,
|
||||
void (*ScaleCols)(uint8_t * dst_ptr, const uint8_t* src_ptr, int dst_width, int x,
|
||||
int dx) = ScaleCols_C;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -1434,10 +1434,10 @@ static void ScalePlaneSimple_16(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_ptr,
|
||||
uint16* dst_ptr) {
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr) {
|
||||
int i;
|
||||
void (*ScaleCols)(uint16 * dst_ptr, const uint16* src_ptr, int dst_width,
|
||||
void (*ScaleCols)(uint16_t * dst_ptr, const uint16_t* src_ptr, int dst_width,
|
||||
int x, int dx) = ScaleCols_16_C;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -1468,11 +1468,11 @@ static void ScalePlaneSimple_16(int src_width,
|
||||
// This function dispatches to a specialized scaler based on scale factor.
|
||||
|
||||
LIBYUV_API
|
||||
void ScalePlane(const uint8* src,
|
||||
void ScalePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -1551,11 +1551,11 @@ void ScalePlane(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
void ScalePlane_16(const uint16* src,
|
||||
void ScalePlane_16(const uint16_t* src,
|
||||
int src_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_stride,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -1637,19 +1637,19 @@ void ScalePlane_16(const uint16* src,
|
||||
// This function in turn calls a scaling function for each plane.
|
||||
|
||||
LIBYUV_API
|
||||
int I420Scale(const uint8* src_y,
|
||||
int I420Scale(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_y,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8* dst_u,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -1674,19 +1674,19 @@ int I420Scale(const uint8* src_y,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int I420Scale_16(const uint16* src_y,
|
||||
int I420Scale_16(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint16* src_u,
|
||||
const uint16_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint16* src_v,
|
||||
const uint16_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint16* dst_y,
|
||||
uint16_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint16* dst_u,
|
||||
uint16_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint16* dst_v,
|
||||
uint16_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -1712,17 +1712,17 @@ int I420Scale_16(const uint16* src_y,
|
||||
|
||||
// Deprecated api
|
||||
LIBYUV_API
|
||||
int Scale(const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
int Scale(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_y,
|
||||
int src_stride_u,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_y,
|
||||
uint8* dst_u,
|
||||
uint8* dst_v,
|
||||
uint8_t* dst_y,
|
||||
uint8_t* dst_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_y,
|
||||
int dst_stride_u,
|
||||
int dst_stride_v,
|
||||
@ -1737,10 +1737,10 @@ int Scale(const uint8* src_y,
|
||||
|
||||
// Deprecated api
|
||||
LIBYUV_API
|
||||
int ScaleOffset(const uint8* src,
|
||||
int ScaleOffset(const uint8_t* src,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int dst_yoffset,
|
||||
@ -1752,14 +1752,14 @@ int ScaleOffset(const uint8* src,
|
||||
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
|
||||
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
|
||||
int aheight = dst_height - dst_yoffset_even * 2; // actual output height
|
||||
const uint8* src_y = src;
|
||||
const uint8* src_u = src + src_width * src_height;
|
||||
const uint8* src_v =
|
||||
const uint8_t* src_y = src;
|
||||
const uint8_t* src_u = src + src_width * src_height;
|
||||
const uint8_t* src_v =
|
||||
src + src_width * src_height + src_halfwidth * src_halfheight;
|
||||
uint8* dst_y = dst + dst_yoffset_even * dst_width;
|
||||
uint8* dst_u =
|
||||
uint8_t* dst_y = dst + dst_yoffset_even * dst_width;
|
||||
uint8_t* dst_u =
|
||||
dst + dst_width * dst_height + (dst_yoffset_even >> 1) * dst_halfwidth;
|
||||
uint8* dst_v = dst + dst_width * dst_height + dst_halfwidth * dst_halfheight +
|
||||
uint8_t* dst_v = dst + dst_width * dst_height + dst_halfwidth * dst_halfheight +
|
||||
(dst_yoffset_even >> 1) * dst_halfwidth;
|
||||
if (!src || src_width <= 0 || src_height <= 0 || !dst || dst_width <= 0 ||
|
||||
dst_height <= 0 || dst_yoffset_even < 0 ||
|
||||
|
||||
@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
// Definition for ScaleFilterCols, ScaleARGBCols and ScaleARGBFilterCols
|
||||
#define CANY(NAMEANY, TERP_SIMD, TERP_C, BPP, MASK) \
|
||||
void NAMEANY(uint8* dst_ptr, const uint8* src_ptr, int dst_width, int x, \
|
||||
void NAMEANY(uint8_t* dst_ptr, const uint8_t* src_ptr, int dst_width, int x, \
|
||||
int dx) { \
|
||||
int r = dst_width & MASK; \
|
||||
int n = dst_width & ~MASK; \
|
||||
@ -61,7 +61,7 @@ CANY(ScaleARGBFilterCols_Any_MSA,
|
||||
// Fixed scale down.
|
||||
// Mask may be non-power of 2, so use MOD
|
||||
#define SDANY(NAMEANY, SCALEROWDOWN_SIMD, SCALEROWDOWN_C, FACTOR, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, ptrdiff_t src_stride, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* src_ptr, ptrdiff_t src_stride, uint8_t* dst_ptr, \
|
||||
int dst_width) { \
|
||||
int r = (int)((unsigned int)dst_width % (MASK + 1)); /* NOLINT */ \
|
||||
int n = dst_width - r; \
|
||||
@ -76,7 +76,7 @@ CANY(ScaleARGBFilterCols_Any_MSA,
|
||||
// Since dst_width is (width + 1) / 2, this function scales one less pixel
|
||||
// and copies the last pixel.
|
||||
#define SDODD(NAMEANY, SCALEROWDOWN_SIMD, SCALEROWDOWN_C, FACTOR, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, ptrdiff_t src_stride, uint8* dst_ptr, \
|
||||
void NAMEANY(const uint8_t* src_ptr, ptrdiff_t src_stride, uint8_t* dst_ptr, \
|
||||
int dst_width) { \
|
||||
int r = (int)((unsigned int)(dst_width - 1) % (MASK + 1)); /* NOLINT */ \
|
||||
int n = (dst_width - 1) - r; \
|
||||
@ -386,8 +386,8 @@ SDANY(ScaleARGBRowDown2Box_Any_MSA,
|
||||
|
||||
// Scale down by even scale factor.
|
||||
#define SDAANY(NAMEANY, SCALEROWDOWN_SIMD, SCALEROWDOWN_C, BPP, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, ptrdiff_t src_stride, int src_stepx, \
|
||||
uint8* dst_ptr, int dst_width) { \
|
||||
void NAMEANY(const uint8_t* src_ptr, ptrdiff_t src_stride, int src_stepx, \
|
||||
uint8_t* dst_ptr, int dst_width) { \
|
||||
int r = dst_width & MASK; \
|
||||
int n = dst_width & ~MASK; \
|
||||
if (n > 0) { \
|
||||
@ -436,7 +436,7 @@ SDAANY(ScaleARGBRowDownEvenBox_Any_MSA,
|
||||
|
||||
// Add rows box filter scale down.
|
||||
#define SAANY(NAMEANY, SCALEADDROW_SIMD, SCALEADDROW_C, MASK) \
|
||||
void NAMEANY(const uint8* src_ptr, uint16* dst_ptr, int src_width) { \
|
||||
void NAMEANY(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) { \
|
||||
int n = src_width & ~MASK; \
|
||||
if (n > 0) { \
|
||||
SCALEADDROW_SIMD(src_ptr, dst_ptr, n); \
|
||||
|
||||
@ -36,8 +36,8 @@ static void ScaleARGBDown2(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
@ -45,8 +45,8 @@ static void ScaleARGBDown2(int src_width,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
int row_stride = src_stride * (dy >> 16);
|
||||
void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride,
|
||||
uint8* dst_argb, int dst_width) =
|
||||
void (*ScaleARGBRowDown2)(const uint8_t* src_argb, ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb, int dst_width) =
|
||||
filtering == kFilterNone
|
||||
? ScaleARGBRowDown2_C
|
||||
: (filtering == kFilterLinear ? ScaleARGBRowDown2Linear_C
|
||||
@ -131,8 +131,8 @@ static void ScaleARGBDown4Box(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
@ -142,8 +142,8 @@ static void ScaleARGBDown4Box(int src_width,
|
||||
const int kRowSize = (dst_width * 2 * 4 + 31) & ~31;
|
||||
align_buffer_64(row, kRowSize * 2);
|
||||
int row_stride = src_stride * (dy >> 16);
|
||||
void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride,
|
||||
uint8* dst_argb, int dst_width) =
|
||||
void (*ScaleARGBRowDown2)(const uint8_t* src_argb, ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb, int dst_width) =
|
||||
ScaleARGBRowDown2Box_C;
|
||||
// Advance to odd row, even column.
|
||||
src_argb += (y >> 16) * src_stride + (x >> 16) * 4;
|
||||
@ -189,8 +189,8 @@ static void ScaleARGBDownEven(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
@ -199,8 +199,8 @@ static void ScaleARGBDownEven(int src_width,
|
||||
int j;
|
||||
int col_step = dx >> 16;
|
||||
int row_stride = (dy >> 16) * src_stride;
|
||||
void (*ScaleARGBRowDownEven)(const uint8* src_argb, ptrdiff_t src_stride,
|
||||
int src_step, uint8* dst_argb, int dst_width) =
|
||||
void (*ScaleARGBRowDownEven)(const uint8_t* src_argb, ptrdiff_t src_stride,
|
||||
int src_step, uint8_t* dst_argb, int dst_width) =
|
||||
filtering ? ScaleARGBRowDownEvenBox_C : ScaleARGBRowDownEven_C;
|
||||
(void)src_width;
|
||||
(void)src_height;
|
||||
@ -255,23 +255,23 @@ static void ScaleARGBBilinearDown(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleARGBFilterCols)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleARGBFilterCols64_C : ScaleARGBFilterCols_C;
|
||||
int64 xlast = x + (int64)(dst_width - 1) * dx;
|
||||
int64 xl = (dx >= 0) ? x : xlast;
|
||||
int64 xr = (dx >= 0) ? xlast : x;
|
||||
int64_t xlast = x + (int64_t)(dst_width - 1) * dx;
|
||||
int64_t xl = (dx >= 0) ? x : xlast;
|
||||
int64_t xr = (dx >= 0) ? xlast : x;
|
||||
int clip_src_width;
|
||||
xl = (xl >> 16) & ~3; // Left edge aligned.
|
||||
xr = (xr >> 16) + 1; // Right most pixel used. Bilinear uses 2 pixels.
|
||||
@ -346,7 +346,7 @@ static void ScaleARGBBilinearDown(int src_width,
|
||||
}
|
||||
for (j = 0; j < dst_height; ++j) {
|
||||
int yi = y >> 16;
|
||||
const uint8* src = src_argb + yi * src_stride;
|
||||
const uint8_t* src = src_argb + yi * src_stride;
|
||||
if (filtering == kFilterLinear) {
|
||||
ScaleARGBFilterCols(dst_argb, src, dst_width, x, dx);
|
||||
} else {
|
||||
@ -371,18 +371,18 @@ static void ScaleARGBBilinearUp(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleARGBFilterCols)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
@ -479,13 +479,13 @@ static void ScaleARGBBilinearUp(int src_width,
|
||||
|
||||
{
|
||||
int yi = y >> 16;
|
||||
const uint8* src = src_argb + yi * src_stride;
|
||||
const uint8_t* src = src_argb + yi * src_stride;
|
||||
|
||||
// Allocate 2 rows of ARGB.
|
||||
const int kRowSize = (dst_width * 4 + 31) & ~31;
|
||||
align_buffer_64(row, kRowSize * 2);
|
||||
|
||||
uint8* rowptr = row;
|
||||
uint8_t* rowptr = row;
|
||||
int rowstride = kRowSize;
|
||||
int lasty = yi;
|
||||
|
||||
@ -535,18 +535,18 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
int src_stride_u,
|
||||
int src_stride_v,
|
||||
int dst_stride_argb,
|
||||
const uint8* src_y,
|
||||
const uint8* src_u,
|
||||
const uint8* src_v,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*I422ToARGBRow)(const uint8* y_buf, const uint8* u_buf,
|
||||
const uint8* v_buf, uint8* rgb_buf, int width) =
|
||||
void (*I422ToARGBRow)(const uint8_t* y_buf, const uint8_t* u_buf,
|
||||
const uint8_t* v_buf, uint8_t* rgb_buf, int width) =
|
||||
I422ToARGBRow_C;
|
||||
#if defined(HAS_I422TOARGBROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||
@ -581,7 +581,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*InterpolateRow)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
#if defined(HAS_INTERPOLATEROW_SSSE3)
|
||||
@ -617,7 +617,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*ScaleARGBFilterCols)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||
if (src_width >= 32768) {
|
||||
@ -682,9 +682,9 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
const int kYShift = 1; // Shift Y by 1 to convert Y plane to UV coordinate.
|
||||
int yi = y >> 16;
|
||||
int uv_yi = yi >> kYShift;
|
||||
const uint8* src_row_y = src_y + yi * src_stride_y;
|
||||
const uint8* src_row_u = src_u + uv_yi * src_stride_u;
|
||||
const uint8* src_row_v = src_v + uv_yi * src_stride_v;
|
||||
const uint8_t* src_row_y = src_y + yi * src_stride_y;
|
||||
const uint8_t* src_row_u = src_u + uv_yi * src_stride_u;
|
||||
const uint8_t* src_row_v = src_v + uv_yi * src_stride_v;
|
||||
|
||||
// Allocate 2 rows of ARGB.
|
||||
const int kRowSize = (dst_width * 4 + 31) & ~31;
|
||||
@ -693,7 +693,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
// Allocate 1 row of ARGB for source conversion.
|
||||
align_buffer_64(argb_row, src_width * 4);
|
||||
|
||||
uint8* rowptr = row;
|
||||
uint8_t* rowptr = row;
|
||||
int rowstride = kRowSize;
|
||||
int lasty = yi;
|
||||
|
||||
@ -765,14 +765,14 @@ static void ScaleARGBSimple(int src_width,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int dx,
|
||||
int y,
|
||||
int dy) {
|
||||
int j;
|
||||
void (*ScaleARGBCols)(uint8 * dst_argb, const uint8* src_argb, int dst_width,
|
||||
void (*ScaleARGBCols)(uint8_t * dst_argb, const uint8_t* src_argb, int dst_width,
|
||||
int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleARGBCols64_C : ScaleARGBCols_C;
|
||||
(void)src_height;
|
||||
@ -817,11 +817,11 @@ static void ScaleARGBSimple(int src_width,
|
||||
// ScaleARGB a ARGB.
|
||||
// This function in turn calls a scaling function
|
||||
// suitable for handling the desired resolutions.
|
||||
static void ScaleARGB(const uint8* src,
|
||||
static void ScaleARGB(const uint8_t* src,
|
||||
int src_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -850,13 +850,13 @@ static void ScaleARGB(const uint8* src,
|
||||
&dx, &dy);
|
||||
src_width = Abs(src_width);
|
||||
if (clip_x) {
|
||||
int64 clipf = (int64)(clip_x)*dx;
|
||||
int64_t clipf = (int64_t)(clip_x)*dx;
|
||||
x += (clipf & 0xffff);
|
||||
src += (clipf >> 16) * 4;
|
||||
dst += clip_x * 4;
|
||||
}
|
||||
if (clip_y) {
|
||||
int64 clipf = (int64)(clip_y)*dy;
|
||||
int64_t clipf = (int64_t)(clip_y)*dy;
|
||||
y += (clipf & 0xffff);
|
||||
src += (clipf >> 16) * src_stride;
|
||||
dst += clip_y * dst_stride;
|
||||
@ -922,11 +922,11 @@ static void ScaleARGB(const uint8* src,
|
||||
}
|
||||
|
||||
LIBYUV_API
|
||||
int ARGBScaleClip(const uint8* src_argb,
|
||||
int ARGBScaleClip(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -950,11 +950,11 @@ int ARGBScaleClip(const uint8* src_argb,
|
||||
|
||||
// Scale an ARGB image.
|
||||
LIBYUV_API
|
||||
int ARGBScale(const uint8* src_argb,
|
||||
int ARGBScale(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -971,18 +971,18 @@ int ARGBScale(const uint8* src_argb,
|
||||
|
||||
// Scale with YUV conversion to ARGB and clipping.
|
||||
LIBYUV_API
|
||||
int YUVToARGBScaleClip(const uint8* src_y,
|
||||
int YUVToARGBScaleClip(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint32 src_fourcc,
|
||||
uint32_t src_fourcc,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
uint32 dst_fourcc,
|
||||
uint32_t dst_fourcc,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int clip_x,
|
||||
@ -990,7 +990,7 @@ int YUVToARGBScaleClip(const uint8* src_y,
|
||||
int clip_width,
|
||||
int clip_height,
|
||||
enum FilterMode filtering) {
|
||||
uint8* argb_buffer = (uint8*)malloc(src_width * src_height * 4);
|
||||
uint8_t* argb_buffer = (uint8_t*)malloc(src_width * src_height * 4);
|
||||
int r;
|
||||
(void)src_fourcc; // TODO(fbarchard): implement and/or assert.
|
||||
(void)dst_fourcc;
|
||||
|
||||
@ -28,9 +28,9 @@ static __inline int Abs(int v) {
|
||||
}
|
||||
|
||||
// CPU agnostic row functions
|
||||
void ScaleRowDown2_C(const uint8* src_ptr,
|
||||
void ScaleRowDown2_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -45,9 +45,9 @@ void ScaleRowDown2_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown2_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown2_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -62,11 +62,11 @@ void ScaleRowDown2_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown2Linear_C(const uint8* src_ptr,
|
||||
void ScaleRowDown2Linear_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8_t* s = src_ptr;
|
||||
int x;
|
||||
(void)src_stride;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
@ -80,11 +80,11 @@ void ScaleRowDown2Linear_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown2Linear_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown2Linear_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
const uint16* s = src_ptr;
|
||||
const uint16_t* s = src_ptr;
|
||||
int x;
|
||||
(void)src_stride;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
@ -98,12 +98,12 @@ void ScaleRowDown2Linear_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown2Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2;
|
||||
@ -117,12 +117,12 @@ void ScaleRowDown2Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown2Box_Odd_C(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_Odd_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
dst_width -= 1;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
@ -141,12 +141,12 @@ void ScaleRowDown2Box_Odd_C(const uint8* src_ptr,
|
||||
dst[0] = (s[0] + t[0] + 1) >> 1;
|
||||
}
|
||||
|
||||
void ScaleRowDown2Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown2Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
const uint16* s = src_ptr;
|
||||
const uint16* t = src_ptr + src_stride;
|
||||
const uint16_t* s = src_ptr;
|
||||
const uint16_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2;
|
||||
@ -160,9 +160,9 @@ void ScaleRowDown2Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown4_C(const uint8* src_ptr,
|
||||
void ScaleRowDown4_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -177,9 +177,9 @@ void ScaleRowDown4_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown4_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown4_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -194,9 +194,9 @@ void ScaleRowDown4_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown4Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int x;
|
||||
@ -232,9 +232,9 @@ void ScaleRowDown4Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown4Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int x;
|
||||
@ -270,9 +270,9 @@ void ScaleRowDown4Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_C(const uint8* src_ptr,
|
||||
void ScaleRowDown34_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -286,9 +286,9 @@ void ScaleRowDown34_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown34_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -303,21 +303,21 @@ void ScaleRowDown34_16_C(const uint16* src_ptr,
|
||||
}
|
||||
|
||||
// Filter rows 0 and 1 together, 3 : 1
|
||||
void ScaleRowDown34_0_Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown34_0_Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* d,
|
||||
uint8_t* d,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
assert((dst_width % 3 == 0) && (dst_width > 0));
|
||||
for (x = 0; x < dst_width; x += 3) {
|
||||
uint8 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint8 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint8 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint8 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint8 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint8 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
uint8_t a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint8_t a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint8_t a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint8_t b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint8_t b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint8_t b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
d[0] = (a0 * 3 + b0 + 2) >> 2;
|
||||
d[1] = (a1 * 3 + b1 + 2) >> 2;
|
||||
d[2] = (a2 * 3 + b2 + 2) >> 2;
|
||||
@ -327,21 +327,21 @@ void ScaleRowDown34_0_Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_0_Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown34_0_Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* d,
|
||||
uint16_t* d,
|
||||
int dst_width) {
|
||||
const uint16* s = src_ptr;
|
||||
const uint16* t = src_ptr + src_stride;
|
||||
const uint16_t* s = src_ptr;
|
||||
const uint16_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
assert((dst_width % 3 == 0) && (dst_width > 0));
|
||||
for (x = 0; x < dst_width; x += 3) {
|
||||
uint16 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint16 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint16 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint16 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint16 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint16 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
uint16_t a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint16_t a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint16_t a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint16_t b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint16_t b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint16_t b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
d[0] = (a0 * 3 + b0 + 2) >> 2;
|
||||
d[1] = (a1 * 3 + b1 + 2) >> 2;
|
||||
d[2] = (a2 * 3 + b2 + 2) >> 2;
|
||||
@ -352,21 +352,21 @@ void ScaleRowDown34_0_Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
|
||||
// Filter rows 1 and 2 together, 1 : 1
|
||||
void ScaleRowDown34_1_Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown34_1_Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* d,
|
||||
uint8_t* d,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
assert((dst_width % 3 == 0) && (dst_width > 0));
|
||||
for (x = 0; x < dst_width; x += 3) {
|
||||
uint8 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint8 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint8 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint8 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint8 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint8 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
uint8_t a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint8_t a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint8_t a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint8_t b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint8_t b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint8_t b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
d[0] = (a0 + b0 + 1) >> 1;
|
||||
d[1] = (a1 + b1 + 1) >> 1;
|
||||
d[2] = (a2 + b2 + 1) >> 1;
|
||||
@ -376,21 +376,21 @@ void ScaleRowDown34_1_Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_1_Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown34_1_Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* d,
|
||||
uint16_t* d,
|
||||
int dst_width) {
|
||||
const uint16* s = src_ptr;
|
||||
const uint16* t = src_ptr + src_stride;
|
||||
const uint16_t* s = src_ptr;
|
||||
const uint16_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
assert((dst_width % 3 == 0) && (dst_width > 0));
|
||||
for (x = 0; x < dst_width; x += 3) {
|
||||
uint16 a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint16 a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint16 a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint16 b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint16 b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint16 b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
uint16_t a0 = (s[0] * 3 + s[1] * 1 + 2) >> 2;
|
||||
uint16_t a1 = (s[1] * 1 + s[2] * 1 + 1) >> 1;
|
||||
uint16_t a2 = (s[2] * 1 + s[3] * 3 + 2) >> 2;
|
||||
uint16_t b0 = (t[0] * 3 + t[1] * 1 + 2) >> 2;
|
||||
uint16_t b1 = (t[1] * 1 + t[2] * 1 + 1) >> 1;
|
||||
uint16_t b2 = (t[2] * 1 + t[3] * 3 + 2) >> 2;
|
||||
d[0] = (a0 + b0 + 1) >> 1;
|
||||
d[1] = (a1 + b1 + 1) >> 1;
|
||||
d[2] = (a2 + b2 + 1) >> 1;
|
||||
@ -401,8 +401,8 @@ void ScaleRowDown34_1_Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
|
||||
// Scales a single row of pixels using point sampling.
|
||||
void ScaleCols_C(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleCols_C(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -419,8 +419,8 @@ void ScaleCols_C(uint8* dst_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleCols_16_C(uint16* dst_ptr,
|
||||
const uint16* src_ptr,
|
||||
void ScaleCols_16_C(uint16_t* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -438,8 +438,8 @@ void ScaleCols_16_C(uint16* dst_ptr,
|
||||
}
|
||||
|
||||
// Scales a single row of pixels up by 2x using point sampling.
|
||||
void ScaleColsUp2_C(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleColsUp2_C(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -456,8 +456,8 @@ void ScaleColsUp2_C(uint8* dst_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleColsUp2_16_C(uint16* dst_ptr,
|
||||
const uint16* src_ptr,
|
||||
void ScaleColsUp2_16_C(uint16_t* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -477,15 +477,15 @@ void ScaleColsUp2_16_C(uint16* dst_ptr,
|
||||
// (1-f)a + fb can be replaced with a + f(b-a)
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#define BLENDER(a, b, f) \
|
||||
(uint8)((int)(a) + ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
(uint8_t)((int)(a) + ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
#else
|
||||
// Intel uses 7 bit math with rounding.
|
||||
#define BLENDER(a, b, f) \
|
||||
(uint8)((int)(a) + (((int)((f) >> 9) * ((int)(b) - (int)(a)) + 0x40) >> 7))
|
||||
(uint8_t)((int)(a) + (((int)((f) >> 9) * ((int)(b) - (int)(a)) + 0x40) >> 7))
|
||||
#endif
|
||||
|
||||
void ScaleFilterCols_C(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols_C(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -511,15 +511,15 @@ void ScaleFilterCols_C(uint8* dst_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleFilterCols64_C(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols64_C(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x32,
|
||||
int dx) {
|
||||
int64 x = (int64)(x32);
|
||||
int64_t x = (int64_t)(x32);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int a = src_ptr[xi];
|
||||
int b = src_ptr[xi + 1];
|
||||
dst_ptr[0] = BLENDER(a, b, x & 0xffff);
|
||||
@ -532,7 +532,7 @@ void ScaleFilterCols64_C(uint8* dst_ptr,
|
||||
dst_ptr += 2;
|
||||
}
|
||||
if (dst_width & 1) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int a = src_ptr[xi];
|
||||
int b = src_ptr[xi + 1];
|
||||
dst_ptr[0] = BLENDER(a, b, x & 0xffff);
|
||||
@ -540,12 +540,12 @@ void ScaleFilterCols64_C(uint8* dst_ptr,
|
||||
}
|
||||
#undef BLENDER
|
||||
|
||||
// Same as 8 bit arm blender but return is cast to uint16
|
||||
// Same as 8 bit arm blender but return is cast to uint16_t
|
||||
#define BLENDER(a, b, f) \
|
||||
(uint16)((int)(a) + ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
(uint16_t)((int)(a) + ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
|
||||
void ScaleFilterCols_16_C(uint16* dst_ptr,
|
||||
const uint16* src_ptr,
|
||||
void ScaleFilterCols_16_C(uint16_t* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -571,15 +571,15 @@ void ScaleFilterCols_16_C(uint16* dst_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleFilterCols64_16_C(uint16* dst_ptr,
|
||||
const uint16* src_ptr,
|
||||
void ScaleFilterCols64_16_C(uint16_t* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
int dst_width,
|
||||
int x32,
|
||||
int dx) {
|
||||
int64 x = (int64)(x32);
|
||||
int64_t x = (int64_t)(x32);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int a = src_ptr[xi];
|
||||
int b = src_ptr[xi + 1];
|
||||
dst_ptr[0] = BLENDER(a, b, x & 0xffff);
|
||||
@ -592,7 +592,7 @@ void ScaleFilterCols64_16_C(uint16* dst_ptr,
|
||||
dst_ptr += 2;
|
||||
}
|
||||
if (dst_width & 1) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int a = src_ptr[xi];
|
||||
int b = src_ptr[xi + 1];
|
||||
dst_ptr[0] = BLENDER(a, b, x & 0xffff);
|
||||
@ -600,9 +600,9 @@ void ScaleFilterCols64_16_C(uint16* dst_ptr,
|
||||
}
|
||||
#undef BLENDER
|
||||
|
||||
void ScaleRowDown38_C(const uint8* src_ptr,
|
||||
void ScaleRowDown38_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -616,9 +616,9 @@ void ScaleRowDown38_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown38_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown38_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -633,9 +633,9 @@ void ScaleRowDown38_16_C(const uint16* src_ptr,
|
||||
}
|
||||
|
||||
// 8x3 -> 3x1
|
||||
void ScaleRowDown38_3_Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown38_3_Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int i;
|
||||
@ -663,9 +663,9 @@ void ScaleRowDown38_3_Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown38_3_Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown38_3_Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int i;
|
||||
@ -694,9 +694,9 @@ void ScaleRowDown38_3_Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
|
||||
// 8x2 -> 3x1
|
||||
void ScaleRowDown38_2_Box_C(const uint8* src_ptr,
|
||||
void ScaleRowDown38_2_Box_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int i;
|
||||
@ -719,9 +719,9 @@ void ScaleRowDown38_2_Box_C(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown38_2_Box_16_C(const uint16* src_ptr,
|
||||
void ScaleRowDown38_2_Box_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int dst_width) {
|
||||
intptr_t stride = src_stride;
|
||||
int i;
|
||||
@ -744,7 +744,7 @@ void ScaleRowDown38_2_Box_16_C(const uint16* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleAddRow_C(const uint8* src_ptr, uint16* dst_ptr, int src_width) {
|
||||
void ScaleAddRow_C(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) {
|
||||
int x;
|
||||
assert(src_width > 0);
|
||||
for (x = 0; x < src_width - 1; x += 2) {
|
||||
@ -758,7 +758,7 @@ void ScaleAddRow_C(const uint8* src_ptr, uint16* dst_ptr, int src_width) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleAddRow_16_C(const uint16* src_ptr, uint32* dst_ptr, int src_width) {
|
||||
void ScaleAddRow_16_C(const uint16_t* src_ptr, uint32_t* dst_ptr, int src_width) {
|
||||
int x;
|
||||
assert(src_width > 0);
|
||||
for (x = 0; x < src_width - 1; x += 2) {
|
||||
@ -772,12 +772,12 @@ void ScaleAddRow_16_C(const uint16* src_ptr, uint32* dst_ptr, int src_width) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2_C(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2_C(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int x;
|
||||
(void)src_stride;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
@ -791,9 +791,9 @@ void ScaleARGBRowDown2_C(const uint8* src_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Linear_C(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Linear_C(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -807,9 +807,9 @@ void ScaleARGBRowDown2Linear_C(const uint8* src_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Box_C(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Box_C(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
int x;
|
||||
for (x = 0; x < dst_width; ++x) {
|
||||
@ -830,13 +830,13 @@ void ScaleARGBRowDown2Box_C(const uint8* src_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDownEven_C(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEven_C(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
(void)src_stride;
|
||||
int x;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
@ -850,10 +850,10 @@ void ScaleARGBRowDownEven_C(const uint8* src_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDownEvenBox_C(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_C(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
int x;
|
||||
for (x = 0; x < dst_width; ++x) {
|
||||
@ -875,13 +875,13 @@ void ScaleARGBRowDownEvenBox_C(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Scales a single row of pixels using point sampling.
|
||||
void ScaleARGBCols_C(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
dst[0] = src[x >> 16];
|
||||
@ -895,14 +895,14 @@ void ScaleARGBCols_C(uint8* dst_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBCols64_C(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols64_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x32,
|
||||
int dx) {
|
||||
int64 x = (int64)(x32);
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
int64_t x = (int64_t)(x32);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
dst[0] = src[x >> 16];
|
||||
@ -917,13 +917,13 @@ void ScaleARGBCols64_C(uint8* dst_argb,
|
||||
}
|
||||
|
||||
// Scales a single row of pixels up by 2x using point sampling.
|
||||
void ScaleARGBColsUp2_C(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBColsUp2_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
(void)x;
|
||||
(void)dx;
|
||||
@ -941,24 +941,24 @@ void ScaleARGBColsUp2_C(uint8* dst_argb,
|
||||
// Mimics SSSE3 blender
|
||||
#define BLENDER1(a, b, f) ((a) * (0x7f ^ f) + (b)*f) >> 7
|
||||
#define BLENDERC(a, b, f, s) \
|
||||
(uint32)(BLENDER1(((a) >> s) & 255, ((b) >> s) & 255, f) << s)
|
||||
(uint32_t)(BLENDER1(((a) >> s) & 255, ((b) >> s) & 255, f) << s)
|
||||
#define BLENDER(a, b, f) \
|
||||
BLENDERC(a, b, f, 24) | BLENDERC(a, b, f, 16) | BLENDERC(a, b, f, 8) | \
|
||||
BLENDERC(a, b, f, 0)
|
||||
|
||||
void ScaleARGBFilterCols_C(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
int xi = x >> 16;
|
||||
int xf = (x >> 9) & 0x7f;
|
||||
uint32 a = src[xi];
|
||||
uint32 b = src[xi + 1];
|
||||
uint32_t a = src[xi];
|
||||
uint32_t b = src[xi + 1];
|
||||
dst[0] = BLENDER(a, b, xf);
|
||||
x += dx;
|
||||
xi = x >> 16;
|
||||
@ -972,26 +972,26 @@ void ScaleARGBFilterCols_C(uint8* dst_argb,
|
||||
if (dst_width & 1) {
|
||||
int xi = x >> 16;
|
||||
int xf = (x >> 9) & 0x7f;
|
||||
uint32 a = src[xi];
|
||||
uint32 b = src[xi + 1];
|
||||
uint32_t a = src[xi];
|
||||
uint32_t b = src[xi + 1];
|
||||
dst[0] = BLENDER(a, b, xf);
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBFilterCols64_C(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols64_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x32,
|
||||
int dx) {
|
||||
int64 x = (int64)(x32);
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
int64_t x = (int64_t)(x32);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
for (j = 0; j < dst_width - 1; j += 2) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int xf = (x >> 9) & 0x7f;
|
||||
uint32 a = src[xi];
|
||||
uint32 b = src[xi + 1];
|
||||
uint32_t a = src[xi];
|
||||
uint32_t b = src[xi + 1];
|
||||
dst[0] = BLENDER(a, b, xf);
|
||||
x += dx;
|
||||
xi = x >> 16;
|
||||
@ -1003,10 +1003,10 @@ void ScaleARGBFilterCols64_C(uint8* dst_argb,
|
||||
dst += 2;
|
||||
}
|
||||
if (dst_width & 1) {
|
||||
int64 xi = x >> 16;
|
||||
int64_t xi = x >> 16;
|
||||
int xf = (x >> 9) & 0x7f;
|
||||
uint32 a = src[xi];
|
||||
uint32 b = src[xi + 1];
|
||||
uint32_t a = src[xi];
|
||||
uint32_t b = src[xi + 1];
|
||||
dst[0] = BLENDER(a, b, xf);
|
||||
}
|
||||
}
|
||||
@ -1020,8 +1020,8 @@ void ScalePlaneVertical(int src_height,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint8* src_argb,
|
||||
uint8* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
uint8_t* dst_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dy,
|
||||
@ -1029,7 +1029,7 @@ void ScalePlaneVertical(int src_height,
|
||||
enum FilterMode filtering) {
|
||||
// TODO(fbarchard): Allow higher bpp.
|
||||
int dst_width_bytes = dst_width * bpp;
|
||||
void (*InterpolateRow)(uint8 * dst_argb, const uint8* src_argb,
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
|
||||
@ -1090,8 +1090,8 @@ void ScalePlaneVertical_16(int src_height,
|
||||
int dst_height,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
const uint16* src_argb,
|
||||
uint16* dst_argb,
|
||||
const uint16_t* src_argb,
|
||||
uint16_t* dst_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dy,
|
||||
@ -1099,7 +1099,7 @@ void ScalePlaneVertical_16(int src_height,
|
||||
enum FilterMode filtering) {
|
||||
// TODO(fbarchard): Allow higher wpp.
|
||||
int dst_width_words = dst_width * wpp;
|
||||
void (*InterpolateRow)(uint16 * dst_argb, const uint16* src_argb,
|
||||
void (*InterpolateRow)(uint16_t * dst_argb, const uint16_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
|
||||
@ -1202,12 +1202,12 @@ enum FilterMode ScaleFilterReduce(int src_width,
|
||||
|
||||
// Divide num by div and return as 16.16 fixed point result.
|
||||
int FixedDiv_C(int num, int div) {
|
||||
return (int)(((int64)(num) << 16) / div);
|
||||
return (int)(((int64_t)(num) << 16) / div);
|
||||
}
|
||||
|
||||
// Divide num by div and return as 16.16 fixed point result.
|
||||
int FixedDiv1_C(int num, int div) {
|
||||
return (int)((((int64)(num) << 16) - 0x00010001) / (div - 1));
|
||||
return (int)((((int64_t)(num) << 16) - 0x00010001) / (div - 1));
|
||||
}
|
||||
|
||||
#define CENTERSTART(dx, s) (dx < 0) ? -((-dx >> 1) + s) : ((dx >> 1) + s)
|
||||
@ -1288,18 +1288,18 @@ void ScaleSlope(int src_width,
|
||||
|
||||
// Read 8x2 upsample with filtering and write 16x1.
|
||||
// actually reads an extra pixel, so 9x2.
|
||||
void ScaleRowUp2_16_C(const uint16* src_ptr,
|
||||
void ScaleRowUp2_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
const uint16* src2 = src_ptr + src_stride;
|
||||
const uint16_t* src2 = src_ptr + src_stride;
|
||||
|
||||
int x;
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
uint16 p0 = src_ptr[0];
|
||||
uint16 p1 = src_ptr[1];
|
||||
uint16 p2 = src2[0];
|
||||
uint16 p3 = src2[1];
|
||||
uint16_t p0 = src_ptr[0];
|
||||
uint16_t p1 = src_ptr[1];
|
||||
uint16_t p2 = src2[0];
|
||||
uint16_t p3 = src2[1];
|
||||
dst[0] = (p0 * 9 + p1 * 3 + p2 * 3 + p3 + 8) >> 4;
|
||||
dst[1] = (p0 * 3 + p1 * 9 + p2 + p3 * 3 + 8) >> 4;
|
||||
++src_ptr;
|
||||
@ -1307,10 +1307,10 @@ void ScaleRowUp2_16_C(const uint16* src_ptr,
|
||||
dst += 2;
|
||||
}
|
||||
if (dst_width & 1) {
|
||||
uint16 p0 = src_ptr[0];
|
||||
uint16 p1 = src_ptr[1];
|
||||
uint16 p2 = src2[0];
|
||||
uint16 p3 = src2[1];
|
||||
uint16_t p0 = src_ptr[0];
|
||||
uint16_t p1 = src_ptr[1];
|
||||
uint16_t p2 = src2[0];
|
||||
uint16_t p3 = src2[1];
|
||||
dst[0] = (p0 * 9 + p1 * 3 + p2 * 3 + p3 + 8) >> 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +93,9 @@ static const uvec16 kScaleAb2 = {65536 / 3, 65536 / 3, 65536 / 2, 65536 / 3,
|
||||
// Generated using gcc disassembly on Visual C object file:
|
||||
// objdump -D yuvscaler.obj >yuvscaler.txt
|
||||
|
||||
void ScaleRowDown2_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown2_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -118,9 +118,9 @@ void ScaleRowDown2_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown2Linear_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -150,9 +150,9 @@ void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown2Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile (
|
||||
"pcmpeqb %%xmm4,%%xmm4 \n"
|
||||
@ -192,9 +192,9 @@ void ScaleRowDown2Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
#ifdef HAS_SCALEROWDOWN2_AVX2
|
||||
void ScaleRowDown2_AVX2(const uint8* src_ptr,
|
||||
void ScaleRowDown2_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -219,9 +219,9 @@ void ScaleRowDown2_AVX2(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown2Linear_AVX2(const uint8* src_ptr,
|
||||
void ScaleRowDown2Linear_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -253,9 +253,9 @@ void ScaleRowDown2Linear_AVX2(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown2Box_AVX2(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile (
|
||||
"vpcmpeqb %%ymm4,%%ymm4,%%ymm4 \n"
|
||||
@ -297,9 +297,9 @@ void ScaleRowDown2Box_AVX2(const uint8* src_ptr,
|
||||
}
|
||||
#endif // HAS_SCALEROWDOWN2_AVX2
|
||||
|
||||
void ScaleRowDown4_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown4_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -328,9 +328,9 @@ void ScaleRowDown4_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown4Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
intptr_t stridex3;
|
||||
asm volatile (
|
||||
@ -385,9 +385,9 @@ void ScaleRowDown4Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
#ifdef HAS_SCALEROWDOWN4_AVX2
|
||||
void ScaleRowDown4_AVX2(const uint8* src_ptr,
|
||||
void ScaleRowDown4_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -418,9 +418,9 @@ void ScaleRowDown4_AVX2(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_AVX2(const uint8* src_ptr,
|
||||
void ScaleRowDown4Box_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile (
|
||||
"vpcmpeqb %%ymm4,%%ymm4,%%ymm4 \n"
|
||||
@ -475,9 +475,9 @@ void ScaleRowDown4Box_AVX2(const uint8* src_ptr,
|
||||
}
|
||||
#endif // HAS_SCALEROWDOWN4_AVX2
|
||||
|
||||
void ScaleRowDown34_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown34_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -513,9 +513,9 @@ void ScaleRowDown34_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown34_1_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movdqa %0,%%xmm2 \n" // kShuf01
|
||||
@ -579,9 +579,9 @@ void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown34_0_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movdqa %0,%%xmm2 \n" // kShuf01
|
||||
@ -649,9 +649,9 @@ void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown38_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown38_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -681,9 +681,9 @@ void ScaleRowDown38_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown38_2_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movdqa %0,%%xmm2 \n"
|
||||
@ -727,9 +727,9 @@ void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
|
||||
void ScaleRowDown38_3_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movdqa %0,%%xmm2 \n"
|
||||
@ -792,7 +792,7 @@ void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Reads 16xN bytes and produces 16 shorts at a time.
|
||||
void ScaleAddRow_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width) {
|
||||
void ScaleAddRow_SSE2(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) {
|
||||
asm volatile (
|
||||
"pxor %%xmm5,%%xmm5 \n"
|
||||
|
||||
@ -822,7 +822,7 @@ void ScaleAddRow_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width) {
|
||||
|
||||
#ifdef HAS_SCALEADDROW_AVX2
|
||||
// Reads 32 bytes and accumulates to 32 shorts at a time.
|
||||
void ScaleAddRow_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width) {
|
||||
void ScaleAddRow_AVX2(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) {
|
||||
asm volatile (
|
||||
"vpxor %%ymm5,%%ymm5,%%ymm5 \n"
|
||||
|
||||
@ -860,8 +860,8 @@ static const uvec16 kFadd40 = {0x4040, 0x4040, 0x4040, 0x4040,
|
||||
0x4040, 0x4040, 0x4040, 0x4040};
|
||||
|
||||
// Bilinear column filtering. SSSE3 version.
|
||||
void ScaleFilterCols_SSSE3(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols_SSSE3(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -956,8 +956,8 @@ void ScaleFilterCols_SSSE3(uint8* dst_ptr,
|
||||
|
||||
// Reads 4 pixels, duplicates them and writes 8 pixels.
|
||||
// Alignment requirement: src_argb 16 byte aligned, dst_argb 16 byte aligned.
|
||||
void ScaleColsUp2_SSE2(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleColsUp2_SSE2(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -984,9 +984,9 @@ void ScaleColsUp2_SSE2(uint8* dst_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2_SSE2(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -1007,9 +1007,9 @@ void ScaleARGBRowDown2_SSE2(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Linear_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile (
|
||||
@ -1033,9 +1033,9 @@ void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Box_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
asm volatile (
|
||||
LABELALIGN
|
||||
@ -1066,10 +1066,10 @@ void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb,
|
||||
|
||||
// Reads 4 pixels at a time.
|
||||
// Alignment requirement: dst_argb 16 byte aligned.
|
||||
void ScaleARGBRowDownEven_SSE2(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEven_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
intptr_t src_stepx_x4 = (intptr_t)(src_stepx);
|
||||
intptr_t src_stepx_x12;
|
||||
@ -1103,10 +1103,10 @@ void ScaleARGBRowDownEven_SSE2(const uint8* src_argb,
|
||||
|
||||
// Blends four 2x2 to 4x1.
|
||||
// Alignment requirement: dst_argb 16 byte aligned.
|
||||
void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
intptr_t src_stepx_x4 = (intptr_t)(src_stepx);
|
||||
intptr_t src_stepx_x12;
|
||||
@ -1149,8 +1149,8 @@ void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBCols_SSE2(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols_SSE2(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -1221,8 +1221,8 @@ void ScaleARGBCols_SSE2(uint8* dst_argb,
|
||||
|
||||
// Reads 4 pixels, duplicates them and writes 8 pixels.
|
||||
// Alignment requirement: src_argb 16 byte aligned, dst_argb 16 byte aligned.
|
||||
void ScaleARGBColsUp2_SSE2(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBColsUp2_SSE2(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -1262,8 +1262,8 @@ static const uvec8 kShuffleFractions = {
|
||||
};
|
||||
|
||||
// Bilinear row filtering combines 4x2 -> 4x1. SSSE3 version
|
||||
void ScaleARGBFilterCols_SSSE3(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols_SSSE3(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
|
||||
@ -127,13 +127,13 @@ void ScaleARGBRowDownEven_MSA(const uint8_t* src_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBRowDownEvenBox_MSA(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_MSA(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
int x;
|
||||
const uint8* nxt_argb = src_argb + src_stride;
|
||||
const uint8_t* nxt_argb = src_argb + src_stride;
|
||||
int32_t stepx = src_stepx * 4;
|
||||
int64_t data0, data1, data2, data3;
|
||||
v16u8 src0 = {0}, src1 = {0}, src2 = {0}, src3 = {0};
|
||||
@ -553,8 +553,8 @@ void ScaleAddRow_MSA(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleFilterCols_MSA(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols_MSA(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -630,13 +630,13 @@ void ScaleFilterCols_MSA(uint8* dst_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBCols_MSA(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols_MSA(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
uint32* dst = (uint32*)(dst_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
uint32_t* dst = (uint32_t*)(dst_argb);
|
||||
int j;
|
||||
v4i32 x_vec = __msa_fill_w(x);
|
||||
v4i32 dx_vec = __msa_fill_w(dx);
|
||||
@ -657,12 +657,12 @@ void ScaleARGBCols_MSA(uint8* dst_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleARGBFilterCols_MSA(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols_MSA(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint32* src = (const uint32*)(src_argb);
|
||||
const uint32_t* src = (const uint32_t*)(src_argb);
|
||||
int j;
|
||||
v4u32 src0, src1, src2, src3;
|
||||
v4u32 vec0, vec1, vec2, vec3;
|
||||
@ -722,9 +722,9 @@ void ScaleARGBFilterCols_MSA(uint8* dst_argb,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_MSA(const uint8* src_ptr,
|
||||
void ScaleRowDown34_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
int x;
|
||||
(void)src_stride;
|
||||
@ -753,12 +753,12 @@ void ScaleRowDown34_MSA(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_0_Box_MSA(const uint8* src_ptr,
|
||||
void ScaleRowDown34_0_Box_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* d,
|
||||
uint8_t* d,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, dst0, dst1, dst2;
|
||||
v16u8 vec0, vec1, vec2, vec3, vec4, vec5;
|
||||
@ -847,12 +847,12 @@ void ScaleRowDown34_0_Box_MSA(const uint8* src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleRowDown34_1_Box_MSA(const uint8* src_ptr,
|
||||
void ScaleRowDown34_1_Box_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* d,
|
||||
uint8_t* d,
|
||||
int dst_width) {
|
||||
const uint8* s = src_ptr;
|
||||
const uint8* t = src_ptr + src_stride;
|
||||
const uint8_t* s = src_ptr;
|
||||
const uint8_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, dst0, dst1, dst2;
|
||||
v16u8 vec0, vec1, vec2, vec3, vec4, vec5;
|
||||
|
||||
@ -23,9 +23,9 @@ extern "C" {
|
||||
// Provided by Fritz Koenig
|
||||
|
||||
// Read 32x1 throw away even pixels, and write 16x1.
|
||||
void ScaleRowDown2_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -44,9 +44,9 @@ void ScaleRowDown2_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Read 32x1 average down and write 16x1.
|
||||
void ScaleRowDown2Linear_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2Linear_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -65,9 +65,9 @@ void ScaleRowDown2Linear_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Read 32x2 average down and write 16x1.
|
||||
void ScaleRowDown2Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
// change the stride to row 2 pointer
|
||||
@ -95,9 +95,9 @@ void ScaleRowDown2Box_NEON(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown4_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown4_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -113,13 +113,13 @@ void ScaleRowDown4_NEON(const uint8* src_ptr,
|
||||
: "q0", "q1", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown4Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
const uint8* src_ptr1 = src_ptr + src_stride;
|
||||
const uint8* src_ptr2 = src_ptr + src_stride * 2;
|
||||
const uint8* src_ptr3 = src_ptr + src_stride * 3;
|
||||
const uint8_t* src_ptr1 = src_ptr + src_stride;
|
||||
const uint8_t* src_ptr2 = src_ptr + src_stride * 2;
|
||||
const uint8_t* src_ptr3 = src_ptr + src_stride * 3;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld1.8 {q0}, [%0]! \n" // load up 16x4
|
||||
@ -149,9 +149,9 @@ void ScaleRowDown4Box_NEON(const uint8* src_ptr,
|
||||
// Down scale from 4 to 3 pixels. Use the neon multilane read/write
|
||||
// to load up the every 4th pixel into a 4 different registers.
|
||||
// Point samples 32 pixels to 24 pixels.
|
||||
void ScaleRowDown34_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -168,9 +168,9 @@ void ScaleRowDown34_NEON(const uint8* src_ptr,
|
||||
: "d0", "d1", "d2", "d3", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_0_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #3 \n"
|
||||
@ -225,9 +225,9 @@ void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
|
||||
"cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown34_1_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_1_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"vmov.u8 d24, #3 \n"
|
||||
@ -276,9 +276,9 @@ static const vec16 kMult38_Div9 = {65536 / 18, 65536 / 18, 65536 / 18,
|
||||
65536 / 18, 65536 / 18};
|
||||
|
||||
// 32 -> 12
|
||||
void ScaleRowDown38_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown38_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -299,11 +299,11 @@ void ScaleRowDown38_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// 32x3 -> 12x1
|
||||
void OMITFP ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
|
||||
void OMITFP ScaleRowDown38_3_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
const uint8* src_ptr1 = src_ptr + src_stride * 2;
|
||||
const uint8_t* src_ptr1 = src_ptr + src_stride * 2;
|
||||
|
||||
asm volatile(
|
||||
"vld1.16 {q13}, [%5] \n"
|
||||
@ -411,9 +411,9 @@ void OMITFP ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// 32x2 -> 12x1
|
||||
void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown38_2_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"vld1.16 {q13}, [%4] \n"
|
||||
@ -504,12 +504,12 @@ void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
|
||||
: "q0", "q1", "q2", "q3", "q13", "q14", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleAddRows_NEON(const uint8* src_ptr,
|
||||
void ScaleAddRows_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int src_width,
|
||||
int src_height) {
|
||||
const uint8* src_tmp;
|
||||
const uint8_t* src_tmp;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"mov %0, %1 \n"
|
||||
@ -547,17 +547,17 @@ void ScaleAddRows_NEON(const uint8* src_ptr,
|
||||
"vld2.8 {d6[" #n "], d7[" #n "]}, [%6] \n"
|
||||
|
||||
// The NEON version mimics this formula (from row_common.cc):
|
||||
// #define BLENDER(a, b, f) (uint8)((int)(a) +
|
||||
// #define BLENDER(a, b, f) (uint8_t)((int)(a) +
|
||||
// ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
|
||||
void ScaleFilterCols_NEON(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
int dx_offset[4] = {0, 1, 2, 3};
|
||||
int* tmp = dx_offset;
|
||||
const uint8* src_tmp = src_ptr;
|
||||
const uint8_t* src_tmp = src_ptr;
|
||||
asm volatile (
|
||||
"vdup.32 q0, %3 \n" // x
|
||||
"vdup.32 q1, %4 \n" // dx
|
||||
@ -615,8 +615,8 @@ void ScaleFilterCols_NEON(uint8* dst_ptr,
|
||||
#undef LOAD2_DATA8_LANE
|
||||
|
||||
// 16x2 -> 16x1
|
||||
void ScaleFilterRows_NEON(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterRows_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int dst_width,
|
||||
int source_y_fraction) {
|
||||
@ -699,9 +699,9 @@ void ScaleFilterRows_NEON(uint8* dst_ptr,
|
||||
: "q0", "q1", "d4", "d5", "q13", "q14", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2_NEON(const uint8* src_ptr,
|
||||
void ScaleARGBRowDown2_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -727,9 +727,9 @@ void ScaleARGBRowDown2_NEON(const uint8* src_ptr,
|
||||
// 54: f942 038d vst2.32 {d16-d19}, [r2]!
|
||||
// 58: d1f5 bne.n 46 <ScaleARGBRowDown2_C+0x46>
|
||||
|
||||
void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Linear_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -749,9 +749,9 @@ void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr,
|
||||
void ScaleARGBRowDown2Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
// change the stride to row 2 pointer
|
||||
@ -786,10 +786,10 @@ void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr,
|
||||
|
||||
// Reads 4 pixels at a time.
|
||||
// Alignment requirement: src_argb 4 byte aligned.
|
||||
void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEven_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -811,10 +811,10 @@ void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
|
||||
|
||||
// Reads 4 pixels at a time.
|
||||
// Alignment requirement: src_argb 4 byte aligned.
|
||||
void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"mov r12, %4, lsl #2 \n"
|
||||
@ -857,13 +857,13 @@ void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
|
||||
"add %3, %3, %4 \n" \
|
||||
"vld1.32 {" #dn "[" #n "]}, [%6] \n"
|
||||
|
||||
void ScaleARGBCols_NEON(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
int tmp;
|
||||
const uint8* src_tmp = src_argb;
|
||||
const uint8_t* src_tmp = src_argb;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
// clang-format off
|
||||
@ -900,14 +900,14 @@ void ScaleARGBCols_NEON(uint8* dst_argb,
|
||||
"add %3, %3, %4 \n" \
|
||||
"vld2.32 {" #dn1 "[" #n "], " #dn2 "[" #n "]}, [%6] \n"
|
||||
|
||||
void ScaleARGBFilterCols_NEON(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
int dx_offset[4] = {0, 1, 2, 3};
|
||||
int* tmp = dx_offset;
|
||||
const uint8* src_tmp = src_argb;
|
||||
const uint8_t* src_tmp = src_argb;
|
||||
asm volatile (
|
||||
"vdup.32 q0, %3 \n" // x
|
||||
"vdup.32 q1, %4 \n" // dx
|
||||
|
||||
@ -21,9 +21,9 @@ extern "C" {
|
||||
#if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
|
||||
|
||||
// Read 32x1 throw away even pixels, and write 16x1.
|
||||
void ScaleRowDown2_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -42,9 +42,9 @@ void ScaleRowDown2_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Read 32x1 average down and write 16x1.
|
||||
void ScaleRowDown2Linear_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2Linear_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -64,9 +64,9 @@ void ScaleRowDown2Linear_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Read 32x2 average down and write 16x1.
|
||||
void ScaleRowDown2Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown2Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
// change the stride to row 2 pointer
|
||||
@ -92,9 +92,9 @@ void ScaleRowDown2Box_NEON(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleRowDown4_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown4_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -110,13 +110,13 @@ void ScaleRowDown4_NEON(const uint8* src_ptr,
|
||||
: "v0", "v1", "v2", "v3", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown4Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown4Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
const uint8* src_ptr1 = src_ptr + src_stride;
|
||||
const uint8* src_ptr2 = src_ptr + src_stride * 2;
|
||||
const uint8* src_ptr3 = src_ptr + src_stride * 3;
|
||||
const uint8_t* src_ptr1 = src_ptr + src_stride;
|
||||
const uint8_t* src_ptr2 = src_ptr + src_stride * 2;
|
||||
const uint8_t* src_ptr3 = src_ptr + src_stride * 3;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"ld1 {v0.16b}, [%0], #16 \n" // load up 16x4
|
||||
@ -145,9 +145,9 @@ void ScaleRowDown4Box_NEON(const uint8* src_ptr,
|
||||
// Down scale from 4 to 3 pixels. Use the neon multilane read/write
|
||||
// to load up the every 4th pixel into a 4 different registers.
|
||||
// Point samples 32 pixels to 24 pixels.
|
||||
void ScaleRowDown34_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -164,9 +164,9 @@ void ScaleRowDown34_NEON(const uint8* src_ptr,
|
||||
: "v0", "v1", "v2", "v3", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_0_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movi v20.8b, #3 \n"
|
||||
@ -221,9 +221,9 @@ void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
|
||||
"v19", "v20", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleRowDown34_1_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown34_1_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"movi v20.8b, #3 \n"
|
||||
@ -273,9 +273,9 @@ static const vec16 kMult38_Div9 = {65536 / 18, 65536 / 18, 65536 / 18,
|
||||
65536 / 18, 65536 / 18};
|
||||
|
||||
// 32 -> 12
|
||||
void ScaleRowDown38_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown38_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -295,11 +295,11 @@ void ScaleRowDown38_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// 32x3 -> 12x1
|
||||
void OMITFP ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
|
||||
void OMITFP ScaleRowDown38_3_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
const uint8* src_ptr1 = src_ptr + src_stride * 2;
|
||||
const uint8_t* src_ptr1 = src_ptr + src_stride * 2;
|
||||
ptrdiff_t tmp_src_stride = src_stride;
|
||||
|
||||
asm volatile(
|
||||
@ -415,9 +415,9 @@ void OMITFP ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// 32x2 -> 12x1
|
||||
void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
|
||||
void ScaleRowDown38_2_Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
// TODO(fbarchard): use src_stride directly for clang 3.5+.
|
||||
ptrdiff_t tmp_src_stride = src_stride;
|
||||
@ -515,12 +515,12 @@ void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
|
||||
"v19", "v30", "v31", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleAddRows_NEON(const uint8* src_ptr,
|
||||
void ScaleAddRows_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int src_width,
|
||||
int src_height) {
|
||||
const uint8* src_tmp;
|
||||
const uint8_t* src_tmp;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"mov %0, %1 \n"
|
||||
@ -558,19 +558,19 @@ void ScaleAddRows_NEON(const uint8* src_ptr,
|
||||
"ld2 {v4.b, v5.b}[" #n "], [%6] \n"
|
||||
|
||||
// The NEON version mimics this formula (from row_common.cc):
|
||||
// #define BLENDER(a, b, f) (uint8)((int)(a) +
|
||||
// #define BLENDER(a, b, f) (uint8_t)((int)(a) +
|
||||
// ((((int)((f)) * ((int)(b) - (int)(a))) + 0x8000) >> 16))
|
||||
|
||||
void ScaleFilterCols_NEON(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterCols_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
int dx_offset[4] = {0, 1, 2, 3};
|
||||
int* tmp = dx_offset;
|
||||
const uint8* src_tmp = src_ptr;
|
||||
int64 x64 = (int64)x; // NOLINT
|
||||
int64 dx64 = (int64)dx; // NOLINT
|
||||
const uint8_t* src_tmp = src_ptr;
|
||||
int64_t x64 = (int64_t)x; // NOLINT
|
||||
int64_t dx64 = (int64_t)dx; // NOLINT
|
||||
asm volatile (
|
||||
"dup v0.4s, %w3 \n" // x
|
||||
"dup v1.4s, %w4 \n" // dx
|
||||
@ -628,8 +628,8 @@ void ScaleFilterCols_NEON(uint8* dst_ptr,
|
||||
#undef LOAD2_DATA8_LANE
|
||||
|
||||
// 16x2 -> 16x1
|
||||
void ScaleFilterRows_NEON(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
void ScaleFilterRows_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int dst_width,
|
||||
int source_y_fraction) {
|
||||
@ -713,9 +713,9 @@ void ScaleFilterRows_NEON(uint8* dst_ptr,
|
||||
: "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "memory", "cc");
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2_NEON(const uint8* src_ptr,
|
||||
void ScaleARGBRowDown2_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -734,9 +734,9 @@ void ScaleARGBRowDown2_NEON(const uint8* src_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDown2Linear_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -757,9 +757,9 @@ void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb,
|
||||
);
|
||||
}
|
||||
|
||||
void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr,
|
||||
void ScaleARGBRowDown2Box_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst,
|
||||
uint8_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
// change the stride to row 2 pointer
|
||||
@ -792,10 +792,10 @@ void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr,
|
||||
|
||||
// Reads 4 pixels at a time.
|
||||
// Alignment requirement: src_argb 4 byte aligned.
|
||||
void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEven_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
(void)src_stride;
|
||||
asm volatile(
|
||||
@ -810,7 +810,7 @@ void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
|
||||
: "+r"(src_argb), // %0
|
||||
"+r"(dst_argb), // %1
|
||||
"+r"(dst_width) // %2
|
||||
: "r"((int64)(src_stepx * 4)) // %3
|
||||
: "r"((int64_t)(src_stepx * 4)) // %3
|
||||
: "memory", "cc", "v0");
|
||||
}
|
||||
|
||||
@ -818,10 +818,10 @@ void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
|
||||
// Alignment requirement: src_argb 4 byte aligned.
|
||||
// TODO(Yang Zhang): Might be worth another optimization pass in future.
|
||||
// It could be upgraded to 8 pixels at a time to start with.
|
||||
void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_NEON(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"add %1, %1, %0 \n"
|
||||
@ -855,7 +855,7 @@ void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
|
||||
"+r"(src_stride), // %1
|
||||
"+r"(dst_argb), // %2
|
||||
"+r"(dst_width) // %3
|
||||
: "r"((int64)(src_stepx * 4)) // %4
|
||||
: "r"((int64_t)(src_stepx * 4)) // %4
|
||||
: "memory", "cc", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16");
|
||||
}
|
||||
|
||||
@ -867,15 +867,15 @@ void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
|
||||
"add %3, %3, %4 \n" \
|
||||
"ld1 {" #vn ".s}[" #n "], [%6] \n"
|
||||
|
||||
void ScaleARGBCols_NEON(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBCols_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
const uint8* src_tmp = src_argb;
|
||||
int64 x64 = (int64)x; // NOLINT
|
||||
int64 dx64 = (int64)dx; // NOLINT
|
||||
int64 tmp64;
|
||||
const uint8_t* src_tmp = src_argb;
|
||||
int64_t x64 = (int64_t)x; // NOLINT
|
||||
int64_t dx64 = (int64_t)dx; // NOLINT
|
||||
int64_t tmp64;
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
// clang-format off
|
||||
@ -912,16 +912,16 @@ void ScaleARGBCols_NEON(uint8* dst_argb,
|
||||
"add %3, %3, %4 \n" \
|
||||
"ld2 {" #vn1 ".s, " #vn2 ".s}[" #n "], [%6] \n"
|
||||
|
||||
void ScaleARGBFilterCols_NEON(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
void ScaleARGBFilterCols_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
int dx_offset[4] = {0, 1, 2, 3};
|
||||
int* tmp = dx_offset;
|
||||
const uint8* src_tmp = src_argb;
|
||||
int64 x64 = (int64)x; // NOLINT
|
||||
int64 dx64 = (int64)dx; // NOLINT
|
||||
const uint8_t* src_tmp = src_argb;
|
||||
int64_t x64 = (int64_t)x; // NOLINT
|
||||
int64_t dx64 = (int64_t)dx; // NOLINT
|
||||
asm volatile (
|
||||
"dup v0.4s, %w3 \n" // x
|
||||
"dup v1.4s, %w4 \n" // dx
|
||||
@ -978,9 +978,9 @@ void ScaleARGBFilterCols_NEON(uint8* dst_argb,
|
||||
#undef LOAD2_DATA32_LANE
|
||||
|
||||
// Read 16x2 average down and write 8x1.
|
||||
void ScaleRowDown2Box_16_NEON(const uint16* src_ptr,
|
||||
void ScaleRowDown2Box_16_NEON(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
// change the stride to row 2 pointer
|
||||
@ -1008,9 +1008,9 @@ void ScaleRowDown2Box_16_NEON(const uint16* src_ptr,
|
||||
|
||||
// Read 8x2 upsample with filtering and write 16x1.
|
||||
// Actually reads an extra pixel, so 9x2.
|
||||
void ScaleRowUp2_16_NEON(const uint16* src_ptr,
|
||||
void ScaleRowUp2_16_NEON(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width) {
|
||||
asm volatile(
|
||||
"add %1, %0, %1, lsl #1 \n" // ptr + stide * 2
|
||||
|
||||
@ -89,9 +89,9 @@ static const uvec16 kScaleAb2 = {65536 / 3, 65536 / 3, 65536 / 2, 65536 / 3,
|
||||
65536 / 3, 65536 / 2, 0, 0};
|
||||
|
||||
// Reads 32 pixels, throws half away and writes 16 pixels.
|
||||
__declspec(naked) void ScaleRowDown2_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -116,9 +116,9 @@ __declspec(naked) void ScaleRowDown2_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Blends 32x1 rectangle to 16x1.
|
||||
__declspec(naked) void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2Linear_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -150,9 +150,9 @@ __declspec(naked) void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Blends 32x2 rectangle to 16x1.
|
||||
__declspec(naked) void ScaleRowDown2Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -195,9 +195,9 @@ __declspec(naked) void ScaleRowDown2Box_SSSE3(const uint8* src_ptr,
|
||||
|
||||
#ifdef HAS_SCALEROWDOWN2_AVX2
|
||||
// Reads 64 pixels, throws half away and writes 32 pixels.
|
||||
__declspec(naked) void ScaleRowDown2_AVX2(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -224,9 +224,9 @@ __declspec(naked) void ScaleRowDown2_AVX2(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Blends 64x1 rectangle to 32x1.
|
||||
__declspec(naked) void ScaleRowDown2Linear_AVX2(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2Linear_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -262,9 +262,9 @@ __declspec(naked) void ScaleRowDown2Linear_AVX2(const uint8* src_ptr,
|
||||
// For rounding, average = (sum + 2) / 4
|
||||
// becomes average((sum >> 1), 0)
|
||||
// Blends 64x2 rectangle to 32x1.
|
||||
__declspec(naked) void ScaleRowDown2Box_AVX2(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown2Box_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -309,9 +309,9 @@ __declspec(naked) void ScaleRowDown2Box_AVX2(const uint8* src_ptr,
|
||||
#endif // HAS_SCALEROWDOWN2_AVX2
|
||||
|
||||
// Point samples 32 pixels to 8 pixels.
|
||||
__declspec(naked) void ScaleRowDown4_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown4_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -341,9 +341,9 @@ __declspec(naked) void ScaleRowDown4_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Blends 32x4 rectangle to 8x1.
|
||||
__declspec(naked) void ScaleRowDown4Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown4Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -400,9 +400,9 @@ __declspec(naked) void ScaleRowDown4Box_SSSE3(const uint8* src_ptr,
|
||||
|
||||
#ifdef HAS_SCALEROWDOWN4_AVX2
|
||||
// Point samples 64 pixels to 16 pixels.
|
||||
__declspec(naked) void ScaleRowDown4_AVX2(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown4_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -435,9 +435,9 @@ __declspec(naked) void ScaleRowDown4_AVX2(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Blends 64x4 rectangle to 16x1.
|
||||
__declspec(naked) void ScaleRowDown4Box_AVX2(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown4Box_AVX2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -499,9 +499,9 @@ __declspec(naked) void ScaleRowDown4Box_AVX2(const uint8* src_ptr,
|
||||
// Produces three 8 byte values. For each 8 bytes, 16 bytes are read.
|
||||
// Then shuffled to do the scaling.
|
||||
|
||||
__declspec(naked) void ScaleRowDown34_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown34_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -547,9 +547,9 @@ __declspec(naked) void ScaleRowDown34_SSSE3(const uint8* src_ptr,
|
||||
// xmm7 kRound34
|
||||
|
||||
// Note that movdqa+palign may be better than movdqu.
|
||||
__declspec(naked) void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown34_1_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -604,9 +604,9 @@ __declspec(naked) void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Note that movdqa+palign may be better than movdqu.
|
||||
__declspec(naked) void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown34_0_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -666,9 +666,9 @@ __declspec(naked) void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
|
||||
// 3/8 point sampler
|
||||
|
||||
// Scale 32 pixels to 12
|
||||
__declspec(naked) void ScaleRowDown38_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown38_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -698,9 +698,9 @@ __declspec(naked) void ScaleRowDown38_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Scale 16x3 pixels to 6x1 with interpolation
|
||||
__declspec(naked) void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown38_3_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -763,9 +763,9 @@ __declspec(naked) void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Scale 16x2 pixels to 6x1 with interpolation
|
||||
__declspec(naked) void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleRowDown38_2_Box_SSSE3(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_ptr,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -808,8 +808,8 @@ __declspec(naked) void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
|
||||
}
|
||||
|
||||
// Reads 16 bytes and accumulates to 16 shorts at a time.
|
||||
__declspec(naked) void ScaleAddRow_SSE2(const uint8* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
__declspec(naked) void ScaleAddRow_SSE2(const uint8_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int src_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -839,8 +839,8 @@ __declspec(naked) void ScaleAddRow_SSE2(const uint8* src_ptr,
|
||||
|
||||
#ifdef HAS_SCALEADDROW_AVX2
|
||||
// Reads 32 bytes and accumulates to 32 shorts at a time.
|
||||
__declspec(naked) void ScaleAddRow_AVX2(const uint8* src_ptr,
|
||||
uint16* dst_ptr,
|
||||
__declspec(naked) void ScaleAddRow_AVX2(const uint8_t* src_ptr,
|
||||
uint16_t* dst_ptr,
|
||||
int src_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_ptr
|
||||
@ -879,8 +879,8 @@ static const uvec16 kFadd40 = {0x4040, 0x4040, 0x4040, 0x4040,
|
||||
0x4040, 0x4040, 0x4040, 0x4040};
|
||||
|
||||
// Bilinear column filtering. SSSE3 version.
|
||||
__declspec(naked) void ScaleFilterCols_SSSE3(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleFilterCols_SSSE3(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -965,8 +965,8 @@ __declspec(naked) void ScaleFilterCols_SSSE3(uint8* dst_ptr,
|
||||
}
|
||||
|
||||
// Reads 16 pixels, duplicates them and writes 32 pixels.
|
||||
__declspec(naked) void ScaleColsUp2_SSE2(uint8* dst_ptr,
|
||||
const uint8* src_ptr,
|
||||
__declspec(naked) void ScaleColsUp2_SSE2(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -992,9 +992,9 @@ __declspec(naked) void ScaleColsUp2_SSE2(uint8* dst_ptr,
|
||||
}
|
||||
|
||||
// Reads 8 pixels, throws half away and writes 4 even pixels (0, 2, 4, 6)
|
||||
__declspec(naked) void ScaleARGBRowDown2_SSE2(const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBRowDown2_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_argb
|
||||
@ -1017,9 +1017,9 @@ __declspec(naked) void ScaleARGBRowDown2_SSE2(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Blends 8x1 rectangle to 4x1.
|
||||
__declspec(naked) void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBRowDown2Linear_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_argb
|
||||
@ -1045,9 +1045,9 @@ __declspec(naked) void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Blends 8x2 rectangle to 4x1.
|
||||
__declspec(naked) void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBRowDown2Box_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push esi
|
||||
@ -1079,10 +1079,10 @@ __declspec(naked) void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Reads 4 pixels at a time.
|
||||
__declspec(naked) void ScaleARGBRowDownEven_SSE2(const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBRowDownEven_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push ebx
|
||||
@ -1116,10 +1116,10 @@ __declspec(naked) void ScaleARGBRowDownEven_SSE2(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Blends four 2x2 to 4x1.
|
||||
__declspec(naked) void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBRowDownEvenBox_SSE2(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width) {
|
||||
__asm {
|
||||
push ebx
|
||||
@ -1164,8 +1164,8 @@ __declspec(naked) void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb,
|
||||
}
|
||||
|
||||
// Column scaling unfiltered. SSE2 version.
|
||||
__declspec(naked) void ScaleARGBCols_SSE2(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBCols_SSE2(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -1257,8 +1257,8 @@ static const uvec8 kShuffleFractions = {
|
||||
0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u,
|
||||
};
|
||||
|
||||
__declspec(naked) void ScaleARGBFilterCols_SSSE3(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBFilterCols_SSSE3(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
@ -1330,8 +1330,8 @@ __declspec(naked) void ScaleARGBFilterCols_SSSE3(uint8* dst_argb,
|
||||
}
|
||||
|
||||
// Reads 4 pixels, duplicates them and writes 8 pixels.
|
||||
__declspec(naked) void ScaleARGBColsUp2_SSE2(uint8* dst_argb,
|
||||
const uint8* src_argb,
|
||||
__declspec(naked) void ScaleARGBColsUp2_SSE2(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx) {
|
||||
|
||||
@ -18,8 +18,8 @@ extern "C" {
|
||||
#define ARRAY_SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
|
||||
|
||||
struct FourCCAliasEntry {
|
||||
uint32 alias;
|
||||
uint32 canonical;
|
||||
uint32_t alias;
|
||||
uint32_t canonical;
|
||||
};
|
||||
|
||||
static const struct FourCCAliasEntry kFourCCAliases[] = {
|
||||
@ -46,7 +46,7 @@ static const struct FourCCAliasEntry kFourCCAliases[] = {
|
||||
// {FOURCC_BGRA, FOURCC_ARGB}, // kCMPixelFormat_32BGRA
|
||||
|
||||
LIBYUV_API
|
||||
uint32 CanonicalFourCC(uint32 fourcc) {
|
||||
uint32_t CanonicalFourCC(uint32_t fourcc) {
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(kFourCCAliases); ++i) {
|
||||
if (kFourCCAliases[i].alias == fourcc) {
|
||||
|
||||
@ -14,14 +14,14 @@
|
||||
namespace libyuv {
|
||||
|
||||
TEST_F(LibYUVBaseTest, SizeOfTypes) {
|
||||
int8 i8 = -1;
|
||||
uint8 u8 = 1u;
|
||||
int16 i16 = -1;
|
||||
uint16 u16 = 1u;
|
||||
int32 i32 = -1;
|
||||
uint32 u32 = 1u;
|
||||
int64 i64 = -1;
|
||||
uint64 u64 = 1u;
|
||||
int8_t i8 = -1;
|
||||
uint8_t u8 = 1u;
|
||||
int16_t i16 = -1;
|
||||
uint16_t u16 = 1u;
|
||||
int32_t i32 = -1;
|
||||
uint32_t u32 = 1u;
|
||||
int64_t i64 = -1;
|
||||
uint64_t u64 = 1u;
|
||||
EXPECT_EQ(1u, sizeof(i8));
|
||||
EXPECT_EQ(1u, sizeof(u8));
|
||||
EXPECT_EQ(2u, sizeof(i16));
|
||||
|
||||
@ -63,10 +63,10 @@ namespace libyuv {
|
||||
\
|
||||
/* The test is overall for color conversion matrix being reversible, so */ \
|
||||
/* this initializes the pixel with 2x2 blocks to eliminate subsampling. */ \
|
||||
uint8* p = orig_y; \
|
||||
uint8_t* p = orig_y; \
|
||||
for (int y = 0; y < benchmark_height_ - HS1; y += HS) { \
|
||||
for (int x = 0; x < benchmark_width_ - 1; x += 2) { \
|
||||
uint8 r = static_cast<uint8>(fastrand()); \
|
||||
uint8_t r = static_cast<uint8_t>(fastrand()); \
|
||||
p[0] = r; \
|
||||
p[1] = r; \
|
||||
p[HN] = r; \
|
||||
@ -74,7 +74,7 @@ namespace libyuv {
|
||||
p += 2; \
|
||||
} \
|
||||
if (benchmark_width_ & 1) { \
|
||||
uint8 r = static_cast<uint8>(fastrand()); \
|
||||
uint8_t r = static_cast<uint8_t>(fastrand()); \
|
||||
p[0] = r; \
|
||||
p[HN] = r; \
|
||||
p += 1; \
|
||||
@ -83,13 +83,13 @@ namespace libyuv {
|
||||
} \
|
||||
if ((benchmark_height_ & 1) && HS == 2) { \
|
||||
for (int x = 0; x < benchmark_width_ - 1; x += 2) { \
|
||||
uint8 r = static_cast<uint8>(fastrand()); \
|
||||
uint8_t r = static_cast<uint8_t>(fastrand()); \
|
||||
p[0] = r; \
|
||||
p[1] = r; \
|
||||
p += 2; \
|
||||
} \
|
||||
if (benchmark_width_ & 1) { \
|
||||
uint8 r = static_cast<uint8>(fastrand()); \
|
||||
uint8_t r = static_cast<uint8_t>(fastrand()); \
|
||||
p[0] = r; \
|
||||
p += 1; \
|
||||
} \
|
||||
@ -147,10 +147,10 @@ static void YUVToRGB(int y, int u, int v, int* r, int* g, int* b) {
|
||||
const int kPixels = kWidth * kHeight;
|
||||
const int kHalfPixels = ((kWidth + 1) / 2) * ((kHeight + 1) / 2);
|
||||
|
||||
SIMD_ALIGNED(uint8 orig_y[16]);
|
||||
SIMD_ALIGNED(uint8 orig_u[8]);
|
||||
SIMD_ALIGNED(uint8 orig_v[8]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels[16 * 4]);
|
||||
SIMD_ALIGNED(uint8_t orig_y[16]);
|
||||
SIMD_ALIGNED(uint8_t orig_u[8]);
|
||||
SIMD_ALIGNED(uint8_t orig_v[8]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[16 * 4]);
|
||||
memset(orig_y, y, kPixels);
|
||||
memset(orig_u, u, kHalfPixels);
|
||||
memset(orig_v, v, kHalfPixels);
|
||||
@ -170,10 +170,10 @@ static void YUVJToRGB(int y, int u, int v, int* r, int* g, int* b) {
|
||||
const int kPixels = kWidth * kHeight;
|
||||
const int kHalfPixels = ((kWidth + 1) / 2) * ((kHeight + 1) / 2);
|
||||
|
||||
SIMD_ALIGNED(uint8 orig_y[16]);
|
||||
SIMD_ALIGNED(uint8 orig_u[8]);
|
||||
SIMD_ALIGNED(uint8 orig_v[8]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels[16 * 4]);
|
||||
SIMD_ALIGNED(uint8_t orig_y[16]);
|
||||
SIMD_ALIGNED(uint8_t orig_u[8]);
|
||||
SIMD_ALIGNED(uint8_t orig_v[8]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[16 * 4]);
|
||||
memset(orig_y, y, kPixels);
|
||||
memset(orig_u, u, kHalfPixels);
|
||||
memset(orig_v, v, kHalfPixels);
|
||||
@ -192,8 +192,8 @@ static void YToRGB(int y, int* r, int* g, int* b) {
|
||||
const int kHeight = 1;
|
||||
const int kPixels = kWidth * kHeight;
|
||||
|
||||
SIMD_ALIGNED(uint8 orig_y[16]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels[16 * 4]);
|
||||
SIMD_ALIGNED(uint8_t orig_y[16]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[16 * 4]);
|
||||
memset(orig_y, y, kPixels);
|
||||
|
||||
/* YUV converted to ARGB. */
|
||||
@ -209,8 +209,8 @@ static void YJToRGB(int y, int* r, int* g, int* b) {
|
||||
const int kHeight = 1;
|
||||
const int kPixels = kWidth * kHeight;
|
||||
|
||||
SIMD_ALIGNED(uint8 orig_y[16]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels[16 * 4]);
|
||||
SIMD_ALIGNED(uint8_t orig_y[16]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[16 * 4]);
|
||||
memset(orig_y, y, kPixels);
|
||||
|
||||
/* YUV converted to ARGB. */
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
namespace libyuv {
|
||||
|
||||
// hash seed of 5381 recommended.
|
||||
static uint32 ReferenceHashDjb2(const uint8* src, uint64 count, uint32 seed) {
|
||||
uint32 hash = seed;
|
||||
static uint32_t ReferenceHashDjb2(const uint8_t* src, uint64_t count, uint32_t seed) {
|
||||
uint32_t hash = seed;
|
||||
if (count > 0) {
|
||||
do {
|
||||
hash = hash * 33 + *src++;
|
||||
@ -41,8 +41,8 @@ TEST_F(LibYUVCompareTest, Djb2_Test) {
|
||||
"The quick brown fox jumps over the lazy dog"
|
||||
" and feels as if he were in the seventh heaven of typography"
|
||||
" together with Hermann Zapf";
|
||||
uint32 foxhash = HashDjb2(reinterpret_cast<const uint8*>(fox), 131, 5381);
|
||||
const uint32 kExpectedFoxHash = 2611006483u;
|
||||
uint32_t foxhash = HashDjb2(reinterpret_cast<const uint8_t*>(fox), 131, 5381);
|
||||
const uint32_t kExpectedFoxHash = 2611006483u;
|
||||
EXPECT_EQ(kExpectedFoxHash, foxhash);
|
||||
|
||||
for (int i = 0; i < kMaxTest; ++i) {
|
||||
@ -50,8 +50,8 @@ TEST_F(LibYUVCompareTest, Djb2_Test) {
|
||||
src_b[i] = (fastrand() & 0xff);
|
||||
}
|
||||
// Compare different buffers. Expect hash is different.
|
||||
uint32 h1 = HashDjb2(src_a, kMaxTest, 5381);
|
||||
uint32 h2 = HashDjb2(src_b, kMaxTest, 5381);
|
||||
uint32_t h1 = HashDjb2(src_a, kMaxTest, 5381);
|
||||
uint32_t h2 = HashDjb2(src_b, kMaxTest, 5381);
|
||||
EXPECT_NE(h1, h2);
|
||||
|
||||
// Make last half same. Expect hash is different.
|
||||
@ -124,8 +124,8 @@ TEST_F(LibYUVCompareTest, BenchmarkDjb2_Opt) {
|
||||
for (int i = 0; i < kMaxTest; ++i) {
|
||||
src_a[i] = i;
|
||||
}
|
||||
uint32 h2 = ReferenceHashDjb2(src_a, kMaxTest, 5381);
|
||||
uint32 h1;
|
||||
uint32_t h2 = ReferenceHashDjb2(src_a, kMaxTest, 5381);
|
||||
uint32_t h1;
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
h1 = HashDjb2(src_a, kMaxTest, 5381);
|
||||
}
|
||||
@ -139,8 +139,8 @@ TEST_F(LibYUVCompareTest, BenchmarkDjb2_Unaligned) {
|
||||
for (int i = 0; i < kMaxTest; ++i) {
|
||||
src_a[i + 1] = i;
|
||||
}
|
||||
uint32 h2 = ReferenceHashDjb2(src_a + 1, kMaxTest, 5381);
|
||||
uint32 h1;
|
||||
uint32_t h2 = ReferenceHashDjb2(src_a + 1, kMaxTest, 5381);
|
||||
uint32_t h1;
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
h1 = HashDjb2(src_a + 1, kMaxTest, 5381);
|
||||
}
|
||||
@ -149,7 +149,7 @@ TEST_F(LibYUVCompareTest, BenchmarkDjb2_Unaligned) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Opt) {
|
||||
uint32 fourcc;
|
||||
uint32_t fourcc;
|
||||
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4;
|
||||
align_buffer_page_end(src_a, kMaxTest);
|
||||
for (int i = 0; i < kMaxTest; ++i) {
|
||||
@ -159,12 +159,12 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Opt) {
|
||||
src_a[0] = 0;
|
||||
fourcc = ARGBDetect(src_a, benchmark_width_ * 4, benchmark_width_,
|
||||
benchmark_height_);
|
||||
EXPECT_EQ(static_cast<uint32>(libyuv::FOURCC_BGRA), fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(libyuv::FOURCC_BGRA), fourcc);
|
||||
src_a[0] = 255;
|
||||
src_a[3] = 0;
|
||||
fourcc = ARGBDetect(src_a, benchmark_width_ * 4, benchmark_width_,
|
||||
benchmark_height_);
|
||||
EXPECT_EQ(static_cast<uint32>(libyuv::FOURCC_ARGB), fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(libyuv::FOURCC_ARGB), fourcc);
|
||||
src_a[3] = 255;
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
@ -177,7 +177,7 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Opt) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Unaligned) {
|
||||
uint32 fourcc;
|
||||
uint32_t fourcc;
|
||||
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4 + 1;
|
||||
align_buffer_page_end(src_a, kMaxTest);
|
||||
for (int i = 1; i < kMaxTest; ++i) {
|
||||
@ -187,12 +187,12 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Unaligned) {
|
||||
src_a[0 + 1] = 0;
|
||||
fourcc = ARGBDetect(src_a + 1, benchmark_width_ * 4, benchmark_width_,
|
||||
benchmark_height_);
|
||||
EXPECT_EQ(static_cast<uint32>(libyuv::FOURCC_BGRA), fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(libyuv::FOURCC_BGRA), fourcc);
|
||||
src_a[0 + 1] = 255;
|
||||
src_a[3 + 1] = 0;
|
||||
fourcc = ARGBDetect(src_a + 1, benchmark_width_ * 4, benchmark_width_,
|
||||
benchmark_height_);
|
||||
EXPECT_EQ(static_cast<uint32>(libyuv::FOURCC_ARGB), fourcc);
|
||||
EXPECT_EQ(static_cast<uint32_t>(libyuv::FOURCC_ARGB), fourcc);
|
||||
src_a[3 + 1] = 255;
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
@ -214,14 +214,14 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) {
|
||||
// Test known value
|
||||
memcpy(src_a, "test0123test4567", 16);
|
||||
memcpy(src_b, "tick0123tock4567", 16);
|
||||
uint32 h1 = HammingDistance_C(src_a, src_b, 16);
|
||||
uint32_t h1 = HammingDistance_C(src_a, src_b, 16);
|
||||
EXPECT_EQ(16u, h1);
|
||||
|
||||
// Test C vs OPT on random buffer
|
||||
MemRandomize(src_a, kMaxWidth);
|
||||
MemRandomize(src_b, kMaxWidth);
|
||||
|
||||
uint32 h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
uint32_t h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
|
||||
int count =
|
||||
benchmark_iterations_ *
|
||||
@ -273,14 +273,14 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_C) {
|
||||
// Test known value
|
||||
memcpy(src_a, "test0123test4567", 16);
|
||||
memcpy(src_b, "tick0123tock4567", 16);
|
||||
uint32 h1 = HammingDistance_C(src_a, src_b, 16);
|
||||
uint32_t h1 = HammingDistance_C(src_a, src_b, 16);
|
||||
EXPECT_EQ(16u, h1);
|
||||
|
||||
// Test C vs OPT on random buffer
|
||||
MemRandomize(src_a, kMaxWidth);
|
||||
MemRandomize(src_b, kMaxWidth);
|
||||
|
||||
uint32 h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
uint32_t h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
|
||||
int count =
|
||||
benchmark_iterations_ *
|
||||
@ -304,14 +304,14 @@ TEST_F(LibYUVCompareTest, BenchmarkHammingDistance) {
|
||||
|
||||
memcpy(src_a, "test0123test4567", 16);
|
||||
memcpy(src_b, "tick0123tock4567", 16);
|
||||
uint64 h1 = ComputeHammingDistance(src_a, src_b, 16);
|
||||
uint64_t h1 = ComputeHammingDistance(src_a, src_b, 16);
|
||||
EXPECT_EQ(16u, h1);
|
||||
|
||||
// Test C vs OPT on random buffer
|
||||
MemRandomize(src_a, kMaxWidth);
|
||||
MemRandomize(src_b, kMaxWidth);
|
||||
|
||||
uint32 h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
uint32_t h0 = HammingDistance_C(src_a, src_b, kMaxWidth);
|
||||
|
||||
int count =
|
||||
benchmark_iterations_ *
|
||||
@ -337,14 +337,14 @@ static const int kMaxOptCount = (1 << (32 - 3)) - 64; // 536870848
|
||||
#endif
|
||||
|
||||
TEST_F(LibYUVCompareTest, TestHammingDistance_Opt) {
|
||||
uint32 h1 = 0;
|
||||
uint32_t h1 = 0;
|
||||
const int kMaxWidth = (benchmark_width_ * benchmark_height_ + 31) & ~31;
|
||||
align_buffer_page_end(src_a, kMaxWidth);
|
||||
align_buffer_page_end(src_b, kMaxWidth);
|
||||
memset(src_a, 255u, kMaxWidth);
|
||||
memset(src_b, 0u, kMaxWidth);
|
||||
|
||||
uint64 h0 = ComputeHammingDistance(src_a, src_b, kMaxWidth);
|
||||
uint64_t h0 = ComputeHammingDistance(src_a, src_b, kMaxWidth);
|
||||
EXPECT_EQ(kMaxWidth * 8ULL, h0);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
@ -385,7 +385,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance_Opt) {
|
||||
if (kMaxWidth <= kMaxOptCount) {
|
||||
EXPECT_EQ(kMaxWidth * 8U, h1);
|
||||
} else {
|
||||
if (kMaxWidth * 8ULL != static_cast<uint64>(h1)) {
|
||||
if (kMaxWidth * 8ULL != static_cast<uint64_t>(h1)) {
|
||||
printf(
|
||||
"warning - HammingDistance_Opt %u does not match %llu "
|
||||
"but length of %u is longer than guaranteed.\n",
|
||||
@ -408,7 +408,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance) {
|
||||
memset(src_a, 255u, benchmark_width_ * benchmark_height_);
|
||||
memset(src_b, 0, benchmark_width_ * benchmark_height_);
|
||||
|
||||
uint64 h1 = 0;
|
||||
uint64_t h1 = 0;
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
h1 = ComputeHammingDistance(src_a, src_b,
|
||||
benchmark_width_ * benchmark_height_);
|
||||
@ -428,7 +428,7 @@ TEST_F(LibYUVCompareTest, BenchmarkSumSquareError_Opt) {
|
||||
|
||||
memcpy(src_a, "test0123test4567", 16);
|
||||
memcpy(src_b, "tick0123tock4567", 16);
|
||||
uint64 h1 = ComputeSumSquareError(src_a, src_b, 16);
|
||||
uint64_t h1 = ComputeSumSquareError(src_a, src_b, 16);
|
||||
EXPECT_EQ(790u, h1);
|
||||
|
||||
for (int i = 0; i < kMaxWidth; ++i) {
|
||||
@ -458,7 +458,7 @@ TEST_F(LibYUVCompareTest, SumSquareError) {
|
||||
memset(src_a, 0, kMaxWidth);
|
||||
memset(src_b, 0, kMaxWidth);
|
||||
|
||||
uint64 err;
|
||||
uint64_t err;
|
||||
err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
EXPECT_EQ(0u, err);
|
||||
@ -480,10 +480,10 @@ TEST_F(LibYUVCompareTest, SumSquareError) {
|
||||
}
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
uint64 c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
uint64_t c_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
uint64 opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
uint64_t opt_err = ComputeSumSquareError(src_a, src_b, kMaxWidth);
|
||||
|
||||
EXPECT_EQ(c_err, opt_err);
|
||||
|
||||
|
||||
@ -136,20 +136,20 @@ namespace libyuv {
|
||||
FMT_PLANAR, DST_T, DST_BPC, DST_SUBSAMP_X, DST_SUBSAMP_Y, \
|
||||
benchmark_width_, _Opt, +, 0)
|
||||
|
||||
TESTPLANARTOP(I420, uint8, 1, 2, 2, I420, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(I422, uint8, 1, 2, 1, I420, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(I444, uint8, 1, 1, 1, I420, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(I420, uint8, 1, 2, 2, I422, uint8, 1, 2, 1)
|
||||
TESTPLANARTOP(I420, uint8, 1, 2, 2, I444, uint8, 1, 1, 1)
|
||||
TESTPLANARTOP(I420, uint8, 1, 2, 2, I420Mirror, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(I422, uint8, 1, 2, 1, I422, uint8, 1, 2, 1)
|
||||
TESTPLANARTOP(I444, uint8, 1, 1, 1, I444, uint8, 1, 1, 1)
|
||||
TESTPLANARTOP(I010, uint16, 2, 2, 2, I010, uint16, 2, 2, 2)
|
||||
TESTPLANARTOP(I010, uint16, 2, 2, 2, I420, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(I420, uint8, 1, 2, 2, I010, uint16, 2, 2, 2)
|
||||
TESTPLANARTOP(H010, uint16, 2, 2, 2, H010, uint16, 2, 2, 2)
|
||||
TESTPLANARTOP(H010, uint16, 2, 2, 2, H420, uint8, 1, 2, 2)
|
||||
TESTPLANARTOP(H420, uint8, 1, 2, 2, H010, uint16, 2, 2, 2)
|
||||
TESTPLANARTOP(I420, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(I422, uint8_t, 1, 2, 1, I420, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(I444, uint8_t, 1, 1, 1, I420, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(I420, uint8_t, 1, 2, 2, I422, uint8_t, 1, 2, 1)
|
||||
TESTPLANARTOP(I420, uint8_t, 1, 2, 2, I444, uint8_t, 1, 1, 1)
|
||||
TESTPLANARTOP(I420, uint8_t, 1, 2, 2, I420Mirror, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(I422, uint8_t, 1, 2, 1, I422, uint8_t, 1, 2, 1)
|
||||
TESTPLANARTOP(I444, uint8_t, 1, 1, 1, I444, uint8_t, 1, 1, 1)
|
||||
TESTPLANARTOP(I010, uint16_t, 2, 2, 2, I010, uint16_t, 2, 2, 2)
|
||||
TESTPLANARTOP(I010, uint16_t, 2, 2, 2, I420, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(I420, uint8_t, 1, 2, 2, I010, uint16_t, 2, 2, 2)
|
||||
TESTPLANARTOP(H010, uint16_t, 2, 2, 2, H010, uint16_t, 2, 2, 2)
|
||||
TESTPLANARTOP(H010, uint16_t, 2, 2, 2, H420, uint8_t, 1, 2, 2)
|
||||
TESTPLANARTOP(H420, uint8_t, 1, 2, 2, H010, uint16_t, 2, 2, 2)
|
||||
|
||||
// Test Android 420 to I420
|
||||
#define TESTAPLANARTOPI(SRC_FMT_PLANAR, PIXEL_STRIDE, SRC_SUBSAMP_X, \
|
||||
@ -173,8 +173,8 @@ TESTPLANARTOP(H420, uint8, 1, 2, 2, H010, uint16, 2, 2, 2)
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
align_buffer_page_end(dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \
|
||||
SUBSAMPLE(kHeight, SUBSAMP_Y)); \
|
||||
uint8* src_u = src_uv + OFF_U; \
|
||||
uint8* src_v = src_uv + (PIXEL_STRIDE == 1 ? kSizeUV : OFF_V); \
|
||||
uint8_t* src_u = src_uv + OFF_U; \
|
||||
uint8_t* src_v = src_uv + (PIXEL_STRIDE == 1 ? kSizeUV : OFF_V); \
|
||||
int src_stride_uv = SUBSAMPLE(kWidth, SUBSAMP_X) * PIXEL_STRIDE; \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kWidth; ++j) \
|
||||
@ -1238,8 +1238,8 @@ TESTSYM(BGRAToARGB, 4, 4, 1)
|
||||
TESTSYM(ABGRToARGB, 4, 4, 1)
|
||||
|
||||
TEST_F(LibYUVConvertTest, Test565) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[256][4]);
|
||||
SIMD_ALIGNED(uint8 pixels565[256][2]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[256][4]);
|
||||
SIMD_ALIGNED(uint8_t pixels565[256][2]);
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
@ -1247,7 +1247,7 @@ TEST_F(LibYUVConvertTest, Test565) {
|
||||
}
|
||||
}
|
||||
ARGBToRGB565(&orig_pixels[0][0], 0, &pixels565[0][0], 0, 256, 1);
|
||||
uint32 checksum = HashDjb2(&pixels565[0][0], sizeof(pixels565), 5381);
|
||||
uint32_t checksum = HashDjb2(&pixels565[0][0], sizeof(pixels565), 5381);
|
||||
EXPECT_EQ(610919429u, checksum);
|
||||
}
|
||||
|
||||
@ -1442,7 +1442,7 @@ TEST_F(LibYUVConvertTest, NV12Crop) {
|
||||
const int sample_size =
|
||||
kWidth * kHeight + kStrideUV * SUBSAMPLE(kHeight, SUBSAMP_Y) * 2;
|
||||
align_buffer_page_end(src_y, sample_size);
|
||||
uint8* src_uv = src_y + kWidth * kHeight;
|
||||
uint8_t* src_uv = src_y + kWidth * kHeight;
|
||||
|
||||
align_buffer_page_end(dst_y, kDestWidth * kDestHeight);
|
||||
align_buffer_page_end(dst_u, SUBSAMPLE(kDestWidth, SUBSAMP_X) *
|
||||
@ -1510,13 +1510,13 @@ TEST_F(LibYUVConvertTest, NV12Crop) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVConvertTest, TestYToARGB) {
|
||||
uint8 y[32];
|
||||
uint8 expectedg[32];
|
||||
uint8_t y[32];
|
||||
uint8_t expectedg[32];
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
y[i] = i * 5 + 17;
|
||||
expectedg[i] = static_cast<int>((y[i] - 16) * 1.164f + 0.5f);
|
||||
}
|
||||
uint8 argb[32 * 4];
|
||||
uint8_t argb[32 * 4];
|
||||
YToARGB(y, 0, argb, 0, 32, 1);
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
@ -1528,7 +1528,7 @@ TEST_F(LibYUVConvertTest, TestYToARGB) {
|
||||
}
|
||||
}
|
||||
|
||||
static const uint8 kNoDither4x4[16] = {
|
||||
static const uint8_t kNoDither4x4[16] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
@ -1555,7 +1555,7 @@ TEST_F(LibYUVConvertTest, TestNoDither) {
|
||||
}
|
||||
|
||||
// Ordered 4x4 dither for 888 to 565. Values from 0 to 7.
|
||||
static const uint8 kDither565_4x4[16] = {
|
||||
static const uint8_t kDither565_4x4[16] = {
|
||||
0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2,
|
||||
};
|
||||
|
||||
@ -2031,25 +2031,25 @@ TEST_F(LibYUVConvertTest, ARGBToAR30Row_Opt) {
|
||||
align_buffer_page_end(dst_argb_c, kStrideB* kHeight + DOFF); \
|
||||
align_buffer_page_end(dst_argb_opt, kStrideB* kHeight + DOFF); \
|
||||
for (int i = 0; i < kWidth * kHeight; ++i) { \
|
||||
reinterpret_cast<uint16*>(src_y + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
reinterpret_cast<uint16_t*>(src_y + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
} \
|
||||
for (int i = 0; i < kSizeUV; ++i) { \
|
||||
reinterpret_cast<uint16*>(src_u + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
reinterpret_cast<uint16*>(src_v + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
reinterpret_cast<uint16_t*>(src_u + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
reinterpret_cast<uint16_t*>(src_v + SOFF)[i] = (fastrand() & 0x3ff); \
|
||||
} \
|
||||
memset(dst_argb_c + DOFF, 1, kStrideB * kHeight); \
|
||||
memset(dst_argb_opt + DOFF, 101, kStrideB * kHeight); \
|
||||
MaskCpuFlags(disable_cpu_flags_); \
|
||||
FMT_PLANAR##To##FMT_B(reinterpret_cast<uint16*>(src_y + SOFF), kWidth, \
|
||||
reinterpret_cast<uint16*>(src_u + SOFF), kStrideUV, \
|
||||
reinterpret_cast<uint16*>(src_v + SOFF), kStrideUV, \
|
||||
FMT_PLANAR##To##FMT_B(reinterpret_cast<uint16_t*>(src_y + SOFF), kWidth, \
|
||||
reinterpret_cast<uint16_t*>(src_u + SOFF), kStrideUV, \
|
||||
reinterpret_cast<uint16_t*>(src_v + SOFF), kStrideUV, \
|
||||
dst_argb_c + DOFF, kStrideB, kWidth, NEG kHeight); \
|
||||
MaskCpuFlags(benchmark_cpu_info_); \
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) { \
|
||||
FMT_PLANAR##To##FMT_B( \
|
||||
reinterpret_cast<uint16*>(src_y + SOFF), kWidth, \
|
||||
reinterpret_cast<uint16*>(src_u + SOFF), kStrideUV, \
|
||||
reinterpret_cast<uint16*>(src_v + SOFF), kStrideUV, \
|
||||
reinterpret_cast<uint16_t*>(src_y + SOFF), kWidth, \
|
||||
reinterpret_cast<uint16_t*>(src_u + SOFF), kStrideUV, \
|
||||
reinterpret_cast<uint16_t*>(src_v + SOFF), kStrideUV, \
|
||||
dst_argb_opt + DOFF, kStrideB, kWidth, NEG kHeight); \
|
||||
} \
|
||||
int max_diff = 0; \
|
||||
@ -2115,9 +2115,9 @@ TEST_F(LibYUVConvertTest, TestH420ToARGB) {
|
||||
memset(histogram_r, 0, sizeof(histogram_r));
|
||||
align_buffer_page_end(orig_yuv, kSize + kSize / 2 * 2);
|
||||
align_buffer_page_end(argb_pixels, kSize * 4);
|
||||
uint8* orig_y = orig_yuv;
|
||||
uint8* orig_u = orig_y + kSize;
|
||||
uint8* orig_v = orig_u + kSize / 2;
|
||||
uint8_t* orig_y = orig_yuv;
|
||||
uint8_t* orig_u = orig_y + kSize;
|
||||
uint8_t* orig_v = orig_u + kSize / 2;
|
||||
|
||||
// Test grey scale
|
||||
for (int i = 0; i < kSize; ++i) {
|
||||
@ -2172,9 +2172,9 @@ TEST_F(LibYUVConvertTest, TestH010ToARGB) {
|
||||
memset(histogram_r, 0, sizeof(histogram_r));
|
||||
align_buffer_page_end(orig_yuv, kSize * 2 + kSize / 2 * 2 * 2);
|
||||
align_buffer_page_end(argb_pixels, kSize * 4);
|
||||
uint16* orig_y = reinterpret_cast<uint16*>(orig_yuv);
|
||||
uint16* orig_u = orig_y + kSize;
|
||||
uint16* orig_v = orig_u + kSize / 2;
|
||||
uint16_t* orig_y = reinterpret_cast<uint16_t*>(orig_yuv);
|
||||
uint16_t* orig_u = orig_y + kSize;
|
||||
uint16_t* orig_v = orig_u + kSize / 2;
|
||||
|
||||
// Test grey scale
|
||||
for (int i = 0; i < kSize; ++i) {
|
||||
@ -2231,9 +2231,9 @@ TEST_F(LibYUVConvertTest, TestH010ToAR30) {
|
||||
|
||||
align_buffer_page_end(orig_yuv, kSize * 2 + kSize / 2 * 2 * 2);
|
||||
align_buffer_page_end(ar30_pixels, kSize * 4);
|
||||
uint16* orig_y = reinterpret_cast<uint16*>(orig_yuv);
|
||||
uint16* orig_u = orig_y + kSize;
|
||||
uint16* orig_v = orig_u + kSize / 2;
|
||||
uint16_t* orig_y = reinterpret_cast<uint16_t*>(orig_yuv);
|
||||
uint16_t* orig_u = orig_y + kSize;
|
||||
uint16_t* orig_v = orig_u + kSize / 2;
|
||||
|
||||
// Test grey scale
|
||||
for (int i = 0; i < kSize; ++i) {
|
||||
@ -2247,10 +2247,10 @@ TEST_F(LibYUVConvertTest, TestH010ToAR30) {
|
||||
H010ToAR30(orig_y, 0, orig_u, 0, orig_v, 0, ar30_pixels, 0, kSize, 1);
|
||||
|
||||
for (int i = 0; i < kSize; ++i) {
|
||||
int b10 = reinterpret_cast<uint32*>(ar30_pixels)[i] & 1023;
|
||||
int g10 = (reinterpret_cast<uint32*>(ar30_pixels)[i] >> 10) & 1023;
|
||||
int r10 = (reinterpret_cast<uint32*>(ar30_pixels)[i] >> 20) & 1023;
|
||||
int a2 = (reinterpret_cast<uint32*>(ar30_pixels)[i] >> 30) & 3;
|
||||
int b10 = reinterpret_cast<uint32_t*>(ar30_pixels)[i] & 1023;
|
||||
int g10 = (reinterpret_cast<uint32_t*>(ar30_pixels)[i] >> 10) & 1023;
|
||||
int r10 = (reinterpret_cast<uint32_t*>(ar30_pixels)[i] >> 20) & 1023;
|
||||
int a2 = (reinterpret_cast<uint32_t*>(ar30_pixels)[i] >> 30) & 3;
|
||||
++histogram_b[b10];
|
||||
++histogram_g[g10];
|
||||
++histogram_r[r10];
|
||||
|
||||
@ -65,8 +65,8 @@ TEST_F(LibYUVBaseTest, TestFixedDiv) {
|
||||
}
|
||||
EXPECT_EQ(123 * 65536, libyuv::FixedDiv(123, 1));
|
||||
|
||||
MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&div[0]), sizeof(div));
|
||||
for (int j = 0; j < 1280; ++j) {
|
||||
if (div[j] == 0) {
|
||||
div[j] = 1280;
|
||||
@ -90,8 +90,8 @@ TEST_F(LibYUVBaseTest, TestFixedDiv_Opt) {
|
||||
int result_opt[1280];
|
||||
int result_c[1280];
|
||||
|
||||
MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&div[0]), sizeof(div));
|
||||
for (int j = 0; j < 1280; ++j) {
|
||||
num[j] &= 4095; // Make numerator smaller.
|
||||
div[j] &= 4095; // Make divisor smaller.
|
||||
@ -124,8 +124,8 @@ TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) {
|
||||
int result_opt[1280];
|
||||
int result_c[1280];
|
||||
|
||||
MemRandomize(reinterpret_cast<uint8*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8*>(&div[0]), sizeof(div));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&num[0]), sizeof(num));
|
||||
MemRandomize(reinterpret_cast<uint8_t*>(&div[0]), sizeof(div));
|
||||
for (int j = 0; j < 1280; ++j) {
|
||||
num[j] &= 4095; // Make numerator smaller.
|
||||
div[j] &= 4095; // Make divisor smaller.
|
||||
|
||||
@ -252,8 +252,8 @@ TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Opt) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBComputeCumulativeSum) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[16][16][4]);
|
||||
SIMD_ALIGNED(int32 added_pixels[16][16][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[16][16][4]);
|
||||
SIMD_ALIGNED(int32_t added_pixels[16][16][4]);
|
||||
|
||||
for (int y = 0; y < 16; ++y) {
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
@ -278,7 +278,7 @@ TEST_F(LibYUVPlanarTest, TestARGBComputeCumulativeSum) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBGray) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
// Test blue
|
||||
@ -349,8 +349,8 @@ TEST_F(LibYUVPlanarTest, TestARGBGray) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBGrayTo) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 gray_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t gray_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
// Test blue
|
||||
@ -421,7 +421,7 @@ TEST_F(LibYUVPlanarTest, TestARGBGrayTo) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBSepia) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
// Test blue
|
||||
@ -493,12 +493,12 @@ TEST_F(LibYUVPlanarTest, TestARGBSepia) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_c[1280][4]);
|
||||
|
||||
// Matrix for Sepia.
|
||||
SIMD_ALIGNED(static const int8 kRGBToSepia[]) = {
|
||||
SIMD_ALIGNED(static const int8_t kRGBToSepia[]) = {
|
||||
17 / 2, 68 / 2, 35 / 2, 0, 22 / 2, 88 / 2, 45 / 2, 0,
|
||||
24 / 2, 98 / 2, 50 / 2, 0, 0, 0, 0, 64, // Copy alpha.
|
||||
};
|
||||
@ -569,10 +569,10 @@ TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestRGBColorMatrix) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
|
||||
// Matrix for Sepia.
|
||||
SIMD_ALIGNED(static const int8 kRGBToSepia[]) = {
|
||||
SIMD_ALIGNED(static const int8_t kRGBToSepia[]) = {
|
||||
17, 68, 35, 0, 22, 88, 45, 0,
|
||||
24, 98, 50, 0, 0, 0, 0, 0, // Unused but makes matrix 16 bytes.
|
||||
};
|
||||
@ -629,11 +629,11 @@ TEST_F(LibYUVPlanarTest, TestRGBColorMatrix) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBColorTable) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
// Matrix for Sepia.
|
||||
static const uint8 kARGBTable[256 * 4] = {
|
||||
static const uint8_t kARGBTable[256 * 4] = {
|
||||
1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 13u, 14u, 15u, 16u,
|
||||
};
|
||||
|
||||
@ -685,11 +685,11 @@ TEST_F(LibYUVPlanarTest, TestARGBColorTable) {
|
||||
|
||||
// Same as TestARGBColorTable except alpha does not change.
|
||||
TEST_F(LibYUVPlanarTest, TestRGBColorTable) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
// Matrix for Sepia.
|
||||
static const uint8 kARGBTable[256 * 4] = {
|
||||
static const uint8_t kARGBTable[256 * 4] = {
|
||||
1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 13u, 14u, 15u, 16u,
|
||||
};
|
||||
|
||||
@ -740,7 +740,7 @@ TEST_F(LibYUVPlanarTest, TestRGBColorTable) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBQuantize) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
|
||||
for (int i = 0; i < 1280; ++i) {
|
||||
orig_pixels[i][0] = i;
|
||||
@ -764,8 +764,8 @@ TEST_F(LibYUVPlanarTest, TestARGBQuantize) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBMirror) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels[1280][4]);
|
||||
|
||||
for (int i = 0; i < 1280; ++i) {
|
||||
orig_pixels[i][0] = i;
|
||||
@ -787,8 +787,8 @@ TEST_F(LibYUVPlanarTest, TestARGBMirror) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestShade) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 shade_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t shade_pixels[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
orig_pixels[0][0] = 10u;
|
||||
@ -845,9 +845,9 @@ TEST_F(LibYUVPlanarTest, TestShade) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBInterpolate) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels_1[1280][4]);
|
||||
SIMD_ALIGNED(uint8 interpolate_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels_0[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels_1[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t interpolate_pixels[1280][4]);
|
||||
memset(orig_pixels_0, 0, sizeof(orig_pixels_0));
|
||||
memset(orig_pixels_1, 0, sizeof(orig_pixels_1));
|
||||
|
||||
@ -926,9 +926,9 @@ TEST_F(LibYUVPlanarTest, TestARGBInterpolate) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestInterpolatePlane) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels_0[1280]);
|
||||
SIMD_ALIGNED(uint8 orig_pixels_1[1280]);
|
||||
SIMD_ALIGNED(uint8 interpolate_pixels[1280]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels_0[1280]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels_1[1280]);
|
||||
SIMD_ALIGNED(uint8_t interpolate_pixels[1280]);
|
||||
memset(orig_pixels_0, 0, sizeof(orig_pixels_0));
|
||||
memset(orig_pixels_1, 0, sizeof(orig_pixels_1));
|
||||
|
||||
@ -1309,8 +1309,8 @@ TEST_F(LibYUVPlanarTest, I420Blend_Invert) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestAffine) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]);
|
||||
SIMD_ALIGNED(uint8 interpolate_pixels_C[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels_0[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t interpolate_pixels_C[1280][4]);
|
||||
|
||||
for (int i = 0; i < 1280; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
@ -1327,7 +1327,7 @@ TEST_F(LibYUVPlanarTest, TestAffine) {
|
||||
EXPECT_EQ(191u, interpolate_pixels_C[255][3]);
|
||||
|
||||
#if defined(HAS_ARGBAFFINEROW_SSE2)
|
||||
SIMD_ALIGNED(uint8 interpolate_pixels_Opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t interpolate_pixels_Opt[1280][4]);
|
||||
ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0],
|
||||
uv_step, 1280);
|
||||
EXPECT_EQ(0, memcmp(interpolate_pixels_Opt, interpolate_pixels_C, 1280 * 4));
|
||||
@ -1367,7 +1367,7 @@ TEST_F(LibYUVPlanarTest, TestCopyPlane) {
|
||||
|
||||
// Fill destination buffers with random data.
|
||||
for (i = 0; i < y_plane_size; ++i) {
|
||||
uint8 random_number = fastrand() & 0x7f;
|
||||
uint8_t random_number = fastrand() & 0x7f;
|
||||
dst_c[i] = random_number;
|
||||
dst_opt[i] = dst_c[i];
|
||||
}
|
||||
@ -1867,12 +1867,12 @@ static int TestBlur(int width,
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
ARGBBlur(src_argb_a + off, kStride, dst_argb_c, kStride,
|
||||
reinterpret_cast<int32*>(dst_cumsum), width * 4, width,
|
||||
reinterpret_cast<int32_t*>(dst_cumsum), width * 4, width,
|
||||
invert * height, radius);
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBBlur(src_argb_a + off, kStride, dst_argb_opt, kStride,
|
||||
reinterpret_cast<int32*>(dst_cumsum), width * 4, width,
|
||||
reinterpret_cast<int32_t*>(dst_cumsum), width * 4, width,
|
||||
invert * height, radius);
|
||||
}
|
||||
int max_diff = 0;
|
||||
@ -1949,9 +1949,9 @@ TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Opt) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBPolynomial) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_c[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
SIMD_ALIGNED(static const float kWarmifyPolynomial[16]) = {
|
||||
@ -2046,37 +2046,37 @@ int TestHalfFloatPlane(int benchmark_width,
|
||||
const int y_plane_size = benchmark_width * benchmark_height * 2;
|
||||
|
||||
align_buffer_page_end(orig_y, y_plane_size * 3);
|
||||
uint8* dst_opt = orig_y + y_plane_size;
|
||||
uint8* dst_c = orig_y + y_plane_size * 2;
|
||||
uint8_t* dst_opt = orig_y + y_plane_size;
|
||||
uint8_t* dst_c = orig_y + y_plane_size * 2;
|
||||
|
||||
MemRandomize(orig_y, y_plane_size);
|
||||
memset(dst_c, 0, y_plane_size);
|
||||
memset(dst_opt, 1, y_plane_size);
|
||||
|
||||
for (i = 0; i < y_plane_size / 2; ++i) {
|
||||
reinterpret_cast<uint16*>(orig_y)[i] &= mask;
|
||||
reinterpret_cast<uint16_t*>(orig_y)[i] &= mask;
|
||||
}
|
||||
|
||||
// Disable all optimizations.
|
||||
MaskCpuFlags(disable_cpu_flags);
|
||||
for (j = 0; j < benchmark_iterations; j++) {
|
||||
HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2,
|
||||
reinterpret_cast<uint16*>(dst_c), benchmark_width * 2, scale,
|
||||
HalfFloatPlane(reinterpret_cast<uint16_t*>(orig_y), benchmark_width * 2,
|
||||
reinterpret_cast<uint16_t*>(dst_c), benchmark_width * 2, scale,
|
||||
benchmark_width, benchmark_height);
|
||||
}
|
||||
|
||||
// Enable optimizations.
|
||||
MaskCpuFlags(benchmark_cpu_info);
|
||||
for (j = 0; j < benchmark_iterations; j++) {
|
||||
HalfFloatPlane(reinterpret_cast<uint16*>(orig_y), benchmark_width * 2,
|
||||
reinterpret_cast<uint16*>(dst_opt), benchmark_width * 2,
|
||||
HalfFloatPlane(reinterpret_cast<uint16_t*>(orig_y), benchmark_width * 2,
|
||||
reinterpret_cast<uint16_t*>(dst_opt), benchmark_width * 2,
|
||||
scale, benchmark_width, benchmark_height);
|
||||
}
|
||||
|
||||
int max_diff = 0;
|
||||
for (i = 0; i < y_plane_size / 2; ++i) {
|
||||
int abs_diff = abs(static_cast<int>(reinterpret_cast<uint16*>(dst_c)[i]) -
|
||||
static_cast<int>(reinterpret_cast<uint16*>(dst_opt)[i]));
|
||||
int abs_diff = abs(static_cast<int>(reinterpret_cast<uint16_t*>(dst_c)[i]) -
|
||||
static_cast<int>(reinterpret_cast<uint16_t*>(dst_opt)[i]));
|
||||
if (abs_diff > max_diff) {
|
||||
max_diff = abs_diff;
|
||||
}
|
||||
@ -2169,9 +2169,9 @@ TEST_F(LibYUVPlanarTest, TestHalfFloatPlane_12bit_One) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_opt[1280][4]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_c[1280][4]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
|
||||
align_buffer_page_end(lumacolortable, 32768);
|
||||
@ -2343,7 +2343,7 @@ static int TestARGBRect(int width,
|
||||
}
|
||||
const int kStride = width * bpp;
|
||||
const int kSize = kStride * height;
|
||||
const uint32 v32 = fastrand() & (bpp == 4 ? 0xffffffff : 0xff);
|
||||
const uint32_t v32 = fastrand() & (bpp == 4 ? 0xffffffff : 0xff);
|
||||
|
||||
align_buffer_page_end(dst_argb_c, kSize + off);
|
||||
align_buffer_page_end(dst_argb_opt, kSize + off);
|
||||
@ -2631,21 +2631,21 @@ TEST_F(LibYUVPlanarTest, MergeUVRow_16_Opt) {
|
||||
memset(dst_pixels_uv_opt, 0, kPixels * 2 * 2);
|
||||
memset(dst_pixels_uv_c, 1, kPixels * 2 * 2);
|
||||
|
||||
MergeUVRow_16_C(reinterpret_cast<const uint16*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16*>(src_pixels_v),
|
||||
reinterpret_cast<uint16*>(dst_pixels_uv_c), 64, kPixels);
|
||||
MergeUVRow_16_C(reinterpret_cast<const uint16_t*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16_t*>(src_pixels_v),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_uv_c), 64, kPixels);
|
||||
|
||||
int has_avx2 = TestCpuFlag(kCpuHasAVX2);
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
if (has_avx2) {
|
||||
MergeUVRow_16_AVX2(reinterpret_cast<const uint16*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16*>(src_pixels_v),
|
||||
reinterpret_cast<uint16*>(dst_pixels_uv_opt), 64,
|
||||
MergeUVRow_16_AVX2(reinterpret_cast<const uint16_t*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16_t*>(src_pixels_v),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_uv_opt), 64,
|
||||
kPixels);
|
||||
} else {
|
||||
MergeUVRow_16_C(reinterpret_cast<const uint16*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16*>(src_pixels_v),
|
||||
reinterpret_cast<uint16*>(dst_pixels_uv_opt), 64,
|
||||
MergeUVRow_16_C(reinterpret_cast<const uint16_t*>(src_pixels_u),
|
||||
reinterpret_cast<const uint16_t*>(src_pixels_v),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_uv_opt), 64,
|
||||
kPixels);
|
||||
}
|
||||
}
|
||||
@ -2673,18 +2673,18 @@ TEST_F(LibYUVPlanarTest, MultiplyRow_16_Opt) {
|
||||
memset(dst_pixels_y_opt, 0, kPixels * 2);
|
||||
memset(dst_pixels_y_c, 1, kPixels * 2);
|
||||
|
||||
MultiplyRow_16_C(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_c), 64, kPixels);
|
||||
MultiplyRow_16_C(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_c), 64, kPixels);
|
||||
|
||||
int has_avx2 = TestCpuFlag(kCpuHasAVX2);
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
if (has_avx2) {
|
||||
MultiplyRow_16_AVX2(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt), 64,
|
||||
MultiplyRow_16_AVX2(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64,
|
||||
kPixels);
|
||||
} else {
|
||||
MultiplyRow_16_C(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt), 64,
|
||||
MultiplyRow_16_C(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 64,
|
||||
kPixels);
|
||||
}
|
||||
}
|
||||
@ -2710,13 +2710,13 @@ TEST_F(LibYUVPlanarTest, Convert16To8Plane) {
|
||||
memset(dst_pixels_y_c, 1, kPixels);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
Convert16To8Plane(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Plane(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
benchmark_width_, dst_pixels_y_c, benchmark_width_, 16384,
|
||||
benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
Convert16To8Plane(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Plane(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
benchmark_width_, dst_pixels_y_opt, benchmark_width_,
|
||||
16384, benchmark_width_, benchmark_height_);
|
||||
}
|
||||
@ -2742,26 +2742,26 @@ TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) {
|
||||
MemRandomize(src_pixels_y, kPixels * 2);
|
||||
// clamp source range to 10 bits.
|
||||
for (int i = 0; i < kPixels; ++i) {
|
||||
reinterpret_cast<uint16*>(src_pixels_y)[i] &= 1023;
|
||||
reinterpret_cast<uint16_t*>(src_pixels_y)[i] &= 1023;
|
||||
}
|
||||
|
||||
memset(dst_pixels_y_opt, 0, kPixels);
|
||||
memset(dst_pixels_y_c, 1, kPixels);
|
||||
|
||||
Convert16To8Row_C(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Row_C(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
dst_pixels_y_c, 16384, kPixels);
|
||||
|
||||
int has_avx2 = TestCpuFlag(kCpuHasAVX2);
|
||||
int has_ssse3 = TestCpuFlag(kCpuHasSSSE3);
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
if (has_avx2) {
|
||||
Convert16To8Row_AVX2(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Row_AVX2(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
dst_pixels_y_opt, 16384, kPixels);
|
||||
} else if (has_ssse3) {
|
||||
Convert16To8Row_SSSE3(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Row_SSSE3(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
dst_pixels_y_opt, 16384, kPixels);
|
||||
} else {
|
||||
Convert16To8Row_C(reinterpret_cast<const uint16*>(src_pixels_y),
|
||||
Convert16To8Row_C(reinterpret_cast<const uint16_t*>(src_pixels_y),
|
||||
dst_pixels_y_opt, 16384, kPixels);
|
||||
}
|
||||
}
|
||||
@ -2788,13 +2788,13 @@ TEST_F(LibYUVPlanarTest, Convert8To16Plane) {
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags_);
|
||||
Convert8To16Plane(src_pixels_y, benchmark_width_,
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_c), benchmark_width_,
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_c), benchmark_width_,
|
||||
1024, benchmark_width_, benchmark_height_);
|
||||
MaskCpuFlags(benchmark_cpu_info_);
|
||||
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
Convert8To16Plane(src_pixels_y, benchmark_width_,
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt),
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt),
|
||||
benchmark_width_, 1024, benchmark_width_,
|
||||
benchmark_height_);
|
||||
}
|
||||
@ -2820,7 +2820,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Row_Opt) {
|
||||
memset(dst_pixels_y_opt, 0, kPixels * 2);
|
||||
memset(dst_pixels_y_c, 1, kPixels * 2);
|
||||
|
||||
Convert8To16Row_C(src_pixels_y, reinterpret_cast<uint16*>(dst_pixels_y_c),
|
||||
Convert8To16Row_C(src_pixels_y, reinterpret_cast<uint16_t*>(dst_pixels_y_c),
|
||||
1024, kPixels);
|
||||
|
||||
int has_avx2 = TestCpuFlag(kCpuHasAVX2);
|
||||
@ -2828,15 +2828,15 @@ TEST_F(LibYUVPlanarTest, Convert8To16Row_Opt) {
|
||||
for (int i = 0; i < benchmark_iterations_; ++i) {
|
||||
if (has_avx2) {
|
||||
Convert8To16Row_AVX2(src_pixels_y,
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt), 1024,
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 1024,
|
||||
kPixels);
|
||||
} else if (has_sse2) {
|
||||
Convert8To16Row_SSE2(src_pixels_y,
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt), 1024,
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 1024,
|
||||
kPixels);
|
||||
} else {
|
||||
Convert8To16Row_C(src_pixels_y,
|
||||
reinterpret_cast<uint16*>(dst_pixels_y_opt), 1024,
|
||||
reinterpret_cast<uint16_t*>(dst_pixels_y_opt), 1024,
|
||||
kPixels);
|
||||
}
|
||||
}
|
||||
@ -2861,8 +2861,8 @@ float TestScaleMaxSamples(int benchmark_width,
|
||||
// NEON does multiple of 8, so round count up
|
||||
const int kPixels = (benchmark_width * benchmark_height + 7) & ~7;
|
||||
align_buffer_page_end(orig_y, kPixels * 4 * 3 + 48);
|
||||
uint8* dst_c = orig_y + kPixels * 4 + 16;
|
||||
uint8* dst_opt = orig_y + kPixels * 4 * 2 + 32;
|
||||
uint8_t* dst_c = orig_y + kPixels * 4 + 16;
|
||||
uint8_t* dst_opt = orig_y + kPixels * 4 * 2 + 32;
|
||||
|
||||
// Randomize works but may contain some denormals affecting performance.
|
||||
// MemRandomize(orig_y, kPixels * 4);
|
||||
@ -2929,8 +2929,8 @@ float TestScaleSumSamples(int benchmark_width,
|
||||
// NEON does multiple of 8, so round count up
|
||||
const int kPixels = (benchmark_width * benchmark_height + 7) & ~7;
|
||||
align_buffer_page_end(orig_y, kPixels * 4 * 3);
|
||||
uint8* dst_c = orig_y + kPixels * 4;
|
||||
uint8* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
uint8_t* dst_c = orig_y + kPixels * 4;
|
||||
uint8_t* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
|
||||
// Randomize works but may contain some denormals affecting performance.
|
||||
// MemRandomize(orig_y, kPixels * 4);
|
||||
@ -3007,8 +3007,8 @@ float TestScaleSamples(int benchmark_width,
|
||||
// NEON does multiple of 8, so round count up
|
||||
const int kPixels = (benchmark_width * benchmark_height + 7) & ~7;
|
||||
align_buffer_page_end(orig_y, kPixels * 4 * 3);
|
||||
uint8* dst_c = orig_y + kPixels * 4;
|
||||
uint8* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
uint8_t* dst_c = orig_y + kPixels * 4;
|
||||
uint8_t* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
|
||||
// Randomize works but may contain some denormals affecting performance.
|
||||
// MemRandomize(orig_y, kPixels * 4);
|
||||
@ -3070,8 +3070,8 @@ float TestCopySamples(int benchmark_width,
|
||||
// NEON does multiple of 16 floats, so round count up
|
||||
const int kPixels = (benchmark_width * benchmark_height + 15) & ~15;
|
||||
align_buffer_page_end(orig_y, kPixels * 4 * 3);
|
||||
uint8* dst_c = orig_y + kPixels * 4;
|
||||
uint8* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
uint8_t* dst_c = orig_y + kPixels * 4;
|
||||
uint8_t* dst_opt = orig_y + kPixels * 4 * 2;
|
||||
|
||||
// Randomize works but may contain some denormals affecting performance.
|
||||
// MemRandomize(orig_y, kPixels * 4);
|
||||
@ -3122,13 +3122,13 @@ TEST_F(LibYUVPlanarTest, TestCopySamples_Opt) {
|
||||
EXPECT_EQ(0, diff);
|
||||
}
|
||||
|
||||
extern "C" void GaussRow_NEON(const uint32* src, uint16* dst, int width);
|
||||
extern "C" void GaussRow_C(const uint32* src, uint16* dst, int width);
|
||||
extern "C" void GaussRow_NEON(const uint32_t* src, uint16_t* dst, int width);
|
||||
extern "C" void GaussRow_C(const uint32_t* src, uint16_t* dst, int width);
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) {
|
||||
SIMD_ALIGNED(uint32 orig_pixels[640 + 4]);
|
||||
SIMD_ALIGNED(uint16 dst_pixels_c[640]);
|
||||
SIMD_ALIGNED(uint16 dst_pixels_opt[640]);
|
||||
SIMD_ALIGNED(uint32_t orig_pixels[640 + 4]);
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_c[640]);
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_opt[640]);
|
||||
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
||||
@ -3156,30 +3156,30 @@ TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) {
|
||||
}
|
||||
|
||||
EXPECT_EQ(dst_pixels_c[0],
|
||||
static_cast<uint16>(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1));
|
||||
EXPECT_EQ(dst_pixels_c[639], static_cast<uint16>(10256));
|
||||
static_cast<uint16_t>(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1));
|
||||
EXPECT_EQ(dst_pixels_c[639], static_cast<uint16_t>(10256));
|
||||
}
|
||||
|
||||
extern "C" void GaussCol_NEON(const uint16* src0,
|
||||
const uint16* src1,
|
||||
const uint16* src2,
|
||||
const uint16* src3,
|
||||
const uint16* src4,
|
||||
uint32* dst,
|
||||
extern "C" void GaussCol_NEON(const uint16_t* src0,
|
||||
const uint16_t* src1,
|
||||
const uint16_t* src2,
|
||||
const uint16_t* src3,
|
||||
const uint16_t* src4,
|
||||
uint32_t* dst,
|
||||
int width);
|
||||
|
||||
extern "C" void GaussCol_C(const uint16* src0,
|
||||
const uint16* src1,
|
||||
const uint16* src2,
|
||||
const uint16* src3,
|
||||
const uint16* src4,
|
||||
uint32* dst,
|
||||
extern "C" void GaussCol_C(const uint16_t* src0,
|
||||
const uint16_t* src1,
|
||||
const uint16_t* src2,
|
||||
const uint16_t* src3,
|
||||
const uint16_t* src4,
|
||||
uint32_t* dst,
|
||||
int width);
|
||||
|
||||
TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) {
|
||||
SIMD_ALIGNED(uint16 orig_pixels[640 * 5]);
|
||||
SIMD_ALIGNED(uint32 dst_pixels_c[640]);
|
||||
SIMD_ALIGNED(uint32 dst_pixels_opt[640]);
|
||||
SIMD_ALIGNED(uint16_t orig_pixels[640 * 5]);
|
||||
SIMD_ALIGNED(uint32_t dst_pixels_c[640]);
|
||||
SIMD_ALIGNED(uint32_t dst_pixels_opt[640]);
|
||||
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
||||
@ -3214,9 +3214,9 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) {
|
||||
EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
|
||||
}
|
||||
|
||||
EXPECT_EQ(dst_pixels_c[0], static_cast<uint32>(0 * 1 + 640 * 4 + 640 * 2 * 6 +
|
||||
EXPECT_EQ(dst_pixels_c[0], static_cast<uint32_t>(0 * 1 + 640 * 4 + 640 * 2 * 6 +
|
||||
640 * 3 * 4 + 640 * 4 * 1));
|
||||
EXPECT_EQ(dst_pixels_c[639], static_cast<uint32>(30704));
|
||||
EXPECT_EQ(dst_pixels_c[639], static_cast<uint32_t>(30704));
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
@ -37,7 +37,7 @@ static int ARGBTestFilter(int src_width,
|
||||
|
||||
int i, j;
|
||||
const int b = 0; // 128 to test for padding/stride.
|
||||
int64 src_argb_plane_size =
|
||||
int64_t src_argb_plane_size =
|
||||
(Abs(src_width) + b * 2) * (Abs(src_height) + b * 2) * 4LL;
|
||||
int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
|
||||
|
||||
@ -48,7 +48,7 @@ static int ARGBTestFilter(int src_width,
|
||||
}
|
||||
MemRandomize(src_argb, src_argb_plane_size);
|
||||
|
||||
int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4LL;
|
||||
int64_t dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4LL;
|
||||
int dst_stride_argb = (b * 2 + dst_width) * 4;
|
||||
|
||||
align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
|
||||
@ -116,11 +116,11 @@ static int ARGBTestFilter(int src_width,
|
||||
static const int kTileX = 8;
|
||||
static const int kTileY = 8;
|
||||
|
||||
static int TileARGBScale(const uint8* src_argb,
|
||||
static int TileARGBScale(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -157,7 +157,7 @@ static int ARGBClipTestFilter(int src_width,
|
||||
}
|
||||
|
||||
const int b = 128;
|
||||
int64 src_argb_plane_size =
|
||||
int64_t src_argb_plane_size =
|
||||
(Abs(src_width) + b * 2) * (Abs(src_height) + b * 2) * 4;
|
||||
int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
|
||||
|
||||
@ -168,7 +168,7 @@ static int ARGBClipTestFilter(int src_width,
|
||||
}
|
||||
memset(src_argb, 1, src_argb_plane_size);
|
||||
|
||||
int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
|
||||
int64_t dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
|
||||
int dst_stride_argb = (b * 2 + dst_width) * 4;
|
||||
|
||||
int i, j;
|
||||
@ -311,18 +311,18 @@ TEST_SCALETO(ARGBScale, 1280, 720)
|
||||
|
||||
// Scale with YUV conversion to ARGB and clipping.
|
||||
LIBYUV_API
|
||||
int YUVToARGBScaleReference2(const uint8* src_y,
|
||||
int YUVToARGBScaleReference2(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8* src_u,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8* src_v,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint32 /* src_fourcc */, // TODO: Add support.
|
||||
uint32_t /* src_fourcc */, // TODO: Add support.
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
uint32 /* dst_fourcc */, // TODO: Add support.
|
||||
uint32_t /* dst_fourcc */, // TODO: Add support.
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int clip_x,
|
||||
@ -330,7 +330,7 @@ int YUVToARGBScaleReference2(const uint8* src_y,
|
||||
int clip_width,
|
||||
int clip_height,
|
||||
enum FilterMode filtering) {
|
||||
uint8* argb_buffer = static_cast<uint8*>(malloc(src_width * src_height * 4));
|
||||
uint8_t* argb_buffer = static_cast<uint8_t*>(malloc(src_width * src_height * 4));
|
||||
int r;
|
||||
I420ToARGB(src_y, src_stride_y, src_u, src_stride_u, src_v, src_stride_v,
|
||||
argb_buffer, src_width * 4, src_width, src_height);
|
||||
@ -342,7 +342,7 @@ int YUVToARGBScaleReference2(const uint8* src_y,
|
||||
return r;
|
||||
}
|
||||
|
||||
static void FillRamp(uint8* buf, int width, int height, int v, int dx, int dy) {
|
||||
static void FillRamp(uint8_t* buf, int width, int height, int v, int dx, int dy) {
|
||||
int rv = v;
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
@ -369,8 +369,8 @@ static int YUVToARGBTestFilter(int src_width,
|
||||
int dst_height,
|
||||
FilterMode f,
|
||||
int benchmark_iterations) {
|
||||
int64 src_y_plane_size = Abs(src_width) * Abs(src_height);
|
||||
int64 src_uv_plane_size =
|
||||
int64_t src_y_plane_size = Abs(src_width) * Abs(src_height);
|
||||
int64_t src_uv_plane_size =
|
||||
((Abs(src_width) + 1) / 2) * ((Abs(src_height) + 1) / 2);
|
||||
int src_stride_y = Abs(src_width);
|
||||
int src_stride_uv = (Abs(src_width) + 1) / 2;
|
||||
@ -379,7 +379,7 @@ static int YUVToARGBTestFilter(int src_width,
|
||||
align_buffer_page_end(src_u, src_uv_plane_size);
|
||||
align_buffer_page_end(src_v, src_uv_plane_size);
|
||||
|
||||
int64 dst_argb_plane_size = (dst_width) * (dst_height)*4LL;
|
||||
int64_t dst_argb_plane_size = (dst_width) * (dst_height)*4LL;
|
||||
int dst_stride_argb = (dst_width)*4;
|
||||
align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
|
||||
align_buffer_page_end(dst_argb_opt, dst_argb_plane_size);
|
||||
|
||||
@ -38,8 +38,8 @@ static int TestFilter(int src_width,
|
||||
int src_width_uv = (Abs(src_width) + 1) >> 1;
|
||||
int src_height_uv = (Abs(src_height) + 1) >> 1;
|
||||
|
||||
int64 src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int64 src_uv_plane_size = (src_width_uv) * (src_height_uv);
|
||||
int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
|
||||
|
||||
int src_stride_y = Abs(src_width);
|
||||
int src_stride_uv = src_width_uv;
|
||||
@ -58,8 +58,8 @@ static int TestFilter(int src_width,
|
||||
int dst_width_uv = (dst_width + 1) >> 1;
|
||||
int dst_height_uv = (dst_height + 1) >> 1;
|
||||
|
||||
int64 dst_y_plane_size = (dst_width) * (dst_height);
|
||||
int64 dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
|
||||
int64_t dst_y_plane_size = (dst_width) * (dst_height);
|
||||
int64_t dst_uv_plane_size = (dst_width_uv) * (dst_height_uv);
|
||||
|
||||
int dst_stride_y = dst_width;
|
||||
int dst_stride_uv = dst_width_uv;
|
||||
@ -157,8 +157,8 @@ static int TestFilter_16(int src_width,
|
||||
int src_width_uv = (Abs(src_width) + 1) >> 1;
|
||||
int src_height_uv = (Abs(src_height) + 1) >> 1;
|
||||
|
||||
int64 src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int64 src_uv_plane_size = (src_width_uv) * (src_height_uv);
|
||||
int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int64_t src_uv_plane_size = (src_width_uv) * (src_height_uv);
|
||||
|
||||
int src_stride_y = Abs(src_width);
|
||||
int src_stride_uv = src_width_uv;
|
||||
@ -173,9 +173,9 @@ static int TestFilter_16(int src_width,
|
||||
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
|
||||
return 0;
|
||||
}
|
||||
uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16);
|
||||
uint16* p_src_u_16 = reinterpret_cast<uint16*>(src_u_16);
|
||||
uint16* p_src_v_16 = reinterpret_cast<uint16*>(src_v_16);
|
||||
uint16_t* p_src_y_16 = reinterpret_cast<uint16_t*>(src_y_16);
|
||||
uint16_t* p_src_u_16 = reinterpret_cast<uint16_t*>(src_u_16);
|
||||
uint16_t* p_src_v_16 = reinterpret_cast<uint16_t*>(src_v_16);
|
||||
|
||||
MemRandomize(src_y, src_y_plane_size);
|
||||
MemRandomize(src_u, src_uv_plane_size);
|
||||
@ -205,9 +205,9 @@ static int TestFilter_16(int src_width,
|
||||
align_buffer_page_end(dst_u_16, dst_uv_plane_size * 2);
|
||||
align_buffer_page_end(dst_v_16, dst_uv_plane_size * 2);
|
||||
|
||||
uint16* p_dst_y_16 = reinterpret_cast<uint16*>(dst_y_16);
|
||||
uint16* p_dst_u_16 = reinterpret_cast<uint16*>(dst_u_16);
|
||||
uint16* p_dst_v_16 = reinterpret_cast<uint16*>(dst_v_16);
|
||||
uint16_t* p_dst_y_16 = reinterpret_cast<uint16_t*>(dst_y_16);
|
||||
uint16_t* p_dst_u_16 = reinterpret_cast<uint16_t*>(dst_u_16);
|
||||
uint16_t* p_dst_v_16 = reinterpret_cast<uint16_t*>(dst_v_16);
|
||||
|
||||
MaskCpuFlags(disable_cpu_flags); // Disable all CPU optimization.
|
||||
I420Scale(src_y, src_stride_y, src_u, src_stride_uv, src_v, src_stride_uv,
|
||||
@ -345,9 +345,9 @@ TEST_SCALETO(Scale, 1280, 720)
|
||||
|
||||
#ifdef HAS_SCALEROWDOWN2_SSSE3
|
||||
TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) {
|
||||
SIMD_ALIGNED(uint8 orig_pixels[128 * 2]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_opt[64]);
|
||||
SIMD_ALIGNED(uint8 dst_pixels_c[64]);
|
||||
SIMD_ALIGNED(uint8_t orig_pixels[128 * 2]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_opt[64]);
|
||||
SIMD_ALIGNED(uint8_t dst_pixels_c[64]);
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
memset(dst_pixels_opt, 0, sizeof(dst_pixels_opt));
|
||||
memset(dst_pixels_c, 0, sizeof(dst_pixels_c));
|
||||
@ -433,19 +433,19 @@ TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) {
|
||||
}
|
||||
#endif // HAS_SCALEROWDOWN2_SSSE3
|
||||
|
||||
extern "C" void ScaleRowUp2_16_NEON(const uint16* src_ptr,
|
||||
extern "C" void ScaleRowUp2_16_NEON(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width);
|
||||
extern "C" void ScaleRowUp2_16_C(const uint16* src_ptr,
|
||||
extern "C" void ScaleRowUp2_16_C(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width);
|
||||
|
||||
TEST_F(LibYUVScaleTest, TestScaleRowUp2_16) {
|
||||
SIMD_ALIGNED(uint16 orig_pixels[640 * 2 + 1]); // 2 rows + 1 pixel overrun.
|
||||
SIMD_ALIGNED(uint16 dst_pixels_opt[1280]);
|
||||
SIMD_ALIGNED(uint16 dst_pixels_c[1280]);
|
||||
SIMD_ALIGNED(uint16_t orig_pixels[640 * 2 + 1]); // 2 rows + 1 pixel overrun.
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_opt[1280]);
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_c[1280]);
|
||||
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
memset(dst_pixels_opt, 1, sizeof(dst_pixels_opt));
|
||||
@ -475,15 +475,15 @@ TEST_F(LibYUVScaleTest, TestScaleRowUp2_16) {
|
||||
EXPECT_EQ(dst_pixels_c[1279], 800);
|
||||
}
|
||||
|
||||
extern "C" void ScaleRowDown2Box_16_NEON(const uint16* src_ptr,
|
||||
extern "C" void ScaleRowDown2Box_16_NEON(const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint16* dst,
|
||||
uint16_t* dst,
|
||||
int dst_width);
|
||||
|
||||
TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_16) {
|
||||
SIMD_ALIGNED(uint16 orig_pixels[2560 * 2]);
|
||||
SIMD_ALIGNED(uint16 dst_pixels_c[1280]);
|
||||
SIMD_ALIGNED(uint16 dst_pixels_opt[1280]);
|
||||
SIMD_ALIGNED(uint16_t orig_pixels[2560 * 2]);
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_c[1280]);
|
||||
SIMD_ALIGNED(uint16_t dst_pixels_opt[1280]);
|
||||
|
||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
||||
@ -530,7 +530,7 @@ static int TestPlaneFilter_16(int src_width,
|
||||
}
|
||||
|
||||
int i;
|
||||
int64 src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int64_t src_y_plane_size = (Abs(src_width)) * (Abs(src_height));
|
||||
int src_stride_y = Abs(src_width);
|
||||
int dst_y_plane_size = dst_width * dst_height;
|
||||
int dst_stride_y = dst_width;
|
||||
@ -539,8 +539,8 @@ static int TestPlaneFilter_16(int src_width,
|
||||
align_buffer_page_end(src_y_16, src_y_plane_size * 2);
|
||||
align_buffer_page_end(dst_y_8, dst_y_plane_size);
|
||||
align_buffer_page_end(dst_y_16, dst_y_plane_size * 2);
|
||||
uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16);
|
||||
uint16* p_dst_y_16 = reinterpret_cast<uint16*>(dst_y_16);
|
||||
uint16_t* p_src_y_16 = reinterpret_cast<uint16_t*>(src_y_16);
|
||||
uint16_t* p_dst_y_16 = reinterpret_cast<uint16_t*>(dst_y_16);
|
||||
|
||||
MemRandomize(src_y, src_y_plane_size);
|
||||
memset(dst_y_8, 0, dst_y_plane_size);
|
||||
|
||||
@ -31,11 +31,11 @@ DEFINE_int32(libyuv_cpu_info,
|
||||
"cpu flags for benchmark code. 1 = C, -1 = SIMD");
|
||||
#else
|
||||
// Disable command line parameters if gflags disabled.
|
||||
static const int32 FLAGS_libyuv_width = 0;
|
||||
static const int32 FLAGS_libyuv_height = 0;
|
||||
static const int32 FLAGS_libyuv_repeat = 0;
|
||||
static const int32 FLAGS_libyuv_flags = 0;
|
||||
static const int32 FLAGS_libyuv_cpu_info = 0;
|
||||
static const int32_t FLAGS_libyuv_width = 0;
|
||||
static const int32_t FLAGS_libyuv_height = 0;
|
||||
static const int32_t FLAGS_libyuv_repeat = 0;
|
||||
static const int32_t FLAGS_libyuv_flags = 0;
|
||||
static const int32_t FLAGS_libyuv_cpu_info = 0;
|
||||
#endif
|
||||
|
||||
// For quicker unittests, default is 128 x 72. But when benchmarking,
|
||||
|
||||
@ -70,9 +70,9 @@ static inline bool SizeValid(int src_width,
|
||||
}
|
||||
|
||||
#define align_buffer_page_end(var, size) \
|
||||
uint8* var##_mem = \
|
||||
reinterpret_cast<uint8*>(malloc(((size) + 4095 + 63) & ~4095)); \
|
||||
uint8* var = reinterpret_cast<uint8*>( \
|
||||
uint8_t* var##_mem = \
|
||||
reinterpret_cast<uint8_t*>(malloc(((size) + 4095 + 63) & ~4095)); \
|
||||
uint8_t* var = reinterpret_cast<uint8_t*>( \
|
||||
(intptr_t)(var##_mem + (((size) + 4095 + 63) & ~4095) - (size)) & ~63)
|
||||
|
||||
#define free_aligned_buffer_page_end(var) \
|
||||
@ -111,10 +111,10 @@ inline int fastrand() {
|
||||
return static_cast<int>((fastrand_seed >> 16) & 0xffff);
|
||||
}
|
||||
|
||||
static inline void MemRandomize(uint8* dst, int64 len) {
|
||||
int64 i;
|
||||
static inline void MemRandomize(uint8_t* dst, int64_t len) {
|
||||
int64_t i;
|
||||
for (i = 0; i < len - 1; i += 2) {
|
||||
*reinterpret_cast<uint16*>(dst) = fastrand();
|
||||
*reinterpret_cast<uint16_t*>(dst) = fastrand();
|
||||
dst += 2;
|
||||
}
|
||||
for (; i < len; ++i) {
|
||||
|
||||
@ -18,7 +18,7 @@ namespace libyuv {
|
||||
|
||||
// Tests FourCC codes in video common, which are used for ConvertToI420().
|
||||
|
||||
static bool TestValidChar(uint32 onecc) {
|
||||
static bool TestValidChar(uint32_t onecc) {
|
||||
if ((onecc >= '0' && onecc <= '9') || (onecc >= 'A' && onecc <= 'Z') ||
|
||||
(onecc >= 'a' && onecc <= 'z') || (onecc == ' ') || (onecc == 0xff)) {
|
||||
return true;
|
||||
@ -26,7 +26,7 @@ static bool TestValidChar(uint32 onecc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool TestValidFourCC(uint32 fourcc, int bpp) {
|
||||
static bool TestValidFourCC(uint32_t fourcc, int bpp) {
|
||||
if (!TestValidChar(fourcc & 0xff) || !TestValidChar((fourcc >> 8) & 0xff) ||
|
||||
!TestValidChar((fourcc >> 16) & 0xff) ||
|
||||
!TestValidChar((fourcc >> 24) & 0xff)) {
|
||||
@ -39,23 +39,23 @@ static bool TestValidFourCC(uint32 fourcc, int bpp) {
|
||||
}
|
||||
|
||||
TEST_F(LibYUVBaseTest, TestCanonicalFourCC) {
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_I420), CanonicalFourCC(FOURCC_IYUV));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_I420), CanonicalFourCC(FOURCC_YU12));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_I422), CanonicalFourCC(FOURCC_YU16));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_I444), CanonicalFourCC(FOURCC_YU24));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUYV));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUVS));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_UYVY), CanonicalFourCC(FOURCC_HDYC));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_UYVY), CanonicalFourCC(FOURCC_2VUY));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_MJPG), CanonicalFourCC(FOURCC_JPEG));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_MJPG), CanonicalFourCC(FOURCC_DMB1));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_RAW), CanonicalFourCC(FOURCC_RGB3));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_24BG), CanonicalFourCC(FOURCC_BGR3));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_BGRA), CanonicalFourCC(FOURCC_CM32));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_RAW), CanonicalFourCC(FOURCC_CM24));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_RGBO), CanonicalFourCC(FOURCC_L555));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_RGBP), CanonicalFourCC(FOURCC_L565));
|
||||
EXPECT_EQ(static_cast<uint32>(FOURCC_RGBO), CanonicalFourCC(FOURCC_5551));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_I420), CanonicalFourCC(FOURCC_IYUV));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_I420), CanonicalFourCC(FOURCC_YU12));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_I422), CanonicalFourCC(FOURCC_YU16));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_I444), CanonicalFourCC(FOURCC_YU24));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUYV));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_YUY2), CanonicalFourCC(FOURCC_YUVS));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_UYVY), CanonicalFourCC(FOURCC_HDYC));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_UYVY), CanonicalFourCC(FOURCC_2VUY));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_MJPG), CanonicalFourCC(FOURCC_JPEG));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_MJPG), CanonicalFourCC(FOURCC_DMB1));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_RAW), CanonicalFourCC(FOURCC_RGB3));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_24BG), CanonicalFourCC(FOURCC_BGR3));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_BGRA), CanonicalFourCC(FOURCC_CM32));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_RAW), CanonicalFourCC(FOURCC_CM24));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBO), CanonicalFourCC(FOURCC_L555));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBP), CanonicalFourCC(FOURCC_L565));
|
||||
EXPECT_EQ(static_cast<uint32_t>(FOURCC_RGBO), CanonicalFourCC(FOURCC_5551));
|
||||
}
|
||||
|
||||
TEST_F(LibYUVBaseTest, TestFourCC) {
|
||||
|
||||
@ -29,12 +29,12 @@ int main(int argc, char** argv) {
|
||||
FILE* fin2 = name2 ? fopen(name2, "rb") : NULL;
|
||||
|
||||
const int kBlockSize = 32768;
|
||||
uint8 buf1[kBlockSize];
|
||||
uint8 buf2[kBlockSize];
|
||||
uint32 hash1 = 5381;
|
||||
uint32 hash2 = 5381;
|
||||
uint64 sum_square_err = 0;
|
||||
uint64 size_min = 0;
|
||||
uint8_t buf1[kBlockSize];
|
||||
uint8_t buf2[kBlockSize];
|
||||
uint32_t hash1 = 5381;
|
||||
uint32_t hash2 = 5381;
|
||||
uint64_t sum_square_err = 0;
|
||||
uint64_t size_min = 0;
|
||||
int amt1 = 0;
|
||||
int amt2 = 0;
|
||||
do {
|
||||
|
||||
46
util/psnr.cc
46
util/psnr.cc
@ -21,14 +21,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int uint32; // NOLINT
|
||||
typedef unsigned int uint32_t; // NOLINT
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else // COMPILER_MSVC
|
||||
#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||
typedef unsigned long uint64; // NOLINT
|
||||
typedef unsigned long uint64_t; // NOLINT
|
||||
#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
|
||||
typedef unsigned long long uint64; // NOLINT
|
||||
typedef unsigned long long uint64_t; // NOLINT
|
||||
#endif // __LP64__
|
||||
#endif // _MSC_VER
|
||||
|
||||
@ -38,10 +38,10 @@ typedef unsigned long long uint64; // NOLINT
|
||||
#if !defined(LIBYUV_DISABLE_NEON) && defined(__ARM_NEON__) && \
|
||||
!defined(__aarch64__)
|
||||
#define HAS_SUMSQUAREERROR_NEON
|
||||
static uint32 SumSquareError_NEON(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
static uint32_t SumSquareError_NEON(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
volatile uint32 sse;
|
||||
volatile uint32_t sse;
|
||||
asm volatile(
|
||||
"vmov.u8 q7, #0 \n"
|
||||
"vmov.u8 q9, #0 \n"
|
||||
@ -73,10 +73,10 @@ static uint32 SumSquareError_NEON(const uint8* src_a,
|
||||
}
|
||||
#elif !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
|
||||
#define HAS_SUMSQUAREERROR_NEON
|
||||
static uint32 SumSquareError_NEON(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
static uint32_t SumSquareError_NEON(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
volatile uint32 sse;
|
||||
volatile uint32_t sse;
|
||||
asm volatile(
|
||||
"eor v16.16b, v16.16b, v16.16b \n"
|
||||
"eor v18.16b, v18.16b, v18.16b \n"
|
||||
@ -107,8 +107,8 @@ static uint32 SumSquareError_NEON(const uint8* src_a,
|
||||
}
|
||||
#elif !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && defined(_MSC_VER)
|
||||
#define HAS_SUMSQUAREERROR_SSE2
|
||||
__declspec(naked) static uint32 SumSquareError_SSE2(const uint8* /*src_a*/,
|
||||
const uint8* /*src_b*/,
|
||||
__declspec(naked) static uint32_t SumSquareError_SSE2(const uint8_t* /*src_a*/,
|
||||
const uint8_t* /*src_b*/,
|
||||
int /*count*/) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src_a
|
||||
@ -146,10 +146,10 @@ __declspec(naked) static uint32 SumSquareError_SSE2(const uint8* /*src_a*/,
|
||||
}
|
||||
#elif !defined(LIBYUV_DISABLE_X86) && (defined(__x86_64__) || defined(__i386__))
|
||||
#define HAS_SUMSQUAREERROR_SSE2
|
||||
static uint32 SumSquareError_SSE2(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
static uint32_t SumSquareError_SSE2(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 sse;
|
||||
uint32_t sse;
|
||||
asm volatile( // NOLINT
|
||||
"pxor %%xmm0,%%xmm0 \n"
|
||||
"pxor %%xmm5,%%xmm5 \n"
|
||||
@ -228,21 +228,21 @@ static int CpuHasSSE2() {
|
||||
}
|
||||
#endif // HAS_SUMSQUAREERROR_SSE2
|
||||
|
||||
static uint32 SumSquareError_C(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
static uint32_t SumSquareError_C(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 sse = 0u;
|
||||
uint32_t sse = 0u;
|
||||
for (int x = 0; x < count; ++x) {
|
||||
int diff = src_a[x] - src_b[x];
|
||||
sse += static_cast<uint32>(diff * diff);
|
||||
sse += static_cast<uint32_t>(diff * diff);
|
||||
}
|
||||
return sse;
|
||||
}
|
||||
|
||||
double ComputeSumSquareError(const uint8* src_a,
|
||||
const uint8* src_b,
|
||||
double ComputeSumSquareError(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count) {
|
||||
uint32 (*SumSquareError)(const uint8* src_a, const uint8* src_b, int count) =
|
||||
uint32_t (*SumSquareError)(const uint8_t* src_a, const uint8_t* src_b, int count) =
|
||||
SumSquareError_C;
|
||||
#if defined(HAS_SUMSQUAREERROR_NEON)
|
||||
SumSquareError = SumSquareError_NEON;
|
||||
@ -253,7 +253,7 @@ double ComputeSumSquareError(const uint8* src_a,
|
||||
}
|
||||
#endif
|
||||
const int kBlockSize = 1 << 15;
|
||||
uint64 sse = 0;
|
||||
uint64_t sse = 0;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for reduction(+ : sse)
|
||||
#endif
|
||||
|
||||
@ -20,7 +20,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED)
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char uint8_t;
|
||||
#define UINT8_TYPE_DEFINED
|
||||
#endif
|
||||
|
||||
@ -31,7 +31,7 @@ static const double kMaxPSNR = 128.0;
|
||||
#if !defined(HAVE_JPEG)
|
||||
// Computer Sum of Squared Error (SSE).
|
||||
// Pass this to ComputePSNR for final result.
|
||||
double ComputeSumSquareError(const uint8* org, const uint8* rec, int size);
|
||||
double ComputeSumSquareError(const uint8_t* org, const uint8_t* rec, int size);
|
||||
#endif
|
||||
|
||||
// PSNR formula: psnr = 10 * log10 (Peak Signal^2 * size / sse)
|
||||
|
||||
@ -90,9 +90,9 @@ bool ExtractResolutionFromFilename(const char* name,
|
||||
fseek(file_org, 0, SEEK_END);
|
||||
size_t total_size = ftell(file_org);
|
||||
fseek(file_org, 0, SEEK_SET);
|
||||
uint8* const ch_org = new uint8[total_size];
|
||||
uint8_t* const ch_org = new uint8_t[total_size];
|
||||
memset(ch_org, 0, total_size);
|
||||
size_t bytes_org = fread(ch_org, sizeof(uint8), total_size, file_org);
|
||||
size_t bytes_org = fread(ch_org, sizeof(uint8_t), total_size, file_org);
|
||||
fclose(file_org);
|
||||
if (bytes_org == total_size) {
|
||||
if (0 == libyuv::MJPGSize(ch_org, total_size, width_ptr, height_ptr)) {
|
||||
@ -107,13 +107,13 @@ bool ExtractResolutionFromFilename(const char* name,
|
||||
|
||||
// Scale Y channel from 16..240 to 0..255.
|
||||
// This can be useful when comparing codecs that are inconsistant about Y
|
||||
uint8 ScaleY(uint8 y) {
|
||||
uint8_t ScaleY(uint8_t y) {
|
||||
int ny = (y - 16) * 256 / 224;
|
||||
if (ny < 0)
|
||||
ny = 0;
|
||||
if (ny > 255)
|
||||
ny = 255;
|
||||
return static_cast<uint8>(ny);
|
||||
return static_cast<uint8_t>(ny);
|
||||
}
|
||||
|
||||
// MSE = Mean Square Error
|
||||
@ -237,8 +237,8 @@ void ParseOptions(int argc, const char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
bool UpdateMetrics(uint8* ch_org,
|
||||
uint8* ch_rec,
|
||||
bool UpdateMetrics(uint8_t* ch_org,
|
||||
uint8_t* ch_rec,
|
||||
const int y_size,
|
||||
const int uv_size,
|
||||
const size_t total_size,
|
||||
@ -247,10 +247,10 @@ bool UpdateMetrics(uint8* ch_org,
|
||||
metric* distorted_frame,
|
||||
bool do_psnr) {
|
||||
const int uv_offset = (do_swap_uv ? uv_size : 0);
|
||||
const uint8* const u_org = ch_org + y_size + uv_offset;
|
||||
const uint8* const u_rec = ch_rec + y_size;
|
||||
const uint8* const v_org = ch_org + y_size + (uv_size - uv_offset);
|
||||
const uint8* const v_rec = ch_rec + y_size + uv_size;
|
||||
const uint8_t* const u_org = ch_org + y_size + uv_offset;
|
||||
const uint8_t* const u_rec = ch_rec + y_size;
|
||||
const uint8_t* const v_org = ch_org + y_size + (uv_size - uv_offset);
|
||||
const uint8_t* const v_rec = ch_rec + y_size + uv_size;
|
||||
if (do_psnr) {
|
||||
#ifdef HAVE_JPEG
|
||||
double y_err = static_cast<double>(
|
||||
@ -374,8 +374,8 @@ int main(int argc, const char* argv[]) {
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8* const ch_org = new uint8[total_size];
|
||||
uint8* const ch_rec = new uint8[total_size];
|
||||
uint8_t* const ch_org = new uint8_t[total_size];
|
||||
uint8_t* const ch_rec = new uint8_t[total_size];
|
||||
if (ch_org == NULL || ch_rec == NULL) {
|
||||
fprintf(stderr, "No memory available\n");
|
||||
fclose(file_org);
|
||||
@ -432,11 +432,11 @@ int main(int argc, const char* argv[]) {
|
||||
if (num_frames && number_of_frames >= num_frames)
|
||||
break;
|
||||
|
||||
size_t bytes_org = fread(ch_org, sizeof(uint8), total_size, file_org);
|
||||
size_t bytes_org = fread(ch_org, sizeof(uint8_t), total_size, file_org);
|
||||
if (bytes_org < total_size) {
|
||||
#ifdef HAVE_JPEG
|
||||
// Try parsing file as a jpeg.
|
||||
uint8* const ch_jpeg = new uint8[bytes_org];
|
||||
uint8_t* const ch_jpeg = new uint8_t[bytes_org];
|
||||
memcpy(ch_jpeg, ch_org, bytes_org);
|
||||
memset(ch_org, 0, total_size);
|
||||
|
||||
@ -456,11 +456,11 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
for (int cur_rec = 0; cur_rec < num_rec; ++cur_rec) {
|
||||
size_t bytes_rec =
|
||||
fread(ch_rec, sizeof(uint8), total_size, file_rec[cur_rec]);
|
||||
fread(ch_rec, sizeof(uint8_t), total_size, file_rec[cur_rec]);
|
||||
if (bytes_rec < total_size) {
|
||||
#ifdef HAVE_JPEG
|
||||
// Try parsing file as a jpeg.
|
||||
uint8* const ch_jpeg = new uint8[bytes_rec];
|
||||
uint8_t* const ch_jpeg = new uint8_t[bytes_rec];
|
||||
memcpy(ch_jpeg, ch_rec, bytes_rec);
|
||||
memset(ch_rec, 0, total_size);
|
||||
|
||||
|
||||
30
util/ssim.cc
30
util/ssim.cc
@ -16,8 +16,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int uint32; // NOLINT
|
||||
typedef unsigned short uint16; // NOLINT
|
||||
typedef unsigned int uint32_t; // NOLINT
|
||||
typedef unsigned short uint16_t; // NOLINT
|
||||
|
||||
#if !defined(LIBYUV_DISABLE_X86) && !defined(__SSE2__) && \
|
||||
(defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)))
|
||||
@ -50,7 +50,7 @@ static const double kiW[KERNEL + 1 + 1] = {
|
||||
|
||||
#if !defined(LIBYUV_DISABLE_X86) && defined(__SSE2__)
|
||||
|
||||
#define PWEIGHT(A, B) static_cast<uint16>(K[(A)] * K[(B)]) // weight product
|
||||
#define PWEIGHT(A, B) static_cast<uint16_t>(K[(A)] * K[(B)]) // weight product
|
||||
#define MAKE_WEIGHT(L) \
|
||||
{ \
|
||||
{ \
|
||||
@ -66,7 +66,7 @@ static const double kiW[KERNEL + 1 + 1] = {
|
||||
// values. We can't call _mm_set_epi16() for static compile-time initialization.
|
||||
static const struct {
|
||||
union {
|
||||
uint16 i16_[8];
|
||||
uint16_t i16_[8];
|
||||
__m128i m_;
|
||||
} values_;
|
||||
} W0 = MAKE_WEIGHT(0), W1 = MAKE_WEIGHT(1), W2 = MAKE_WEIGHT(2),
|
||||
@ -109,14 +109,14 @@ static double FinalizeSSIM(double iw,
|
||||
// Note: worst case of accumulation is a weight of 33 = 11 + 2 * (7 + 3 + 1)
|
||||
// with a diff of 255, squared. The maximum error is thus 0x4388241,
|
||||
// which fits into 32 bits integers.
|
||||
double GetSSIM(const uint8* org,
|
||||
const uint8* rec,
|
||||
double GetSSIM(const uint8_t* org,
|
||||
const uint8_t* rec,
|
||||
int xo,
|
||||
int yo,
|
||||
int W,
|
||||
int H,
|
||||
int stride) {
|
||||
uint32 ws = 0, xm = 0, ym = 0, xxm = 0, xym = 0, yym = 0;
|
||||
uint32_t ws = 0, xm = 0, ym = 0, xxm = 0, xym = 0, yym = 0;
|
||||
org += (yo - KERNEL) * stride;
|
||||
org += (xo - KERNEL);
|
||||
rec += (yo - KERNEL) * stride;
|
||||
@ -142,13 +142,13 @@ double GetSSIM(const uint8* org,
|
||||
return FinalizeSSIM(1. / ws, xm, ym, xxm, xym, yym);
|
||||
}
|
||||
|
||||
double GetSSIMFullKernel(const uint8* org,
|
||||
const uint8* rec,
|
||||
double GetSSIMFullKernel(const uint8_t* org,
|
||||
const uint8_t* rec,
|
||||
int xo,
|
||||
int yo,
|
||||
int stride,
|
||||
double area_weight) {
|
||||
uint32 xm = 0, ym = 0, xxm = 0, xym = 0, yym = 0;
|
||||
uint32_t xm = 0, ym = 0, xxm = 0, xym = 0, yym = 0;
|
||||
|
||||
#if defined(LIBYUV_DISABLE_X86) || !defined(__SSE2__)
|
||||
|
||||
@ -262,7 +262,7 @@ double GetSSIMFullKernel(const uint8* org,
|
||||
|
||||
#define ADD_AND_STORE_FOUR_EPI32(M, OUT) \
|
||||
do { \
|
||||
uint32 tmp[4]; \
|
||||
uint32_t tmp[4]; \
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(tmp), (M)); \
|
||||
(OUT) = tmp[3] + tmp[2] + tmp[1] + tmp[0]; \
|
||||
} while (0)
|
||||
@ -292,8 +292,8 @@ static int start_max(int x, int y) {
|
||||
return (x > y) ? x : y;
|
||||
}
|
||||
|
||||
double CalcSSIM(const uint8* org,
|
||||
const uint8* rec,
|
||||
double CalcSSIM(const uint8_t* org,
|
||||
const uint8_t* rec,
|
||||
const int image_width,
|
||||
const int image_height) {
|
||||
double SSIM = 0.;
|
||||
@ -328,8 +328,8 @@ double CalcSSIM(const uint8* org,
|
||||
// NOTE: we could use similar method for the left-most pixels too.
|
||||
const int kScratchWidth = 8;
|
||||
const int kScratchStride = kScratchWidth + KERNEL + 1;
|
||||
uint8 scratch_org[KERNEL_SIZE * kScratchStride] = {0};
|
||||
uint8 scratch_rec[KERNEL_SIZE * kScratchStride] = {0};
|
||||
uint8_t scratch_org[KERNEL_SIZE * kScratchStride] = {0};
|
||||
uint8_t scratch_rec[KERNEL_SIZE * kScratchStride] = {0};
|
||||
|
||||
for (int k = 0; k < KERNEL_SIZE; ++k) {
|
||||
const int offset =
|
||||
|
||||
@ -20,12 +20,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(INT_TYPES_DEFINED) && !defined(UINT8_TYPE_DEFINED)
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char uint8_t;
|
||||
#define UINT8_TYPE_DEFINED
|
||||
#endif
|
||||
|
||||
double CalcSSIM(const uint8* org,
|
||||
const uint8* rec,
|
||||
double CalcSSIM(const uint8_t* org,
|
||||
const uint8_t* rec,
|
||||
const int image_width,
|
||||
const int image_height);
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ int num_skip_org = 0; // Number of frames to skip in original.
|
||||
int num_frames = 0; // Number of frames to convert.
|
||||
int filter = 1; // Bilinear filter for scaling.
|
||||
|
||||
static __inline uint32 Abs(int32 v) {
|
||||
static __inline uint32_t Abs(int32_t v) {
|
||||
return v >= 0 ? v : -v;
|
||||
}
|
||||
|
||||
@ -158,11 +158,11 @@ void ParseOptions(int argc, const char* argv[]) {
|
||||
static const int kTileX = 32;
|
||||
static const int kTileY = 32;
|
||||
|
||||
static int TileARGBScale(const uint8* src_argb,
|
||||
static int TileARGBScale(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8* dst_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
@ -242,9 +242,9 @@ int main(int argc, const char* argv[]) {
|
||||
fseek(file_org, num_skip_org * total_size, SEEK_SET);
|
||||
#endif
|
||||
|
||||
uint8* const ch_org = new uint8[org_size];
|
||||
uint8* const ch_dst = new uint8[dst_size];
|
||||
uint8* const ch_rec = new uint8[total_size];
|
||||
uint8_t* const ch_org = new uint8_t[org_size];
|
||||
uint8_t* const ch_dst = new uint8_t[dst_size];
|
||||
uint8_t* const ch_rec = new uint8_t[total_size];
|
||||
if (ch_org == NULL || ch_rec == NULL) {
|
||||
fprintf(stderr, "No memory available\n");
|
||||
fclose(file_org);
|
||||
@ -270,7 +270,7 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
// Load original YUV or ARGB frame.
|
||||
size_t bytes_org =
|
||||
fread(ch_org, sizeof(uint8), static_cast<size_t>(org_size), file_org);
|
||||
fread(ch_org, sizeof(uint8_t), static_cast<size_t>(org_size), file_org);
|
||||
if (bytes_org < static_cast<size_t>(org_size))
|
||||
break;
|
||||
|
||||
@ -329,13 +329,13 @@ int main(int argc, const char* argv[]) {
|
||||
// Output YUV or ARGB frame.
|
||||
if (rec_is_yuv) {
|
||||
size_t bytes_rec =
|
||||
fwrite(ch_rec, sizeof(uint8), static_cast<size_t>(total_size),
|
||||
fwrite(ch_rec, sizeof(uint8_t), static_cast<size_t>(total_size),
|
||||
file_rec[cur_rec]);
|
||||
if (bytes_rec < static_cast<size_t>(total_size))
|
||||
break;
|
||||
} else {
|
||||
size_t bytes_rec =
|
||||
fwrite(ch_dst, sizeof(uint8), static_cast<size_t>(dst_size),
|
||||
fwrite(ch_dst, sizeof(uint8_t), static_cast<size_t>(dst_size),
|
||||
file_rec[cur_rec]);
|
||||
if (bytes_rec < static_cast<size_t>(dst_size))
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user