[vlc-devel] [PATCH 2/2] avcodec: directx_va: get rid of useless width/height variables

Steve Lhomme robux4 at videolabs.io
Tue Mar 21 16:12:00 CET 2017


surface_width and surface_height are what really matter.
---
 modules/codec/avcodec/directx_va.c | 12 +++++-------
 modules/codec/avcodec/directx_va.h |  2 --
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index f588bb0640..bf8be6c466 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -274,7 +274,7 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
 {
     int surface_count = 2;
 
-    if (dx_sys->width == avctx->coded_width && dx_sys->height == avctx->coded_height
+    if (dx_sys->surface_width == avctx->coded_width && dx_sys->surface_height == avctx->coded_height
      && dx_sys->decoder != NULL)
         goto ok;
 
@@ -308,16 +308,14 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
 
     dx_sys->surface_count = surface_count;
 
-    dx_sys->width  = avctx->coded_width;
-    dx_sys->height = avctx->coded_height;
-    dx_sys->surface_width  = dx_sys->width;
-    dx_sys->surface_height = dx_sys->height;
+    dx_sys->surface_width  = avctx->coded_width;
+    dx_sys->surface_height = avctx->coded_height;
 
     /* FIXME transmit a video_format_t by VaSetup directly */
     video_format_t fmt;
     memset(&fmt, 0, sizeof(fmt));
-    fmt.i_width = dx_sys->width;
-    fmt.i_height = dx_sys->height;
+    fmt.i_width = dx_sys->surface_width;
+    fmt.i_height = dx_sys->surface_height;
     fmt.i_frame_rate = avctx->framerate.num;
     fmt.i_frame_rate_base = avctx->framerate.den;
 
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 0561dcdae1..86969aafe3 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -59,8 +59,6 @@ typedef struct input_list_t {
 typedef struct
 {
     int          codec_id;
-    int          width;
-    int          height;
 
     /* DLL */
     HINSTANCE             hdecoder_dll;
-- 
2.11.1



More information about the vlc-devel mailing list