Skip to content

Commit

Permalink
[Decode] Align VPL default frame rate to 30fps
Browse files Browse the repository at this point in the history
Align codecs default frame rate to 30fps according to VPL document.
  • Loading branch information
XuanJessica authored and gfxVPLsdm committed Jul 23, 2024
1 parent e91df32 commit ff7ea47
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
11 changes: 11 additions & 0 deletions _studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,17 @@ mfxStatus VideoDECODEAV1::FillVideoParam(UMC_AV1_DECODER::AV1DecoderParams const
|| par->mfx.FrameInfo.FourCC == MFX_FOURCC_Y416)
par->mfx.FrameInfo.Shift = 1;

if (vp->framerate_n && vp->framerate_d)
{
par->mfx.FrameInfo.FrameRateExtN = vp->framerate_n;
par->mfx.FrameInfo.FrameRateExtD = vp->framerate_d;
}
else // If no frame rate info in bitstream, will set to default 30fps
{
par->mfx.FrameInfo.FrameRateExtN = 30;
par->mfx.FrameInfo.FrameRateExtD = 1;
}

return MFX_ERR_NONE;
}

Expand Down
4 changes: 3 additions & 1 deletion _studio/mfx_lib/decode/vp8/src/mfx_vp8_dec_decode_common.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020 Intel Corporation
// Copyright (c) 2014-2024 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 @@ -126,6 +126,8 @@ namespace VP8DecodeCommon
p_params->mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
p_params->mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
p_params->mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
p_params->mfx.FrameInfo.FrameRateExtN = 30;
p_params->mfx.FrameInfo.FrameRateExtD = 1;
MoveBitstreamData(*p_bs, n_bytes_offset);

return MFX_ERR_NONE;
Expand Down
5 changes: 4 additions & 1 deletion _studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2012-2019 Intel Corporation
// Copyright (c) 2012-2024 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 @@ -262,6 +262,9 @@ void FillVideoParam(eMFXPlatform platform, UMC_VP9_DECODER::VP9DecoderFrame cons
params.mfx.FrameInfo.Shift = 1;
}
}

params.mfx.FrameInfo.FrameRateExtN = 30;
params.mfx.FrameInfo.FrameRateExtD = 1;
}

} //MFX_VP9_Utility
Expand Down
5 changes: 5 additions & 0 deletions _studio/shared/umc/codec/av1_dec/include/umc_av1_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ namespace UMC_AV1_DECODER
, anchors_loaded(false)
, skip_first_frames(0)
, pre_loaded_anchors(nullptr)
, framerate_n(0)
, framerate_d(0)
{}

public:
Expand All @@ -72,6 +74,9 @@ namespace UMC_AV1_DECODER
bool anchors_loaded;
uint32_t skip_first_frames;
mfxFrameSurface1** pre_loaded_anchors;
uint32_t framerate_n; // (uint32_t) frame rate numerator
uint32_t framerate_d; // (uint32_t) frame rate denominator

};

class ReportItem // adopted from HEVC/AVC decoders
Expand Down
6 changes: 6 additions & 0 deletions _studio/shared/umc/codec/av1_dec/src/umc_av1_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,12 @@ namespace UMC_AV1_DECODER

par.film_grain = sh.film_grain_param_present;

par.framerate_n = sh.timing_info.time_scale;
par.framerate_d = sh.timing_info.num_units_in_display_tick;
if (sh.timing_info.num_units_in_display_tick && sh.timing_info.time_scale)
{
par.info.framerate = sh.timing_info.time_scale / sh.timing_info.num_units_in_display_tick;
}
return UMC::UMC_OK;
}

Expand Down
8 changes: 4 additions & 4 deletions _studio/shared/umc/codec/h264_dec/src/umc_h264_dec_mfx.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2003-2019 Intel Corporation
// Copyright (c) 2003-2024 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 @@ -180,10 +180,10 @@ Status FillVideoParam(const UMC_H264_DECODER::H264SeqParamSet * seq, mfxVideoPar
par->mfx.FrameInfo.FrameRateExtD = seq->vui.num_units_in_tick * 2;
par->mfx.FrameInfo.FrameRateExtN = seq->vui.time_scale;
}
else
else // If no frame rate info in bitstream, will set to default 30fps
{
par->mfx.FrameInfo.FrameRateExtD = 0;
par->mfx.FrameInfo.FrameRateExtN = 0;
par->mfx.FrameInfo.FrameRateExtD = 30;
par->mfx.FrameInfo.FrameRateExtN = 1;
}

par->mfx.CodecProfile = seq->profile_idc;
Expand Down
7 changes: 6 additions & 1 deletion _studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2020 Intel Corporation
// Copyright (c) 2017-2024 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 @@ -340,6 +340,11 @@ UMC::Status FillVideoParam(const H265VideoParamSet * vps, const H265SeqParamSet
par->mfx.FrameInfo.FrameRateExtD = seq->getTimingInfo()->vps_num_units_in_tick;
par->mfx.FrameInfo.FrameRateExtN = seq->getTimingInfo()->vps_time_scale;
}
else // If no frame rate info in bitstream, will set to default 30fps
{
par->mfx.FrameInfo.FrameRateExtN = 30;
par->mfx.FrameInfo.FrameRateExtD = 1;
}

par->mfx.CodecProfile = (mfxU16)seq->m_pcPTL.GetGeneralPTL()->profile_idc;
par->mfx.CodecLevel = (mfxU16)seq->m_pcPTL.GetGeneralPTL()->level_idc;
Expand Down
8 changes: 7 additions & 1 deletion _studio/shared/umc/codec/vvc_dec/src/umc_vvc_mfx_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022-2023 Intel Corporation
// Copyright (c) 2022-2024 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 @@ -121,6 +121,12 @@ namespace UMC_VVC_DECODER
par->mfx.FrameInfo.FrameRateExtD = (mfxU32)(pVps->general_timing_hrd_parameters.num_units_in_tick);
}
}
// If no frame rate info in bitstream, will set to default 30fps
if (!par->mfx.FrameInfo.FrameRateExtN || !par->mfx.FrameInfo.FrameRateExtD)
{
par->mfx.FrameInfo.FrameRateExtN = 30;
par->mfx.FrameInfo.FrameRateExtD = 1;
}

if (pSps->profile_tier_level.general_profile_idc == (VVC_STILL_PICTURE | VVC_MAIN_10))
par->mfx.CodecProfile = MFX_PROFILE_VVC_MAIN10;
Expand Down

0 comments on commit ff7ea47

Please sign in to comment.