Browse Source

qsv: dump more info in error, debug and verbose mode

Dump iopattern mode and the SDK error/warning desciptions for qsv based
filters and iopattern mode for qsvenc

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com
tags/n4.4
Haihao Xiang Linjie Fu 5 years ago
parent
commit
b8cd37a59f
4 changed files with 64 additions and 24 deletions
  1. +1
    -0
      libavcodec/qsvenc.c
  2. +15
    -6
      libavfilter/qsvvpp.c
  3. +26
    -10
      libavfilter/vf_deinterlace_qsv.c
  4. +22
    -8
      libavfilter/vf_scale_qsv.c

+ 1
- 0
libavcodec/qsvenc.c View File

@@ -1132,6 +1132,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
if (!iopattern) if (!iopattern)
iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
q->param.IOPattern = iopattern; q->param.IOPattern = iopattern;
ff_qsv_print_iopattern(avctx, iopattern, "Encoder");


ret = qsvenc_init_session(avctx, q); ret = qsvenc_init_session(avctx, q);
if (ret < 0) if (ret < 0)


+ 15
- 6
libavfilter/qsvvpp.c View File

@@ -609,15 +609,19 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
} }
} }


if (ret != MFX_ERR_NONE) {
av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n");
if (ret < 0)
return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle");
else if (ret > 0) {
ff_qsvvpp_print_warning(avctx, ret, "Warning in getting the session handle");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


/* create a "slave" session with those same properties, to be used for vpp */ /* create a "slave" session with those same properties, to be used for vpp */
ret = MFXInit(impl, &ver, &s->session); ret = MFXInit(impl, &ver, &s->session);
if (ret != MFX_ERR_NONE) {
av_log(avctx, AV_LOG_ERROR, "Error initializing a session for scaling\n");
if (ret < 0)
return ff_qsvvpp_print_error(avctx, ret, "Error initializing a session");
else if (ret > 0) {
ff_qsvvpp_print_warning(avctx, ret, "Warning in session initialization");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


@@ -750,11 +754,16 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p
else if (IS_OPAQUE_MEMORY(s->out_mem_mode)) else if (IS_OPAQUE_MEMORY(s->out_mem_mode))
s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY; s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;


/* Print input memory mode */
ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0x0F, "VPP");
/* Print output memory mode */
ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0xF0, "VPP");
ret = MFXVideoVPP_Init(s->session, &s->vpp_param); ret = MFXVideoVPP_Init(s->session, &s->vpp_param);
if (ret < 0) { if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to create a qsvvpp, ret = %d.\n", ret);
ret = ff_qsvvpp_print_error(avctx, ret, "Failed to create a qsvvpp");
goto failed; goto failed;
}
} else if (ret > 0)
ff_qsvvpp_print_warning(avctx, ret, "Warning When creating qsvvpp");


*vpp = s; *vpp = s;
return 0; return 0;


+ 26
- 10
libavfilter/vf_deinterlace_qsv.c View File

@@ -202,16 +202,20 @@ static int init_out_session(AVFilterContext *ctx)
} }
} }


if (err != MFX_ERR_NONE) {
av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
if (err < 0)
return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle");
else if (err > 0) {
ff_qsvvpp_print_warning(ctx, err, "Warning in getting the session handle");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


/* create a "slave" session with those same properties, to be used for /* create a "slave" session with those same properties, to be used for
* actual deinterlacing */ * actual deinterlacing */
err = MFXInit(impl, &ver, &s->session); err = MFXInit(impl, &ver, &s->session);
if (err != MFX_ERR_NONE) {
av_log(ctx, AV_LOG_ERROR, "Error initializing a session for deinterlacing\n");
if (err < 0)
return ff_qsvvpp_print_error(ctx, err, "Error initializing a session for deinterlacing");
else if (err > 0) {
ff_qsvvpp_print_warning(ctx, err, "Warning in session initialization");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


@@ -309,9 +313,17 @@ static int init_out_session(AVFilterContext *ctx)
par.vpp.Out.FrameRateExtD = ctx->outputs[0]->time_base.den; par.vpp.Out.FrameRateExtD = ctx->outputs[0]->time_base.den;
} }


/* Print input memory mode */
ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0x0F, "VPP");
/* Print output memory mode */
ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0xF0, "VPP");
err = MFXVideoVPP_Init(s->session, &par); err = MFXVideoVPP_Init(s->session, &par);
if (err != MFX_ERR_NONE) {
av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for deinterlacing: %d\n", err);
if (err < 0)
return ff_qsvvpp_print_error(ctx, err,
"Error opening the VPP for deinterlacing");
else if (err > 0) {
ff_qsvvpp_print_warning(ctx, err,
"Warning in VPP initialization");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


@@ -482,8 +494,13 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in,
return QSVDEINT_MORE_INPUT; return QSVDEINT_MORE_INPUT;
} }


