From: Leo Izen <leo.izen@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Ramiro Polla <ramiro.polla@gmail.com>, Leo Izen <leo.izen@gmail.com> Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/pngdec: fix mDCv typo Date: Tue, 2 Jul 2024 09:44:23 -0400 Message-ID: <20240702134424.133688-1-leo.izen@gmail.com> (raw) When mDCv support was added, there was a typo in both variable names and also the MKTAG itself, incorrectly listing it as mDVc. The tag name stands for Mastering Display Color Volume so mDCv is correct. See other files such as av1dec.c which uses mdcv. Typo originally introduced in c7a57b0f70f8d1574aa0f0dbe98db85d8ac91c76. Signed-off-by: Leo Izen <leo.izen@gmail.com> Reported-by: Ramiro Polla <ramiro.polla@gmail.com> --- libavcodec/pngdec.c | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 1c910e6a5b..180806e5e1 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -86,11 +86,12 @@ typedef struct PNGDecContext { int have_clli; uint32_t clli_max; uint32_t clli_avg; - int have_mdvc; - uint16_t mdvc_primaries[3][2]; - uint16_t mdvc_white_point[2]; - uint32_t mdvc_max_lum; - uint32_t mdvc_min_lum; + /* Mastering Display Color Volume */ + int have_mdcv; + uint16_t mdcv_primaries[3][2]; + uint16_t mdcv_white_point[2]; + uint32_t mdcv_max_lum; + uint32_t mdcv_min_lum; enum PNGHeaderState hdr_state; enum PNGImageState pic_state; @@ -763,24 +764,24 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) } } - if (s->have_mdvc) { - AVMasteringDisplayMetadata *mdvc; + if (s->have_mdcv) { + AVMasteringDisplayMetadata *mdcv; - ret = ff_decode_mastering_display_new(avctx, frame, &mdvc); + ret = ff_decode_mastering_display_new(avctx, frame, &mdcv); if (ret < 0) return ret; - if (mdvc) { - mdvc->has_primaries = 1; + if (mdcv) { + mdcv->has_primaries = 1; for (int i = 0; i < 3; i++) { - mdvc->display_primaries[i][0] = av_make_q(s->mdvc_primaries[i][0], 50000); - mdvc->display_primaries[i][1] = av_make_q(s->mdvc_primaries[i][1], 50000); + mdcv->display_primaries[i][0] = av_make_q(s->mdcv_primaries[i][0], 50000); + mdcv->display_primaries[i][1] = av_make_q(s->mdcv_primaries[i][1], 50000); } - mdvc->white_point[0] = av_make_q(s->mdvc_white_point[0], 50000); - mdvc->white_point[1] = av_make_q(s->mdvc_white_point[1], 50000); - mdvc->has_luminance = 1; - mdvc->max_luminance = av_make_q(s->mdvc_max_lum, 10000); - mdvc->min_luminance = av_make_q(s->mdvc_min_lum, 10000); + mdcv->white_point[0] = av_make_q(s->mdcv_white_point[0], 50000); + mdcv->white_point[1] = av_make_q(s->mdcv_white_point[1], 50000); + mdcv->has_luminance = 1; + mdcv->max_luminance = av_make_q(s->mdcv_max_lum, 10000); + mdcv->min_luminance = av_make_q(s->mdcv_min_lum, 10000); } } @@ -1571,20 +1572,20 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, s->clli_max = bytestream2_get_be32u(&gb_chunk); s->clli_avg = bytestream2_get_be32u(&gb_chunk); break; - case MKTAG('m', 'D', 'V', 'c'): + case MKTAG('m', 'D', 'C', 'v'): if (bytestream2_get_bytes_left(&gb_chunk) != 24) { - av_log(avctx, AV_LOG_WARNING, "Invalid mDVc chunk size: %d\n", bytestream2_get_bytes_left(&gb_chunk)); + av_log(avctx, AV_LOG_WARNING, "Invalid mDCv chunk size: %d\n", bytestream2_get_bytes_left(&gb_chunk)); break; } - s->have_mdvc = 1; + s->have_mdcv = 1; for (int i = 0; i < 3; i++) { - s->mdvc_primaries[i][0] = bytestream2_get_be16u(&gb_chunk); - s->mdvc_primaries[i][1] = bytestream2_get_be16u(&gb_chunk); + s->mdcv_primaries[i][0] = bytestream2_get_be16u(&gb_chunk); + s->mdcv_primaries[i][1] = bytestream2_get_be16u(&gb_chunk); } - s->mdvc_white_point[0] = bytestream2_get_be16u(&gb_chunk); - s->mdvc_white_point[1] = bytestream2_get_be16u(&gb_chunk); - s->mdvc_max_lum = bytestream2_get_be32u(&gb_chunk); - s->mdvc_min_lum = bytestream2_get_be32u(&gb_chunk); + s->mdcv_white_point[0] = bytestream2_get_be16u(&gb_chunk); + s->mdcv_white_point[1] = bytestream2_get_be16u(&gb_chunk); + s->mdcv_max_lum = bytestream2_get_be32u(&gb_chunk); + s->mdcv_min_lum = bytestream2_get_be32u(&gb_chunk); break; case MKTAG('I', 'E', 'N', 'D'): if (!(s->pic_state & PNG_ALLIMAGE)) -- 2.45.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-07-02 13:44 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-07-02 13:44 Leo Izen [this message] 2024-07-02 13:44 ` [FFmpeg-devel] [PATCH 2/2] avcodec/pngenc: " Leo Izen 2024-07-02 15:14 ` Sean McGovern 2024-07-02 15:48 ` Andreas Rheinhardt 2024-07-02 15:52 ` Sean McGovern 2024-07-02 15:54 ` Andreas Rheinhardt 2024-07-03 14:25 ` Leo Izen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240702134424.133688-1-leo.izen@gmail.com \ --to=leo.izen@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=ramiro.polla@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git