Skip to content

Commit

Permalink
[Decode] Aligne the beh of Av1 multi sequence header with Spec (#6250)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuan, Pengxin <[email protected]>
  • Loading branch information
gfxVPLsdm and pengxin99 authored Dec 12, 2023
1 parent b25b83a commit 0237fcd
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
5 changes: 4 additions & 1 deletion _studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Intel Corporation
// Copyright (c) 2017-2023 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -1032,6 +1032,9 @@ mfxStatus VideoDECODEAV1::SubmitFrame(mfxBitstream* bs, mfxFrameSurface1* surfac
case UMC::UMC_ERR_SYNC:
sts = MFX_ERR_MORE_DATA;
break;
case UMC::UMC_ERR_INVALID_PARAMS:
sts = MFX_ERR_INVALID_VIDEO_PARAM;
break;

default:
if (sts < 0 || umcRes < 0)
Expand Down
15 changes: 14 additions & 1 deletion _studio/shared/umc/codec/av1_dec/include/umc_av1_decoder.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2012-2021 Intel Corporation
// Copyright (c) 2012-2023 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -128,6 +128,18 @@ namespace UMC_AV1_DECODER
{ return UMC::UMC_ERR_NOT_IMPLEMENTED; }
virtual uint32_t GetNumOfSkippedFrames() override
{ return 0; }
bool is_seq_header_ready() const
{
return sequence_header_ready;
}
void set_seq_header_ready()
{
sequence_header_ready = true;
}
void clean_seq_header_ready()
{
sequence_header_ready = false;
}

public:

Expand Down Expand Up @@ -211,6 +223,7 @@ namespace UMC_AV1_DECODER
uint32_t saved_clip_info_width;
uint32_t saved_clip_info_height;
bool clip_info_size_saved;
bool sequence_header_ready;

FrameHeader m_prev_frame_header;
bool m_prev_frame_header_exist;
Expand Down
23 changes: 22 additions & 1 deletion _studio/shared/umc/codec/av1_dec/src/umc_av1_decoder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021 Intel Corporation
// Copyright (c) 2017-2023 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -54,6 +54,7 @@ namespace UMC_AV1_DECODER
, saved_clip_info_width(0)
, saved_clip_info_height(0)
, clip_info_size_saved(false)
, sequence_header_ready(false)
, m_prev_frame_header_exist(false)
, m_specified_anchor_Idx(0)
, m_isAnchor(false)
Expand Down Expand Up @@ -641,6 +642,7 @@ namespace UMC_AV1_DECODER
assert(!AllocComplete(*pFrameInProgress));
pCurrFrame = pFrameInProgress;
gotFullFrame = true;
clean_seq_header_ready();
}
else
{
Expand Down Expand Up @@ -694,10 +696,21 @@ namespace UMC_AV1_DECODER
// check if sequence header has been changed
if (IsNeedSPSInvalidate(old_seqHdr.get(), sequence_header.get()))
{
// According to Spec Section 7.5 the contents of sequence_header_obu must be
// bit-identical each time the sequence header
// appears except for the contents of operating_parameters_info
if (is_seq_header_ready())
{
assert(!"Multi sequence_header_obu not bit-identical!");
return UMC::UMC_ERR_INVALID_PARAMS;
}

Update_drc(sequence_header.get());
// new resolution required
return UMC::UMC_NTF_NEW_RESOLUTION;
}

set_seq_header_ready();
break;
}
case OBU_TILE_LIST:
Expand Down Expand Up @@ -746,6 +759,7 @@ namespace UMC_AV1_DECODER
in->MoveDataPointer(OBUOffset); // do not submit frame header in data buffer
OBUOffset = 0;
gotFullFrame = true; // tile list is a complete frame
clean_seq_header_ready();
tile_list_idx++;
break;
case OBU_FRAME_HEADER:
Expand Down Expand Up @@ -776,11 +790,13 @@ namespace UMC_AV1_DECODER
gotFullFrame = true;
frames_to_skip--;
fh.is_anchor = 1;
clean_seq_header_ready();
}
else if (anchor_decode)
{
gotFullFrame = true;
fh.is_anchor = 1;
clean_seq_header_ready();
}
else
{
Expand All @@ -794,6 +810,7 @@ namespace UMC_AV1_DECODER
{
repeatedFrame = true;
gotFullFrame = true;
clean_seq_header_ready();
}
break;
}
Expand All @@ -814,6 +831,10 @@ namespace UMC_AV1_DECODER
{
ReadTileGroup(layout, bs, *pFH, OBUOffset, obuInfo.size);
gotFullFrame = GotFullFrame(pFrameInProgress, *pFH, layout);
if(gotFullFrame)
{
clean_seq_header_ready();
}
break;
}
}
Expand Down

0 comments on commit 0237fcd

Please sign in to comment.