[vlc-commits] commit: Allocated mod16 D3D surfaces. (Laurent Aimar )

git at videolan.org git at videolan.org
Sun Jun 27 20:22:10 CEST 2010


vlc/vlc-1.1 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jun 26 21:55:20 2010 +0200| [6fe1bf343648dd9edceee03c3cf9c873e11a4260] | committer: Jean-Baptiste Kempf 

Allocated mod16 D3D surfaces.

It seems necessary for ATI(?) dxva2 support.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=6fe1bf343648dd9edceee03c3cf9c873e11a4260
---

 modules/codec/avcodec/dxva2.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 90a7d9e..eaa6d60 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -230,6 +230,8 @@ typedef struct
     /* */
     vlc_object_t *log;
     int          codec_id;
+    int          width;
+    int          height;
 
     /* DLL */
 	HINSTANCE             hd3d9_dll;
@@ -306,8 +308,7 @@ static int Setup(vlc_va_t *external, void **hw, vlc_fourcc_t *chroma,
 {
     vlc_va_dxva2_t *va = vlc_va_dxva2_Get(external);
 
-    if (va->surface_width  == width &&
-        va->surface_height == height)
+    if (va->width == width && va->height == height && va->decoder)
         goto ok;
 
     /* */
@@ -378,7 +379,7 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
             lock.Pitch / 2,
         };
         CopyFromYv12(picture, plane, pitch,
-                     va->surface_width, va->surface_height,
+                     va->width, va->height,
                      &va->surface_cache);
     } else {
         assert(va->render == MAKEFOURCC('N','V','1','2'));
@@ -391,7 +392,7 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
             lock.Pitch,
         };
         CopyFromNv12(picture, plane, pitch,
-                     va->surface_width, va->surface_height,
+                     va->width, va->height,
                      &va->surface_cache);
     }
 
@@ -829,7 +830,12 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va,
     msg_Dbg(va->log, "DxCreateVideoDecoder id %d %dx%d",
             codec_id, fmt->i_width, fmt->i_height);
 
+    va->width  = fmt->i_width;
+    va->height = fmt->i_height;
+
     /* Allocates all surfaces needed for the decoder */
+    va->surface_width  = (fmt->i_width  + 15) & ~15;
+    va->surface_height = (fmt->i_height + 15) & ~15;
     switch (codec_id) {
     case CODEC_ID_H264:
         va->surface_count = 16 + 1;
@@ -840,8 +846,8 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va,
     }
     LPDIRECT3DSURFACE9 surface_list[VA_DXVA2_MAX_SURFACE_COUNT];
     if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs,
-                                                         fmt->i_width,
-                                                         fmt->i_height,
+                                                         va->surface_width,
+                                                         va->surface_height,
                                                          va->surface_count - 1,
                                                          va->render,
                                                          D3DPOOL_DEFAULT,
@@ -859,8 +865,6 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va,
         surface->refcount = 0;
         surface->order = 0;
     }
-    va->surface_width  = fmt->i_width;
-    va->surface_height = fmt->i_height;
     msg_Dbg(va->log, "IDirectXVideoAccelerationService_CreateSurface succeed with %d surfaces (%dx%d)",
             va->surface_count, fmt->i_width, fmt->i_height);
 



More information about the vlc-commits mailing list