Dump iopattern mode and the SDK error/warning desciptions for qsv based filters and iopattern mode for qsvenc
Unified · Split
| @@ -1132,6 +1132,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) · 1131 unmodified lines | |||
| 1132 | if (!iopattern) | 1132 | if (!iopattern) |
| 1133 | iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; | 1133 | iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; |
| 1134 | q->param.IOPattern = iopattern; | 1134 | q->param.IOPattern = iopattern; |
| 1135 | ff_qsv_print_iopattern(avctx, iopattern, "Encoder"); | ||
| 1135 | 1136 | ||
| 1136 | ret = qsvenc_init_session(avctx, q); | 1137 | ret = qsvenc_init_session(avctx, q); |
| 1137 | if (ret < 0) | 1138 | if (ret < 0) |
| @@ -609,15 +609,19 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) · 608 unmodified lines | |||
| 609 | } | 609 | } |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | if (ret != MFX_ERR_NONE) { | 612 | if (ret < 0) |
| 613 | av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n"); | 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"); | ||
| 614 | return AVERROR_UNKNOWN; | 616 | return AVERROR_UNKNOWN; |
| 615 | } | 617 | } |
| 616 | 618 | ||
| 617 | /* create a "slave" session with those same properties, to be used for vpp */ | 619 | /* create a "slave" session with those same properties, to be used for vpp */ |
| 618 | ret = MFXInit(impl, &ver, &s->session); | 620 | ret = MFXInit(impl, &ver, &s->session); |
| 619 | if (ret != MFX_ERR_NONE) { | 621 | if (ret < 0) |
| 620 | av_log(avctx, AV_LOG_ERROR, "Error initializing a session for scaling\n"); | 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"); | ||
| 621 | return AVERROR_UNKNOWN; | 625 | return AVERROR_UNKNOWN; |
| 622 | } | 626 | } |
| 623 | 627 | ||
| @@ -750,11 +754,16 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p · 126 unmodified lines | |||
| 750 | else if (IS_OPAQUE_MEMORY(s->out_mem_mode)) | 754 | else if (IS_OPAQUE_MEMORY(s->out_mem_mode)) |
| 751 | s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY; | 755 | s->vpp_param.IOPattern |= MFX_IOPATTERN_OUT_OPAQUE_MEMORY; |
| 752 | 756 | ||
| 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"); | ||
| 753 | ret = MFXVideoVPP_Init(s->session, &s->vpp_param); | 761 | ret = MFXVideoVPP_Init(s->session, &s->vpp_param); |
| 754 | if (ret < 0) { | 762 | 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"); |
| 756 | goto failed; | 764 | goto failed; |
| 757 | } | 765 | } else if (ret > 0) |
| 766 | ff_qsvvpp_print_warning(avctx, ret, "Warning When creating qsvvpp"); | ||
| 758 | 767 | ||
| 759 | *vpp = s; | 768 | *vpp = s; |
| 760 | return 0; | 769 | return 0; |
| @@ -202,16 +202,20 @@ static int init_out_session(AVFilterContext *ctx) · 201 unmodified lines | |||
| 202 | } | 202 | } |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | if (err != MFX_ERR_NONE) { | 205 | if (err < 0) |
| 206 | av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n"); | 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"); | ||
| 207 | return AVERROR_UNKNOWN; | 209 | return AVERROR_UNKNOWN; |
| 208 | } | 210 | } |
| 209 | 211 | ||
| 210 | /* create a "slave" session with those same properties, to be used for | 212 | /* create a "slave" session with those same properties, to be used for |
| 211 | * actual deinterlacing */ | 213 | * actual deinterlacing */ |
| 212 | err = MFXInit(impl, &ver, &s->session); | 214 | err = MFXInit(impl, &ver, &s->session); |
| 213 | if (err != MFX_ERR_NONE) { | 215 | if (err < 0) |
| 214 | av_log(ctx, AV_LOG_ERROR, "Error initializing a session for deinterlacing\n"); | 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"); | ||
| 215 | return AVERROR_UNKNOWN; | 219 | return AVERROR_UNKNOWN; |
| 216 | } | 220 | } |
| 217 | 221 | ||
| @@ -309,9 +313,17 @@ static int init_out_session(AVFilterContext *ctx) · 91 unmodified lines | |||
| 309 | par.vpp.Out.FrameRateExtD = ctx->outputs[0]->time_base.den; | 313 | par.vpp.Out.FrameRateExtD = ctx->outputs[0]->time_base.den; |
| 310 | } | 314 | } |
| 311 | 315 | ||
| 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"); | ||
| 312 | err = MFXVideoVPP_Init(s->session, &par); | 320 | err = MFXVideoVPP_Init(s->session, &par); |
| 313 | if (err != MFX_ERR_NONE) { | 321 | if (err < 0) |
| 314 | av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for deinterlacing: %d\n", err); | 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"); | ||
| 315 | return AVERROR_UNKNOWN; | 327 | return AVERROR_UNKNOWN; |
| 316 | } | 328 | } |
| 317 | 329 | ||
| @@ -482,8 +494,13 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, · 164 unmodified lines | |||
| 482 | return QSVDEINT_MORE_INPUT; | 494 | return QSVDEINT_MORE_INPUT; |
| 483 | } | 495 | } |
| 484 | 496 | ||
| 485 | if ((err < 0 && err != MFX_ERR_MORE_SURFACE) || !sync) { | 497 | if (err < 0 && err != MFX_ERR_MORE_SURFACE) { |
| 486 | av_log(ctx, AV_LOG_ERROR, "Error during deinterlacing: %d\n", err); | 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"); | ||
| 487 | ret = AVERROR_UNKNOWN; | 504 | ret = AVERROR_UNKNOWN; |
| 488 | goto fail; | 505 | goto fail; |
| 489 | } | 506 | } |
| @@ -494,8 +511,7 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, · 4 unmodified lines | |||
| 494 | err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); | 511 | err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); |
| 495 | } while (err == MFX_WRN_IN_EXECUTION); | 512 | } while (err == MFX_WRN_IN_EXECUTION); |
| 496 | if (err < 0) { | 513 | if (err < 0) { |
| 497 | av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err); | 514 | ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation"); |
| 498 | ret = AVERROR_UNKNOWN; | ||
| 499 | goto fail; | 515 | goto fail; |
| 500 | } | 516 | } |
| 501 | 517 | ||
| @@ -313,8 +313,10 @@ static int init_out_session(AVFilterContext *ctx) · 312 unmodified lines | |||
| 313 | } | 313 | } |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | if (err != MFX_ERR_NONE) { | 316 | if (err < 0) |
| 317 | av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n"); | 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"); | ||
| 318 | return AVERROR_UNKNOWN; | 320 | return AVERROR_UNKNOWN; |
| 319 | } | 321 | } |
| 320 | 322 | ||
| @@ -430,9 +432,17 @@ static int init_out_session(AVFilterContext *ctx) · 109 unmodified lines | |||
| 430 | par.vpp.Out.FrameRateExtN = 25; | 432 | par.vpp.Out.FrameRateExtN = 25; |
| 431 | par.vpp.Out.FrameRateExtD = 1; | 433 | par.vpp.Out.FrameRateExtD = 1; |
| 432 | 434 | ||
| 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"); | ||
| 433 | err = MFXVideoVPP_Init(s->session, &par); | 439 | err = MFXVideoVPP_Init(s->session, &par); |
| 434 | if (err != MFX_ERR_NONE) { | 440 | if (err < 0) |
| 435 | av_log(ctx, AV_LOG_ERROR, "Error opening the VPP for scaling\n"); | 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"); | ||
| 436 | return AVERROR_UNKNOWN; | 446 | return AVERROR_UNKNOWN; |
| 437 | } | 447 | } |
| 438 | 448 | ||
| @@ -573,8 +583,13 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) · 134 unmodified lines | |||
| 573 | av_usleep(1); | 583 | av_usleep(1); |
| 574 | } while (err == MFX_WRN_DEVICE_BUSY); | 584 | } while (err == MFX_WRN_DEVICE_BUSY); |
| 575 | 585 | ||
| 576 | if (err < 0 || !sync) { | 586 | if (err < 0) { |
| 577 | av_log(ctx, AV_LOG_ERROR, "Error during scaling\n"); | 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"); | ||
| 578 | ret = AVERROR_UNKNOWN; | 593 | ret = AVERROR_UNKNOWN; |
| 579 | goto fail; | 594 | goto fail; |
| 580 | } | 595 | } |
| @@ -583,8 +598,7 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) · 2 unmodified lines | |||
| 583 | err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); | 598 | err = MFXVideoCORE_SyncOperation(s->session, sync, 1000); |
| 584 | } while (err == MFX_WRN_IN_EXECUTION); | 599 | } while (err == MFX_WRN_IN_EXECUTION); |
| 585 | if (err < 0) { | 600 | if (err < 0) { |
| 586 | av_log(ctx, AV_LOG_ERROR, "Error synchronizing the operation: %d\n", err); | 601 | ret = ff_qsvvpp_print_error(ctx, err, "Error synchronizing the operation"); |
| 587 | ret = AVERROR_UNKNOWN; | ||
| 588 | goto fail; | 602 | goto fail; |
| 589 | } | 603 | } |
| 590 | 604 | ||