Skip to content

Commit

Permalink
Fix passthru copy when input X2RGB10 with a2rgb10 pointer
Browse files Browse the repository at this point in the history
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: Intel-Media-SDK#1654
  • Loading branch information
Anton Grishin committed Aug 6, 2020
1 parent a7e69f8 commit ee260cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion _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
Expand Down Expand Up @@ -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];
Expand Down
7 changes: 6 additions & 1 deletion _studio/shared/src/libmfx_core.cpp
Expand Up @@ -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});
Expand All @@ -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:
{
Expand Down

0 comments on commit ee260cf

Please sign in to comment.