[FFmpeg-devel] [PATCH 2/2] lavfi/vaapi: add more factors when using VAProcColorStandardExplicit

Fei Wang fei.w.wang at intel.com
Sun Apr 26 06:02:56 EEST 2020


Use VAProcColorStandardExplicit only if the color properties all
specificed.

Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
 libavfilter/vaapi_vpp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index 6ffc09d..e1d3373 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -278,10 +278,14 @@ static void vaapi_vpp_fill_colour_standard(VAAPIColourProperties *props,
     // use them and avoid doing any mapping.  (The driver may not support
     // some particular code point, but it still has enough information to
     // make a better fallback choice than we do in that case.)
-    for (i = 0; i < nb_vacs; i++) {
-        if (vacs[i] == VAProcColorStandardExplicit) {
-            props->va_color_standard = VAProcColorStandardExplicit;
-            return;
+    if ((props->colorspace != AVCOL_SPC_UNSPECIFIED) &&
+        (props->color_trc != AVCOL_TRC_UNSPECIFIED) &&
+        (props->color_primaries != AVCOL_PRI_UNSPECIFIED)) {
+        for (i = 0; i < nb_vacs; i++) {
+            if (vacs[i] == VAProcColorStandardExplicit) {
+                props->va_color_standard = VAProcColorStandardExplicit;
+                return;
+            }
         }
     }
 #endif
-- 
2.7.4



More information about the ffmpeg-devel mailing list