[vlc-devel] [PATCH 05/20] hw:d3d11: clean code

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


Use local variables when possible
---
 modules/hw/d3d11/d3d11_adjust.c      | 16 ++++++++--------
 modules/hw/d3d11/d3d11_deinterlace.c | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_adjust.c b/modules/hw/d3d11/d3d11_adjust.c
index e00bdf3c7a..c954c79c08 100644
--- a/modules/hw/d3d11/d3d11_adjust.c
+++ b/modules/hw/d3d11/d3d11_adjust.c
@@ -350,7 +350,7 @@ static int Open(vlc_object_t *obj)
         msg_Warn(filter, "No mutex found to lock the decoder");
     sys->context_mutex = context_lock;
 
-    const video_format_t *fmt = &dst->format;
+    const video_format_t *fmt = &filter->fmt_out.video;
 
     D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = {
         .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE,
@@ -360,11 +360,11 @@ static int Open(vlc_object_t *obj)
         },
         .InputWidth   = fmt->i_width,
         .InputHeight  = fmt->i_height,
-        .OutputWidth  = dst->format.i_width,
-        .OutputHeight = dst->format.i_height,
+        .OutputWidth  = dstDesc.Width,
+        .OutputHeight = dstDesc.Height,
         .OutputFrameRate = {
-            .Numerator   = dst->format.i_frame_rate,
-            .Denominator = dst->format.i_frame_rate_base,
+            .Numerator   = fmt->i_frame_rate,
+            .Denominator = fmt->i_frame_rate_base,
         },
         .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL,
     };
@@ -379,16 +379,16 @@ static int Open(vlc_object_t *obj)
 #ifndef NDEBUG
     D3D11_LogProcessorSupport(filter, processorEnumerator);
 #endif
-    hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dst->p_sys->formatTexture, &flags);
+    hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dstDesc.Format, &flags);
     if (!SUCCEEDED(hr))
     {
-        msg_Dbg(filter, "can't read processor support for %s", DxgiFormatToStr(dst->p_sys->formatTexture));
+        msg_Dbg(filter, "can't read processor support for %s", DxgiFormatToStr(dstDesc.Format));
         goto error;
     }
     if ( !(flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT) ||
          !(flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT) )
     {
-        msg_Dbg(filter, "input/output %s is not supported", DxgiFormatToStr(dst->p_sys->formatTexture));
+        msg_Dbg(filter, "input/output %s is not supported", DxgiFormatToStr(dstDesc.Format));
         goto error;
     }
 
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index b47f0dc342..1e310fb2dc 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -332,7 +332,7 @@ static int Open(vlc_object_t *obj)
         msg_Warn(filter, "No mutex found to lock the decoder");
     sys->context_mutex = context_lock;
 
-    const video_format_t *fmt = &dst->format;
+    const video_format_t *fmt = &filter->fmt_out.video;
 
     D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = {
         .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST,
@@ -342,11 +342,11 @@ static int Open(vlc_object_t *obj)
         },
         .InputWidth   = fmt->i_width,
         .InputHeight  = fmt->i_height,
-        .OutputWidth  = dst->format.i_width,
-        .OutputHeight = dst->format.i_height,
+        .OutputWidth  = dstDesc.Width,
+        .OutputHeight = dstDesc.Height,
         .OutputFrameRate = {
-            .Numerator   = dst->format.i_frame_rate,
-            .Denominator = dst->format.i_frame_rate_base,
+            .Numerator   = fmt->i_frame_rate,
+            .Denominator = fmt->i_frame_rate_base,
         },
         .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL,
     };
@@ -361,16 +361,16 @@ static int Open(vlc_object_t *obj)
 #ifndef NDEBUG
     D3D11_LogProcessorSupport(filter, processorEnumerator);
 #endif
-    hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dst->p_sys->formatTexture, &flags);
+    hr = ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(processorEnumerator, dstDesc.Format, &flags);
     if (!SUCCEEDED(hr))
     {
-        msg_Dbg(filter, "can't read processor support for %s", DxgiFormatToStr(dst->p_sys->formatTexture));
+        msg_Dbg(filter, "can't read processor support for %s", DxgiFormatToStr(dstDesc.Format));
         goto error;
     }
     if ( !(flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT) ||
          !(flags & D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT) )
     {
-        msg_Dbg(filter, "deinterlacing %s is not supported", DxgiFormatToStr(dst->p_sys->formatTexture));
+        msg_Dbg(filter, "deinterlacing %s is not supported", DxgiFormatToStr(dstDesc.Format));
         goto error;
     }
 
-- 
2.14.2



More information about the vlc-devel mailing list