[vlc-commits] vaapi: use AVFrame.opaque to store per-picture state directly

Rémi Denis-Courmont git at videolan.org
Wed Jul 24 22:42:52 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 24 23:21:45 2013 +0300| [6aca96ae791a29cefb2bbe301b1096f90dea4c99] | committer: Rémi Denis-Courmont

vaapi: use AVFrame.opaque to store per-picture state directly

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

 modules/codec/avcodec/vaapi.c |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 418f9af..d014d7d 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -513,23 +513,17 @@ static int Get( vlc_va_t *va, AVFrame *p_ff )
         if( i == 0 || i == 3 )
             p_ff->data[i] = (void*)(uintptr_t)p_surface->i_id;/* Yummie */
     }
+    p_ff->opaque = p_surface;
     return VLC_SUCCESS;
 }
 
 static void Release( vlc_va_t *va, AVFrame *p_ff )
 {
     vlc_va_sys_t *sys = va->sys;
-
-    VASurfaceID i_surface_id = (VASurfaceID)(uintptr_t)p_ff->data[3];
+    vlc_va_surface_t *p_surface = p_ff->opaque;
 
     vlc_mutex_lock( &sys->lock );
-    for( int i = 0; i < sys->i_surface_count; i++ )
-    {
-        vlc_va_surface_t *p_surface = &sys->p_surface[i];
-
-        if( p_surface->i_id == i_surface_id )
-            p_surface->i_refcount--;
-    }
+    p_surface->i_refcount--;
     vlc_mutex_unlock( &sys->lock );
 }
 



More information about the vlc-commits mailing list