[vlc-devel] [PATCH 08/20] d3d11_filters: fix adjust output when all values are default

Steve Lhomme robux4 at videolabs.io
Wed Nov 22 18:18:27 CET 2017


---
 modules/hw/d3d11/d3d11_adjust.c | 41 +++++++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_adjust.c b/modules/hw/d3d11/d3d11_adjust.c
index c954c79c08..1c4aca64fb 100644
--- a/modules/hw/d3d11/d3d11_adjust.c
+++ b/modules/hw/d3d11/d3d11_adjust.c
@@ -243,35 +243,60 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
         p_sys->procOutput[1]
     };
 
-    size_t idx = 0;
+    size_t idx = 0, count = 0;
     /* contrast */
     if ( ApplyFilter( p_sys,
                       D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST, &p_sys->Contrast,
                       inputs[idx], outputs[idx] ) )
+    {
         idx++;
+        count++;
+    }
     /* brightness */
     if ( ApplyFilter( p_sys,
                       D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS, &p_sys->Brightness,
                       inputs[idx], outputs[idx] ) )
+    {
         idx++;
+        count++;
+    }
     /* hue */
     if ( ApplyFilter( p_sys,
                       D3D11_VIDEO_PROCESSOR_FILTER_HUE, &p_sys->Hue,
                       inputs[idx], outputs[idx] ) )
+    {
         idx++;
+        count++;
+    }
     /* saturation */
     if ( ApplyFilter( p_sys,
                       D3D11_VIDEO_PROCESSOR_FILTER_SATURATION, &p_sys->Saturation,
                       inputs[idx], outputs[idx] ) )
+    {
         idx++;
+        count++;
+    }
 
-    ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
-                                              p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
-                                              p_outpic->p_sys->slice_index,
-                                              0, 0, 0,
-                                              p_sys->out[outputs[idx] == p_sys->procOutput[0] ? 1 : 0].resource,
-                                              0,
-                                              NULL);
+    if (count == 0)
+    {
+        ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
+                                                  p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
+                                                  p_outpic->p_sys->slice_index,
+                                                  0, 0, 0,
+                                                  p_src_sys->resource[KNOWN_DXGI_INDEX],
+                                                  p_src_sys->slice_index,
+                                                  NULL);
+    }
+    else
+    {
+        ID3D11DeviceContext_CopySubresourceRegion(p_outpic->p_sys->context,
+                                                  p_outpic->p_sys->resource[KNOWN_DXGI_INDEX],
+                                                  p_outpic->p_sys->slice_index,
+                                                  0, 0, 0,
+                                                  p_sys->out[outputs[idx] == p_sys->procOutput[0] ? 1 : 0].resource,
+                                                  0,
+                                                  NULL);
+    }
 
     if( p_sys->context_mutex  != INVALID_HANDLE_VALUE )
         ReleaseMutex( p_sys->context_mutex );
-- 
2.14.2



More information about the vlc-devel mailing list