From patchwork Tue Jul 2 13:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 50303 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp2996477vqv; Wed, 3 Jul 2024 04:04:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVnvZmpS6Id50qzdPgXokXcAAsfxWPafjRdTROovdRkhTM9s9ynkYXxO7zTNRHXTAb5veUFJtPKNoY0whpMHh/eYQEQ/n8LONnRKQ== X-Google-Smtp-Source: AGHT+IH8HuZvlFKbW7/looTcBielFQWu0jV8eyS5pFt8dVhEynKiEhMf0ocdEkczxeZVHSMzClAS X-Received: by 2002:a05:651c:198b:b0:2ec:4487:6a8f with SMTP id 38308e7fff4ca-2ee5e6ba645mr86184011fa.37.1720004646753; Wed, 03 Jul 2024 04:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720004646; cv=none; d=google.com; s=arc-20160816; b=Bl3/JZsyXL1/44M+8OyEm4sdkr45//L4/xa26LpefUtWw6sDE6PQZS1OET5mfJqLh4 am+gwOMYflcwbEcYHEiLxDqsQ9gqdNv231C/tDYogWqkCWjh7acI1JFVk6g5yX73xGSy GRjAjK8i0XDG81LwtqDheP9BvBy0TNqtvBde5GQO1DLyGZKL/PIRK5MPLHoBWHb03n1d tvjQ2o4nN4kWgUXFTMb9QiSmtpih0L3ncKWSEMubHsjofEks/vUUtYTn4uMCO2sf0Wqh rBHDSY9dJ5jVChuQVokQjiFqI6pBPPjI4tVwSiX9D8MlENjKh8lv4xK9SlOh/z5di4AM 4s6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=S2rhGnHK3pv65VK8Tlszx1DnCuchCQKKmCl7rvSNtIY=; fh=wbRw4dmpm5HLdLOi49E3B1xR6OR4JvuzzqZfDAQQ2R4=; b=Lh4Q4W5gUg/pJV5OvMpq6GXPgqZk4yONaxFnbXzZVELhVfoJIYoh/aG4H5BcHLHhNE 5GTMhVqVfEzeD+hGnNM8B5YTQYpKTMuysllxravq8Pu9pvyUDWrr3//9LBa5Iod4ALPf AF41zBNW5gFl+zDFwdlCLY0oPYn4862jvV7JlUBCkhh+y6wyJ42GyadQBernYats1nlk +3Hte6gPwXg73iKk2sGz7386Xp9OdmqGJewEb0X11C5zxcBLqADlon+4gdb1mLkaIRt6 46OamseczH5Frhjpj/rXaBcFDFS4ox7JoJ8ceCiSAEqsXKE0+GwQ6Amqr7y2igOfHpOc OF0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="M53/Ca4X"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 38308e7fff4ca-2ee5155e2b8si29268391fa.525.2024.07.03.04.04.06; Wed, 03 Jul 2024 04:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="M53/Ca4X"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E167068D8DB; Tue, 2 Jul 2024 16:44:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A9CF268D8AE for ; Tue, 2 Jul 2024 16:44:28 +0300 (EEST) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e03605bedb4so513854276.0 for ; Tue, 02 Jul 2024 06:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719927867; x=1720532667; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mmUvanBHkO0Q+knJSaFTkwp+V1k0d0JJ4tCL0yyEt34=; b=M53/Ca4XPp70Ka9xZnGfWqXRMp5LQxVIWvro6IsoD0+XUOv3Fqd/CxQ/PTOXsj3N2C TG+Ay9jiw7T4EsZ5PP+VO31e9T+3KOaKewULIDSnJdlLrlNSI3sIul1W5vi5/tUWrKFJ R8iWGiI+6yEkIXTvj4rId4vlgqYNurMi6kG+1VhxLExMkb4rcr1t6mTrPF/M0zWx57rP L530nvJhcxBjgekGvmJW4v69ThoPksxEFDO/2V9mngfHmGbwTSMc1PWNdFdirCvK5Xso kLsQZ7t9UMMj+ThKtfW3sW+s9o2ffRj6pNE2r+OwV1PPPTvWUdfabKb+s6kjG6JuCqC1 yv2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719927867; x=1720532667; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mmUvanBHkO0Q+knJSaFTkwp+V1k0d0JJ4tCL0yyEt34=; b=UgeBKjq9dkuliu3F4wJL41iGoLemYJ+SjWE3B/L+Zu7uzqwMPEV4JjqhjlvHQARFR3 2Y93b8fB/nvxEFjc4dHslp4fMW8QbZ1LGnHCwPikk8xLx8Pj+CGMqJdWVnvx3xQt1uAa FcB5j3kOf4oakukX69VVimeEP3qO/wxPuaDiA1p+EMvAG9jliC5lTNgIJi6EGBCazwox 6ugrqfNulEGxUIJZpK+5VCMIwPG1hif/qMDDKDX/jtf5O2RFy6ufVf9qQGmtotd05eYy CLG/IpaVNqUDVnD/opCNijiCxKehH+b5nCYTgE++hUNCVo1vNqTCP1QuTlSPZMScwDLp MVpQ== X-Gm-Message-State: AOJu0YzySRrFGdBVoXtgoieWnTWQVkZ4mvWVPoSJzuPdnronVrr0G+Cl NUc/gVyW7dQe2gDx9lH3jZeoUKx+syRUj+f1OSHzOxbjTeJmgZN6c7t5Dw== X-Received: by 2002:a81:92cb:0:b0:61b:e64c:6e43 with SMTP id 00721157ae682-64dff4e84admr47535077b3.2.1719927866748; Tue, 02 Jul 2024 06:44:26 -0700 (PDT) Received: from gauss.local (c-68-56-149-176.hsd1.mi.comcast.net. [68.56.149.176]) by smtp.gmail.com with ESMTPSA id 00721157ae682-64a9c40907csm17540187b3.139.2024.07.02.06.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 06:44:26 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Jul 2024 09:44:23 -0400 Message-ID: <20240702134424.133688-1-leo.izen@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/pngdec: fix mDCv typo X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Ramiro Polla , Leo Izen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eGblCebs6UDS 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 Reported-by: Ramiro Polla --- 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))