[FFmpeg-cvslog] avformat/mov: simplify parsing of mdcv atom using av_make_q()

James Almer git at videolan.org
Thu Dec 21 06:25:07 EET 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Dec 21 01:23:17 2017 -0300| [bc10260f49d594b552926b5f81e0282dfdebc503] | committer: James Almer

avformat/mov: simplify parsing of mdcv atom using av_make_q()

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavformat/mov.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 480e506370..20644734dc 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5210,20 +5210,14 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     for (i = 0; i < 3; i++) {
         const int j = mapping[i];
-        sc->mastering->display_primaries[j][0].num = avio_rb16(pb);
-        sc->mastering->display_primaries[j][0].den = chroma_den;
-        sc->mastering->display_primaries[j][1].num = avio_rb16(pb);
-        sc->mastering->display_primaries[j][1].den = chroma_den;
-    }
-    sc->mastering->white_point[0].num = avio_rb16(pb);
-    sc->mastering->white_point[0].den = chroma_den;
-    sc->mastering->white_point[1].num = avio_rb16(pb);
-    sc->mastering->white_point[1].den = chroma_den;
-
-    sc->mastering->max_luminance.num = avio_rb32(pb);
-    sc->mastering->max_luminance.den = luma_den;
-    sc->mastering->min_luminance.num = avio_rb32(pb);
-    sc->mastering->min_luminance.den = luma_den;
+        sc->mastering->display_primaries[j][0] = av_make_q(avio_rb16(pb), chroma_den);
+        sc->mastering->display_primaries[j][1] = av_make_q(avio_rb16(pb), chroma_den);
+    }
+    sc->mastering->white_point[0] = av_make_q(avio_rb16(pb), chroma_den);
+    sc->mastering->white_point[1] = av_make_q(avio_rb16(pb), chroma_den);
+
+    sc->mastering->max_luminance = av_make_q(avio_rb32(pb), luma_den);
+    sc->mastering->min_luminance = av_make_q(avio_rb32(pb), luma_den);
 
     sc->mastering->has_luminance = 1;
     sc->mastering->has_primaries = 1;



More information about the ffmpeg-cvslog mailing list