Fix some google-runtime-int warnings in frameworks/rs.
* Use (u)int16_t instead of (unsigned) short.
Bug: 112478838
Test: build with WITH_TIDY=1
Change-Id: I5bb64e093a6d97e114da2ee0d7a085d532f4b238
diff --git a/cpu_ref/rsCpuIntrinsicColorMatrix.cpp b/cpu_ref/rsCpuIntrinsicColorMatrix.cpp
index 0c3ffa2..6e2ffb5 100644
--- a/cpu_ref/rsCpuIntrinsicColorMatrix.cpp
+++ b/cpu_ref/rsCpuIntrinsicColorMatrix.cpp
@@ -174,7 +174,7 @@
// The following four fields are read as constants
// by the SIMD assembly code.
- short ip[16];
+ int16_t ip[16];
int ipa[4];
float tmpFp[16];
float tmpFpa[4];
@@ -195,7 +195,7 @@
bool build(Key_t key);
- void (*mOptKernel)(void *dst, const void *src, const short *coef, uint32_t count);
+ void (*mOptKernel)(void *dst, const void *src, const int16_t *coef, uint32_t count);
};
@@ -451,11 +451,11 @@
#if defined(ARCH_X86_HAVE_SSSE3)
extern void rsdIntrinsicColorMatrixDot_K(void *dst, const void *src,
- const short *coef, uint32_t count);
+ const int16_t *coef, uint32_t count);
extern void rsdIntrinsicColorMatrix3x3_K(void *dst, const void *src,
- const short *coef, uint32_t count);
+ const int16_t *coef, uint32_t count);
extern void rsdIntrinsicColorMatrix4x4_K(void *dst, const void *src,
- const short *coef, uint32_t count);
+ const int16_t *coef, uint32_t count);
using android::renderscript::Key_t;
@@ -744,7 +744,7 @@
void RsdCpuScriptIntrinsicColorMatrix::updateCoeffCache(float fpMul, float addMul) {
for(int ct=0; ct < 16; ct++) {
- ip[ct] = (short)(fp[ct] * 256.f + 0.5f);
+ ip[ct] = (int16_t)(fp[ct] * 256.f + 0.5f);
tmpFp[ct] = fp[ct] * fpMul;
//ALOGE("mat %i %f %f", ct, fp[ct], tmpFp[ct]);
}
@@ -969,7 +969,7 @@
#if defined(ARCH_X86_HAVE_SSSE3)
if ((mOptKernel == nullptr) || (mLastKey.key != key.key)) {
// FIXME: Disable mOptKernel to pass RS color matrix CTS cases
- // mOptKernel = (void (*)(void *, const void *, const short *, uint32_t)) selectKernel(key);
+ // mOptKernel = (void (*)(void *, const void *, const int16_t *, uint32_t)) selectKernel(key);
mLastKey = key;
}
@@ -979,7 +979,7 @@
mBuf = nullptr;
mOptKernel = nullptr;
if (build(key)) {
- mOptKernel = (void (*)(void *, const void *, const short *, uint32_t)) mBuf;
+ mOptKernel = (void (*)(void *, const void *, const int16_t *, uint32_t)) mBuf;
}
#if defined(ARCH_ARM64_USE_INTRINSICS)
else {
diff --git a/cpu_ref/rsCpuIntrinsicConvolve3x3.cpp b/cpu_ref/rsCpuIntrinsicConvolve3x3.cpp
index c2b4bd9..a2cd8e5 100644
--- a/cpu_ref/rsCpuIntrinsicConvolve3x3.cpp
+++ b/cpu_ref/rsCpuIntrinsicConvolve3x3.cpp
@@ -35,7 +35,7 @@
protected:
float mFp[16];
- short mIp[16];
+ int16_t mIp[16];
ObjectBaseRef<const Allocation> mAlloc;
ObjectBaseRef<const Element> mElement;
@@ -70,15 +70,15 @@
memcpy (&mFp, data, dataLength);
for(int ct=0; ct < 9; ct++) {
if (mFp[ct] >= 0) {
- mIp[ct] = (short)(mFp[ct] * 256.f + 0.5f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f + 0.5f);
} else {
- mIp[ct] = (short)(mFp[ct] * 256.f - 0.5f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f - 0.5f);
}
}
}
extern "C" void rsdIntrinsicConvolve3x3_K(void *dst, const void *y0, const void *y1,
- const void *y2, const short *coef, uint32_t count);
+ const void *y2, const int16_t *coef, uint32_t count);
static void ConvolveOneU4(const RsExpandKernelDriverInfo *info, uint32_t x, uchar4 *out,
@@ -480,7 +480,7 @@
}
for(int ct=0; ct < 9; ct++) {
mFp[ct] = 1.f / 9.f;
- mIp[ct] = (short)(mFp[ct] * 256.f + 0.5f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f + 0.5f);
}
}
diff --git a/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp b/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp
index 7ea9cf8..59030bf 100644
--- a/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp
+++ b/cpu_ref/rsCpuIntrinsicConvolve5x5.cpp
@@ -35,7 +35,7 @@
protected:
float mFp[28];
- short mIp[28];
+ int16_t mIp[28];
ObjectBaseRef<Allocation> alloc;
@@ -72,9 +72,9 @@
memcpy (&mFp, data, dataLength);
for(int ct=0; ct < 25; ct++) {
if (mFp[ct] >= 0) {
- mIp[ct] = (short)(mFp[ct] * 256.f + 0.5f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f + 0.5f);
} else {
- mIp[ct] = (short)(mFp[ct] * 256.f - 0.5f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f - 0.5f);
}
}
}
@@ -338,7 +338,7 @@
extern "C" void rsdIntrinsicConvolve5x5_K(void *dst, const void *y0, const void *y1,
const void *y2, const void *y3, const void *y4,
- const short *coef, uint32_t count);
+ const int16_t *coef, uint32_t count);
void RsdCpuScriptIntrinsicConvolve5x5::kernelU4(const RsExpandKernelDriverInfo *info,
uint32_t xstart, uint32_t xend,
@@ -678,7 +678,7 @@
}
for(int ct=0; ct < 25; ct++) {
mFp[ct] = 1.f / 25.f;
- mIp[ct] = (short)(mFp[ct] * 256.f);
+ mIp[ct] = (int16_t)(mFp[ct] * 256.f);
}
}
diff --git a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
index db6bd5e..bb0ad44 100644
--- a/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
+++ b/cpu_ref/rsCpuIntrinsicYuvToRGB.cpp
@@ -58,9 +58,9 @@
static uchar4 rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v) {
- short Y = ((short)y) - 16;
- short U = ((short)u) - 128;
- short V = ((short)v) - 128;
+ int16_t Y = ((int16_t)y) - 16;
+ int16_t U = ((int16_t)u) - 128;
+ int16_t V = ((int16_t)v) - 128;
short4 p;
p.x = (Y * 298 + V * 409 + 128) >> 8;