From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6FAD942290 for ; Tue, 1 Mar 2022 14:36:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C024968B22C; Tue, 1 Mar 2022 16:36:44 +0200 (EET) Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B723268A67E for ; Tue, 1 Mar 2022 16:36:37 +0200 (EET) Received: by mail-oi1-f170.google.com with SMTP id y7so16387532oih.5 for ; Tue, 01 Mar 2022 06:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=puGOQqJQfotxL18Cv+A/wStYLHqbTpxzEK4uS1BlTxk=; b=IFLHlbAH7Z5TwIIeCOkRb24H8YjNP7jWiSFCFllNSuWLC9mqa5W96AQRhL1WoVJuyH wsKhNapcKKUaskAAjccQ4EckdhpndZQMJCMIXu9R3hGMdHML/Ia77vQ3/C4+YYFktn8K HOZ51TmTT8ANbSGR9aPPlNSVs8aKa+N2896Qa7iRLq841AUS892lScaXv5BxM94kuTjp uj/Fy0GL1EDy7qg2/BclyL42UTYDGXW8iWvz5OyR869CYJ2WlowPiVfYLs/udv2/FUNQ kWAYpkDQ8YYPxUr+HBlvTg2cZujv3jfBuKMxwBD6T9F7wMcN/f4mOQzUfOs7DYvbAbuI lrUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=puGOQqJQfotxL18Cv+A/wStYLHqbTpxzEK4uS1BlTxk=; b=IuFkVJFxr2KzUaW2MTTOfd7M2TpEkTmna4o0UdDFqEA3jwkHf/foiTLJg7n7IRC88B bZzim7SUWBxxXxzkAiIq00s4AOOJcqPP01tXWqpZEXGUE6t0hFN5oN0hqRcteuU8Fw6u h8MW3HUEz6mIrsxmcOhHdx2qkczDnSMN4Z2t3ABpGHdWEOa6o2uuL2JY0oBv8w/uAWxb gllPxuGx5yrpx5Do1IfRYIE3GP/jrArByU7BxXClDWno28aych4uqQZXk8mYrSmPTLE/ EQC4qQ4PM2XQDeKBVdc1eFRPYwOiv1xVBcM4zF3yMjHiWil7ntP9TbbMPnYbjJ2pzfsE WSEg== X-Gm-Message-State: AOAM530Eq5WEawUYbTKRTnXGZjO/vdDL05PPw/YMeYwdKf6U8jpahc9g bTmQNEqgA0FYZ84cn5+8NkXQqkP/267JJg== X-Google-Smtp-Source: ABdhPJwPogz7N3B6aMmCo1xKcGSLoMqVKQVoOTfParlU9EBdYPTw6R4fA7cfOMzN/Wo+xHmAWijzcQ== X-Received: by 2002:aca:ad01:0:b0:2d3:79c8:9471 with SMTP id w1-20020acaad01000000b002d379c89471mr13163170oie.98.1646145395935; Tue, 01 Mar 2022 06:36:35 -0800 (PST) Received: from [192.168.0.10] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id l1-20020a4aa781000000b0031cf8e00738sm6296380oom.1.2022.03.01.06.36.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Mar 2022 06:36:35 -0800 (PST) Message-ID: <7b7c3b92-c5a6-9d50-bf79-07016ea02009@gmail.com> Date: Tue, 1 Mar 2022 11:36:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220301142310.16367-1-jamrial@gmail.com> From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avfilter/framepool: use av_image_fill_plane_sizes() to calculate pool sizes 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/1/2022 11:31 AM, Paul B Mahol wrote: > On Tue, Mar 1, 2022 at 3:23 PM James Almer wrote: > >> Signed-off-by: James Almer >> --- >> libavfilter/framepool.c | 20 ++++++++++++++------ >> 1 file changed, 14 insertions(+), 6 deletions(-) >> >> diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c >> index 5b510c9af9..cf6a1d0ea0 100644 >> --- a/libavfilter/framepool.c >> +++ b/libavfilter/framepool.c >> @@ -57,6 +57,8 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* >> (*alloc)(size_t size), >> int i, ret; >> FFFramePool *pool; >> const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); >> + ptrdiff_t linesizes[4]; >> + size_t sizes[4]; >> >> if (!desc) >> return NULL; >> @@ -89,13 +91,19 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* >> (*alloc)(size_t size), >> } >> } >> >> - for (i = 0; i < 4 && pool->linesize[i]; i++) { >> - int h = pool->height; >> - if (i == 1 || i == 2) >> - h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); >> + for (i = 0; i < 4; i++) >> + linesizes[i] = pool->linesize[i]; >> >> - pool->pools[i] = av_buffer_pool_init(pool->linesize[i] * h + >> align, >> - alloc); >> + if (av_image_fill_plane_sizes(sizes, pool->format, >> + FFALIGN(pool->height, align), >> > > This is not needed for height. av_frame_get_buffer() does it, and the lavc pool uses avcodec_align_dimensions2() to align height and achieve the same effect (Look at what it does for yuv422p). It's the only change in 17a59a634c39b00a680c6ebbaea58db95594d13d that could have generated the issue Haihao reported. > > Original reporter never posted valgrind report of bug. > > >> + linesizes) < 0) { >> + goto fail; >> + } >> + >> + for (i = 0; i < 4 && sizes[i]; i++) { >> + if (sizes[i] > SIZE_MAX - align) >> + goto fail; >> + pool->pools[i] = av_buffer_pool_init(sizes[i] + align, alloc); >> if (!pool->pools[i]) >> goto fail; >> } >> -- >> 2.35.1 >> >> _______________________________________________ >> 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". >> > _______________________________________________ > 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". _______________________________________________ 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".