From 5b902a40b0f1ca53ce4084326a8eac8529261086 Mon Sep 17 00:00:00 2001 From: "Wang, Yuchen" Date: Fri, 26 Feb 2021 14:12:33 +0800 Subject: [PATCH] OpenSource Align and Macro Standardization --- .../decode/h265/include/mfx_h265_dec_decode.h | 5 +- .../decode/h265/src/mfx_h265_dec_decode.cpp | 131 ++++++++---------- .../umc_h265_va_packer_common_g12.hpp | 2 - .../platform/umc_h265_va_packer_vaapi_g12.hpp | 4 +- .../h265_dec/include/umc_h265_au_splitter.h | 8 +- .../include/umc_h265_bitstream_headers.h | 9 +- .../codec/h265_dec/include/umc_h265_debug.h | 8 +- .../h265_dec/include/umc_h265_dec_defs.h | 27 ++-- .../codec/h265_dec/include/umc_h265_frame.h | 11 +- .../h265_dec/include/umc_h265_frame_info.h | 10 +- .../h265_dec/include/umc_h265_frame_list.h | 8 +- .../codec/h265_dec/include/umc_h265_headers.h | 10 +- .../codec/h265_dec/include/umc_h265_heap.h | 8 +- .../h265_dec/include/umc_h265_mfx_supplier.h | 8 +- .../h265_dec/include/umc_h265_mfx_utils.h | 8 +- .../codec/h265_dec/include/umc_h265_nal_spl.h | 8 +- .../codec/h265_dec/include/umc_h265_notify.h | 8 +- .../include/umc_h265_segment_decoder_base.h | 8 +- .../include/umc_h265_segment_decoder_dxva.h | 8 +- .../include/umc_h265_slice_decoding.h | 5 +- .../codec/h265_dec/include/umc_h265_tables.h | 10 +- .../h265_dec/include/umc_h265_task_broker.h | 10 +- .../h265_dec/include/umc_h265_task_supplier.h | 17 ++- .../h265_dec/include/umc_h265_va_packer.h | 10 +- .../include/umc_h265_va_packer_vaapi.h | 9 +- .../h265_dec/include/umc_h265_va_supplier.h | 8 +- .../umc/codec/h265_dec/include/umc_h265_yuv.h | 8 +- .../h265_dec/src/umc_h265_au_splitter.cpp | 8 +- .../src/umc_h265_bitstream_headers.cpp | 19 +-- .../umc/codec/h265_dec/src/umc_h265_debug.cpp | 9 +- .../umc/codec/h265_dec/src/umc_h265_frame.cpp | 12 +- .../h265_dec/src/umc_h265_frame_info.cpp | 12 +- .../h265_dec/src/umc_h265_frame_list.cpp | 8 +- .../umc/codec/h265_dec/src/umc_h265_heap.cpp | 9 +- .../h265_dec/src/umc_h265_mfx_supplier.cpp | 3 +- .../codec/h265_dec/src/umc_h265_mfx_utils.cpp | 52 +++---- .../codec/h265_dec/src/umc_h265_nal_spl.cpp | 10 +- .../h265_dec/src/umc_h265_scaling_list.cpp | 8 +- .../src/umc_h265_segment_decoder_dxva.cpp | 11 +- .../umc/codec/h265_dec/src/umc_h265_sei.cpp | 2 +- .../h265_dec/src/umc_h265_slice_decoding.cpp | 5 +- .../codec/h265_dec/src/umc_h265_tables.cpp | 9 +- .../h265_dec/src/umc_h265_task_broker.cpp | 19 +-- .../h265_dec/src/umc_h265_task_supplier.cpp | 22 ++- .../codec/h265_dec/src/umc_h265_va_packer.cpp | 10 +- .../h265_dec/src/umc_h265_va_packer_cenc.cpp | 11 +- .../h265_dec/src/umc_h265_va_packer_vaapi.cpp | 9 +- .../h265_dec/src/umc_h265_va_supplier.cpp | 9 +- .../umc/codec/h265_dec/src/umc_h265_yuv.cpp | 23 ++- 49 files changed, 298 insertions(+), 348 deletions(-) diff --git a/_studio/mfx_lib/decode/h265/include/mfx_h265_dec_decode.h b/_studio/mfx_lib/decode/h265/include/mfx_h265_dec_decode.h index b0d8f1e907..00680a7c37 100644 --- a/_studio/mfx_lib/decode/h265/include/mfx_h265_dec_decode.h +++ b/_studio/mfx_lib/decode/h265/include/mfx_h265_dec_decode.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -49,9 +49,9 @@ namespace UMC_HEVC_DECODER class VATaskSupplier; class H265DecoderFrame; } - typedef UMC_HEVC_DECODER::VATaskSupplier MFX_AVC_Decoder_H265; + class VideoDECODE; // HEVC decoder interface class class VideoDECODEH265 : public VideoDECODE @@ -114,7 +114,6 @@ class VideoDECODEH265 : public VideoDECODE // Fill up resolution information if new header arrived void FillVideoParam(mfxVideoParamWrapper *par, bool full); - // Fill up frame allocator request data mfxStatus UpdateAllocRequest(mfxVideoParam *par, mfxFrameAllocRequest *request, diff --git a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp index 11d12fc3a1..9b9d8a75c4 100644 --- a/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp +++ b/_studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -30,14 +30,12 @@ #include "umc_h265_frame_list.h" #include "vm_sys_info.h" - #include "umc_h265_va_supplier.h" #include "umc_va_linux_protected.h" #include "umc_va_video_processing.h" #include "mfx_session.h" using namespace UMC_HEVC_DECODER; - inline mfxU32 CalculateAsyncDepth(eMFXPlatform platform, mfxVideoParam *par) { @@ -194,7 +192,6 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) MFX_CHECK_NULL_PTR1(par); - m_platform = MFX_Utility::GetPlatform_H265(m_core, par); eMFXHWType type = MFX_HW_UNKNOWN; @@ -221,17 +218,23 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) m_vPar.mfx.NumThread = (mfxU16)CalculateNumThread(par, m_platform); if (MFX_PLATFORM_SOFTWARE == m_platform) + { return MFX_ERR_UNSUPPORTED; - m_useDelayedDisplay = ENABLE_DELAYED_DISPLAY_MODE != 0 && IsNeedToUseHWBuffering(m_core->GetHWType()) && (asyncDepth != 1); + } + else + { + m_useDelayedDisplay = ENABLE_DELAYED_DISPLAY_MODE != 0 && IsNeedToUseHWBuffering(m_core->GetHWType()) && (asyncDepth != 1); + bool useBigSurfacePoolWA = MFX_Utility::IsBugSurfacePoolApplicable(type, par); - bool useBigSurfacePoolWA = MFX_Utility::IsBugSurfacePoolApplicable(type, par); + m_pH265VideoDecoder.reset(useBigSurfacePoolWA ? new VATaskSupplierBigSurfacePool() : new VATaskSupplier()); // HW + m_FrameAllocator.reset(new mfx_UMC_FrameAllocator_D3D()); - m_pH265VideoDecoder.reset(useBigSurfacePoolWA ? new VATaskSupplierBigSurfacePool() : new VATaskSupplier()); // HW - m_FrameAllocator.reset(new mfx_UMC_FrameAllocator_D3D()); + } int32_t useInternal = (MFX_PLATFORM_SOFTWARE == m_platform) ? (m_vPar.IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) : (m_vPar.IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY); + #ifndef MFX_DEC_VIDEO_POSTPROCESS_DISABLE mfxExtDecVideoProcessing * videoProcessing = (mfxExtDecVideoProcessing *)GetExtendedBuffer(par->ExtParam, par->NumExtParam, MFX_EXTBUFF_DEC_VIDEO_PROCESSING); /* There are following conditions for post processing via HW fixed function engine: @@ -244,13 +247,14 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) MFX_CHECK(m_core->GetHWType() >= MFX_HW_SCL && (m_vPar.IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY), MFX_ERR_UNSUPPORTED); + //PicStruct support differs, need to check per-platform if (m_core->GetHWType() <= MFX_HW_ICL_LP) { MFX_CHECK(m_vPar.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_PROGRESSIVE, MFX_ERR_UNSUPPORTED); } MFX_CHECK(par->mfx.FrameInfo.FourCC == videoProcessing->Out.FourCC, MFX_ERR_UNSUPPORTED);//This is to avoid CSC cases, will remove once CSC is fully tested - bool is_fourcc_supported = false; + bool is_fourcc_supported = false; if (m_core->GetHWType() < MFX_HW_TGL_LP) { is_fourcc_supported = @@ -284,7 +288,6 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) useInternal = 1; } #endif - if (m_vPar.IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) { mfxExtOpaqueSurfaceAlloc *pOpaqAlloc = (mfxExtOpaqueSurfaceAlloc *)GetExtendedBuffer(par->ExtParam, par->NumExtParam, MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION); @@ -368,12 +371,10 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) { m_FrameAllocator->SetExternalFramesResponse(&m_response); } - if (m_platform != MFX_PLATFORM_SOFTWARE) { mfxSts = m_core->CreateVA(&m_vFirstPar, &request, &m_response, m_FrameAllocator.get()); - if (mfxSts < MFX_ERR_NONE) - return mfxSts; + MFX_CHECK(mfxSts >= MFX_ERR_NONE, mfxSts); } UMC::Status umcSts = m_FrameAllocator->InitMfx(0, m_core, &m_vFirstPar, &request, &m_response, !useInternal, m_platform == MFX_PLATFORM_SOFTWARE); @@ -395,7 +396,6 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) ConvertMFXParamsToUMC(&m_vFirstPar, &umcVideoParams); umcVideoParams.numThreads = m_vPar.mfx.NumThread; umcVideoParams.info.bitrate = asyncDepth - umcVideoParams.numThreads; // buffered frames - if (MFX_PLATFORM_SOFTWARE != m_platform) { m_core->GetVA((mfxHDL*)&m_va, MFX_MEMTYPE_FROM_DECODE); @@ -420,7 +420,6 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) m_frameOrder = (mfxU16)MFX_FRAMEORDER_UNKNOWN; m_isFirstRun = true; - if (MFX_PLATFORM_SOFTWARE != m_platform && m_useDelayedDisplay) { static_cast(m_pH265VideoDecoder.get())->SetBufferedFramesNumber(NUMBER_OF_ADDITIONAL_FRAMES); @@ -434,10 +433,7 @@ mfxStatus VideoDECODEH265::Init(mfxVideoParam *par) MFX_RETURN(MFX_ERR_UNSUPPORTED); } - if (isNeedChangeVideoParamWarning) - { - return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM; - } + MFX_CHECK(!isNeedChangeVideoParamWarning, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM); return MFX_ERR_NONE; } @@ -461,14 +457,17 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par) #ifndef MFX_DEC_VIDEO_POSTPROCESS_DISABLE mfxExtDecVideoProcessing * videoProcessing = (mfxExtDecVideoProcessing *)GetExtendedBuffer(m_vFirstPar.ExtParam, m_vFirstPar.NumExtParam, MFX_EXTBUFF_DEC_VIDEO_PROCESSING); + if (videoProcessing != nullptr) { // hardware resize is enabled bool hardwareUpscale = videoProcessing->Out.Width >= par->mfx.FrameInfo.Width || videoProcessing->Out.Height >= par->mfx.FrameInfo.Height; + if (hardwareUpscale) { + // for now only downscale is supported return MFX_ERR_INVALID_VIDEO_PARAM; } } @@ -501,7 +500,6 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par) m_vPar.mfx.NumThread = (mfxU16)CalculateNumThread(par, m_platform); - m_pH265VideoDecoder->SetVideoParams(&m_vFirstPar); if (m_platform != m_core->GetPlatformType()) @@ -510,10 +508,7 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par) MFX_RETURN(MFX_ERR_UNSUPPORTED); } - if (isNeedChangeVideoParamWarning) - { - return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM; - } + MFX_CHECK(!isNeedChangeVideoParamWarning, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM); return MFX_ERR_NONE; } @@ -541,7 +536,6 @@ mfxStatus VideoDECODEH265::Close(void) m_frameOrder = (mfxU16)MFX_FRAMEORDER_UNKNOWN; m_va = 0; memset(&m_stat, 0, sizeof(m_stat)); - return MFX_ERR_NONE; } @@ -583,8 +577,6 @@ mfxStatus VideoDECODEH265::GetVideoParam(mfxVideoParam *par) par->Protected = m_vPar.Protected; par->IOPattern = m_vPar.IOPattern; par->AsyncDepth = m_vPar.AsyncDepth; - - mfxExtVideoSignalInfo * videoSignal = (mfxExtVideoSignalInfo *)GetExtendedBuffer(par->ExtParam, par->NumExtParam, MFX_EXTBUFF_VIDEO_SIGNAL_INFO); if (videoSignal) { @@ -679,9 +671,7 @@ mfxStatus VideoDECODEH265::DecodeHeader(VideoCORE *core, mfxBitstream *bs, mfxVi decoder.SetMemoryAllocator(&tempAllocator); UMC::Status umcRes = MFX_Utility::DecodeHeader(&decoder, &avcInfo, bs, par); - if (umcRes == UMC::UMC_ERR_NOT_ENOUGH_DATA) - return MFX_ERR_MORE_DATA; - + MFX_CHECK(umcRes != UMC::UMC_ERR_NOT_ENOUGH_DATA, MFX_ERR_MORE_DATA); MFX_CHECK(umcRes == UMC::UMC_OK, ConvertUMCStatusToMfx(umcRes)); umcRes = FillParam(core, &decoder, par, false); @@ -737,25 +727,26 @@ mfxStatus VideoDECODEH265::QueryIOSurf(VideoCORE *core, mfxVideoParam *par, mfxF params = *par; bool isNeedChangeVideoParamWarning = IsNeedChangeVideoParam(¶ms); - MFX_CHECK( - par->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY || - par->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY || - par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY, - MFX_ERR_INVALID_VIDEO_PARAM); + auto const supportedMemoryType = + (par->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) + || (par->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) + || (par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) + ; + + MFX_CHECK(supportedMemoryType, MFX_ERR_INVALID_VIDEO_PARAM); MFX_CHECK(!( par->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY && par->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY), MFX_ERR_INVALID_VIDEO_PARAM); - MFX_CHECK(!( - par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY && - par->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY), + par->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY && + par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY), MFX_ERR_INVALID_VIDEO_PARAM); MFX_CHECK(!( - par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY && - par->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY), + par->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY && + par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY), MFX_ERR_INVALID_VIDEO_PARAM); int32_t isInternalManaging = (MFX_PLATFORM_SOFTWARE == platform) ? @@ -773,7 +764,6 @@ mfxStatus VideoDECODEH265::QueryIOSurf(VideoCORE *core, mfxVideoParam *par, mfxF else request->Type = MFX_MEMTYPE_SYSTEM_MEMORY | MFX_MEMTYPE_FROM_DECODE; } - if (par->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) { request->Type |= MFX_MEMTYPE_OPAQUE_FRAME; @@ -789,10 +779,7 @@ mfxStatus VideoDECODEH265::QueryIOSurf(VideoCORE *core, mfxVideoParam *par, mfxF MFX_RETURN(MFX_ERR_UNSUPPORTED); } - if (isNeedChangeVideoParamWarning) - { - return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM; - } + MFX_CHECK(!isNeedChangeVideoParamWarning, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM); return MFX_ERR_NONE; } @@ -1028,10 +1015,13 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * MFX_CHECK_NULL_PTR2(surface_work, surface_out); mfxStatus sts = MFX_ERR_NONE; - sts = bs ? CheckBitstream(bs) : MFX_ERR_NONE; - if (sts != MFX_ERR_NONE) - return sts; + if (bs) + { + sts = CheckBitstream(bs); + MFX_CHECK_STS(sts); + } + UMC::Status umcRes = UMC::UMC_OK; *surface_out = 0; @@ -1053,17 +1043,17 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * MFX_CHECK(sts == MFX_ERR_NONE, MFX_ERR_INVALID_VIDEO_PARAM); sts = CheckFrameData(surface_work); + MFX_CHECK_STS(sts); sts = m_FrameAllocator->SetCurrentMFXSurface(surface_work, m_isOpaq); MFX_CHECK_STS(sts); - sts = MFX_ERR_UNDEFINED_BEHAVIOR; - if (bs && IS_PROTECTION_ANY(m_vPar.Protected)) { MFX_CHECK(m_va->GetProtectedVA() && (bs->DataFlag & MFX_BITSTREAM_COMPLETE_FRAME), MFX_ERR_UNDEFINED_BEHAVIOR); m_va->GetProtectedVA()->SetBitstream(bs); } + #ifndef MFX_DEC_VIDEO_POSTPROCESS_DISABLE if (m_va->GetVideoProcessingVA() && m_core->GetVAType() == MFX_HW_VAAPI) { @@ -1076,9 +1066,9 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * m_va->GetVideoProcessingVA()->SetOutputSurface(surfHDL); } #endif // !MFX_DEC_VIDEO_POSTPROCESS_DISABLE + //gpu session priority m_va->m_ContextPriority = m_core->GetSession()->m_priority; - try { bool force = false; @@ -1090,14 +1080,8 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * for (;;) { - if (m_FrameAllocator->FindFreeSurface() == -1) - { - umcRes = UMC::UMC_ERR_NEED_FORCE_OUTPUT; - } - else - { - umcRes = m_pH265VideoDecoder->AddSource(bs ? &src : 0); - } + umcRes = m_FrameAllocator->FindFreeSurface() == -1 ? + UMC::UMC_ERR_NEED_FORCE_OUTPUT : m_pH265VideoDecoder->AddSource(bs ? &src : 0); umcAddSourceRes = umcFrameRes = umcRes; @@ -1122,7 +1106,6 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * if (umcRes == UMC::UMC_ERR_INVALID_STREAM) { umcAddSourceRes = umcFrameRes = umcRes = UMC::UMC_OK; - } if (umcRes == UMC::UMC_NTF_NEW_RESOLUTION) @@ -1148,8 +1131,6 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * force = true; sts = MFX_ERR_MORE_DATA; } - -#if defined (MFX_VA_LINUX) if (umcRes == UMC::UMC_ERR_DEVICE_FAILED) { sts = MFX_ERR_DEVICE_FAILED; @@ -1158,11 +1139,8 @@ mfxStatus VideoDECODEH265::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1 * { sts = MFX_ERR_GPU_HANG; } -#endif - { - src.Save(bs); - } + src.Save(bs); if (sts == MFX_ERR_INCOMPATIBLE_VIDEO_PARAM) return sts; @@ -1293,6 +1271,7 @@ void VideoDECODEH265::FillOutputSurface(mfxFrameSurface1 **surf_out, mfxFrameSur surface_out->Info.CropY = videoProcessing->Out.CropY; } #endif + bool isShouldUpdate = !(m_vFirstPar.mfx.FrameInfo.AspectRatioH || m_vFirstPar.mfx.FrameInfo.AspectRatioW); surface_out->Info.AspectRatioH = isShouldUpdate ? (mfxU16)pFrame->m_aspect_height : m_vFirstPar.mfx.FrameInfo.AspectRatioH; @@ -1364,7 +1343,6 @@ void VideoDECODEH265::FillOutputSurface(mfxFrameSurface1 **surf_out, mfxFrameSur if (pFrame->m_isUsedAsReference) info->FrameType |= MFX_FRAMETYPE_REF; } - } // Wait until a frame is ready to be output and set necessary surface flags @@ -1524,7 +1502,8 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode) MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED); int32_t test_num = 0; - m_pH265VideoDecoder->ChangeVideoDecodingSpeed(test_num); + mfxStatus sts = m_pH265VideoDecoder->ChangeVideoDecodingSpeed(test_num); + MFX_CHECK_STS(sts); int32_t num = 0; @@ -1553,8 +1532,13 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode) // Check if new parameters are compatible with new parameters bool VideoDECODEH265::IsSameVideoParam(mfxVideoParam * newPar, mfxVideoParam * oldPar, eMFXHWType type) { - if ((newPar->IOPattern & (MFX_IOPATTERN_OUT_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY)) != - (oldPar->IOPattern & (MFX_IOPATTERN_OUT_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY)) ) + auto const mask = + MFX_IOPATTERN_OUT_SYSTEM_MEMORY + | MFX_IOPATTERN_OUT_VIDEO_MEMORY + | MFX_IOPATTERN_OUT_OPAQUE_MEMORY + ; + if ((newPar->IOPattern & mask) != + (oldPar->IOPattern & mask)) { return false; } @@ -1612,7 +1596,6 @@ bool VideoDECODEH265::IsSameVideoParam(mfxVideoParam * newPar, mfxVideoParam * o { return false; } - if (oldPar->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) { mfxExtOpaqueSurfaceAlloc * opaqueNew = (mfxExtOpaqueSurfaceAlloc *)GetExtendedBuffer(newPar->ExtParam, newPar->NumExtParam, MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION); @@ -1651,6 +1634,7 @@ bool VideoDECODEH265::IsSameVideoParam(mfxVideoParam * newPar, mfxVideoParam * o #ifndef MFX_DEC_VIDEO_POSTPROCESS_DISABLE mfxExtDecVideoProcessing * newVideoProcessing = (mfxExtDecVideoProcessing *)GetExtendedBuffer(newPar->ExtParam, newPar->NumExtParam, MFX_EXTBUFF_DEC_VIDEO_PROCESSING); mfxExtDecVideoProcessing * oldVideoProcessing = (mfxExtDecVideoProcessing *)GetExtendedBuffer(oldPar->ExtParam, oldPar->NumExtParam, MFX_EXTBUFF_DEC_VIDEO_PROCESSING); + if (((newVideoProcessing) && (!oldVideoProcessing)) || ((!newVideoProcessing) && (oldVideoProcessing))) return false; @@ -1660,11 +1644,14 @@ bool VideoDECODEH265::IsSameVideoParam(mfxVideoParam * newPar, mfxVideoParam * o return false; if (newVideoProcessing->Out.Height > oldVideoProcessing->Out.Height) return false; + /* Check Input cropping */ if (!((newVideoProcessing->In.CropX <= newVideoProcessing->In.CropW) && (newVideoProcessing->In.CropW <= newPar->mfx.FrameInfo.CropW) && (newVideoProcessing->In.CropY <= newVideoProcessing->In.CropH) && (newVideoProcessing->In.CropH <= newPar->mfx.FrameInfo.CropH))) return false; + + /* Check output cropping */ if (!((newVideoProcessing->Out.CropX <= newVideoProcessing->Out.CropW) && (newVideoProcessing->Out.CropW <= newVideoProcessing->Out.Width) && ((newVideoProcessing->Out.CropX + newVideoProcessing->Out.CropH) @@ -1674,11 +1661,11 @@ bool VideoDECODEH265::IsSameVideoParam(mfxVideoParam * newPar, mfxVideoParam * o ((newVideoProcessing->Out.CropY + newVideoProcessing->Out.CropH) <= newVideoProcessing->Out.Height))) return false; + } #endif //MFX_DEC_VIDEO_POSTPROCESS_DISABLE return true; } - // Fill up frame allocator request data mfxStatus VideoDECODEH265::UpdateAllocRequest(mfxVideoParam *par, mfxFrameAllocRequest *request, diff --git a/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_common_g12.hpp b/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_common_g12.hpp index 2fa96e7c32..b338560f5a 100644 --- a/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_common_g12.hpp +++ b/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_common_g12.hpp @@ -146,7 +146,6 @@ namespace UMC_HEVC_DECODER uint32_t tileXIdx = slice->getTileXIdx(); uint32_t tileYIdx = slice->getTileYIdx(); - auto step = GetEntryPointOffsetStep(slice, tileYIdx); //'m_tileByteLocation' contains absolute offsets, but we have to pass relative ones just as they are in a bitstream @@ -167,7 +166,6 @@ namespace UMC_HEVC_DECODER tileXIdx = 0; tileYIdx++; } - step = GetEntryPointOffsetStep(slice, tileYIdx); } } diff --git a/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_vaapi_g12.hpp b/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_vaapi_g12.hpp index 410814b020..9afe8f0c51 100755 --- a/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_vaapi_g12.hpp +++ b/_studio/shared/umc/codec/h265_dec/include/platform/umc_h265_va_packer_vaapi_g12.hpp @@ -32,13 +32,11 @@ namespace UMC_HEVC_DECODER namespace G12 { inline - void PackPicHeader(UMC::VideoAccelerator*, H265DecoderFrame const* frame, H265DBPList const* dpb, VAPictureParameterBufferHEVCScc* pp) + void PackPicHeader(UMC::VideoAccelerator*, H265DecoderFrame const* frame, H265DBPList const*, VAPictureParameterBufferHEVCScc* pp) { assert(frame); - assert(dpb); assert(pp); - (void)dpb; auto si = frame->GetAU(); if (!si) throw h265_exception(UMC::UMC_ERR_FAILED); diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_au_splitter.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_au_splitter.h index 12a8e9063d..cda3b5986b 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_au_splitter.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_au_splitter.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_bitstream_headers.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_bitstream_headers.h index c42c48c071..c49ed007f6 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_bitstream_headers.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_bitstream_headers.h @@ -1,15 +1,15 @@ -// Copyright (c) 2020 Intel Corporation -// +// Copyright (c) 2012-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -213,7 +213,6 @@ class H265BaseBitstream template inline uint32_t GetPredefinedBits(); - // Read variable length coded unsigned element uint32_t GetVLCElementU(); diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_debug.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_debug.h index 95952e83bb..cf33174e0b 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_debug.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_debug.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h index 1f4281f009..5e88f8e2e6 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_dec_defs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -30,11 +30,11 @@ namespace UMC_HEVC_DECODER { - #define H265_FORCEINLINE __attribute__((always_inline)) #define H265_NONLINE __attribute__((noinline)) // This better be placed in some general/common header + # define H265_RESTRICT enum @@ -150,7 +150,6 @@ enum #define SAO_BO_BITS 5 #define LUMA_GROUP_NUM (1 << SAO_BO_BITS) - struct H265SeqParamSet; class H265DecoderFrame; class H265DecYUVBufferPadded; @@ -1181,22 +1180,22 @@ typedef struct { struct H265SliceHeader { // from nal unit header - NalUnitType nal_unit_type; + NalUnitType nal_unit_type; uint32_t nuh_temporal_id; // slice spec members - int32_t first_slice_segment_in_pic_flag; + int32_t first_slice_segment_in_pic_flag; uint8_t no_output_of_prior_pics_flag; // nonzero: remove previously decoded pictures from decoded picture buffer uint16_t slice_pic_parameter_set_id; uint8_t dependent_slice_segment_flag; uint32_t slice_segment_address; - SliceType slice_type; + SliceType slice_type; uint8_t pic_output_flag; uint32_t colour_plane_id; // if separate_colour_plane_flag = = 1 only - int32_t slice_pic_order_cnt_lsb; // picture order count (mod MaxPicOrderCntLsb) + int32_t slice_pic_order_cnt_lsb; // picture order count (mod MaxPicOrderCntLsb) uint8_t short_term_ref_pic_set_sps_flag; uint8_t slice_temporal_mvp_enabled_flag; @@ -1205,8 +1204,8 @@ struct H265SliceHeader uint8_t slice_sao_chroma_flag; uint8_t num_ref_idx_active_override_flag; - int32_t num_ref_idx_l0_active; - int32_t num_ref_idx_l1_active; + int32_t num_ref_idx_l0_active; + int32_t num_ref_idx_l1_active; uint8_t mvd_l1_zero_flag; uint8_t cabac_init_flag; @@ -1219,7 +1218,7 @@ struct H265SliceHeader wpScalingParam pred_weight_table[2][MAX_NUM_REF_PICS][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V] int32_t max_num_merge_cand; - uint8_t use_integer_mv_flag; + uint8_t use_integer_mv_flag; int32_t slice_qp_delta; // to calculate default slice QP int32_t slice_cb_qp_offset; @@ -1229,13 +1228,13 @@ struct H265SliceHeader int32_t slice_act_cb_qp_offset; int32_t slice_act_cr_qp_offset; - uint8_t cu_chroma_qp_offset_enabled_flag; + uint8_t cu_chroma_qp_offset_enabled_flag; - uint8_t deblocking_filter_override_flag; - uint8_t slice_deblocking_filter_disabled_flag; + uint8_t deblocking_filter_override_flag; + uint8_t slice_deblocking_filter_disabled_flag; int32_t slice_beta_offset; int32_t slice_tc_offset; - uint8_t slice_loop_filter_across_slices_enabled_flag; + uint8_t slice_loop_filter_across_slices_enabled_flag; uint32_t num_entry_point_offsets; diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h index b66e6a01b2..010577727e 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2019 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,7 +29,6 @@ #include "umc_h265_notify.h" #include "umc_h265_heap.h" - namespace UMC_HEVC_DECODER { class H265Slice; @@ -297,8 +296,6 @@ class H265DecoderFrame : public H265DecYUVBufferPadded, public RefCounter m_ErrorType |= errorType; } - - void AddSlice(H265Slice * pSlice); protected: diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_info.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_info.h index c5f9d72464..f0185cc053 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_info.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_info.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -32,7 +32,6 @@ namespace UMC_HEVC_DECODER { class H265DecoderFrame; - // Collection of slices that constitute one decoder frame class H265DecoderFrameInfo { @@ -196,7 +195,6 @@ class H265DecoderFrameInfo void SetPrevAU(H265DecoderFrameInfo *au) {m_prevAU = au;} void SetRefAU(H265DecoderFrameInfo *au) {m_refAU = au;} - bool m_hasTiles; H265DecoderFrame * m_pFrame; diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_list.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_list.h index 8136afb67c..d689b9cf53 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_list.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_frame_list.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_headers.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_headers.h index 7372181a2e..98f22bf001 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_headers.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_headers.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -39,7 +39,7 @@ class HeaderSet HeaderSet(Heap_Objects *pObjHeap) : m_Header() - , m_pObjHeap(pObjHeap) + ,m_pObjHeap(pObjHeap) , m_currentID(-1) { } diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_heap.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_heap.h index ae8182f0d3..7633455af2 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_heap.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_heap.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_supplier.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_supplier.h index bbd7062289..e8f40fcb91 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_supplier.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_supplier.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_utils.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_utils.h index 0dd5016209..ffd095294c 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_utils.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_mfx_utils.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2017-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_nal_spl.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_nal_spl.h index 51a2869e11..d055ece7c0 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_nal_spl.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_nal_spl.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2019 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_notify.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_notify.h index 84481f3b32..40d6afac31 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_notify.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_notify.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_base.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_base.h index 0d4375998f..f33e068426 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_base.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_base.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_dxva.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_dxva.h index 321c2320f1..8c72eb8b24 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_dxva.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_segment_decoder_dxva.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2013-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_slice_decoding.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_slice_decoding.h index c97ece7f7f..dbcfc88972 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_slice_decoding.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_slice_decoding.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -27,6 +27,7 @@ #include #include "umc_h265_dec_defs.h" #include "umc_h265_bitstream_headers.h" + #include "umc_h265_heap.h" namespace UMC_HEVC_DECODER @@ -149,7 +150,6 @@ class H265Slice : public HeapObject virtual bool DecodeSliceHeader(PocDecoding * pocDecoding); H265SliceHeader m_SliceHeader; // (H265SliceHeader) slice header - H265HeadersBitstream m_BitStream; // (H265Bitstream) slice bit stream // Obtain bit stream object @@ -158,6 +158,7 @@ class H265Slice : public HeapObject H265HeadersBitstream const* GetBitStream() const { return &m_BitStream; } + protected: const H265PicParamSet* m_pPicParamSet; // (H265PicParamSet *) pointer to array of picture parameters sets const H265SeqParamSet* m_pSeqParamSet; // (H265SeqParamSet *) pointer to array of sequence parameters sets diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_tables.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_tables.h index c0f7b98384..5e79abaf93 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_tables.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_tables.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -54,8 +54,6 @@ const uint16_t SAspectRatio[17][2] = // Inverse QP scale lookup table extern const uint16_t g_invQuantScales[6]; // IQ(QP%6) - - } // namespace UMC_HEVC_DECODER #endif //__UMC_H265_DEC_TABLES_H__ diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_broker.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_broker.h index c71a1cba8a..993fb151aa 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_broker.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_broker.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -119,8 +119,6 @@ class TaskBroker_H265 UMC::Mutex m_mGuard; }; - - } // namespace UMC_HEVC_DECODER #endif // __UMC_H265_TASK_BROKER_H diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h index 5952c83f0a..bfe45cca98 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h @@ -1,15 +1,15 @@ -// Copyright (c) 2020 Intel Corporation -// +// Copyright (c) 2012-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -40,7 +40,6 @@ #include "umc_va_base.h" - namespace UMC_HEVC_DECODER { class TaskBroker_H265; @@ -79,7 +78,7 @@ class Skipping_H265 // Check if frame should be skipped to decrease decoding delays bool IsShouldSkipFrame(H265DecoderFrame * pFrame); // Set decoding skip frame mode - void ChangeVideoDecodingSpeed(int32_t& num); + virtual mfxStatus ChangeVideoDecodingSpeed(int32_t& num); void Reset(); struct SkipInfo @@ -306,8 +305,7 @@ class TaskSupplier_H265 : public Skipping_H265, public AU_Splitter_H265, public UMC::Status GetInfo(UMC::VideoDecoderParams *lpInfo); // Add a new bitstream data buffer to decoding - virtual UMC::Status AddSource(UMC::MediaData * pSource); - + virtual UMC::Status AddSource(UMC::MediaData *pSource); // Chose appropriate processing action for specified NAL unit UMC::Status ProcessNalUnit(UMC::MediaDataEx *nalUnit); @@ -326,7 +324,7 @@ class TaskSupplier_H265 : public Skipping_H265, public AU_Splitter_H265, public virtual H265DecoderFrame *GetFrameToDisplayInternal(bool force); // Retrieve decoded SEI data with SEI_USER_DATA_REGISTERED_TYPE type - UMC::Status GetUserData(UMC::MediaData * pUD); + UMC::Status GetUserData(UMC::MediaData *pUD); bool IsShouldSuspendDisplay(); @@ -439,6 +437,7 @@ class TaskSupplier_H265 : public Skipping_H265, public AU_Splitter_H265, public bool m_decodedOrder; bool m_checkCRAInsideResetProcess; bool m_bFirstSliceInSequence; + bool m_bFirstSliceInBitstream; H265Slice * m_pLastSlice; diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer.h index a6a506b342..cb04afccee 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2020 Intel Corporation -// +// Copyright (c) 2013-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -26,7 +26,6 @@ #include "umc_va_base.h" - #include #include "umc_h265_tables.h" @@ -155,6 +154,7 @@ class Packer virtual UMC::Status GetStatusReport(void * pStatusReport, size_t size) = 0; virtual UMC::Status SyncTask(int32_t index, void * error) = 0; + virtual bool IsGPUSyncEventEnable() = 0; virtual void BeginFrame(H265DecoderFrame*) = 0; virtual void EndFrame() = 0; diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer_vaapi.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer_vaapi.h index 26481bcde5..5238322256 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer_vaapi.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_packer_vaapi.h @@ -51,6 +51,9 @@ namespace UMC_HEVC_DECODER UMC::Status SyncTask(int32_t index, void* error) override { return m_va->SyncTask(index, error); } + bool IsGPUSyncEventEnable() override + { return false; } + void BeginFrame(H265DecoderFrame*) override; void EndFrame() override { /* Nothing to do */} @@ -60,14 +63,15 @@ namespace UMC_HEVC_DECODER bool PackSliceParams(H265Slice const* slice, size_t, bool last_slice) override { return PackSliceParams(slice, last_slice) ? true : false; } + void PackProcessingInfo(H265DecoderFrameInfo * sliceInfo); + protected: virtual VASliceParameterBufferBase* PackSliceParams(H265Slice const*, bool last_slice) = 0; virtual void CreateSliceParamBuffer(size_t count) = 0; virtual void PackSliceParams(VASliceParameterBufferBase* sp_base, H265Slice const* slice, bool last_slice) = 0; - void PackProcessingInfo(H265DecoderFrameInfo * sliceInfo); void PackPriorityParams(); - + private: void PackQmatrix(H265Slice const*) override; }; @@ -158,5 +162,6 @@ namespace UMC_HEVC_DECODER #include "platform/umc_h265_va_packer_vaapi_g11.hpp" #endif + #endif // __UMC_H265_VA_PACKER_VAAPI_H #endif // MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_supplier.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_supplier.h index cddfa6d390..718b856e98 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_supplier.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_va_supplier.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2018 Intel Corporation -// +// Copyright (c) 2013-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_yuv.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_yuv.h index 4ba4545a60..a9a72a4b80 100644 --- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_yuv.h +++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_yuv.h @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_au_splitter.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_au_splitter.cpp index 3d92250133..86d7eecce6 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_au_splitter.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_au_splitter.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_bitstream_headers.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_bitstream_headers.cpp index 585b6c324a..c82805940e 100755 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_bitstream_headers.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_bitstream_headers.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2020 Intel Corporation -// +// Copyright (c) 2012-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -1310,6 +1310,7 @@ void H265HeadersBitstream::xParsePredWeightTable(const H265SeqParamSet *sps, H26 wpScalingParam* wp; SliceType eSliceType = sliceHdr->slice_type; int32_t iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); + int32_t iPresent = 0; sliceHdr->luma_log2_weight_denom = GetVLCElementU(); // used in HW decoder if (sliceHdr->luma_log2_weight_denom > 7) @@ -1342,13 +1343,14 @@ void H265HeadersBitstream::xParsePredWeightTable(const H265SeqParamSet *sps, H26 if (sliceHdr->m_RefPOCList[eRefPicList][iRefIdx] == sliceHdr->m_poc) { - wp[0].present_flag = 0; // luma_weight_lX_flag + iPresent = 0; } else { - wp[0].present_flag = Get1Bit(); // luma_weight_lX_flag + iPresent = Get1Bit(); } + wp[0].present_flag = (iPresent == 1); // luma_weight_lX_flag uTotalSignalledWeightFlags += wp[0].present_flag; } @@ -1360,13 +1362,14 @@ void H265HeadersBitstream::xParsePredWeightTable(const H265SeqParamSet *sps, H26 if (sliceHdr->m_RefPOCList[eRefPicList][iRefIdx] == sliceHdr->m_poc) { - wp[1].present_flag = wp[2].present_flag = 0; // chroma_weight_lX_flag + iPresent = 0; } else { - wp[1].present_flag = wp[2].present_flag = Get1Bit(); // chroma_weight_lX_flag + iPresent = Get1Bit(); } + wp[1].present_flag = wp[2].present_flag = (iPresent == 1); // chroma_weight_lX_flag uTotalSignalledWeightFlags += 2*wp[1].present_flag; } } diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_debug.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_debug.cpp index ce7b1f4d73..0476a9e7c1 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_debug.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_debug.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,7 +24,6 @@ #include "umc_h265_debug.h" #include - #ifdef ENABLE_TRACE #include "umc_h265_frame.h" #endif diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp index b9670c5579..dbdeccaa2f 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2019 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -27,7 +27,6 @@ #include "umc_h265_debug.h" - namespace UMC_HEVC_DECODER { @@ -48,7 +47,6 @@ H265DecoderFrame::H265DecoderFrame(UMC::MemoryAllocator *pMemoryAllocator, Heap_ m_isLongTermRef = false; m_RefPicListResetCount = 0; m_PicOrderCnt = 0; - // set memory managment tools m_pMemoryAllocator = pMemoryAllocator; @@ -320,7 +318,5 @@ bool H265DecoderFrame::CheckReferenceFrameError() return false; } - - } // end namespace UMC_HEVC_DECODER #endif // MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_info.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_info.cpp index 5ad97f465f..8a0528f614 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_info.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_info.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2018 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -27,12 +27,10 @@ namespace UMC_HEVC_DECODER { - bool H265DecoderFrameInfo::IsCompleted() const { if (GetStatus() == H265DecoderFrameInfo::STATUS_COMPLETED) return true; - return false; } @@ -42,7 +40,6 @@ void H265DecoderFrameInfo::Reset() m_hasTiles = false; - m_isNeedDeblocking = false; m_isNeedSAO = false; @@ -121,6 +118,7 @@ void H265DecoderFrameInfo::EliminateErrors() { // HEVC 7.4.7.1 General slice segment header semantics H265Slice *baseSlice = GetSlice(0); // after the for() loop above ,the first slice is treated as 'base' slice + bool bIndepSliceMissing = false; for (uint32_t sliceId = 1; sliceId < GetSliceCount(); sliceId++) { diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp index 5005434b56..fcf418cb6b 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_frame_list.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp index 37c347c806..aca8beae2d 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_heap.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -333,6 +333,5 @@ void RefCounter::DecrementReference() Free(); } } - } // namespace UMC_HEVC_DECODER #endif // MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_supplier.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_supplier.cpp index 724894aa40..75dde85669 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_supplier.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_supplier.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Intel Corporation +// Copyright (c) 2012-2019 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 @@ -162,7 +162,6 @@ UMC::Status MFXTaskSupplier_H265::Init(UMC::VideoDecoderParams *init) GetView()->dpbSize = 16; m_DPBSizeEx = m_iThreadNum + init->info.bitrate; - return UMC::UMC_OK; } diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp index 4cc5dd5163..286e130e58 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_mfx_utils.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 Intel Corporation +// Copyright (c) 2017-2020 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 @@ -27,6 +27,7 @@ #include "umc_h265_nal_spl.h" #include "mfx_common_decode_int.h" + #include "mfxpcp.h" #include @@ -49,6 +50,8 @@ bool IsNeedPartialAcceleration_H265(mfxVideoParam* par, eMFXHWType type) if (par->mfx.FrameInfo.FourCC == MFX_FOURCC_P210 || par->mfx.FrameInfo.FourCC == MFX_FOURCC_NV16) return true; +#else + (void)type; #endif return false; @@ -81,7 +84,6 @@ mfxU16 MatchProfile(mfxU32 fourcc) return MFX_PROFILE_UNKNOWN; } - inline bool CheckGUID(VideoCORE * core, eMFXHWType type, mfxVideoParam const* param) { @@ -94,7 +96,6 @@ bool CheckGUID(VideoCORE * core, eMFXHWType type, mfxVideoParam const* param) profile = MatchProfile(vp.mfx.FrameInfo.FourCC); vp.mfx.CodecProfile |= profile; //preserve tier } - #if defined (MFX_VA_LINUX) if (core->IsGuidSupported(DXVA_ModeHEVC_VLD_Main, &vp) != MFX_ERR_NONE) return false; @@ -119,11 +120,8 @@ bool CheckGUID(VideoCORE * core, eMFXHWType type, mfxVideoParam const* param) // Returns implementation platform eMFXPlatform GetPlatform_H265(VideoCORE * core, mfxVideoParam * par) { - (void)core; - if (!par) return MFX_PLATFORM_SOFTWARE; - eMFXPlatform platform = core->GetPlatformType(); eMFXHWType typeHW = MFX_HW_UNKNOWN; typeHW = core->GetHWType(); @@ -132,7 +130,6 @@ eMFXPlatform GetPlatform_H265(VideoCORE * core, mfxVideoParam * par) { return MFX_PLATFORM_SOFTWARE; } - if (platform != MFX_PLATFORM_SOFTWARE && !CheckGUID(core, typeHW, par)) platform = MFX_PLATFORM_SOFTWARE; @@ -141,11 +138,9 @@ eMFXPlatform GetPlatform_H265(VideoCORE * core, mfxVideoParam * par) bool IsBugSurfacePoolApplicable(eMFXHWType hwtype, mfxVideoParam * par) { - (void)hwtype; - if (par == NULL) return false; - + (void)hwtype; return false; } @@ -153,7 +148,7 @@ bool IsBugSurfacePoolApplicable(eMFXHWType hwtype, mfxVideoParam * par) inline mfxU16 QueryMaxProfile(eMFXHWType type) { - + (void)type; if (type < MFX_HW_SCL) return MFX_PROFILE_HEVC_MAIN; else if (type < MFX_HW_ICL) @@ -193,7 +188,6 @@ bool CheckChromaFormat(mfxU16 profile, mfxU16 format) { MFX_PROFILE_HEVC_MAIN, { -1, MFX_CHROMAFORMAT_YUV420, -1, -1 } }, { MFX_PROFILE_HEVC_MAIN10, { -1, MFX_CHROMAFORMAT_YUV420, -1, -1 } }, { MFX_PROFILE_HEVC_MAINSP, { -1, MFX_CHROMAFORMAT_YUV420, -1, -1 } }, - { MFX_PROFILE_HEVC_REXT, { -1, MFX_CHROMAFORMAT_YUV420, MFX_CHROMAFORMAT_YUV422, MFX_CHROMAFORMAT_YUV444 } }, #if (MFX_VERSION >= 1032) @@ -285,7 +279,7 @@ mfxU32 CalculateFourcc(mfxU16 codecProfile, mfxFrameInfo const* frameInfo) { 0, 0, 0, 0 }, //400 { MFX_FOURCC_NV12, MFX_FOURCC_P010, MFX_FOURCC_P016, 0 }, //420 { MFX_FOURCC_YUY2, MFX_FOURCC_Y210, MFX_FOURCC_Y216, 0 }, //422 - { MFX_FOURCC_AYUV, MFX_FOURCC_Y410, MFX_FOURCC_Y416, 0 }, //444 + { MFX_FOURCC_AYUV, MFX_FOURCC_Y410, MFX_FOURCC_Y416, 0 } //444 #elif (MFX_VERSION >= 1027) { 0, 0, 0, 0 }, //400 { MFX_FOURCC_NV12, MFX_FOURCC_P010, 0, 0 }, //420 @@ -772,16 +766,20 @@ mfxStatus Query_H265(VideoCORE *core, mfxVideoParam *in, mfxVideoParam *out, eMF sts = MFX_ERR_UNSUPPORTED; } - if ((in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) || (in->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) || - (in->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY)) + if ( (in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) + || (in->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) + || (in->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) + ) { uint32_t mask = in->IOPattern & 0xf0; - if (mask == MFX_IOPATTERN_OUT_VIDEO_MEMORY || mask == MFX_IOPATTERN_OUT_SYSTEM_MEMORY || mask == MFX_IOPATTERN_OUT_OPAQUE_MEMORY) + if (mask == MFX_IOPATTERN_OUT_VIDEO_MEMORY + || mask == MFX_IOPATTERN_OUT_SYSTEM_MEMORY + || mask == MFX_IOPATTERN_OUT_OPAQUE_MEMORY + ) out->IOPattern = in->IOPattern; else sts = MFX_ERR_UNSUPPORTED; } - if (in->mfx.FrameInfo.FourCC) { // mfxFrameInfo @@ -888,11 +886,15 @@ mfxStatus Query_H265(VideoCORE *core, mfxVideoParam *in, mfxVideoParam *out, eMF sts = MFX_ERR_UNSUPPORTED; } - if (in->mfx.FrameInfo.FourCC && - !CheckFourcc(in->mfx.FrameInfo.FourCC, profile, &in->mfx.FrameInfo)) + if (in->mfx.FrameInfo.FourCC) { - out->mfx.FrameInfo.FourCC = 0; - sts = MFX_ERR_UNSUPPORTED; + if(CheckFourcc(in->mfx.FrameInfo.FourCC, profile, &in->mfx.FrameInfo)) + out->mfx.FrameInfo.FourCC = in->mfx.FrameInfo.FourCC; + else + { + out->mfx.FrameInfo.FourCC = 0; + sts = MFX_ERR_UNSUPPORTED; + } } out->mfx.FrameInfo.Shift = in->mfx.FrameInfo.Shift; @@ -996,7 +998,6 @@ mfxStatus Query_H265(VideoCORE *core, mfxVideoParam *in, mfxVideoParam *out, eMF out->mfx.FrameInfo.BitDepthLuma = 8; out->mfx.FrameInfo.BitDepthChroma = 8; out->mfx.FrameInfo.Shift = 0; - out->Protected = 0; out->mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; @@ -1037,7 +1038,6 @@ bool CheckVideoParam_H265(mfxVideoParam *in, eMFXHWType type) if (in->mfx.FrameInfo.Height > 16384 /* || (in->mfx.FrameInfo.Height % in->mfx.FrameInfo.reserved[0]) */) return false; - if (in->mfx.FrameInfo.FourCC != MFX_FOURCC_NV12 && in->mfx.FrameInfo.FourCC != MFX_FOURCC_NV16 && in->mfx.FrameInfo.FourCC != MFX_FOURCC_P010 && @@ -1114,12 +1114,14 @@ bool CheckVideoParam_H265(mfxVideoParam *in, eMFXHWType type) in->mfx.FrameInfo.ChromaFormat != MFX_CHROMAFORMAT_YUV444 ) return false; - if (!(in->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) && !(in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) && !(in->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY)) + if ( !(in->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) + && !(in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY) + && !(in->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) + ) return false; if ((in->IOPattern & MFX_IOPATTERN_OUT_VIDEO_MEMORY) && (in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY)) return false; - if ((in->IOPattern & MFX_IOPATTERN_OUT_OPAQUE_MEMORY) && (in->IOPattern & MFX_IOPATTERN_OUT_SYSTEM_MEMORY)) return false; diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_nal_spl.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_nal_spl.cpp index 3b1d460073..de61c7d8ad 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_nal_spl.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_nal_spl.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2019 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -597,7 +597,7 @@ void SwapMemoryAndRemovePreventingBytes_H265(void *pDestination, size_t &nDstSiz // first two bytes i = 0; - while (i < std::min(2, nSrcSize)) + while (i < std::min(size_t(2), nSrcSize)) { pDst = (uint8_t) pSrc; ++pDst; diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_scaling_list.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_scaling_list.cpp index 7957b372ad..53985544bf 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_scaling_list.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_scaling_list.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2019 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_segment_decoder_dxva.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_segment_decoder_dxva.cpp index 382b79b4ee..5c87b7d903 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_segment_decoder_dxva.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_segment_decoder_dxva.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2013-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -38,7 +38,6 @@ #include "vm_time.h" - namespace UMC_HEVC_DECODER { H265_DXVA_SegmentDecoderCommon::H265_DXVA_SegmentDecoderCommon(TaskSupplier_H265 * pTaskSupplier) @@ -157,7 +156,6 @@ bool TaskBrokerSingleThreadDXVA::GetNextTaskInternal(H265Task *) if (!dxva_sd->GetPacker()) return false; - UMC::Status sts = UMC::UMC_OK; VAStatus surfErr = VA_STATUS_SUCCESS; int32_t index; @@ -202,7 +200,6 @@ bool TaskBrokerSingleThreadDXVA::GetNextTaskInternal(H265Task *) } SwitchCurrentAU(); - return false; } diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_sei.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_sei.cpp index 95a2194a68..c24bc890c4 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_sei.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_sei.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Intel Corporation +// Copyright (c) 2012-2019 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 diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_slice_decoding.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_slice_decoding.cpp index 26c0b251df..6c4e27123a 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_slice_decoding.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_slice_decoding.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -248,7 +248,7 @@ bool H265Slice::DecodeSliceHeader(PocDecoding * pocDecoding) } catch(...) { - if (!m_SliceHeader.dependent_slice_segment_flag) + if (!m_SliceHeader.dependent_slice_segment_flag) { if (m_SliceHeader.slice_type != I_SLICE) m_bError = true; @@ -260,7 +260,6 @@ bool H265Slice::DecodeSliceHeader(PocDecoding * pocDecoding) return (UMC::UMC_OK == umcRes); } // bool H265Slice::DecodeSliceHeader(bool bFullInitialization) - // Get tile column CTB width uint32_t H265Slice::getTileColumnWidth(uint32_t col) const { diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_tables.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_tables.cpp index f4f862c28a..637df3d34f 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_tables.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_tables.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -87,7 +87,6 @@ const uint16_t g_invQuantScales[6] = { 40,45,51,57,64,72 }; - } // end namespace UMC_HEVC_DECODER #endif // MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_broker.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_broker.cpp index 87b16c1e45..4711cb8c34 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_broker.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_broker.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,21 +28,14 @@ #include "umc_h265_debug.h" - -//#define ECHO -//#define ECHO_DEB - #undef DEBUG_PRINT -#undef DEBUG_PRINT1 #define DEBUG_PRINT(x) -#define DEBUG_PRINT1(x) namespace UMC_HEVC_DECODER { H265Slice* FindSliceByCUAddr(H265DecoderFrameInfo * info, int32_t firstCUToProcess); TileThreadingInfo * FindTileForProcess(H265DecoderFrameInfo * info, int32_t taskID, bool isDecRec = false); - TaskBroker_H265::TaskBroker_H265(TaskSupplier_H265 * pTaskSupplier) : m_pTaskSupplier(pTaskSupplier) , m_iConsumerNumber(0) @@ -126,7 +119,6 @@ bool TaskBroker_H265::AddFrameToDecoding(H265DecoderFrame * frame) UMC::AutomaticUMCMutex guard(m_mGuard); - m_decodingQueue.push_back(frame); frame->StartDecoding(); return true; @@ -387,7 +379,6 @@ bool TaskBroker_H265::GetNextTask(H265Task *pTask) { UMC::AutomaticUMCMutex guard(m_mGuard); - bool res = GetNextTaskInternal(pTask); return res; @@ -434,7 +425,5 @@ bool TaskBroker_H265::IsExistTasks(H265DecoderFrame * frame) return Check_Status(slicesInfo->GetStatus()); } - - } // namespace UMC_HEVC_DECODER #endif // MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp index 90625687fd..69c872de8b 100755 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 Intel Corporation +// Copyright (c) 2012-2020 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 @@ -41,7 +41,6 @@ #include "umc_frame_data.h" #include "umc_h265_debug.h" - #include "mfx_common.h" // for trace routines namespace UMC_HEVC_DECODER @@ -315,7 +314,7 @@ bool Skipping_H265::IsShouldSkipFrame(H265DecoderFrame * ) } // Set decoding skip frame mode -void Skipping_H265::ChangeVideoDecodingSpeed(int32_t & num) +mfxStatus Skipping_H265::ChangeVideoDecodingSpeed(int32_t & num) { m_VideoDecodingSpeed += num; @@ -329,6 +328,8 @@ void Skipping_H265::ChangeVideoDecodingSpeed(int32_t & num) int32_t deblocking_off = m_PermanentTurnOffDeblocking; if (deblocking_off == 3) m_PermanentTurnOffDeblocking = 3; + + return MFX_ERR_NONE; } // Get current skip mode state @@ -624,6 +625,7 @@ TaskSupplier_H265::TaskSupplier_H265() , m_decodedOrder(false) , m_checkCRAInsideResetProcess(false) , m_bFirstSliceInSequence(true) + , m_bFirstSliceInBitstream(true) , m_pLastSlice(0) , m_pLastDisplayed(0) , m_pMemoryAllocator(0) @@ -702,6 +704,7 @@ UMC::Status TaskSupplier_H265::Init(UMC::VideoDecoderParams *init) void TaskSupplier_H265::CreateTaskBroker() { + } // Initialize what is necessary to decode bitstream header before the main part is initialized @@ -1808,7 +1811,6 @@ UMC::Status TaskSupplier_H265::AddOneFrame(UMC::MediaData * pSource) if (umsRes == UMC::UMC_NTF_NEW_RESOLUTION || (nut == NAL_UT_SPS && umsRes == UMC::UMC_ERR_INVALID_STREAM)) { - int32_t nalIndex = pMediaDataEx->index; int32_t size = pMediaDataEx->offsets[nalIndex + 1] - pMediaDataEx->offsets[nalIndex]; @@ -2142,7 +2144,6 @@ void TaskSupplier_H265::CheckCRAOrBLA(const H265Slice *pSlice) //Check NoOutputPriorPics if (pSlice->GetRapPicFlag() && no_output_of_prior_pics_flag) { - for (H265DecoderFrame *pCurr = GetView()->pDPB->head(); pCurr; pCurr = pCurr->future()) { pCurr->m_pic_output = false; @@ -2225,7 +2226,6 @@ UMC::Status TaskSupplier_H265::AddSlice(H265Slice * pSlice, bool ) sps->m_changed || pps->m_changed || !IsPictureTheSame(firstSlice, pSlice); - if (changed) { CompleteFrame(view.pCurFrame); @@ -2301,7 +2301,6 @@ H265DecoderFrame* TaskSupplier_H265::AddSelfReferenceFrame(H265Slice* slice) slice->GetCurrentFrame(); } - // Mark frame as full with slices void TaskSupplier_H265::OnFullFrame(H265DecoderFrame * pFrame) { @@ -2432,7 +2431,6 @@ UMC::Status TaskSupplier_H265::AllocateFrameData(H265DecoderFrame * pFrame, mfxS pFrame->allocate(frmData, &info); pFrame->m_index = frmMID; - (void)pPicParamSet; return UMC::UMC_OK; @@ -2502,7 +2500,6 @@ H265DecoderFrame * TaskSupplier_H265::AllocateNewFrame(const H265Slice *pSlice) pFrame->m_DisplayPictureStruct_H265 = DPS_FRAME_H265; } - InitFrameCounter(pFrame, pSlice); return pFrame; @@ -2638,7 +2635,7 @@ uint32_t GetLevelIDCIndex(uint32_t level_idc) } // Calculate maximum DPB size based on level and resolution -int32_t CalculateDPBSize(uint32_t /*profile_idc*/, uint32_t &level_idc, int32_t width, int32_t height, uint32_t num_ref_frames) +int32_t CalculateDPBSize(uint32_t profile_idc, uint32_t &level_idc, int32_t width, int32_t height, uint32_t num_ref_frames) { // can increase level_idc to hold num_ref_frames uint32_t lumaPsArray[] = { 36864, 122880, 245760, 552960, 983040, 2228224, 2228224, 8912896, 8912896, 8912896, 35651584, 35651584, 35651584 }; @@ -2650,11 +2647,8 @@ int32_t CalculateDPBSize(uint32_t /*profile_idc*/, uint32_t &level_idc, int32_t uint32_t MaxLumaPs = lumaPsArray[index]; uint32_t const maxDpbPicBuf = -#ifndef MFX_VA - profile_idc != H265_PROFILE_SCC ? 6 : 7; -#else 6;//HW handles second version of current reference (twoVersionsOfCurrDecPicFlag) itself -#endif + (void)profile_idc; uint32_t PicSizeInSamplesY = width * height; diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer.cpp index a9162ef6f3..280d0ddab0 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Intel Corporation +// Copyright (c) 2013-2019 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 @@ -23,12 +23,14 @@ #include "umc_h265_va_packer.h" #include "umc_va_base.h" +#include "umc_h265_tables.h" +#include "umc_h265_frame_info.h" #ifdef UMC_VA #include "umc_h265_task_supplier.h" #endif -#include "umc_h265_tables.h" +#include "umc_h265_va_packer_vaapi.h" #include "umc_va_linux_protected.h" #include "mfx_ext_buffers.h" @@ -79,11 +81,12 @@ namespace UMC_HEVC_DECODER extern Packer * CreatePackerVAAPI(VideoAccelerator*); #if defined(MFX_ENABLE_CPLIB) - extern Packer * CreatePackerCENC(VideoAccelerator*); +extern Packer * CreatePackerCENC(VideoAccelerator*); #endif Packer * Packer::CreatePacker(VideoAccelerator * va) { + (void)va; Packer * packer = 0; #ifdef MFX_ENABLE_CPLIB @@ -93,6 +96,7 @@ Packer * Packer::CreatePacker(VideoAccelerator * va) #endif packer = CreatePackerVAAPI(va); + return packer; } diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_cenc.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_cenc.cpp index 3c72e49db9..ff4f2113a2 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_cenc.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_cenc.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2020 Intel Corporation +// Copyright (c) 2003-2020 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 @@ -34,11 +34,12 @@ using namespace UMC; -#if (MFX_VERSION >= MFX_VERSION_NEXT) -#define PACKER_VAAPI G12::PackerVAAPI +#if (MFX_VERSION >= 1032) +typedef G12::PackerVAAPI PACKER_VAAPI #else -#define PACKER_VAAPI G11::PackerVAAPI +typedef G11::PackerVAAPI PACKER_VAAPI #endif + namespace UMC_HEVC_DECODER { @@ -208,4 +209,4 @@ namespace UMC_HEVC_DECODER } // namespace UMC_HEVC_DECODER #endif // #if defined (MFX_ENABLE_CPLIB) -#endif // MFX_ENABLE_H265_VIDEO_DECODE +#endif // MFX_ENABLE_H265_VIDEO_DECODE \ No newline at end of file diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_vaapi.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_vaapi.cpp index 6c3ff71df3..634a5a37ce 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_vaapi.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_packer_vaapi.cpp @@ -23,10 +23,12 @@ #ifdef MFX_ENABLE_H265_VIDEO_DECODE #include "umc_va_base.h" + #include "umc_va_linux.h" #include "umc_h265_va_packer_vaapi.h" #include "umc_h265_task_supplier.h" #include "umc_va_video_processing.h" + #include namespace UMC_HEVC_DECODER @@ -34,6 +36,7 @@ namespace UMC_HEVC_DECODER void PackerVAAPI::BeginFrame(H265DecoderFrame* frame) { (void)frame; + } void PackerVAAPI::PackQmatrix(H265Slice const* slice) @@ -115,7 +118,6 @@ namespace UMC_HEVC_DECODER pipelineBuf->surface = m_va->GetSurfaceID(sliceInfo->m_pFrame->m_index); // should filled in packer pipelineBuf->additional_outputs = (VASurfaceID*)vpVA->GetCurrentOutputSurface(); } - void PackerVAAPI::PackPriorityParams() { mfxPriority priority = m_va->m_ContextPriority; @@ -172,16 +174,13 @@ namespace UMC_HEVC_DECODER for (size_t n = 0; n < count; n++) PackSliceParams(fi->GetSlice(int32_t(n)), n, n == count - 1); - #ifndef MFX_DEC_VIDEO_POSTPROCESS_DISABLE if (m_va->GetVideoProcessingVA()) PackProcessingInfo(fi); #endif - //Set Gpu priority if(m_va->m_MaxContextPriority) PackPriorityParams(); - auto s = m_va->Execute(); if (s != UMC::UMC_OK) throw h265_exception(s); @@ -207,4 +206,6 @@ namespace UMC_HEVC_DECODER } } + + #endif //MFX_ENABLE_H265_VIDEO_DECODE diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_supplier.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_supplier.cpp index 542802fdf5..237c48db0b 100755 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_supplier.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_va_supplier.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2020 Intel Corporation -// +// Copyright (c) 2013-2020 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -162,7 +162,6 @@ UMC::Status VATaskSupplier::AllocateFrameData(H265DecoderFrame * pFrame, mfxSize mfx_alloc->GetSurfaceByIndex(frmMID); if (!surface) throw h265_exception(UMC::UMC_ERR_ALLOC); - } pFrame->allocate(&frmData, &info); diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_yuv.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_yuv.cpp index 707634f7f6..5a5d23fa16 100644 --- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_yuv.cpp +++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_yuv.cpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017 Intel Corporation -// +// Copyright (c) 2012-2019 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 // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -51,15 +51,12 @@ H265DecYUVBufferPadded::H265DecYUVBufferPadded(UMC::MemoryAllocator *pMemoryAllo , m_pMemoryAllocator(pMemoryAllocator) , m_midAllocatedBuffer(0) , m_pAllocatedBuffer(0) + , m_lumaSize() + , m_chromaSize() , m_pitch_luma(0) , m_pitch_chroma(0) , m_color_format(UMC::NV12) { - m_lumaSize.width = 0; - m_lumaSize.height = 0; - - m_chromaSize.width = 0; - m_chromaSize.height = 0; } H265DecYUVBufferPadded::~H265DecYUVBufferPadded() @@ -89,7 +86,7 @@ void H265DecYUVBufferPadded::deallocate() m_pYPlane = m_pUPlane = m_pVPlane = m_pUVPlane = NULL; - m_lumaSize = {0, 0}; + m_lumaSize = { 0, 0 }; m_pitch_luma = 0; m_pitch_chroma = 0; } @@ -102,7 +99,6 @@ void H265DecYUVBufferPadded::Init(const UMC::VideoDataInfo *info) if (info->GetNumPlanes() == 0) throw h265_exception(UMC::UMC_ERR_NULL_PTR); - m_color_format = info->GetColorFormat(); m_chroma_format = GetH265ColorFormat(info->GetColorFormat()); m_lumaSize = info->GetPlaneInfo(0)->m_ippSize; @@ -117,7 +113,7 @@ void H265DecYUVBufferPadded::Init(const UMC::VideoDataInfo *info) } else { - m_chromaSize = {0, 0}; + m_chromaSize = { 0, 0 }; } } @@ -130,7 +126,6 @@ void H265DecYUVBufferPadded::allocate(const UMC::FrameData * frameData, const UM deallocate(); return; } - m_frameData = *frameData; if (frameData->GetPlaneMemoryInfo(0)->m_planePtr) @@ -168,7 +163,7 @@ void H265DecYUVBufferPadded::allocate(const UMC::FrameData * frameData, const UM } else { - m_chromaSize = {0, 0}; + m_chromaSize = { 0, 0 }; m_pitch_chroma = 0; m_pUPlane = 0; m_pVPlane = 0;