From ee260cfbaa41db1d6322d9d74f5814891cedee0c Mon Sep 17 00:00:00 2001 From: Anton Grishin Date: Thu, 6 Aug 2020 09:55:04 +0300 Subject: [PATCH] Fix passthru copy when input X2RGB10 with a2rgb10 pointer If input use only a2rgb10 pointer and we get min pointer, this leads to nullptr error. Since a2rgb10(x2rgb10) packed 10 bit format, no need to check all pointers before copy, we only need to copy B pointer (that is in union with a2rgb10 pointer). cmd to check: ./ffmpeg -hwaccel qsv -v verbose -c:v hevc_qsv -i \ ../p010.h265 -vf scale_qsv=format=x2rgb10,hwdownload,format=x2rgb10 \ -vframes 1 out.yuv -y fixes: #1654 --- _studio/shared/src/libmfx_allocator_vaapi.cpp | 3 ++- _studio/shared/src/libmfx_core.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/_studio/shared/src/libmfx_allocator_vaapi.cpp b/_studio/shared/src/libmfx_allocator_vaapi.cpp index 46b37a4225..c96b81da41 100644 --- a/_studio/shared/src/libmfx_allocator_vaapi.cpp +++ b/_studio/shared/src/libmfx_allocator_vaapi.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019 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 @@ -515,6 +515,7 @@ mfxStatus mfxDefaultAllocatorVAAPI::SetFrameData(const VAImage &va_image, mfxU32 break; #ifndef ANDROID case VA_FOURCC_A2R10G10B10: + case VA_FOURCC_X2R10G10B10: if (mfx_fourcc == MFX_FOURCC_A2RGB10) { ptr->B = p_buffer + va_image.offsets[0]; diff --git a/_studio/shared/src/libmfx_core.cpp b/_studio/shared/src/libmfx_core.cpp index 55c2c3a4c9..aed7308883 100644 --- a/_studio/shared/src/libmfx_core.cpp +++ b/_studio/shared/src/libmfx_core.cpp @@ -1497,7 +1497,6 @@ mfxStatus CoreDoSWFastCopy(mfxFrameSurface1 *pDst, mfxFrameSurface1 *pSrc, int c case MFX_FOURCC_AYUV: case MFX_FOURCC_RGB4: case MFX_FOURCC_BGR4: - case MFX_FOURCC_A2RGB10: { mfxU8* ptrSrc = std::min({pSrc->Data.R, pSrc->Data.G, pSrc->Data.B}); mfxU8* ptrDst = std::min({pDst->Data.R, pDst->Data.G, pDst->Data.B}); @@ -1508,6 +1507,12 @@ mfxStatus CoreDoSWFastCopy(mfxFrameSurface1 *pDst, mfxFrameSurface1 *pSrc, int c MFX_CHECK_STS(sts); break; } +case MFX_FOURCC_A2RGB10: + roi.width *= 4; + + sts = FastCopy::Copy(pDst->Data.B, dstPitch, pSrc->Data.B, srcPitch, roi, copyFlag); + MFX_CHECK_STS(sts); + break; case MFX_FOURCC_ARGB16: case MFX_FOURCC_ABGR16: {