dsp,x86: normalize types w/_mm_set* calls (2)

missed in:
83539239 (origin/main, main) dsp,x86: normalize types w/_mm_set* calls

fixes integer sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
4292337446 (32-bit, unsigned) to type 'int' changed the value to
-2629850 (32-bit, signed)
runtime error: implicit conversion from type
'uint8_t' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type
'char' changed the value to -128 (8-bit, signed)

Bug: b/229626362
Change-Id: Ie904da8ded26725b4e0a9b82cc0679234f0a5388
This commit is contained in:
James Zern 2022-08-04 11:24:41 -07:00
parent 835392393b
commit 8980362eed
3 changed files with 8 additions and 7 deletions

View File

@ -1062,7 +1062,7 @@ static void VE16_SSE2(uint8_t* dst) {
static void HE16_SSE2(uint8_t* dst) { // horizontal static void HE16_SSE2(uint8_t* dst) { // horizontal
int j; int j;
for (j = 16; j > 0; --j) { for (j = 16; j > 0; --j) {
const __m128i values = _mm_set1_epi8(dst[-1]); const __m128i values = _mm_set1_epi8((char)dst[-1]);
_mm_storeu_si128((__m128i*)dst, values); _mm_storeu_si128((__m128i*)dst, values);
dst += BPS; dst += BPS;
} }

View File

@ -208,7 +208,7 @@ static void PredictorAdd0_SSE2(const uint32_t* in, const uint32_t* upper,
static void PredictorAdd1_SSE2(const uint32_t* in, const uint32_t* upper, static void PredictorAdd1_SSE2(const uint32_t* in, const uint32_t* upper,
int num_pixels, uint32_t* out) { int num_pixels, uint32_t* out) {
int i; int i;
__m128i prev = _mm_set1_epi32(out[-1]); __m128i prev = _mm_set1_epi32((int)out[-1]);
for (i = 0; i + 4 <= num_pixels; i += 4) { for (i = 0; i + 4 <= num_pixels; i += 4) {
// a | b | c | d // a | b | c | d
const __m128i src = _mm_loadu_si128((const __m128i*)&in[i]); const __m128i src = _mm_loadu_si128((const __m128i*)&in[i]);
@ -561,7 +561,7 @@ static void ConvertBGRAToRGBA_SSE2(const uint32_t* src,
static void ConvertBGRAToRGBA4444_SSE2(const uint32_t* src, static void ConvertBGRAToRGBA4444_SSE2(const uint32_t* src,
int num_pixels, uint8_t* dst) { int num_pixels, uint8_t* dst) {
const __m128i mask_0x0f = _mm_set1_epi8(0x0f); const __m128i mask_0x0f = _mm_set1_epi8(0x0f);
const __m128i mask_0xf0 = _mm_set1_epi8(0xf0); const __m128i mask_0xf0 = _mm_set1_epi8((char)0xf0);
const __m128i* in = (const __m128i*)src; const __m128i* in = (const __m128i*)src;
__m128i* out = (__m128i*)dst; __m128i* out = (__m128i*)dst;
while (num_pixels >= 8) { while (num_pixels >= 8) {
@ -596,8 +596,8 @@ static void ConvertBGRAToRGBA4444_SSE2(const uint32_t* src,
static void ConvertBGRAToRGB565_SSE2(const uint32_t* src, static void ConvertBGRAToRGB565_SSE2(const uint32_t* src,
int num_pixels, uint8_t* dst) { int num_pixels, uint8_t* dst) {
const __m128i mask_0xe0 = _mm_set1_epi8(0xe0); const __m128i mask_0xe0 = _mm_set1_epi8((char)0xe0);
const __m128i mask_0xf8 = _mm_set1_epi8(0xf8); const __m128i mask_0xf8 = _mm_set1_epi8((char)0xf8);
const __m128i mask_0x07 = _mm_set1_epi8(0x07); const __m128i mask_0x07 = _mm_set1_epi8(0x07);
const __m128i* in = (const __m128i*)src; const __m128i* in = (const __m128i*)src;
__m128i* out = (__m128i*)dst; __m128i* out = (__m128i*)dst;

View File

@ -25,8 +25,9 @@ static void TransformColorInverse_SSE41(const VP8LMultipliers* const m,
int num_pixels, uint32_t* dst) { int num_pixels, uint32_t* dst) {
// sign-extended multiplying constants, pre-shifted by 5. // sign-extended multiplying constants, pre-shifted by 5.
#define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend #define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend
const __m128i mults_rb = _mm_set1_epi32((uint32_t)CST(green_to_red_) << 16 | const __m128i mults_rb =
(CST(green_to_blue_) & 0xffff)); _mm_set1_epi32((int)((uint32_t)CST(green_to_red_) << 16 |
(CST(green_to_blue_) & 0xffff)));
const __m128i mults_b2 = _mm_set1_epi32(CST(red_to_blue_)); const __m128i mults_b2 = _mm_set1_epi32(CST(red_to_blue_));
#undef CST #undef CST
const __m128i mask_ag = _mm_set1_epi32((int)0xff00ff00); const __m128i mask_ag = _mm_set1_epi32((int)0xff00ff00);