Commit 7e389884 authored by Frank Barchard's avatar Frank Barchard Committed by Frank Barchard

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/879922Reviewed-by: 's avatarMiguel Casas <mcasas@chromium.org>
parent 13771ffa
......@@ -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 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 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 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_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_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"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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_;
};
......
This diff is collapsed.
......@@ -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);
......
This diff is collapsed.
......@@ -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,
......
This diff is collapsed.
......@@ -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"
......
This diff is collapsed.
......@@ -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];
......
This diff is collapsed.
......@@ -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"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment