Skip to content

Commit

Permalink
[Decode] Add MFX_ENABLE_VVC_VIDEO_DECODE define
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyuan-dev authored and gfxVPLsdm committed Jul 22, 2024
1 parent f01aabc commit 0a62bc9
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 44 deletions.
4 changes: 2 additions & 2 deletions _studio/mfx_lib/decode/vvc/src/mfx_vvc_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@

VideoDECODEVVC::VideoDECODEVVC(VideoCORE *core, mfxStatus *sts)
: m_core(core)
, m_isFirstRun(true)
, m_request()
, m_response()
, m_response_alien()
, m_stat()
, m_isInit(false)
, m_frameOrder((mfxU16)MFX_FRAMEORDER_UNKNOWN)
, m_isFirstRun(true)
, m_useDelayedDisplay(false)
, m_frameOrder((mfxU16)MFX_FRAMEORDER_UNKNOWN)
, m_is_cscInUse(false)
{
if (sts)
Expand Down
4 changes: 2 additions & 2 deletions _studio/shared/umc/codec/vvc_dec/include/umc_vvc_dec_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ namespace UMC_VVC_DECODER
return UMC::B_PICTURE;
case I_SLICE:
return UMC::I_PICTURE;
default:
return UMC::NONE_PICTURE;
}

return UMC::NONE_PICTURE;
}

enum ChannelType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ namespace UMC_VVC_DECODER

ReportItem(uint32_t index, uint8_t status)
: m_index(index)
, m_status(status)
, m_field(0)
, m_status(status)
{
}

Expand Down
4 changes: 2 additions & 2 deletions _studio/shared/umc/codec/vvc_dec/src/umc_vvc_au_splitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace UMC_VVC_DECODER
};

StartCodeSearcher::StartCodeSearcher()
: m_code(-1)
, m_pts(-1)
: m_pts(-1)
, m_code(-1)
, m_suggestedSize(10 * 1024)
{
m_mediaData.SetExData(&m_mediaDataEx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,8 @@ namespace UMC_VVC_DECODER
}
for (uint32_t nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++)
{
if ((nalOrVcl == 0) && (general_timing_hrd_parameters->general_nal_hrd_params_present_flag) ||
(nalOrVcl == 1) && (general_timing_hrd_parameters->general_vcl_hrd_params_present_flag))
if (((nalOrVcl == 0) && (general_timing_hrd_parameters->general_nal_hrd_params_present_flag)) ||
((nalOrVcl == 1) && (general_timing_hrd_parameters->general_vcl_hrd_params_present_flag)))
{
for (uint32_t j = 0; j <= general_timing_hrd_parameters->hrd_cpb_cnt_minus1; j++)
{
Expand All @@ -1675,8 +1675,8 @@ namespace UMC_VVC_DECODER
ols_timing_hrd_parameters->low_delay_hrd_flag[i] = ols_timing_hrd_parameters->low_delay_hrd_flag[MaxSubLayersVal];
for (uint32_t nalOrVcl = 0; nalOrVcl < 2; nalOrVcl++)
{
if ((nalOrVcl == 0) && (general_timing_hrd_parameters->general_nal_hrd_params_present_flag) ||
(nalOrVcl == 1) && (general_timing_hrd_parameters->general_vcl_hrd_params_present_flag))
if (((nalOrVcl == 0) && (general_timing_hrd_parameters->general_nal_hrd_params_present_flag)) ||
((nalOrVcl == 1) && (general_timing_hrd_parameters->general_vcl_hrd_params_present_flag)))
{
for (uint32_t j = 0; j <= general_timing_hrd_parameters->hrd_cpb_cnt_minus1; j++)
{
Expand Down
18 changes: 9 additions & 9 deletions _studio/shared/umc/codec/vvc_dec/src/umc_vvc_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,30 @@ namespace UMC_VVC_DECODER
, m_counter(0)
, m_firstMfxVideoParams()
, m_currFrame(nullptr)
, m_frameOrder(0)
, m_dpbSize(0)
, m_DPBSizeEx(0)
, m_sps_max_dec_pic_buffering(0)
, m_sps_max_num_reorder_pics(0)
, m_localDeltaFrameTime(0)
, m_useExternalFramerate(false)
, m_localFrameTime(0)
, m_currHeaders(&m_ObjHeap)
, m_decOrder(false)
, m_level_idc(0)
, m_frameOrder(0)
, m_pocRandomAccess(VVC_MAX_INT)
, m_sps_max_dec_pic_buffering(0)
, m_sps_max_num_reorder_pics(0)
, m_localFrameTime(0)
, m_maxUIDWhenDisplayed(0)
, m_level_idc(0)
, m_currHeaders(&m_ObjHeap)
, m_va(nullptr)
, m_RA_POC(0)
, m_noRaslOutputFlag(0)
, m_IRAPType()
, m_checkCRAInsideResetProcess(false)
, m_FirstAU(nullptr)
, m_IsShouldQuit(false)
, repeateFrame()
, m_prevSliceSkipped(false)
, m_skippedPOC(0)
, m_IRAPType()
, repeateFrame()
, m_skippedLayerID(0)
, m_pocRandomAccess(VVC_MAX_INT)
, m_tOlsIdxTidExternalSet(false)
, m_tOlsIdxTidOpiSet(false)
{
Expand Down
24 changes: 12 additions & 12 deletions _studio/shared/umc/codec/vvc_dec/src/umc_vvc_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
namespace UMC_VVC_DECODER
{
VVCDecoderFrameInfo::VVCDecoderFrameInfo(VVCDecoderFrame &Frame)
: m_frame(Frame)
, m_isFilled(false)
, m_IsIDR(0)
: m_IsIDR(0)
, m_frame(Frame)
, m_frameBeforeIDR(0)
, m_isFilled(false)
, m_Status()
, m_isIntraAU(0)
, m_nextAU(0)
, m_prevAU(0)
, m_refAU(0)
, m_Status()
{
}

Expand Down Expand Up @@ -103,7 +103,8 @@ namespace UMC_VVC_DECODER
}

VVCDecoderFrame::VVCDecoderFrame()
: m_decOrder(0xffffffff)
: m_frameOrder(0)
, m_decOrder(0xffffffff)
, m_displayOrder(0xffffffff)
, m_dFrameTime(-1.0)
, m_isOriginalPTS(false)
Expand All @@ -112,6 +113,10 @@ namespace UMC_VVC_DECODER
, m_verticalSize(0)
, m_aspectWidth(0)
, m_aspectHeight(0)
, m_RefPicListResetCount(0)
, m_pitchChroma(0)
, m_isFull(false)
, m_decFlush(false)
, m_data(new UMC::FrameData{})
, m_locked(0)
, m_decodingStarted(false)
Expand All @@ -120,17 +125,12 @@ namespace UMC_VVC_DECODER
, m_outputted(false)
, m_displayed(false)
, m_decoded(false)
, m_isFull(false)
, m_isRef(false)
, m_isSkipped(false)
, m_error(0)
, m_slicesInfo(*this)
, m_RefPicListResetCount(0)
, m_frameOrder(0)
, m_isInter(true)
, m_decFlush(false)
, m_pitchChroma(0)
, show_as_existing(false)
, m_isInter(true)
, m_slicesInfo(*this)
{
Reset();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
namespace UMC_VVC_DECODER
{
VVCSlice::VVCSlice()
: m_seqParamSet(0)
: m_tileByteLocation(0)
, m_picParamSet(0)
, m_tileByteLocation (0)
, m_seqParamSet(0)
{
m_picHeader = {};
m_adaptParamSet.clear();
Expand Down
20 changes: 10 additions & 10 deletions _studio/shared/umc/codec/vvc_dec/src/umc_vvc_va_packer_vaapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ namespace UMC_VVC_DECODER
uint32_t tile_count = pPicParamSet->pps_num_exp_tile_columns_minus1 + pPicParamSet->pps_num_exp_tile_rows_minus1 + 2;
UMC::UMCVACompBuffer* compBufTile = nullptr;
auto pTileParam = reinterpret_cast<uint16_t*>(m_va->GetCompBuffer(VATileBufferType, &compBufTile,sizeof(uint16_t) * tile_count));
if (!pTileParam || !compBufTile || (compBufTile->GetBufferSize() < sizeof(uint16_t)))
if (!pTileParam || !compBufTile || (static_cast<size_t>(compBufTile->GetBufferSize()) < sizeof(uint16_t)))
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);

memset(pTileParam, 0, sizeof(uint16_t) * tile_count);
Expand Down Expand Up @@ -260,7 +260,7 @@ namespace UMC_VVC_DECODER
uint32_t subpic_count = pSeqParamSet->sps_num_subpics_minus1 + 1;
UMC::UMCVACompBuffer* compBufSubpic = nullptr;
auto pSubpicParam = reinterpret_cast<VASubPicVVC*>(m_va->GetCompBuffer(VASubPicBufferType, &compBufSubpic,sizeof(VASubPicVVC) * subpic_count));
if (!pSubpicParam || !compBufSubpic || (compBufSubpic->GetBufferSize() < sizeof(VASubPicVVC)))
if (!pSubpicParam || !compBufSubpic || (static_cast<size_t>(compBufSubpic->GetBufferSize()) < sizeof(VASubPicVVC)))
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);
memset(pSubpicParam, 0, sizeof(VASubPicVVC) * subpic_count);

Expand Down Expand Up @@ -402,7 +402,7 @@ namespace UMC_VVC_DECODER
break;
uint32_t max_surf_num = pSlice->GetMaxSurfNum();
uint32_t refFramePOCidx = pPicParam->ReferenceFrames[idx].picture_id - max_surf_num; // should add sync depth
if (pPicParam->ReferenceFrames[refFramePOCidx].picture_id == sh_rpls[listIdx]->POC[i])
if (pPicParam->ReferenceFrames[refFramePOCidx].picture_id == static_cast<uint32_t>(sh_rpls[listIdx]->POC[i]))
{
pSliceParam->RefPicList[listIdx][i] = idx;
break;
Expand Down Expand Up @@ -483,12 +483,12 @@ namespace UMC_VVC_DECODER

UMC::UMCVACompBuffer* compBufferSlice = nullptr;
VASliceParameterBufferVVC* vvcSliceParamsLongBase = reinterpret_cast<VASliceParameterBufferVVC*>(m_va->GetCompBuffer(VASliceParameterBufferType, &compBufferSlice,sizeof(VASliceParameterBufferVVC) * slice_num));
if (!vvcSliceParamsLongBase || !compBufferSlice || (compBufferSlice->GetBufferSize() < sizeof(VASliceParameterBufferVVC) * slice_num))
if (!vvcSliceParamsLongBase || !compBufferSlice || (static_cast<size_t>(compBufferSlice->GetBufferSize()) < sizeof(VASliceParameterBufferVVC) * slice_num))
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);

size_t sliceDataBufferSize = 0;
int32_t alignedSize = 0;
for(int i = 0; i < slice_num; i++)
for(size_t i = 0; i < slice_num; i++)
{
VVCSlice *pSlice = pSliceInfo->GetSlice(i);
if(!pSlice)
Expand Down Expand Up @@ -516,7 +516,7 @@ namespace UMC_VVC_DECODER
uint32_t size = 0;
uint32_t* src_ptr = 0;
uint32_t size_before = 0;
for(int i = 0; i < slice_num; i++)
for(size_t i = 0; i < slice_num; i++)
{
vvcSliceParamsLongBase->slice_data_offset = size_before;
VVCSlice *pSlice = pSliceInfo->GetSlice(i);
Expand Down Expand Up @@ -876,7 +876,7 @@ namespace UMC_VVC_DECODER
// Pic params buffer packing
UMC::UMCVACompBuffer* compBufPic = nullptr;
auto picParam = reinterpret_cast<VAPictureParameterBufferVVC*>(m_va->GetCompBuffer(VAPictureParameterBufferType, &compBufPic,sizeof(VAPictureParameterBufferVVC)));
if (!picParam || !compBufPic || (compBufPic->GetBufferSize() < sizeof(VAPictureParameterBufferVVC)))
if (!picParam || !compBufPic || (static_cast<size_t>(compBufPic->GetBufferSize()) < sizeof(VAPictureParameterBufferVVC)))
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);

memset(picParam, 0, sizeof(VAPictureParameterBufferVVC));
Expand All @@ -894,7 +894,7 @@ namespace UMC_VVC_DECODER
}
UMC::UMCVACompBuffer* compBufAlf = nullptr;
auto alfParam = reinterpret_cast<VAAlfDataVVC*>(m_va->GetCompBuffer(VAAlfBufferType, &compBufAlf,sizeof(VAAlfDataVVC)*ALF_num));
if (!alfParam || !compBufAlf || (compBufAlf->GetBufferSize() < sizeof(VAAlfDataVVC)*ALF_num))
if (!alfParam || !compBufAlf || (static_cast<size_t>(compBufAlf->GetBufferSize()) < sizeof(VAAlfDataVVC)*ALF_num))
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);
memset(alfParam, 0, sizeof(VAAlfDataVVC)*ALF_num);
pFirstSlice->aps_num[ALF_APS] = ALF_num; // return the actual No.
Expand All @@ -913,7 +913,7 @@ namespace UMC_VVC_DECODER
// LMCS buffer packing
UMC::UMCVACompBuffer* compBufLmcs = nullptr;
auto lmcsParam = reinterpret_cast<VALmcsDataVVC*>(m_va->GetCompBuffer(VALmcsBufferType, &compBufLmcs,sizeof(VALmcsDataVVC)*LMCS_num));
if (!lmcsParam || !compBufLmcs || (compBufLmcs->GetBufferSize() < sizeof(VALmcsDataVVC)))
if (!lmcsParam || !compBufLmcs || (static_cast<size_t>(compBufLmcs->GetBufferSize()) < sizeof(VALmcsDataVVC)))
{
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);
}
Expand All @@ -933,7 +933,7 @@ namespace UMC_VVC_DECODER
// ScalingList buffer packing
UMC::UMCVACompBuffer* compBufSL = nullptr;
auto scalingParam = reinterpret_cast<VAScalingListVVC*>(m_va->GetCompBuffer(VAIQMatrixBufferType, &compBufSL,sizeof(VAScalingListVVC)*scalinglist_num));
if (!scalingParam || !compBufSL || (compBufSL->GetBufferSize() < sizeof(VAScalingListVVC)))
if (!scalingParam || !compBufSL || (static_cast<size_t>(compBufSL->GetBufferSize()) < sizeof(VAScalingListVVC)))
{
throw vvc_exception(MFX_ERR_MEMORY_ALLOC);
}
Expand Down
1 change: 1 addition & 0 deletions mfx_features.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
#cmakedefine MFX_ENABLE_MJPEG_VIDEO_ENCODE
#cmakedefine MFX_ENABLE_VC1_VIDEO_DECODE
#cmakedefine MFX_ENABLE_AV1_VIDEO_DECODE
#cmakedefine MFX_ENABLE_VVC_VIDEO_DECODE

0 comments on commit 0a62bc9

Please sign in to comment.