Commit 2c3eaffd authored by boyuanxiao-argondesign's avatar boyuanxiao-argondesign Committed by Ronald S. Bultje
Browse files

Correct the condition for freeing references in dav1d_parse_obus

A new coded video sequence (see page 193; section 7.5 of the spec)
begins when we see a sequence header that isn't bit identical to
previous ones. This is the point at which we can throw away previous
frames etc.
parent a1e945ca
Pipeline #2634 passed with stages
in 2 minutes and 52 seconds
...@@ -1090,7 +1090,10 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in) { ...@@ -1090,7 +1090,10 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in) {
return res; return res;
if (check_for_overrun(&gb, init_bit_pos, len)) if (check_for_overrun(&gb, init_bit_pos, len))
return -EINVAL; return -EINVAL;
if (!c->have_frame_hdr || memcmp(&hdr, &c->seq_hdr, sizeof(hdr))) { // If we have read a sequence header which is different from
// the old one, this is a new video sequence and can't use any
// previous state. Free that state.
if (c->have_seq_hdr && memcmp(&hdr, &c->seq_hdr, sizeof(hdr))) {
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
if (c->refs[i].p.p.data[0]) if (c->refs[i].p.p.data[0])
dav1d_thread_picture_unref(&c->refs[i].p); dav1d_thread_picture_unref(&c->refs[i].p);
...@@ -1099,8 +1102,7 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in) { ...@@ -1099,8 +1102,7 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in) {
if (c->cdf[i].cdf) if (c->cdf[i].cdf)
dav1d_cdf_thread_unref(&c->cdf[i]); dav1d_cdf_thread_unref(&c->cdf[i]);
} }
if (c->have_seq_hdr) c->seq_hdr = hdr;
c->seq_hdr = hdr;
} }
c->have_seq_hdr = 1; c->have_seq_hdr = 1;
break; break;
......
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