if ((err < 0 && err != MFX_ERR_MORE_SURFACE) || !sync) {
av_log(ctx, AV_LOG_ERROR, "Error during deinterlacing: %d\n", err);
if (err < 0 && err != MFX_ERR_MORE_SURFACE) {
ret = ff_qsvvpp_print_error(ctx, err, "Error during deinterlacing");
goto fail;
}

if (!sync) {
av_log(ctx, AV_LOG_ERROR, "No sync during deinterlacing\n");
ret = AVERROR_UNKNOWN; ret = AVERROR_UNKNOWN;
goto fail; goto fail;
} }
@@ -494,8 +511,7 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in,
err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); err = MFXVideoCORE_SyncOperation(s->session, sync, 1000);
} while (err == MFX_WRN_IN_EXECUTION); } while (err == MFX_WRN_IN_EXECUTION);
if (err < 0) { if (err < 0) {
av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err);
ret = AVERROR_UNKNOWN;
ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation");
goto fail; goto fail;
} }




+ 22
- 8
libavfilter/vf_scale_qsv.c View File

@@ -313,8 +313,10 @@ static int init_out_session(AVFilterContext *ctx)
} }
} }


if (err != MFX_ERR_NONE) {
av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
if (err < 0)
return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle");
else if (err > 0) {
ff_qsvvpp_print_warning(ctx, err, "Warning in getting the session handle");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


@@ -430,9 +432,17 @@ static int init_out_session(AVFilterContext *ctx)
par.vpp.Out.FrameRateExtN = 25; par.vpp.Out.FrameRateExtN = 25;
par.vpp.Out.FrameRateExtD = 1; par.vpp.Out.FrameRateExtD = 1;


/* Print input memory mode */
ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0x0F, "VPP");
/* Print output memory mode */
ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0xF0, "VPP");
err = MFXVideoVPP_Init(s->session, &par); err = MFXVideoVPP_Init(s->session, &par);
if (err != MFX_ERR_NONE) {
av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for scaling\n");
if (err < 0)
return ff_qsvvpp_print_error(ctx, err,
"Error opening the VPP for scaling");
else if (err > 0) {
ff_qsvvpp_print_warning(ctx, err,
"Warning in VPP initialization");
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
} }


@@ -573,8 +583,13 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in)
av_usleep(1); av_usleep(1);
} while (err == MFX_WRN_DEVICE_BUSY); } while (err == MFX_WRN_DEVICE_BUSY);


if (err < 0 || !sync) {
av_log(ctx, AV_LOG_ERROR, "Error during scaling\n");
if (err < 0) {
ret = ff_qsvvpp_print_error(ctx, err, "Error during scaling");
goto fail;
}

if (!sync) {
av_log(ctx, AV_LOG_ERROR, "No sync during scaling\n");
ret = AVERROR_UNKNOWN; ret = AVERROR_UNKNOWN;
goto fail; goto fail;
} }
@@ -583,8 +598,7 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in)
err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); err = MFXVideoCORE_SyncOperation(s->session, sync, 1000);
} while (err == MFX_WRN_IN_EXECUTION); } while (err == MFX_WRN_IN_EXECUTION);
if (err < 0) { if (err < 0) {
av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err);
ret = AVERROR_UNKNOWN;
ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation");
goto fail; goto fail;
} }




Loading…
Cancel
Save