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 A8CC042293 for ; Tue, 1 Mar 2022 14:52:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2188868B26F; Tue, 1 Mar 2022 16:51:58 +0200 (EET) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2E8C668B209 for ; Tue, 1 Mar 2022 16:51:52 +0200 (EET) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-2d646fffcc2so147386337b3.4 for ; Tue, 01 Mar 2022 06:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=9e8sU+Tvp3nlxe5l0C4gVk43Bd1kLaZdkDbOwKJ4lQc=; b=MwjRfThhyM9VomHlh43HQaw71v3se6tWG+JkabwtS54vB9OV7tBmHt9mWPQynVK8ub LD3Nwsl9bfTop73jgxKj/b/RWb7srTl/RUOicEMWDuTGjTfPb+bwgIs5tWigJpb76Nt+ g/8oFhQnXHlXozWv/oLJe/AvHGy39kCUe3fE2+txURawN1QGWFi25iYnJa4QxnOaVASi GXAX5uVFl3QEaP9SvuNurUNgBWyNwuC/usjB2/dKSU7LUCfOyjgM/HJPvMoRspFFGYOt ppdQ72LPw6OqzRwkhGRqJlrdejdPPylazFNVEBHbNLZjlW89bdkR3RxlmaG5FaXX23Mx n06g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=9e8sU+Tvp3nlxe5l0C4gVk43Bd1kLaZdkDbOwKJ4lQc=; b=YaHA7SblXMSNwMmInVkuDrIgURc2f0DvIZ78YeuAYGit0Gty0rUvysdL6Iz6TIy5x8 Ql6KuODC0irQwd4BDWF49hp8Veuu5NwsfpK55a9cAowx3CWHIrwn1WgYzqSDuInqBbq/ T05ckFmoRHGZv6eNGu7V5BntK6jo1ZUwxDV8rP3UGoSgOqRUjZqoFJqfs6ljw/puWE8Z XzOFZq+KQdXgFWVGrvUU0O/errgBFeHvumPzOWT21D79Ejvj15KtdQuVlgmhc+pSgE2Z 8Xf+ojuj3xpGbUl2pNHKfte9baWe6sNe7IXxViZa8ySjIuE0eepltzgKRyDeJOB71fF6 i3HQ== X-Gm-Message-State: AOAM530IVwPSkesohZe65eWO6Zt845cXzUq7g12QSiRZVQ4F9m0FeTOf Bjagk29K+wJsVh0xUFZtVbMnRminmlZU7tlaFBB0HN85EGk= X-Google-Smtp-Source: ABdhPJydVcP/yGLPEuN6dN8A7u8dMSW57p8ZFTuhYYXS9/UB5rrbHsXtLmHrTvRVt74uNQB6GyHLA2u/wMJ49xdokuk= X-Received: by 2002:a0d:eb53:0:b0:2db:da53:a6d0 with SMTP id u80-20020a0deb53000000b002dbda53a6d0mr3835107ywe.34.1646146310730; Tue, 01 Mar 2022 06:51:50 -0800 (PST) MIME-Version: 1.0 References: <20220301142310.16367-1-jamrial@gmail.com> <7b7c3b92-c5a6-9d50-bf79-07016ea02009@gmail.com> In-Reply-To: <7b7c3b92-c5a6-9d50-bf79-07016ea02009@gmail.com> From: Paul B Mahol Date: Tue, 1 Mar 2022 15:53:29 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, Mar 1, 2022 at 3:36 PM James Almer wrote: > 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. > I see only victims of cargo cultism here. Filter frames are unrelated to avcodec frames. Why I can not reproduce the issue, I'm on similar intel cpu. > > > > > 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". > _______________________________________________ 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".