diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 250b4e61e36fef7275bda521b20ecab4899e3f1f..5217adfa9d1574428937bb0a39adfad8e871c7d0 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 abbede5d978a58af171ceeca4c049f4efe29b3f1..45bedf9a7b37704d4e6bfd5cb6f116c2d2c4f61e 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)