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

Francois Cartegnie git at videolan.org
Wed Aug 8 16:57:20 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug  8 16:54:12 2018 +0200| [c4e5806a0e12dfb099abe865facb5bc7c10e30e5] | committer: Francois Cartegnie

codec: aom: do proper color mapping

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

 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 9ff8166bf0..9f0b9bf4bb 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -563,7 +563,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 \
+                           packetizer/iso_color_tables.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 b256a8ada2..2ee937d4f3 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -41,6 +41,8 @@
 # define SOUT_CFG_PREFIX "sout-aom-"
 #endif
 
+#include "../packetizer/iso_color_tables.h"
+
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
@@ -221,23 +223,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