qsvdec: fix vp8 decoding failure issues

Message ID 1516875552-15323-1-git-send-email-zhong.li@intel.com
State New
Headers show
Series
  • qsvdec: fix vp8 decoding failure issues
Related show

Commit Message

Li, Zhong Jan. 25, 2018, 10:19 a.m.
many vp8 clips decoding will be failed if hw_frames_ctx is enabled,
reporting "Error during QSV decoding.: incompatible video parameters (-14)".
It is due to mfx.FrameInfo.Width/Height don't match coded_w/coded_h.

Reproduce: -hwaccel qsv -init_hw_device qsv -c:v vp8_qsv -i /fate-suit/vp8-test-vectors-r1/vp80-00-comprehensive-001.ivf
-vf "hwdownload,format=nv12" -pix_fmt yuv420p -f md5 -

This patch also allows coded_w/h smaller than surface_w/h.

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/qsv.c    | 2 +-
 libavcodec/qsvdec.c | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Luca Barbato Jan. 26, 2018, 8:37 a.m. | #1
On 25/01/2018 11:19, Zhong Li wrote:
> many vp8 clips decoding will be failed if hw_frames_ctx is enabled,
> reporting "Error during QSV decoding.: incompatible video parameters (-14)".
> It is due to mfx.FrameInfo.Width/Height don't match coded_w/coded_h.
> 
> Reproduce: -hwaccel qsv -init_hw_device qsv -c:v vp8_qsv -i /fate-suit/vp8-test-vectors-r1/vp80-00-comprehensive-001.ivf
> -vf "hwdownload,format=nv12" -pix_fmt yuv420p -f md5 -
> 
> This patch also allows coded_w/h smaller than surface_w/h.
> 

Sounds ok. The surface may be larger than the coded dimension (that 
could be larger than the presentation dimension).

lu
Maxym Dmytrychenko Jan. 26, 2018, 8:50 a.m. | #2
LGTM as well

On Fri, Jan 26, 2018 at 9:37 AM, Luca Barbato <lu_zero@gentoo.org> wrote:

> On 25/01/2018 11:19, Zhong Li wrote:
>
>> many vp8 clips decoding will be failed if hw_frames_ctx is enabled,
>> reporting "Error during QSV decoding.: incompatible video parameters
>> (-14)".
>> It is due to mfx.FrameInfo.Width/Height don't match coded_w/coded_h.
>>
>> Reproduce: -hwaccel qsv -init_hw_device qsv -c:v vp8_qsv -i
>> /fate-suit/vp8-test-vectors-r1/vp80-00-comprehensive-001.ivf
>> -vf "hwdownload,format=nv12" -pix_fmt yuv420p -f md5 -
>>
>> This patch also allows coded_w/h smaller than surface_w/h.
>>
>>
> Sounds ok. The surface may be larger than the coded dimension (that could
> be larger than the presentation dimension).
>
> lu
>
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 96dca14..e78633d 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -389,7 +389,7 @@  static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req,
         mfxFrameInfo      *i  = &req->Info;
         mfxFrameInfo      *i1 = &frames_hwctx->surfaces[0].Info;
 
-        if (i->Width  != i1->Width  || i->Height != i1->Height ||
+        if (i->Width  > i1->Width  || i->Height > i1->Height ||
             i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) {
             av_log(ctx->logctx, AV_LOG_ERROR, "Mismatching surface properties in an "
                    "allocation request: %dx%d %d %d vs %dx%d %d %d\n",
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 9741f33..f31172d 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -149,9 +149,6 @@  static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
             else if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
                 iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
         }
-
-        frame_width  = frames_hwctx->surfaces[0].Info.Width;
-        frame_height = frames_hwctx->surfaces[0].Info.Height;
     }
 
     if (!iopattern)