Merge "Fix some google-runtime-int warnings in frameworks/rs."
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 1b533d0..03f911e 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -132,27 +132,27 @@
 
 class Short2 {
  public:
-  short x, y;
+  int16_t x, y;
 
-  Short2(short initX, short initY)
+  Short2(int16_t initX, int16_t initY)
     : x(initX), y(initY) {}
   Short2() : x(0), y(0) {}
 };
 
 class Short3 {
  public:
-  short x, y, z;
+  int16_t x, y, z;
 
-  Short3(short initX, short initY, short initZ)
+  Short3(int16_t initX, int16_t initY, int16_t initZ)
     : x(initX), y(initY), z(initZ) {}
   Short3() : x(0), y(0), z(0) {}
 };
 
 class Short4 {
  public:
-  short x, y, z, w;
+  int16_t x, y, z, w;
 
-  Short4(short initX, short initY, short initZ, short initW)
+  Short4(int16_t initX, int16_t initY, int16_t initZ, int16_t initW)
     : x(initX), y(initY), z(initZ), w(initW) {}
   Short4() : x(0), y(0), z(0), w(0) {}
 };
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;
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index e96904a..2627ae6 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -1287,7 +1287,7 @@
     ALOGD("%s {%hhu, %hhu, %hhu, %hhu}  0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w);
 }
 
-void rsDebug(const char *s, short c) {
+void rsDebug(const char *s, int16_t c) {
     ALOGD("%s %hd  0x%hx", s, c, c);
 }
 
@@ -1306,7 +1306,7 @@
     ALOGD("%s {%hd, %hd, %hd, %hd}  0x%hx 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w);
 }
 
-void rsDebug(const char *s, unsigned short c) {
+void rsDebug(const char *s, uint16_t c) {
     ALOGD("%s %hu  0x%hx", s, c, c);
 }