Commit 8fac3029 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Janne Grunau

Don't use msac_decode_bool() for edge partition parsing

This is identical to what libaom does, and fixes #119. After
gather_left/top_partition_prob(), probabilities *can* overlap,
and in extreme cases the output CDF[0] can therefore be 0, which
will cause an assert failure when used with msac_decode_bool().
parent c52cc17a
......@@ -2028,8 +2028,8 @@ static int decode_sb(Dav1dTileContext *const t, const enum BlockLevel bl,
const Av1Block *const b = &f->frame_thread.b[t->by * f->b4_stride + t->bx];
is_split = b->bl != bl;
} else {
const unsigned p = gather_top_partition_prob(pc, bl);
is_split = msac_decode_bool(&t->ts->msac, p);
const uint16_t cdf[2] = { gather_top_partition_prob(pc, bl), 0 };
is_split = msac_decode_symbol(&t->ts->msac, cdf, 2);
if (DEBUG_BLOCK_INFO)
printf("poc=%d,y=%d,x=%d,bl=%d,ctx=%d,bp=%d: r=%d\n",
f->frame_hdr.frame_offset, t->by, t->bx, bl, ctx,
......@@ -2057,8 +2057,8 @@ static int decode_sb(Dav1dTileContext *const t, const enum BlockLevel bl,
const Av1Block *const b = &f->frame_thread.b[t->by * f->b4_stride + t->bx];
is_split = b->bl != bl;
} else {
const unsigned p = gather_left_partition_prob(pc, bl);
is_split = msac_decode_bool(&t->ts->msac, p);
uint16_t cdf[2] = { gather_left_partition_prob(pc, bl), 0 };
is_split = msac_decode_symbol(&t->ts->msac, cdf, 2);
if (f->cur.p.p.layout == DAV1D_PIXEL_LAYOUT_I422 && !is_split)
return 1;
if (DEBUG_BLOCK_INFO)
......
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