diff options
author | Frank Barchard <fbarchard@google.com> | 2018-01-22 18:35:52 -0800 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2018-01-23 19:16:05 +0000 |
commit | 7e389884a14285de2085052c819abee4e53139af (patch) | |
tree | a13ddf691bc79b5b96c6e7e8912925ecba6a9a20 /source/scale_common.cc | |
parent | 13771ffaadb810c706bd421be4bdf48a928032e6 (diff) | |
download | libyuv-7e389884a14285de2085052c819abee4e53139af.tar.gz |
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>
Diffstat (limited to 'source/scale_common.cc')
-rw-r--r-- | source/scale_common.cc | 360 |
1 files changed, 180 insertions, 180 deletions
diff --git a/source/scale_common.cc b/source/scale_common.cc index e060c3cb..5d9b5797 100644 --- a/source/scale_common.cc +++ b/source/scale_common.cc @@ -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; } } |