avcodec/cbs_av1: fix parsing frame_size_with_refs

found_ref is not a single value in the bitstream. Fixes parsing files with
frame size changes.

Based on code from cbs_vp9.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2018-10-26 21:32:36 -03:00
parent fef2162b6e
commit 99ef8b8afd
2 changed files with 4 additions and 4 deletions

View File

@ -161,7 +161,7 @@ typedef struct AV1RawFrameHeader {
uint8_t render_width_minus_1; uint8_t render_width_minus_1;
uint8_t render_height_minus_1; uint8_t render_height_minus_1;
uint8_t found_ref; uint8_t found_ref[AV1_REFS_PER_FRAME];
uint8_t refresh_frame_flags; uint8_t refresh_frame_flags;
uint8_t allow_intrabc; uint8_t allow_intrabc;

View File

@ -417,8 +417,8 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw,
int i, err; int i, err;
for (i = 0; i < AV1_REFS_PER_FRAME; i++) { for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
flag(found_ref); flags(found_ref[i], 1, i);
if (current->found_ref) { if (current->found_ref[i]) {
AV1ReferenceFrameState *ref = AV1ReferenceFrameState *ref =
&priv->ref[current->ref_frame_idx[i]]; &priv->ref[current->ref_frame_idx[i]];
@ -439,7 +439,7 @@ static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw,
} }
} }
if (current->found_ref == 0) { if (i >= AV1_REFS_PER_FRAME) {
CHECK(FUNC(frame_size)(ctx, rw, current)); CHECK(FUNC(frame_size)(ctx, rw, current));
CHECK(FUNC(render_size)(ctx, rw, current)); CHECK(FUNC(render_size)(ctx, rw, current));
} else { } else {