Skip to content

Check obu_type if single_picture_header_flag is 1 - #5322

Open
wantehchang wants to merge 1 commit into
AOMediaCodec:mainfrom
wantehchang:still-picture-obu-type
Open

Check obu_type if single_picture_header_flag is 1#5322
wantehchang wants to merge 1 commit into
AOMediaCodec:mainfrom
wantehchang:still-picture-obu-type

Conversation

@wantehchang

Copy link
Copy Markdown
Member

If single_picture_header_flag is equal to 1 in the sequence header OBU, frame_type is inferred to be KEY_FRAME. Therefore obu_type needs to be OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY, otherwise frame_type and obu_type will be inconsistent with each other and things will go wrong.

Fixes #5319.

If single_picture_header_flag is equal to 1 in the sequence header OBU,
frame_type is inferred to be KEY_FRAME. Therefore obu_type needs to be
OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY, otherwise frame_type and
obu_type will be inconsistent with each other and things will go wrong.

Fixes AOMediaCodec#5319.
Comment thread av2/decoder/decodeframe.c
if (obu_type == OBU_LEADING_SEF || obu_type == OBU_REGULAR_SEF)
return read_show_existing_frame(pbi, obu_type == OBU_REGULAR_SEF, rb);
if (obu_type == OBU_CLOSED_LOOP_KEY || obu_type == OBU_OPEN_LOOP_KEY) {
current_frame->frame_type = KEY_FRAME;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the single_picture_header_flag=0 case, OBU_CLOSED_LOOP_KEY and OBU_OPEN_LOOP_KEY are mapped to KEY_FRAME.

Comment thread av2/decoder/decodeframe.c
!cm->immediate_output_picture)) {
avm_internal_error(&cm->error, AVM_CODEC_CORRUPT_FRAME,
"Still pictures must be coded as shown keyframes");
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the single_picture_header_flag=0 case, if still_picture is equal to 1, we require the OBU type be OBU_CLOSED_LOOP_KEY or OBU_OPEN_LOOP_KEY via the current_frame->frame_type != KEY_FRAME check. The check I added at line 8010 for the single_picture_header_flag=1 case matches this check.

However, I am not sure if we should allow OBU_OPEN_LOOP_KEY in a still-picture sequence. What do you think?

Comment thread av2/decoder/decodeframe.c
if (obu_type != OBU_CLOSED_LOOP_KEY && obu_type != OBU_OPEN_LOOP_KEY) {
avm_internal_error(&cm->error, AVM_CODEC_CORRUPT_FRAME,
"Still pictures must be coded as keyframes");
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peter, Urvang: Do you know of a way to check if the still-picture sequence has more than one frame?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In a still-picture sequence, the decoder crashes when decoding a second frame of type OBU_BRIDGE_FRAME

2 participants