[vlc-commits] demux: libmp4: SmDm is fixed point

Francois Cartegnie git at videolan.org
Wed Aug 22 11:33:11 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug 22 10:43:14 2018 +0200| [6f2c751c0989362557614374727cbb0ada9ed32b] | committer: Francois Cartegnie

demux: libmp4: SmDm is fixed point

(cherry picked from commit dcb0c69563163968c2538504d9f619ab69fe44be)

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

 modules/demux/mp4/libmp4.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index b71abf8739..a3a01f762e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2008,11 +2008,22 @@ static int MP4_ReadBox_SmDm( stream_t *p_stream, MP4_Box_t *p_box )
 
     const uint8_t RGB2GBR[3] = {2,0,1};
     for(int i=0; i<6; i++)
-        MP4_GET2BYTES( p_SmDm->primaries[RGB2GBR[i/2] + i%2] );
+    {
+        int index = RGB2GBR[i/2] + i%2;
+        MP4_GET2BYTES( p_SmDm->primaries[index] );
+        p_SmDm->primaries[index] = 50000 * (double)p_SmDm->primaries[index] / (double)(1<<16);
+    }
+
     for(int i=0; i<2; i++)
+    {
         MP4_GET2BYTES( p_SmDm->white_point[i] );
+        p_SmDm->white_point[i] = 50000 * (double)p_SmDm->white_point[i] / (double)(1<<16);
+    }
+
     MP4_GET4BYTES( p_SmDm->i_luminanceMax );
     MP4_GET4BYTES( p_SmDm->i_luminanceMin );
+    p_SmDm->i_luminanceMax = 10000 * (double)p_SmDm->i_luminanceMax / (double) (1<<8);
+    p_SmDm->i_luminanceMin = 10000 * (double)p_SmDm->i_luminanceMin / (double) (1<<14);
 
     MP4_READBOX_EXIT( 1 );
 }



More information about the vlc-commits mailing list