[vlc-devel] [PATCH] vout: wingdi: request filterchain resetting converter for expected display size.
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 21 09:32:14 CET 2019
On 21/01/2019 07:22, Xie Zhigang wrote:
> When using wingdi as video output module, if picture size is not
> matching the display size, it have to use StretchBlt to perform video
> scaling in poor quality.
>
> If it requests video filter chain resetting the video converter in new
> target picture size which matches display size, wingdi can get better
> scaled picture ready for display in quality.
> ---
> modules/video_output/win32/wingdi.c | 35 +++++++++++++++++++++++++----------
> 1 file changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
> index 2bead11..e61e2b4 100644
> --- a/modules/video_output/win32/wingdi.c
> +++ b/modules/video_output/win32/wingdi.c
> @@ -75,6 +75,8 @@ struct vout_display_sys_t
> RGBQUAD green;
> RGBQUAD blue;
> };
> +
> + int prev_size_diff;
> };
>
> static picture_pool_t *Pool (vout_display_t *, unsigned);
> @@ -144,22 +146,35 @@ static void Display(vout_display_t *vd, picture_t *picture)
> #define rect_src_clipped vd->sys->sys.rect_src_clipped
> #define rect_dest vd->sys->sys.rect_dest
> #define rect_dest_clipped vd->sys->sys.rect_dest_clipped
> +
> + int size_diff = 0;
> + size_diff = (rect_dest_clipped.right - rect_dest_clipped.left) *
> + (rect_dest_clipped.bottom - rect_dest_clipped.top)
> + - (rect_src_clipped.right - rect_src_clipped.left) *
> + (rect_src_clipped.bottom - rect_src_clipped.top);
> +
> RECT rect_dst = rect_dest_clipped;
> HDC hdc = GetDC(sys->sys.hvideownd);
>
> OffsetRect(&rect_dst, -rect_dest.left, -rect_dest.top);
> SelectObject(sys->off_dc, sys->off_bitmap);
>
> - if (rect_dest_clipped.right - rect_dest_clipped.left !=
> - rect_src_clipped.right - rect_src_clipped.left ||
> - rect_dest_clipped.bottom - rect_dest_clipped.top !=
> - rect_src_clipped.bottom - rect_src_clipped.top) {
> - StretchBlt(hdc, rect_dst.left, rect_dst.top,
> - rect_dst.right, rect_dst.bottom,
> - sys->off_dc,
> - rect_src_clipped.left, rect_src_clipped.top,
> - rect_src_clipped.right, rect_src_clipped.bottom,
> - SRCCOPY);
> + if (size_diff != sys->prev_size_diff)
> + {
> + sys->prev_size_diff = size_diff;
> + /* request new vout picture size should be scaled to */
> + vd->fmt.i_visible_width = rect_dest_clipped.right - rect_dest_clipped.left;
> + vd->fmt.i_visible_height = rect_dest_clipped.bottom - rect_dest_clipped.top;
> + /* align to 64 is expected to faster access. */
> + vd->fmt.i_width = (rect_dest_clipped.right - rect_dest_clipped.left + 63) & (~63);
> + vd->fmt.i_height = (rect_dest_clipped.bottom - rect_dest_clipped.top + 63) & (~63);
You're not suppsed to change vd->fmt after Open(). I think
vout_display_SendEventPicturesInvalid() should pass the new format it wants.
> +
> + video_format_t fmt = vd->fmt;
> +
> + Clean(vd);
> + Init(vd, &fmt, fmt.i_width, fmt.i_height);
> +
> + vout_display_SendEventPicturesInvalid(vd);
If you want to call that you need to set "has_pictures_invalid" to true
during initialization. In fact it should assert with the current master.
Also you don't handle VOUT_DISPLAY_RESET_PICTURES it should assert as well.
When developing code make sure you use --enable-debug during configure.
> } else {
> BitBlt(hdc, rect_dst.left, rect_dst.top,
> rect_dst.right, rect_dst.bottom,
> --
> 2.7.4
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list