diff options
author | James Almer <jamrial@gmail.com> | 2019-02-10 02:14:14 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-02-11 22:58:27 +0300 |
commit | 00fd38f1846a3c889b6ec645107eaea415b99840 (patch) | |
tree | 468b8bbc6da085788c381016471b776668bd2233 /libavformat/mov.c | |
parent | 6174686bc346e24fd146a725a97d77e571ebf5b4 (diff) |
avformat/mov: don't rescale mastering display values from the SmDm atom
Simplifies code.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index cc91beb7f9..d889c26b78 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5288,9 +5288,7 @@ static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; - const int chroma_den = 50000; - const int luma_den = 10000; - int i, j, version; + int i, version; if (c->fc->nb_streams < 1) return AVERROR_INVALIDDATA; @@ -5313,17 +5311,15 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!sc->mastering) return AVERROR(ENOMEM); - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - sc->mastering->display_primaries[i][j] = - av_make_q(lrint(((double)avio_rb16(pb) / (1 << 16)) * chroma_den), chroma_den); - for (i = 0; i < 2; i++) - sc->mastering->white_point[i] = - av_make_q(lrint(((double)avio_rb16(pb) / (1 << 16)) * chroma_den), chroma_den); - sc->mastering->max_luminance = - av_make_q(lrint(((double)avio_rb32(pb) / (1 << 8)) * luma_den), luma_den); - sc->mastering->min_luminance = - av_make_q(lrint(((double)avio_rb32(pb) / (1 << 14)) * luma_den), luma_den); + for (i = 0; i < 3; i++) { + sc->mastering->display_primaries[i][0] = av_make_q(avio_rb16(pb), 1 << 16); + sc->mastering->display_primaries[i][1] = av_make_q(avio_rb16(pb), 1 << 16); + } + sc->mastering->white_point[0] = av_make_q(avio_rb16(pb), 1 << 16); + sc->mastering->white_point[1] = av_make_q(avio_rb16(pb), 1 << 16); + + sc->mastering->max_luminance = av_make_q(avio_rb32(pb), 1 << 8); + sc->mastering->min_luminance = av_make_q(avio_rb32(pb), 1 << 14); sc->mastering->has_primaries = 1; sc->mastering->has_luminance = 1; |