[vlc-commits] hw: vaapi: add vlc_vaapi_IsChromaOpaque

Thomas Guillem git at videolan.org
Tue Nov 7 11:52:50 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Sep  3 10:56:06 2017 +0200| [7a46400e2eec9797eb11f2aa4dc1aaa37357201a] | committer: Thomas Guillem

hw: vaapi: add vlc_vaapi_IsChromaOpaque

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

 modules/hw/vaapi/filters.c   | 4 ++--
 modules/hw/vaapi/vlc_vaapi.c | 2 +-
 modules/hw/vaapi/vlc_vaapi.h | 6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index ba00dbe1c0..e68700bb82 100755
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -56,7 +56,7 @@ vlc_vaapi_FilterHoldInstance(filter_t *filter, VADisplay *dpy)
     if (!pic)
         return NULL;
 
-    if (pic->format.i_chroma != VLC_CODEC_VAAPI_420)
+    if (!vlc_vaapi_IsChromaOpaque(pic->format.i_chroma))
     {
         picture_Release(pic);
         return NULL;
@@ -360,7 +360,7 @@ Open(filter_t * filter,
 {
     filter_sys_t *      filter_sys;
 
-    if (filter->fmt_out.video.i_chroma != VLC_CODEC_VAAPI_420 ||
+    if (!vlc_vaapi_IsChromaOpaque(filter->fmt_out.video.i_chroma) ||
         !video_format_IsSimilar(&filter->fmt_out.video, &filter->fmt_in.video))
         return VLC_EGENERIC;
 
diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c
index 59d520aafb..e777a879a4 100644
--- a/modules/hw/vaapi/vlc_vaapi.c
+++ b/modules/hw/vaapi/vlc_vaapi.c
@@ -638,7 +638,7 @@ vlc_vaapi_PicSysHoldInstance(picture_sys_t *sys, VADisplay *dpy)
 }
 
 #define ASSERT_VAAPI_CHROMA(pic) do { \
-    assert(pic->format.i_chroma == VLC_CODEC_VAAPI_420); \
+    assert(vlc_vaapi_IsChromaOpaque(pic->format.i_chroma)); \
 } while(0)
 
 void
diff --git a/modules/hw/vaapi/vlc_vaapi.h b/modules/hw/vaapi/vlc_vaapi.h
index 08b55b626b..ce37b95cb8 100644
--- a/modules/hw/vaapi/vlc_vaapi.h
+++ b/modules/hw/vaapi/vlc_vaapi.h
@@ -205,4 +205,10 @@ vlc_vaapi_PicGetSurface(picture_t *pic);
 VADisplay
 vlc_vaapi_PicGetDisplay(picture_t *pic);
 
+static inline bool
+vlc_vaapi_IsChromaOpaque(int i_vlc_chroma)
+{
+    return i_vlc_chroma == VLC_CODEC_VAAPI_420;
+}
+
 #endif /* VLC_VAAPI_H */



More information about the vlc-commits mailing list