History

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

Haihao Xiang committed 5 years ago

Commit b8cd37a1 parent db28e9c4 files · +64 −24Browse files

Unified · Split

4 files
  1. libavcodec/qsvenc.c +1 −0
  2. libavfilter/qsvvpp.c +15 −6
  3. libavfilter/vf_deinterlace_qsv.c +26 −10
  4. libavfilter/vf_scale_qsv.c +22 −8
libavcodec/qsvenc.c+1−0
@@ -1132,6 +1132,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) · 1131 unmodified lines
11321132 if (!iopattern)
11331133 iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
11341134 q->param.IOPattern = iopattern;
1135+ ff_qsv_print_iopattern(avctx, iopattern, "Encoder");
11351136
11361137 ret = qsvenc_init_session(avctx, q);
11371138 if (ret < 0)
libavfilter/qsvvpp.c+15−6
@@ -609,15 +609,19 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) · 608 unmodified lines
609609 }
610610 }
611611
612− if (ret != MFX_ERR_NONE) {
613− av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n");
612+ if (ret < 0)
613+ return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle");
614+ else if (ret > 0) {
615+ ff_qsvvpp_print_warning(avctx, ret, "Warning in getting the session handle");
614616 return AVERROR_UNKNOWN;
615617 }
616618
617619 /* create a "slave" session with those same properties, to be used for vpp */
618620 ret = MFXInit(impl, &ver, &s->session);
619− if (ret != MFX_ERR_NONE) {
620− av_log(avctx, AV_LOG_ERROR, "Error initializing a session for scaling\n");
621+ if (ret < 0)
622+ return ff_qsvvpp_print_error(avctx, ret, "Error initializing a session");
623+ else if (ret > 0) {
624+ ff_qsvvpp_print_warning(avctx, ret, "Warning in session initialization");
621625 return AVERROR_UNKNOWN;
622626 }
623627
@@ -750,11 +754,16 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p · 126 unmodified lines
750754 else if (IS_OPAQUE_MEMORY(s->out_mem_mode))
751755 s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
752756
757+ /* Print input memory mode */
758+ ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0x0F, "VPP");
759+ /* Print output memory mode */
760+ ff_qsvvpp_print_iopattern(avctx, s->vpp_param.IOPattern & 0xF0, "VPP");
753761 ret = MFXVideoVPP_Init(s->session, &s->vpp_param);
754762 if (ret < 0) {
755− av_log(avctx, AV_LOG_ERROR, "Failed to create a qsvvpp, ret = %d.\n", ret);
763+ ret = ff_qsvvpp_print_error(avctx, ret, "Failed to create a qsvvpp");
756764 goto failed;
757− }
765+ } else if (ret > 0)
766+ ff_qsvvpp_print_warning(avctx, ret, "Warning When creating qsvvpp");
758767
759768 *vpp = s;
760769 return 0;
libavfilter/vf_deinterlace_qsv.c+26−10
@@ -202,16 +202,20 @@ static int init_out_session(AVFilterContext *ctx) · 201 unmodified lines
202202 }
203203 }
204204
205− if (err != MFX_ERR_NONE) {
206− av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
205+ if (err < 0)
206+ return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle");
207+ else if (err > 0) {
208+ ff_qsvvpp_print_warning(ctx, err, "Warning in getting the session handle");
207209 return AVERROR_UNKNOWN;
208210 }
209211
210212 /* create a "slave" session with those same properties, to be used for
211213 * actual deinterlacing */
212214 err = MFXInit(impl, &ver, &s->session);
213− if (err != MFX_ERR_NONE) {
214− av_log(ctx, AV_LOG_ERROR, "Error initializing a session for deinterlacing\n");
215+ if (err < 0)
216+ return ff_qsvvpp_print_error(ctx, err, "Error initializing a session for deinterlacing");
217+ else if (err > 0) {
218+ ff_qsvvpp_print_warning(ctx, err, "Warning in session initialization");
215219 return AVERROR_UNKNOWN;
216220 }
217221
@@ -309,9 +313,17 @@ static int init_out_session(AVFilterContext *ctx) · 91 unmodified lines
309313 par.vpp.Out.FrameRateExtD = ctx->outputs[0]->time_base.den;
310314 }
311315
316+ /* Print input memory mode */
317+ ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0x0F, "VPP");
318+ /* Print output memory mode */
319+ ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0xF0, "VPP");
312320 err = MFXVideoVPP_Init(s->session, &par);
313− if (err != MFX_ERR_NONE) {
314− av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for deinterlacing: %d\n", err);
321+ if (err < 0)
322+ return ff_qsvvpp_print_error(ctx, err,
323+ "Error opening the VPP for deinterlacing");
324+ else if (err > 0) {
325+ ff_qsvvpp_print_warning(ctx, err,
326+ "Warning in VPP initialization");
315327 return AVERROR_UNKNOWN;
316328 }
317329
@@ -482,8 +494,13 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, · 164 unmodified lines
482494 return QSVDEINT_MORE_INPUT;
483495 }
484496
485− if ((err < 0 && err != MFX_ERR_MORE_SURFACE) || !sync) {
486− av_log(ctx, AV_LOG_ERROR, "Error during deinterlacing: %d\n", err);
497+ if (err < 0 && err != MFX_ERR_MORE_SURFACE) {
498+ ret = ff_qsvvpp_print_error(ctx, err, "Error during deinterlacing");
499+ goto fail;
500+ }
501+
502+ if (!sync) {
503+ av_log(ctx, AV_LOG_ERROR, "No sync during deinterlacing\n");
487504 ret = AVERROR_UNKNOWN;
488505 goto fail;
489506 }
@@ -494,8 +511,7 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, · 4 unmodified lines
494511 err = MFXVideoCORE_SyncOperation(s->session, sync, 1000);
495512 } while (err == MFX_WRN_IN_EXECUTION);
496513 if (err < 0) {
497− av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err);
498− ret = AVERROR_UNKNOWN;
514+ ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation");
499515 goto fail;
500516 }
501517
libavfilter/vf_scale_qsv.c+22−8
@@ -313,8 +313,10 @@ static int init_out_session(AVFilterContext *ctx) · 312 unmodified lines
313313 }
314314 }
315315
316− if (err != MFX_ERR_NONE) {
317− av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
316+ if (err < 0)
317+ return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle");
318+ else if (err > 0) {
319+ ff_qsvvpp_print_warning(ctx, err, "Warning in getting the session handle");
318320 return AVERROR_UNKNOWN;
319321 }
320322
@@ -430,9 +432,17 @@ static int init_out_session(AVFilterContext *ctx) · 109 unmodified lines
430432 par.vpp.Out.FrameRateExtN = 25;
431433 par.vpp.Out.FrameRateExtD = 1;
432434
435+ /* Print input memory mode */
436+ ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0x0F, "VPP");
437+ /* Print output memory mode */
438+ ff_qsvvpp_print_iopattern(ctx, par.IOPattern & 0xF0, "VPP");
433439 err = MFXVideoVPP_Init(s->session, &par);
434− if (err != MFX_ERR_NONE) {
435− av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for scaling\n");
440+ if (err < 0)
441+ return ff_qsvvpp_print_error(ctx, err,
442+ "Error opening the VPP for scaling");
443+ else if (err > 0) {
444+ ff_qsvvpp_print_warning(ctx, err,
445+ "Warning in VPP initialization");
436446 return AVERROR_UNKNOWN;
437447 }
438448
@@ -573,8 +583,13 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) · 134 unmodified lines
573583 av_usleep(1);
574584 } while (err == MFX_WRN_DEVICE_BUSY);
575585
576− if (err < 0 || !sync) {
577− av_log(ctx, AV_LOG_ERROR, "Error during scaling\n");
586+ if (err < 0) {
587+ ret = ff_qsvvpp_print_error(ctx, err, "Error during scaling");
588+ goto fail;
589+ }
590+
591+ if (!sync) {
592+ av_log(ctx, AV_LOG_ERROR, "No sync during scaling\n");
578593 ret = AVERROR_UNKNOWN;
579594 goto fail;
580595 }
@@ -583,8 +598,7 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) · 2 unmodified lines
583598 err = MFXVideoCORE_SyncOperation(s->session, sync, 1000);
584599 } while (err == MFX_WRN_IN_EXECUTION);
585600 if (err < 0) {
586− av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err);
587− ret = AVERROR_UNKNOWN;
601+ ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation");
588602 goto fail;
589603 }
590604

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t