[vlc-commits] hw:d3d11: filter the correct part of the picture
Steve Lhomme
git at videolan.org
Mon Feb 5 19:21:11 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 5 15:07:53 2018 +0100| [c9804755bd83af7037e9afebe8dd4da3b1e61e46] | committer: Jean-Baptiste Kempf
hw:d3d11: filter the correct part of the picture
The source and destination may have different padding, so we need to ensure
we copy to/from the right area.
Fixes #19601
(cherry picked from commit 7c92309e654c4d8310ced9bb342c334f38156f69)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c9804755bd83af7037e9afebe8dd4da3b1e61e46
---
modules/hw/d3d11/d3d11_filters.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index e835142ef9..7a47891435 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -137,7 +137,8 @@ static bool ApplyFilter( filter_sys_t *p_sys,
D3D11_VIDEO_PROCESSOR_FILTER filter,
const struct filter_level *p_level,
ID3D11VideoProcessorInputView *input,
- ID3D11VideoProcessorOutputView *output )
+ ID3D11VideoProcessorOutputView *output,
+ const video_format_t *fmt)
{
HRESULT hr;
@@ -152,6 +153,16 @@ static bool ApplyFilter( filter_sys_t *p_sys,
TRUE,
level);
+ RECT srcRect;
+ srcRect.left = fmt->i_x_offset;
+ srcRect.top = fmt->i_y_offset;
+ srcRect.right = srcRect.left + fmt->i_visible_width;
+ srcRect.bottom = srcRect.top + fmt->i_visible_height;
+ ID3D11VideoContext_VideoProcessorSetStreamSourceRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+ 0, TRUE, &srcRect);
+ ID3D11VideoContext_VideoProcessorSetStreamDestRect(p_sys->d3dvidctx, p_sys->videoProcessor,
+ 0, TRUE, &srcRect);
+
D3D11_VIDEO_PROCESSOR_STREAM stream = {0};
stream.Enable = TRUE;
stream.pInputSurface = input;
@@ -256,7 +267,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
/* contrast */
if ( ApplyFilter( p_sys,
D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST, &p_sys->Contrast,
- inputs[idx], outputs[idx] ) )
+ inputs[idx], outputs[idx], &p_filter->fmt_out.video ) )
{
idx++;
count++;
@@ -264,7 +275,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
/* brightness */
if ( ApplyFilter( p_sys,
D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS, &p_sys->Brightness,
- inputs[idx], outputs[idx] ) )
+ inputs[idx], outputs[idx], &p_filter->fmt_out.video ) )
{
idx++;
count++;
@@ -272,7 +283,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
/* hue */
if ( ApplyFilter( p_sys,
D3D11_VIDEO_PROCESSOR_FILTER_HUE, &p_sys->Hue,
- inputs[idx], outputs[idx] ) )
+ inputs[idx], outputs[idx], &p_filter->fmt_out.video ) )
{
idx++;
count++;
@@ -280,7 +291,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
/* saturation */
if ( ApplyFilter( p_sys,
D3D11_VIDEO_PROCESSOR_FILTER_SATURATION, &p_sys->Saturation,
- inputs[idx], outputs[idx] ) )
+ inputs[idx], outputs[idx], &p_filter->fmt_out.video ) )
{
idx++;
count++;
More information about the vlc-commits
mailing list