vp8: fix some implicit signed -> unsigned conv warnings

and vice-versa mostly when dealing with bitmasks

w/clang-11 -fsanitize=undefined

Change-Id: I6d8f676bf87679ba1dad9cb7f55eea172103d9d3
This commit is contained in:
James Zern
2021-11-06 16:33:00 -07:00
parent 40c21ff6fe
commit 1676cddaaa
6 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -872,8 +872,8 @@ static void init_frame(VP8D_COMP *pbi) {
xd->mode_info_stride = pc->mode_info_stride;
xd->corrupted = 0; /* init without corruption */
xd->fullpixel_mask = 0xffffffff;
if (pc->full_pixel) xd->fullpixel_mask = 0xfffffff8;
xd->fullpixel_mask = ~0;
if (pc->full_pixel) xd->fullpixel_mask = ~7;
}
int vp8_decode_frame(VP8D_COMP *pbi) {
+2 -2
View File
@@ -634,8 +634,8 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) {
cpi->prob_last_coded, cpi->prob_gf_coded);
}
xd->fullpixel_mask = 0xffffffff;
if (cm->full_pixel) xd->fullpixel_mask = 0xfffffff8;
xd->fullpixel_mask = ~0;
if (cm->full_pixel) xd->fullpixel_mask = ~7;
vp8_zero(x->coef_counts);
vp8_zero(x->ymode_count);
+1 -1
View File
@@ -160,7 +160,7 @@ static void calc_prob(vp8_prob *p, const unsigned int ct[2]) {
const unsigned int tot = ct[0] + ct[1];
if (tot) {
const vp8_prob x = ((ct[0] * 255) / tot) & -2;
const vp8_prob x = ((ct[0] * 255) / tot) & ~1u;
*p = x ? x : 1;
}
}
+2 -2
View File
@@ -66,8 +66,8 @@ struct lookahead_ctx *vp8_lookahead_init(unsigned int width,
depth += 1;
/* Align the buffer dimensions */
width = (width + 15) & ~15;
height = (height + 15) & ~15;
width = (width + 15) & ~15u;
height = (height + 15) & ~15u;
/* Allocate the lookahead structures */
ctx = calloc(1, sizeof(*ctx));
+1 -1
View File
@@ -314,7 +314,7 @@ static void calc_iframe_target_size(VP8_COMP *cpi) {
* bandwidth per second * fraction of the initial buffer
* level
*/
target = cpi->oxcf.starting_buffer_level / 2;
target = (uint64_t)cpi->oxcf.starting_buffer_level / 2;
if (target > cpi->oxcf.target_bandwidth * 3 / 2) {
target = cpi->oxcf.target_bandwidth * 3 / 2;
+1 -1
View File
@@ -391,7 +391,7 @@ static INLINE unsigned int x87_set_double_precision(void) {
// Reserved 01B
// Double Precision (53-Bits) 10B
// Extended Precision (64-Bits) 11B
x87_set_control_word((mode & ~0x300) | 0x200);
x87_set_control_word((mode & ~0x300u) | 0x200u);
return mode;
}