When process yuv420 frames, FFmpeg uses same alignment on Y/U/V planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's pitch, which makes U/V planes 16-bytes aligned. We need to set a separate alignment to meet runtime's behaviour. Now alignment is changed to 16 so that the linesizes of U/V planes meet the requirment of VPL/MSDK. Add get_buffer.video callback to qsv filters to change the default get_buffer behaviour. Now the commandline works fine: ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 3082x1884 \ -i ./3082x1884.yuv -vf 'vpp_qsv=w=2466:h=1508' -f rawvideo \ -pix_fmt yuv420p 2466_1508.yuv
Unified · Split
| @@ -1015,3 +1015,16 @@ int ff_qsvvpp_create_mfx_session(void *ctx, · 1014 unmodified lines | |||
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | #endif | 1017 | #endif |
| 1018 | |||
| 1019 | AVFrame *ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h) | ||
| 1020 | { | ||
| 1021 | /* When process YUV420 frames, FFmpeg uses same alignment on Y/U/V | ||
| 1022 | * planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's | ||
| 1023 | * pitch, which makes U/V planes 16-bytes aligned. We need to set a | ||
| 1024 | * separate alignment to meet runtime's behaviour. | ||
| 1025 | */ | ||
| 1026 | return ff_default_get_video_buffer2(inlink, | ||
| 1027 | FFALIGN(inlink->w, 32), | ||
| 1028 | FFALIGN(inlink->h, 32), | ||
| 1029 | 16); | ||
| 1030 | } | ||
| @@ -127,4 +127,5 @@ int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err, · 126 unmodified lines | |||
| 127 | int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation, | 127 | int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation, |
| 128 | mfxVersion *pver, mfxSession *psession); | 128 | mfxVersion *pver, mfxSession *psession); |
| 129 | 129 | ||
| 130 | AVFrame *ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h); | ||
| 130 | #endif /* AVFILTER_QSVVPP_H */ | 131 | #endif /* AVFILTER_QSVVPP_H */ |
| @@ -581,6 +581,7 @@ static const AVFilterPad qsvdeint_inputs[] = { · 580 unmodified lines | |||
| 581 | .name = "default", | 581 | .name = "default", |
| 582 | .type = AVMEDIA_TYPE_VIDEO, | 582 | .type = AVMEDIA_TYPE_VIDEO, |
| 583 | .filter_frame = qsvdeint_filter_frame, | 583 | .filter_frame = qsvdeint_filter_frame, |
| 584 | .get_buffer.video = ff_qsvvpp_get_video_buffer, | ||
| 584 | }, | 585 | }, |
| 585 | }; | 586 | }; |
| 586 | 587 | ||
| @@ -399,11 +399,13 @@ static const AVFilterPad overlay_qsv_inputs[] = { · 398 unmodified lines | |||
| 399 | .name = "main", | 399 | .name = "main", |
| 400 | .type = AVMEDIA_TYPE_VIDEO, | 400 | .type = AVMEDIA_TYPE_VIDEO, |
| 401 | .config_props = config_main_input, | 401 | .config_props = config_main_input, |
| 402 | .get_buffer.video = ff_qsvvpp_get_video_buffer, | ||
| 402 | }, | 403 | }, |
| 403 | { | 404 | { |
| 404 | .name = "overlay", | 405 | .name = "overlay", |
| 405 | .type = AVMEDIA_TYPE_VIDEO, | 406 | .type = AVMEDIA_TYPE_VIDEO, |
| 406 | .config_props = config_overlay_input, | 407 | .config_props = config_overlay_input, |
| 408 | .get_buffer.video = ff_qsvvpp_get_video_buffer, | ||
| 407 | }, | 409 | }, |
| 408 | }; | 410 | }; |
| 409 | 411 | ||
| @@ -641,6 +641,7 @@ static const AVFilterPad qsvscale_inputs[] = { · 640 unmodified lines | |||
| 641 | .name = "default", | 641 | .name = "default", |
| 642 | .type = AVMEDIA_TYPE_VIDEO, | 642 | .type = AVMEDIA_TYPE_VIDEO, |
| 643 | .filter_frame = qsvscale_filter_frame, | 643 | .filter_frame = qsvscale_filter_frame, |
| 644 | .get_buffer.video = ff_qsvvpp_get_video_buffer, | ||
| 644 | }, | 645 | }, |
| 645 | }; | 646 | }; |
| 646 | 647 | ||
| @@ -634,6 +634,7 @@ static const AVFilterPad vpp_inputs[] = { · 633 unmodified lines | |||
| 634 | .name = "default", | 634 | .name = "default", |
| 635 | .type = AVMEDIA_TYPE_VIDEO, | 635 | .type = AVMEDIA_TYPE_VIDEO, |
| 636 | .config_props = config_input, | 636 | .config_props = config_input, |
| 637 | .get_buffer.video = ff_qsvvpp_get_video_buffer, | ||
| 637 | }, | 638 | }, |
| 638 | }; | 639 | }; |
| 639 | 640 | ||