[vlc-commits] codec: aom: do proper color mapping

Francois Cartegnie git at videolan.org
Thu Oct 4 17:20:51 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug  8 16:54:12 2018 +0200| [fd46f980eb0a02fd5da3d74b2b2abece62f521c3] | committer: Tristan Matthews

codec: aom: do proper color mapping

(cherry picked from commit c4e5806a0e12dfb099abe865facb5bc7c10e30e5)

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

 modules/codec/Makefile.am |  3 ++-
 modules/codec/aom.c       | 23 +++++++----------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 6a534c259a..9bbc5f2877 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -572,7 +572,8 @@ libvpx_plugin_la_LIBADD = $(VPX_LIBS)
 EXTRA_LTLIBRARIES += libvpx_plugin.la
 codec_LTLIBRARIES += $(LTLIBvpx)
 
-libaom_plugin_la_SOURCES = codec/aom.c
+libaom_plugin_la_SOURCES = codec/aom.c \
+                           demux/mp4/color_config.h
 libaom_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
 libaom_plugin_la_CFLAGS = $(AM_CFLAGS) $(AOM_CFLAGS) $(CPPFLAGS_aom)
 libaom_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 37cfcbef7b..6392a7acf9 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -35,6 +35,8 @@
 #include <aom/aom_decoder.h>
 #include <aom/aomdx.h>
 
+#include "demux/mp4/color_config.h"
+
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
@@ -187,23 +189,12 @@ static void OutputFrame(decoder_t *dec, const struct aom_image *img)
         dec->fmt_out.video.i_sar_den = 1;
     }
 
-    v->b_color_range_full = img->range == AOM_CR_FULL_RANGE;
-
-    switch( img->mc )
+    if(dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
     {
-        case AOM_CICP_MC_BT_709:
-            v->space = COLOR_SPACE_BT709;
-            break;
-        case AOM_CICP_MC_BT_601:
-        case AOM_CICP_MC_SMPTE_240:
-            v->space = COLOR_SPACE_BT601;
-            break;
-        case AOM_CICP_MC_BT_2020_CL:
-        case AOM_CICP_MC_BT_2020_NCL:
-            v->space = COLOR_SPACE_BT2020;
-            break;
-        default:
-            break;
+        v->primaries = iso_23001_8_cp_to_vlc_primaries(img->cp);
+        v->transfer = iso_23001_8_tc_to_vlc_xfer(img->tc);
+        v->space = iso_23001_8_mc_to_vlc_coeffs(img->mc);
+        v->b_color_range_full = img->range == AOM_CR_FULL_RANGE;
     }
 
     dec->fmt_out.video.projection_mode = dec->fmt_in.video.projection_mode;



More information about the vlc-commits mailing list