Refactor integer sizes to match image size and dimension.

Bug: 264511092
Test: atest ImsMediaNativeTests
Change-Id: I93c7c99f4d1b1da83a1add6f348f151789ddedc1
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaImageRotate.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaImageRotate.h
index 1e541d7..939cd67 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaImageRotate.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/utils/ImsMediaImageRotate.h
@@ -39,7 +39,7 @@
      * @param nSrcHeight Source Image height.
      */
     static void YUV420_Planar_Rotate90_Flip(
-            uint8_t* pbDst, uint8_t* pbSrc, uint32_t nSrcWidth, uint32_t nSrcHeight);
+            uint8_t* pbDst, uint8_t* pbSrc, uint16_t nSrcWidth, uint16_t nSrcHeight);
 
     /**
      * @brief Rotates YUVImage_420_888 Image by 90 degrees.
@@ -59,7 +59,7 @@
      * @param nSrcHeight Source Image height.
      */
     static void YUV420_SP_Rotate90(uint8_t* pbDst, uint8_t* pYPlane, uint8_t* pUVPlane,
-            uint32_t nSrcWidth, uint32_t nSrcHeight);
+            uint16_t nSrcWidth, uint16_t nSrcHeight);
 
     /**
      * @brief Rotates YUVImage_420_888 Image by 90 degrees and flip.
@@ -79,7 +79,7 @@
      * @param nSrcHeight Source Image height.
      */
     static void YUV420_SP_Rotate90_Flip(uint8_t* pbDst, uint8_t* pYPlane, uint8_t* pUVPlane,
-            uint32_t nSrcWidth, uint32_t nSrcHeight);
+            uint16_t nSrcWidth, uint16_t nSrcHeight);
 
     /**
      * @brief Rotates YUVImage_420_888 Image by 270 degrees.
@@ -99,7 +99,7 @@
      * @param nSrcHeight Source Image height.
      */
     static void YUV420_SP_Rotate270(uint8_t* pbDst, uint8_t* pYPlane, uint8_t* pUVPlane,
-            uint32_t nSrcWidth, uint32_t nSrcHeight);
+            uint16_t nSrcWidth, uint16_t nSrcHeight);
 };
 
 #endif  // IMS_MEDIA_IMAGE_ROTATE
\ No newline at end of file
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotate.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotate.cpp
index 7ee053d..90947c1 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotate.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotate.cpp
@@ -17,10 +17,11 @@
 #include "ImsMediaImageRotate.h"
 
 void ImsMediaImageRotate::YUV420_Planar_Rotate90_Flip(
-        uint8_t* pbDst, uint8_t* pbSrc, uint32_t nSrcWidth, uint32_t nSrcHeight)
+        uint8_t* pbDst, uint8_t* pbSrc, uint16_t nSrcWidth, uint16_t nSrcHeight)
 {
-    uint32_t srcIdx, dstIdx, x, y;
-    const uint32_t size = nSrcWidth * nSrcHeight;
+    uint16_t x, y;
+    uint64_t srcIdx, dstIdx;
+    const uint64_t size = nSrcWidth * nSrcHeight;
     dstIdx = size - 1;
 
     // Rotate Y buffer
@@ -37,7 +38,7 @@
     }
 
     dstIdx = (size * 1.5f) - 1;
-    const uint32_t usize = size / 4;
+    const uint64_t usize = size / 4;
     nSrcWidth /= 2;
     nSrcHeight /= 2;
 
@@ -57,10 +58,11 @@
 }
 
 void ImsMediaImageRotate::YUV420_SP_Rotate90(uint8_t* pbDst, uint8_t* pYPlane, uint8_t* pUVPlane,
-        uint32_t nSrcWidth, uint32_t nSrcHeight)
+        uint16_t nSrcWidth, uint16_t nSrcHeight)
 {
-    uint32_t srcIdx, dstIdx, x, y;
-    const uint32_t size = nSrcWidth * nSrcHeight;
+    uint16_t x, y;
+    uint64_t srcIdx, dstIdx;
+    const uint64_t size = nSrcWidth * nSrcHeight;
     dstIdx = size - 1;
 
     // Rotate Y buffer
@@ -93,10 +95,12 @@
 }
 
 void ImsMediaImageRotate::YUV420_SP_Rotate90_Flip(uint8_t* pbDst, uint8_t* pYPlane,
-        uint8_t* pUVPlane, uint32_t nSrcWidth, uint32_t nSrcHeight)
+        uint8_t* pUVPlane, uint16_t nSrcWidth, uint16_t nSrcHeight)
 {
-    uint32_t srcIdx, dstIdx, x, y;
-    const uint32_t size = nSrcWidth * nSrcHeight;
+    uint16_t x, y;
+    uint64_t srcIdx, dstIdx;
+    const uint64_t size = nSrcWidth * nSrcHeight;
+
     dstIdx = size - 1;
 
     // Rotate Y buffer
@@ -129,10 +133,12 @@
 }
 
 void ImsMediaImageRotate::YUV420_SP_Rotate270(uint8_t* pbDst, uint8_t* pYPlane, uint8_t* pUVPlane,
-        uint32_t nSrcWidth, uint32_t nSrcHeight)
+        uint16_t nSrcWidth, uint16_t nSrcHeight)
 {
-    uint32_t srcIdx, dstIdx, x, y;
-    const uint32_t size = nSrcWidth * nSrcHeight;
+    uint16_t x, y;
+    uint64_t srcIdx, dstIdx;
+    const uint64_t size = nSrcWidth * nSrcHeight;
+
     dstIdx = size - 1;
 
     // Rotate Y buffer
diff --git a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotateTest.cpp b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotateTest.cpp
index 0cdeb90..60dc69f 100644
--- a/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotateTest.cpp
+++ b/tests/native/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaImageRotateTest.cpp
@@ -28,7 +28,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate90FlipTest)
 {
-    const uint32_t img_width = 4, img_height = 4;
+    const uint16_t img_width = 4, img_height = 4;
     const uint32_t img_buf_size = img_width * img_height * 1.5f;
 
     // Input image Y buffer
@@ -52,7 +52,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate90FlipTest_ZeroImageSize)
 {
-    const uint32_t img_width = 0, img_height = 0;
+    const uint16_t img_width = 0, img_height = 0;
 
     // Input image Y buffer
     uint8_t input_img_y[0] = {};
@@ -74,7 +74,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate270Test)
 {
-    const uint32_t img_width = 4, img_height = 4;
+    const uint16_t img_width = 4, img_height = 4;
     const uint32_t img_buf_size = img_width * img_height * 1.5f;
 
     // Input image Y buffer
@@ -98,7 +98,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate270Test_ZeroImageSize)
 {
-    const uint32_t img_width = 0, img_height = 0;
+    const uint16_t img_width = 0, img_height = 0;
 
     // Input image Y buffer
     uint8_t input_img_y[0] = {};
@@ -120,7 +120,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate90Planar)
 {
-    const uint32_t img_width = 4, img_height = 4;
+    const uint16_t img_width = 4, img_height = 4;
     const uint32_t img_buf_size = img_width * img_height * 1.5f;
 
     // Input image YUV buffer
@@ -141,7 +141,7 @@
 
 TEST_F(ImsMediaImageRotateTest, Rotate90PlanarTest_ZeroImageSize)
 {
-    const uint32_t img_width = 0, img_height = 0;
+    const uint16_t img_width = 0, img_height = 0;
 
     // Input image YUV buffer
     uint8_t input_img[0] = {};