[FFmpeg-devel,5/5] libav/qsv: set Info.Shift according to the setting in desc

Submitted by Linjie Fu on June 28, 2019, 2:29 a.m.

Details

Message ID 1561688983-1310-1-git-send-email-linjie.fu@intel.com
State New
Headers show

Commit Message

Linjie Fu June 28, 2019, 2:29 a.m.
Currently, Info.Shift in libmfx is set according to the depth of the
pixfmt. As QSV now supports Y410 (depth > 8 but shift = 0), it doesn't
work any more.

Modify to set Info.Shift according to the setting in desc.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/qsvdec.c       | 2 +-
 libavutil/hwcontext_qsv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 7650325..0f45a34 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -208,7 +208,7 @@  static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
 
     param.mfx.FrameInfo.BitDepthLuma   = desc->comp[0].depth;
     param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
-    param.mfx.FrameInfo.Shift          = desc->comp[0].depth > 8;
+    param.mfx.FrameInfo.Shift          = desc->comp[0].shift > 0;
     param.mfx.FrameInfo.FourCC         = q->fourcc;
     param.mfx.FrameInfo.Width          = frame_width;
     param.mfx.FrameInfo.Height         = frame_height;
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index f0be4bb..ab484b6 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -323,7 +323,7 @@  static int qsv_init_surface(AVHWFramesContext *ctx, mfxFrameSurface1 *surf)
 
     surf->Info.BitDepthLuma   = desc->comp[0].depth;
     surf->Info.BitDepthChroma = desc->comp[0].depth;
-    surf->Info.Shift          = desc->comp[0].depth > 8;
+    surf->Info.Shift          = desc->comp[0].shift > 0;
 
     if (desc->log2_chroma_w && desc->log2_chroma_h)
         surf->Info.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;