avcodec/pngdec: fix mDCv typo

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 c7a57b0f70.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
This commit is contained in:
Leo Izen 2024-07-02 09:24:18 -04:00
parent d241edc2b4
commit c1af34c25b
No known key found for this signature in database
GPG Key ID: 764E48EA48221833

View File

@ -86,11 +86,12 @@ typedef struct PNGDecContext {
int have_clli; int have_clli;
uint32_t clli_max; uint32_t clli_max;
uint32_t clli_avg; uint32_t clli_avg;
int have_mdvc; /* Mastering Display Color Volume */
uint16_t mdvc_primaries[3][2]; int have_mdcv;
uint16_t mdvc_white_point[2]; uint16_t mdcv_primaries[3][2];
uint32_t mdvc_max_lum; uint16_t mdcv_white_point[2];
uint32_t mdvc_min_lum; uint32_t mdcv_max_lum;
uint32_t mdcv_min_lum;
enum PNGHeaderState hdr_state; enum PNGHeaderState hdr_state;
enum PNGImageState pic_state; enum PNGImageState pic_state;
@ -763,24 +764,24 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame)
} }
} }
if (s->have_mdvc) { if (s->have_mdcv) {
AVMasteringDisplayMetadata *mdvc; AVMasteringDisplayMetadata *mdcv;
ret = ff_decode_mastering_display_new(avctx, frame, &mdvc); ret = ff_decode_mastering_display_new(avctx, frame, &mdcv);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (mdvc) { if (mdcv) {
mdvc->has_primaries = 1; mdcv->has_primaries = 1;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
mdvc->display_primaries[i][0] = av_make_q(s->mdvc_primaries[i][0], 50000); mdcv->display_primaries[i][0] = av_make_q(s->mdcv_primaries[i][0], 50000);
mdvc->display_primaries[i][1] = av_make_q(s->mdvc_primaries[i][1], 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); mdcv->white_point[0] = av_make_q(s->mdcv_white_point[0], 50000);
mdvc->white_point[1] = av_make_q(s->mdvc_white_point[1], 50000); mdcv->white_point[1] = av_make_q(s->mdcv_white_point[1], 50000);
mdvc->has_luminance = 1; mdcv->has_luminance = 1;
mdvc->max_luminance = av_make_q(s->mdvc_max_lum, 10000); mdcv->max_luminance = av_make_q(s->mdcv_max_lum, 10000);
mdvc->min_luminance = av_make_q(s->mdvc_min_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_max = bytestream2_get_be32u(&gb_chunk);
s->clli_avg = bytestream2_get_be32u(&gb_chunk); s->clli_avg = bytestream2_get_be32u(&gb_chunk);
break; break;
case MKTAG('m', 'D', 'V', 'c'): case MKTAG('m', 'D', 'C', 'v'):
if (bytestream2_get_bytes_left(&gb_chunk) != 24) { 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; break;
} }
s->have_mdvc = 1; s->have_mdcv = 1;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
s->mdvc_primaries[i][0] = bytestream2_get_be16u(&gb_chunk); s->mdcv_primaries[i][0] = bytestream2_get_be16u(&gb_chunk);
s->mdvc_primaries[i][1] = 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->mdcv_white_point[0] = bytestream2_get_be16u(&gb_chunk);
s->mdvc_white_point[1] = bytestream2_get_be16u(&gb_chunk); s->mdcv_white_point[1] = bytestream2_get_be16u(&gb_chunk);
s->mdvc_max_lum = bytestream2_get_be32u(&gb_chunk); s->mdcv_max_lum = bytestream2_get_be32u(&gb_chunk);
s->mdvc_min_lum = bytestream2_get_be32u(&gb_chunk); s->mdcv_min_lum = bytestream2_get_be32u(&gb_chunk);
break; break;
case MKTAG('I', 'E', 'N', 'D'): case MKTAG('I', 'E', 'N', 'D'):
if (!(s->pic_state & PNG_ALLIMAGE)) if (!(s->pic_state & PNG_ALLIMAGE))