Commit 65b41008 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Workaround two more ubsan warnings.

Fixes #27 as well as another one mentioned in the wiki task-list.
parent deab2534
...@@ -408,13 +408,13 @@ static inline int av1_get_fwd_ref_2_ctx(const BlockContext *const a, ...@@ -408,13 +408,13 @@ static inline int av1_get_fwd_ref_2_ctx(const BlockContext *const a,
int cnt[2] = { 0 }; int cnt[2] = { 0 };
if (have_top && !a->intra[xb4]) { if (have_top && !a->intra[xb4]) {
if (a->ref[0][xb4] - 2U < 2) cnt[a->ref[0][xb4] - 2]++; if ((a->ref[0][xb4] ^ 2U) < 2) cnt[a->ref[0][xb4] - 2]++;
if (a->comp_type[xb4] && a->ref[1][xb4] - 2U < 2) cnt[a->ref[1][xb4] - 2]++; if (a->comp_type[xb4] && (a->ref[1][xb4] ^ 2U) < 2) cnt[a->ref[1][xb4] - 2]++;
} }
if (have_left && !l->intra[yb4]) { if (have_left && !l->intra[yb4]) {
if (l->ref[0][yb4] - 2U < 2) cnt[l->ref[0][yb4] - 2]++; if ((l->ref[0][yb4] ^ 2U) < 2) cnt[l->ref[0][yb4] - 2]++;
if (l->comp_type[yb4] && l->ref[1][yb4] - 2U < 2) cnt[l->ref[1][yb4] - 2]++; if (l->comp_type[yb4] && (l->ref[1][yb4] ^ 2U) < 2) cnt[l->ref[1][yb4] - 2]++;
} }
return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2; return cnt[0] == cnt[1] ? 1 : cnt[0] < cnt[1] ? 0 : 2;
......
...@@ -111,13 +111,17 @@ static inline void mask_edges_inter(uint32_t (*masks)[32][3], ...@@ -111,13 +111,17 @@ static inline void mask_edges_inter(uint32_t (*masks)[32][3],
for (y = 0; y < h4; y++) { for (y = 0; y < h4; y++) {
int ltx = txa[0][0][y][0]; int ltx = txa[0][0][y][0];
int step = txa[0][1][y][0]; int step = txa[0][1][y][0];
for (x = step, mask = 1U << (bx4 + step); if (step < w4) {
x < w4; x += step, mask <<= step) x = step;
{ mask = 1U << (bx4 + step);
const int rtx = txa[0][0][y][x]; do {
masks[0][by4 + y][imin(rtx, ltx)] |= mask; const int rtx = txa[0][0][y][x];
ltx = rtx; masks[0][by4 + y][imin(rtx, ltx)] |= mask;
step = txa[0][1][y][x]; ltx = rtx;
step = txa[0][1][y][x];
x += step;
mask <<= step;
} while (x < w4);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment