From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 22A034F2B1 for ; Sat, 21 Feb 2026 15:52:59 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'LqyEClDtIHaWNK83DXRRzdWavjE4AvFBujXBQITgNeI=', expected b'uf+RuizsCV6iYHo/ylP5ltoKA3Bc3w8zXaYvryoWM4c=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1771675242; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=LqyEClDtIHaWNK83DXRRzdWavjE4AvFBujXBQITgNeI=; b=XULt61xQSsLqD0/ALS4Ze1EJwThXWgckhpWbEvlL3nH1CKfdpjuOzoIsrpzpIV8c1ZG8U GI7yOMtHoXP9/QdOIeWZMREgKD3BZ3tpukqpmwmiEjCo00JpWcU/JsPUh101MOWa5OdEGsD Aigx+d294uDkfX4V3QzQNqyUUdvrMY9jRSA+M6GT0SUYAKxaD0t8IxhgVvPWudQsHBzBzlk Jf0rZSB8Mh2klMQVzbR8kfS74ErrG0I3YlYTF7UYRUCgAvMfMfHWeFf3YW0qAxrVhnEkyHv cyxDgWAKO/FjEpCBw2ug/848itGgCENNdpUJr9z/uf5RoczKEkBnQo//3mdg== Received: from [172.18.0.3] (unknown [172.18.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 187E06914AA; Sat, 21 Feb 2026 14:00:42 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1771675215; b=ugSSTAfSUXyYXLSPC734BaN7QLMTYp+bek+gonW2Hyc16SNeIopI962xPLutcOsEGQ0qh Wp+znSKy+p56lINBMX44nhu4r3Hq9un2HPEUJ638tyclVz9etGCNH4HAt51DUQ4ix1/rTbV OeXYcqYVob0AE+0UCMjXv+jh7JHx1eMSWLXAktCgPDXm2BCtNDuvasCheCQa2y+pezERsoN ql8ZT/BpPoBsxTspBXscajBoLD8ROeP27wR2D2ReKPkYGlWZ9ns9th5iMrtkSJECwWqm0be 7M+wHEnBSMOcygVnaORXjZEnunTzqRTwIjaaf2onpbGC+fFIrIS1EAuB2sJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1771675215; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=AUTDWy7V/5aCSsp7aE0GO+KPrTDOJS0kws7mvFj0Rp4=; b=n7t+Ne7rcJZALE2o69XmJ4JQ+PwuBeVzhDPPApni0d5HaJ/CxfyfigdFvSBHFOQT5Jy85 6tzo+X2tfgVChDpWOPKJQmIEgN4cGqn3q6TTxoRLFy7lArIJMUT2zeCfs/SAa88cp1k5CNj kRd1DcboTrCUtmtj6A2ixxhNf0L1w6N/4ruDJSZpKExfjFaVEZsqON+Cd2qSnGRuAfmEabM asDVcgTcjQL0SNv7zdk3xgIPH40PpYf137EMU3hGILYZK14VjTLCfTzVpPyS+cIdFnq4IYS kGBgPKEhauz5T6KEwb/pnTV5G4iI/lVrng4lRW0weOpialn5p8HFSAGMgZEg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1771675204; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=uf+RuizsCV6iYHo/ylP5ltoKA3Bc3w8zXaYvryoWM4c=; b=Saio8aDuuGrLu6B+0wO+NayaXbHas5s8UQ5BnuV9XQ8TixEx6oe/TNtOvxVlNAoXP0XvQ Rp/PuQirl4/R2G5bOXxhsp48NEFkJibWObLH5fbxAhZhwbkNXWla7zXbTZDLOV3w3Noi7Md 9HfLE51pW9J86iTQi+buhBMSUIBF1fPwu1GEI2O1XbROGlRcy4OYT/pNIe6pHbvbOaNyxJK VV+jUhIsoyQSHfBfqVZJZh3qTcA4BJC9s6GG70IHI1097QM78LZ3h/0LbHMz99q9i1QKFfE Cc3f1qo7FqGZn0DKZTm4CAOIECXlQ+sGGzU0GXNJZUZODT3h0K4pEp1/50Jg== MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Sat, 21 Feb 2026 12:00:03 -0000 Message-ID: <177167520445.25.15218072951556380874@29965ddac10e> Message-ID-Hash: MMC6QLXY6UBENKC262K325DG7XKKERD2 X-Message-ID-Hash: MMC6QLXY6UBENKC262K325DG7XKKERD2 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] avutil/imgutils: two minor cleanup commits (PR #22238) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Niklas Haas via ffmpeg-devel Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #22238 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22238 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22238.patch Spotted while wading through the mess that is all of our many divergent plane allocation implementations. >>From 0f5e09a5ea99793f6e271565546f80c543627da6 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 20 Feb 2026 20:43:42 +0100 Subject: [PATCH 1/2] avutil/imgutils: eliminate dead code This condition is impossible to satisfy: if (desc->flags & AV_PIX_FMT_FLAG_PAL && pointers[1] && pointers[1] - pointers[0] > linesizes[0] * h) Specifically, pointers[1] - pointers[0] is equal by definition of av_image_fill_pointers() to: sizes[0] = (size_t)h * linesizes[0]; // via av_image_fill_plane_sizes() data[1] = data[0] + sizes[0]; So it's impossible for there to be extra padding between the planes unless something drastic changes, which is unlikely at this stage. --- libavutil/imgutils.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 8ff8a6be41..ae671e005f 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -261,13 +261,6 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], } } - if (desc->flags & AV_PIX_FMT_FLAG_PAL && pointers[1] && - pointers[1] - pointers[0] > linesizes[0] * h) { - /* zero-initialize the padding before the palette */ - memset(pointers[0] + linesizes[0] * h, 0, - pointers[1] - pointers[0] - linesizes[0] * h); - } - return ret; } -- 2.52.0 >>From a452b87121e5e81510683859e855708fa697431b Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 21 Feb 2026 12:50:45 +0100 Subject: [PATCH 2/2] avutil/imgutils: always correctly align palette formats There is literally no reason to error out here when we can just trivially increase the alignment requirement. As far as I can tell, there is no wording or documentation for av_image_alloc() that says "align=0" should guarantee tightly packed data. --- libavutil/imgutils.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index ae671e005f..9ccd62bfa6 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -227,6 +227,9 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], if (!desc) return AVERROR(EINVAL); + if (desc->flags & AV_PIX_FMT_FLAG_PAL) + align = FFMAX(align, sizeof(uint32_t)); + if ((ret = av_image_check_size(w, h, 0, NULL)) < 0) return ret; if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, align>7 ? FFALIGN(w, 8) : w)) < 0) @@ -252,14 +255,8 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], av_free(buf); return ret; } - if (desc->flags & AV_PIX_FMT_FLAG_PAL) { + if (desc->flags & AV_PIX_FMT_FLAG_PAL) avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); - if (align < 4) { - av_log(NULL, AV_LOG_ERROR, "Formats with a palette require a minimum alignment of 4\n"); - av_free(buf); - return AVERROR(EINVAL); - } - } return ret; } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org