History

qsv: add requirement for the mininal version of libmfx

libmfx 1.28 was released 3 years ago, it is easy to get a greater version than 1.28. We may remove lots of compile-time checks if adding the requirement for the minimal version in the configure script.

Haihao Xiang committed 4 years ago

Commit 478e1a91 parent f8a07c49 files · +250 −482Browse files

Showing the changes to libavfilter (2 of 9 files). Show all

Unified · Split

2 files
  1. libavfilter/vf_scale_qsv.c +1 −12
  2. libavfilter/vf_vpp_qsv.c +67 −76
libavfilter/vf_scale_qsv.c+1−12
@@ -69,7 +69,6 @@ enum var_name { · 68 unmodified lines
69 VARS_NB69 VARS_NB
70};70};
71 71
72#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19)
73#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))72#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
74 73
75typedef struct QSVScaleContext {74typedef struct QSVScaleContext {
@@ -92,12 +91,10 @@ typedef struct QSVScaleContext { · 16 unmodified lines
92 91
93 mfxExtOpaqueSurfaceAlloc opaque_alloc;92 mfxExtOpaqueSurfaceAlloc opaque_alloc;
94 93
95#if QSV_HAVE_SCALING_CONFIG
96 mfxExtVPPScaling scale_conf;94 mfxExtVPPScaling scale_conf;
97#endif
98 int mode;95 int mode;
99 96
100 mfxExtBuffer *ext_buffers[1 + QSV_HAVE_SCALING_CONFIG];97 mfxExtBuffer *ext_buffers[2];
101 int num_ext_buf;98 int num_ext_buf;
102 99
103 int shift_width, shift_height;100 int shift_width, shift_height;
@@ -397,14 +394,12 @@ static int init_out_session(AVFilterContext *ctx) · 293 unmodified lines
397 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;394 par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY;
398 }395 }
399 396
400#if QSV_HAVE_SCALING_CONFIG
401 memset(&s->scale_conf, 0, sizeof(mfxExtVPPScaling));397 memset(&s->scale_conf, 0, sizeof(mfxExtVPPScaling));
402 s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING;398 s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING;
403 s->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling);399 s->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling);
404 s->scale_conf.ScalingMode = s->mode;400 s->scale_conf.ScalingMode = s->mode;
405 s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->scale_conf;401 s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->scale_conf;
406 av_log(ctx, AV_LOG_VERBOSE, "Scaling mode: %d\n", s->mode);402 av_log(ctx, AV_LOG_VERBOSE, "Scaling mode: %d\n", s->mode);
407#endif
408 403
409 par.ExtParam = s->ext_buffers;404 par.ExtParam = s->ext_buffers;
410 par.NumExtParam = s->num_ext_buf;405 par.NumExtParam = s->num_ext_buf;
@@ -620,15 +615,9 @@ static const AVOption options[] = { · 209 unmodified lines
620 { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },615 { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
621 { "format", "Output pixel format", OFFSET(format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },616 { "format", "Output pixel format", OFFSET(format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
622 617
623#if QSV_HAVE_SCALING_CONFIG
624 { "mode", "set scaling mode", OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"},618 { "mode", "set scaling mode", OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"},
625 { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "mode"},619 { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "mode"},
626 { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "mode"},620 { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "mode"},
627#else
628 { "mode", "(not supported)", OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, INT_MAX, FLAGS, "mode"},
629 { "low_power", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, FLAGS, "mode"},
630 { "hq", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, FLAGS, "mode"},
631#endif
632 621
633 { NULL },622 { NULL },
634};623};
libavfilter/vf_vpp_qsv.c+67−76
@@ -43,9 +43,6 @@ · 42 unmodified lines
43 43
44/* number of video enhancement filters */44/* number of video enhancement filters */
45#define ENH_FILTERS_COUNT (8)45#define ENH_FILTERS_COUNT (8)
46#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17)
47#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19)
48#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19)
49 46
50typedef struct VPPContext{47typedef struct VPPContext{
51 const AVClass *class;48 const AVClass *class;
@@ -60,9 +57,7 @@ typedef struct VPPContext{ · 8 unmodified lines
60 mfxExtVPPProcAmp procamp_conf;57 mfxExtVPPProcAmp procamp_conf;
61 mfxExtVPPRotation rotation_conf;58 mfxExtVPPRotation rotation_conf;
62 mfxExtVPPMirroring mirroring_conf;59 mfxExtVPPMirroring mirroring_conf;
63#ifdef QSV_HAVE_SCALING_CONFIG
64 mfxExtVPPScaling scale_conf;60 mfxExtVPPScaling scale_conf;
65#endif
66 61
67 int out_width;62 int out_width;
68 int out_height;63 int out_height;
@@ -138,9 +133,7 @@ static const AVOption options[] = { · 69 unmodified lines
138 { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },133 { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
139 { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },134 { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
140 { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS },135 { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS },
141#ifdef QSV_HAVE_SCALING_CONFIG
142 { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },136 { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },
143#endif
144 { NULL }137 { NULL }
145};138};
146 139
@@ -422,84 +415,83 @@ static int config_output(AVFilterLink *outlink) · 275 unmodified lines
422 }415 }
423 416
424 if (vpp->transpose >= 0) {417 if (vpp->transpose >= 0) {
425#ifdef QSV_HAVE_ROTATION418 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
426 switch (vpp->transpose) {419 switch (vpp->transpose) {
427 case TRANSPOSE_CCLOCK_FLIP:420 case TRANSPOSE_CCLOCK_FLIP:
428 vpp->rotate = MFX_ANGLE_270;421 vpp->rotate = MFX_ANGLE_270;
429 vpp->hflip = MFX_MIRRORING_HORIZONTAL;422 vpp->hflip = MFX_MIRRORING_HORIZONTAL;
430 break;423 break;
431 case TRANSPOSE_CLOCK:424 case TRANSPOSE_CLOCK:
432 vpp->rotate = MFX_ANGLE_90;425 vpp->rotate = MFX_ANGLE_90;
433 vpp->hflip = MFX_MIRRORING_DISABLED;426 vpp->hflip = MFX_MIRRORING_DISABLED;
434 break;427 break;
435 case TRANSPOSE_CCLOCK:428 case TRANSPOSE_CCLOCK:
436 vpp->rotate = MFX_ANGLE_270;429 vpp->rotate = MFX_ANGLE_270;
437 vpp->hflip = MFX_MIRRORING_DISABLED;430 vpp->hflip = MFX_MIRRORING_DISABLED;
438 break;431 break;
439 case TRANSPOSE_CLOCK_FLIP:432 case TRANSPOSE_CLOCK_FLIP:
440 vpp->rotate = MFX_ANGLE_90;433 vpp->rotate = MFX_ANGLE_90;
441 vpp->hflip = MFX_MIRRORING_HORIZONTAL;434 vpp->hflip = MFX_MIRRORING_HORIZONTAL;
442 break;435 break;
443 case TRANSPOSE_REVERSAL:436 case TRANSPOSE_REVERSAL:
444 vpp->rotate = MFX_ANGLE_180;437 vpp->rotate = MFX_ANGLE_180;
445 vpp->hflip = MFX_MIRRORING_DISABLED;438 vpp->hflip = MFX_MIRRORING_DISABLED;
446 break;439 break;
447 case TRANSPOSE_HFLIP:440 case TRANSPOSE_HFLIP:
448 vpp->rotate = MFX_ANGLE_0;441 vpp->rotate = MFX_ANGLE_0;
449 vpp->hflip = MFX_MIRRORING_HORIZONTAL;442 vpp->hflip = MFX_MIRRORING_HORIZONTAL;
450 break;443 break;
451 case TRANSPOSE_VFLIP:444 case TRANSPOSE_VFLIP:
452 vpp->rotate = MFX_ANGLE_180;445 vpp->rotate = MFX_ANGLE_180;
453 vpp->hflip = MFX_MIRRORING_HORIZONTAL;446 vpp->hflip = MFX_MIRRORING_HORIZONTAL;
454 break;447 break;
455 default:448 default:
456 av_log(ctx, AV_LOG_ERROR, "Failed to set transpose mode to %d.\n", vpp->transpose);449 av_log(ctx, AV_LOG_ERROR, "Failed to set transpose mode to %d.\n", vpp->transpose);
457 return AVERROR(EINVAL);450 return AVERROR(EINVAL);
451 }
452 } else {
453 av_log(ctx, AV_LOG_WARNING, "The QSV VPP transpose option is "
454 "not supported with this MSDK version.\n");
455 vpp->transpose = 0;
458 }456 }
459#else
460 av_log(ctx, AV_LOG_WARNING, "The QSV VPP transpose option is "
461 "not supported with this MSDK version.\n");
462 vpp->transpose = 0;
463#endif
464 }457 }
465 458
466 if (vpp->rotate) {459 if (vpp->rotate) {
467#ifdef QSV_HAVE_ROTATION460 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 17)) {
468 memset(&vpp->rotation_conf, 0, sizeof(mfxExtVPPRotation));461 memset(&vpp->rotation_conf, 0, sizeof(mfxExtVPPRotation));
469 vpp->rotation_conf.Header.BufferId = MFX_EXTBUFF_VPP_ROTATION;462 vpp->rotation_conf.Header.BufferId = MFX_EXTBUFF_VPP_ROTATION;
470 vpp->rotation_conf.Header.BufferSz = sizeof(mfxExtVPPRotation);463 vpp->rotation_conf.Header.BufferSz = sizeof(mfxExtVPPRotation);
471 vpp->rotation_conf.Angle = vpp->rotate;464 vpp->rotation_conf.Angle = vpp->rotate;
472 465
473 if (MFX_ANGLE_90 == vpp->rotate || MFX_ANGLE_270 == vpp->rotate) {466 if (MFX_ANGLE_90 == vpp->rotate || MFX_ANGLE_270 == vpp->rotate) {
474 FFSWAP(int, vpp->out_width, vpp->out_height);467 FFSWAP(int, vpp->out_width, vpp->out_height);
475 FFSWAP(int, outlink->w, outlink->h);468 FFSWAP(int, outlink->w, outlink->h);
476 av_log(ctx, AV_LOG_DEBUG, "Swap width and height for clock/cclock rotation.\n");469 av_log(ctx, AV_LOG_DEBUG, "Swap width and height for clock/cclock rotation.\n");
477 }470 }
478 471
479 param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->rotation_conf;472 param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->rotation_conf;
480#else473 } else {
481 av_log(ctx, AV_LOG_WARNING, "The QSV VPP rotate option is "474 av_log(ctx, AV_LOG_WARNING, "The QSV VPP rotate option is "
482 "not supported with this MSDK version.\n");475 "not supported with this MSDK version.\n");
483 vpp->rotate = 0;476 vpp->rotate = 0;
484#endif477 }
485 }478 }
486 479
487 if (vpp->hflip) {480 if (vpp->hflip) {
488#ifdef QSV_HAVE_MIRRORING481 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
489 memset(&vpp->mirroring_conf, 0, sizeof(mfxExtVPPMirroring));482 memset(&vpp->mirroring_conf, 0, sizeof(mfxExtVPPMirroring));
490 vpp->mirroring_conf.Header.BufferId = MFX_EXTBUFF_VPP_MIRRORING;483 vpp->mirroring_conf.Header.BufferId = MFX_EXTBUFF_VPP_MIRRORING;
491 vpp->mirroring_conf.Header.BufferSz = sizeof(mfxExtVPPMirroring);484 vpp->mirroring_conf.Header.BufferSz = sizeof(mfxExtVPPMirroring);
492 vpp->mirroring_conf.Type = vpp->hflip;485 vpp->mirroring_conf.Type = vpp->hflip;
493 486
494 param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->mirroring_conf;487 param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->mirroring_conf;
495#else488 } else {
496 av_log(ctx, AV_LOG_WARNING, "The QSV VPP hflip option is "489 av_log(ctx, AV_LOG_WARNING, "The QSV VPP hflip option is "
497 "not supported with this MSDK version.\n");490 "not supported with this MSDK version.\n");
498 vpp->hflip = 0;491 vpp->hflip = 0;
499#endif492 }
500 }493 }
501 494
502#ifdef QSV_HAVE_SCALING_CONFIG
503 if (inlink->w != outlink->w || inlink->h != outlink->h) {495 if (inlink->w != outlink->w || inlink->h != outlink->h) {
504 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {496 if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
505 memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));497 memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
@@ -512,7 +504,6 @@ static int config_output(AVFilterLink *outlink) · 6 unmodified lines
512 av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is "504 av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is "
513 "not supported with this MSDK version.\n");505 "not supported with this MSDK version.\n");
514 }506 }
515#endif
516 507
517 if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||508 if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
518 vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||509 vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||

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