avcodec/av1_parser: read frame properties directly from AV1RawFrameHeader
Simplifies code Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -99,7 +99,6 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
|||||||
CodedBitstreamUnit *unit = &td->units[i];
|
CodedBitstreamUnit *unit = &td->units[i];
|
||||||
AV1RawOBU *obu = unit->content;
|
AV1RawOBU *obu = unit->content;
|
||||||
AV1RawFrameHeader *frame;
|
AV1RawFrameHeader *frame;
|
||||||
int frame_type;
|
|
||||||
|
|
||||||
if (unit->type == AV1_OBU_FRAME)
|
if (unit->type == AV1_OBU_FRAME)
|
||||||
frame = &obu->obu.frame.header;
|
frame = &obu->obu.frame.header;
|
||||||
@ -111,30 +110,15 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
|||||||
if (obu->header.spatial_id > 0)
|
if (obu->header.spatial_id > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (frame->show_existing_frame) {
|
if (!frame->show_frame)
|
||||||
AV1ReferenceFrameState *ref = &av1->ref[frame->frame_to_show_map_idx];
|
|
||||||
|
|
||||||
if (!ref->valid) {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "Invalid reference frame\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->width = ref->frame_width;
|
|
||||||
ctx->height = ref->frame_height;
|
|
||||||
frame_type = ref->frame_type;
|
|
||||||
|
|
||||||
ctx->key_frame = 0;
|
|
||||||
} else if (!frame->show_frame) {
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
ctx->width = av1->frame_width;
|
|
||||||
ctx->height = av1->frame_height;
|
|
||||||
frame_type = frame->frame_type;
|
|
||||||
|
|
||||||
ctx->key_frame = frame_type == AV1_FRAME_KEY;
|
ctx->width = frame->frame_width_minus_1 + 1;
|
||||||
}
|
ctx->height = frame->frame_height_minus_1 + 1;
|
||||||
|
|
||||||
switch (frame_type) {
|
ctx->key_frame = frame->frame_type == AV1_FRAME_KEY && !frame->show_existing_frame;
|
||||||
|
|
||||||
|
switch (frame->frame_type) {
|
||||||
case AV1_FRAME_KEY:
|
case AV1_FRAME_KEY:
|
||||||
case AV1_FRAME_INTRA_ONLY:
|
case AV1_FRAME_INTRA_ONLY:
|
||||||
ctx->pict_type = AV_PICTURE_TYPE_I;
|
ctx->pict_type = AV_PICTURE_TYPE_I;
|
||||||
|
Reference in New Issue
Block a user