History

libavfilter/qsvvpp: Change the alignment to meet the requirement of YUV420P format

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

Wenbin Chen committed 3 years ago

Commit 20f29411 parent d4f853f6 files · +19 −0Browse files

Unified · Split

6 files
  1. libavfilter/qsvvpp.c +13 −0
  2. libavfilter/qsvvpp.h +1 −0
  3. libavfilter/vf_deinterlace_qsv.c +1 −0
  4. libavfilter/vf_overlay_qsv.c +2 −0
  5. libavfilter/vf_scale_qsv.c +1 −0
  6. libavfilter/vf_vpp_qsv.c +1 −0
libavfilter/qsvvpp.c+13−0
@@ -1015,3 +1015,16 @@ int ff_qsvvpp_create_mfx_session(void *ctx, · 1014 unmodified lines
10151015 }
10161016
10171017 #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+}
libavfilter/qsvvpp.h+1−0
@@ -127,4 +127,5 @@ int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err, · 126 unmodified lines
127127 int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL implementation,
128128 mfxVersion *pver, mfxSession *psession);
129129
130+AVFrame *ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h);
130131 #endif /* AVFILTER_QSVVPP_H */
libavfilter/vf_deinterlace_qsv.c+1−0
@@ -581,6 +581,7 @@ static const AVFilterPad qsvdeint_inputs[] = { · 580 unmodified lines
581581 .name = "default",
582582 .type = AVMEDIA_TYPE_VIDEO,
583583 .filter_frame = qsvdeint_filter_frame,
584+ .get_buffer.video = ff_qsvvpp_get_video_buffer,
584585 },
585586 };
586587
libavfilter/vf_overlay_qsv.c+2−0
@@ -399,11 +399,13 @@ static const AVFilterPad overlay_qsv_inputs[] = { · 398 unmodified lines
399399 .name = "main",
400400 .type = AVMEDIA_TYPE_VIDEO,
401401 .config_props = config_main_input,
402+ .get_buffer.video = ff_qsvvpp_get_video_buffer,
402403 },
403404 {
404405 .name = "overlay",
405406 .type = AVMEDIA_TYPE_VIDEO,
406407 .config_props = config_overlay_input,
408+ .get_buffer.video = ff_qsvvpp_get_video_buffer,
407409 },
408410 };
409411
libavfilter/vf_scale_qsv.c+1−0
@@ -641,6 +641,7 @@ static const AVFilterPad qsvscale_inputs[] = { · 640 unmodified lines
641641 .name = "default",
642642 .type = AVMEDIA_TYPE_VIDEO,
643643 .filter_frame = qsvscale_filter_frame,
644+ .get_buffer.video = ff_qsvvpp_get_video_buffer,
644645 },
645646 };
646647
libavfilter/vf_vpp_qsv.c+1−0
@@ -634,6 +634,7 @@ static const AVFilterPad vpp_inputs[] = { · 633 unmodified lines
634634 .name = "default",
635635 .type = AVMEDIA_TYPE_VIDEO,
636636 .config_props = config_input,
637+ .get_buffer.video = ff_qsvvpp_get_video_buffer,
637638 },
638639 };
639640

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