[FFmpeg-cvslog] lavc/qsv: add memory type message
Zhong Li
git at videolan.org
Thu Sep 26 08:49:00 EEST 2019
ffmpeg | branch: master | Zhong Li <zhong.li at intel.com> | Fri Sep 20 04:45:27 2019 +0800| [525de9567903e32b6ee2dc594bd55c26581029dd] | committer: Zhong Li
lavc/qsv: add memory type message
Signed-off-by: Zhong Li <zhong.li at intel.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=525de9567903e32b6ee2dc594bd55c26581029dd
---
libavcodec/qsv.c | 29 +++++++++++++++++++++++++++++
libavcodec/qsv_internal.h | 3 +++
libavcodec/qsvdec.c | 2 ++
3 files changed, 34 insertions(+)
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index c4aef70b1e..994c9ebcb0 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -137,6 +137,35 @@ int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level)
}
}
+static const struct {
+ int mfx_iopattern;
+ const char *desc;
+} qsv_iopatterns[] = {
+ {MFX_IOPATTERN_IN_VIDEO_MEMORY, "input is video memory surface" },
+ {MFX_IOPATTERN_IN_SYSTEM_MEMORY, "input is system memory surface" },
+ {MFX_IOPATTERN_IN_OPAQUE_MEMORY, "input is opaque memory surface" },
+ {MFX_IOPATTERN_OUT_VIDEO_MEMORY, "output is video memory surface" },
+ {MFX_IOPATTERN_OUT_SYSTEM_MEMORY, "output is system memory surface" },
+ {MFX_IOPATTERN_OUT_OPAQUE_MEMORY, "output is opaque memory surface" },
+};
+
+int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern,
+ const char *extra_string)
+{
+ const char *desc = NULL;
+
+ for (int i = 0; i < FF_ARRAY_ELEMS(qsv_iopatterns); i++) {
+ if (qsv_iopatterns[i].mfx_iopattern == mfx_iopattern) {
+ desc = qsv_iopatterns[i].desc;
+ }
+ }
+ if (!desc)
+ desc = "unknown iopattern";
+
+ av_log(log_ctx, AV_LOG_VERBOSE, "%s: %s\n", extra_string, desc);
+ return 0;
+}
+
static const struct {
mfxStatus mfxerr;
int averr;
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 62885134b1..8b44a9b6f4 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -101,6 +101,9 @@ typedef struct QSVFramesContext {
int nb_mids;
} QSVFramesContext;
+int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern,
+ const char *extra_string);
+
/**
* Convert a libmfx error code into an ffmpeg error code.
*/
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 2fce478d63..9299596e33 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -193,6 +193,8 @@ static int qsv_decode_preinit(AVCodecContext *avctx, QSVContext *q, enum AVPixel
iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
q->iopattern = iopattern;
+ ff_qsv_print_iopattern(avctx, q->iopattern, "Decoder");
+
ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx, avctx->hw_device_ctx);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");
More information about the ffmpeg-cvslog
mailing list