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 37FBC40914 for ; Thu, 3 Mar 2022 16:58:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5C89E68AFE2; Thu, 3 Mar 2022 18:58:04 +0200 (EET) Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6603D68AEC7 for ; Thu, 3 Mar 2022 18:57:58 +0200 (EET) Received: by mail-oo1-f41.google.com with SMTP id n5-20020a4a9545000000b0031d45a442feso6436575ooi.3 for ; Thu, 03 Mar 2022 08:57:58 -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=GX1qveWtcKGJL83hCmqauvTLFOOHpipjio4WWMBjMHE=; b=KUHCjOdT6YfjaxiOtF0ehbj5FmCLAS35u+fOzJyBQ9PlKq/14j4h3wrmWZUV5r+oaw IedyexCvYJbrG6ge+O6y2qurl9yXlv+pj2TwlWl5GUsvKx8bf0qmY2LaSz5B09RKcsZP mkZADUjJmme6vWHCSLK1xlYszw+2XEzrF1WdbspYYY7rMP1pzvjojXPlROICjkj1RPtL lNnK5EecmBbNt9cBraHh+Qzmwn/VM/U1PbA4Tm3yLuyxGrlBkDXQWas+vwYIitAPKM8e FfM8JYYE0AEgL9CDMncABjnz99M0JjTBc5PaE8+A/TDlAOYFxHoB3xWDZvK6BPTV20RF EDJg== 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=GX1qveWtcKGJL83hCmqauvTLFOOHpipjio4WWMBjMHE=; b=0MF39mub+4S4jIm0Hiwj5ip6+vkt6KPrNhu3fN4kRCnmLiYe285VK9qAIenCSmTJQl mF6zNcw2OH4KNK0dPY7ZkXSHfXCOxI2U/I0GXiD0FZxq5tOB8FmFdbdwbHWWK3h2ItJw PopQHX6t9St031CPDQgOnj9lileZ71fl2o45eCTRrQsMjNCIo8TAJk9ZC1hMLZGhZmBX 22kMtxPHemuIWtHt4ZcgNgDLgSvdPuGRfMe1lo0twyjGln8D/yijrOtJ68KalCt8YM+e sWz4n+M++bWTSqNmIh+XXj4nUjnAINHEaLp89dnxddjSnb50n3N47hX03l+NECJ/WG7a ZthA== X-Gm-Message-State: AOAM533Pa3kZ4SGjaFnzf+g6xKnB61hrs0tQZyfaOVxCnftzg7vkM6iw 4G4uTs2IFtW1UUAdqvC8Xh0oHV7oGYw= X-Google-Smtp-Source: ABdhPJwisGs2VVwkBYOhFPEdRDnZn7BtWwxGR97MQ8WkkY+m4LdIhZJ0XRr5/xC+WijVnUobr6gCdw== X-Received: by 2002:a05:6870:1807:b0:d7:2a4c:14bc with SMTP id t7-20020a056870180700b000d72a4c14bcmr4663808oaf.143.1646326676602; Thu, 03 Mar 2022 08:57:56 -0800 (PST) Received: from [192.168.0.10] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id e28-20020a0568301e5c00b005af640ec226sm1169139otj.56.2022.03.03.08.57.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 08:57:55 -0800 (PST) Message-ID: <69414543-44bd-5a95-bfe5-a197359527f8@gmail.com> Date: Thu, 3 Mar 2022 13:57:53 -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> <1e6e3de9-b08f-6613-ae14-77914b8b8e39@gmail.com> <1ab7f4c6-ee52-385d-4f81-c28dbb007943@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/3/2022 1:46 PM, Paul B Mahol wrote: > On 3/3/22, James Almer wrote: >> >> >> On 3/3/2022 10:56 AM, Paul B Mahol wrote: >>> On 3/3/22, James Almer wrote: >>>> >>>> >>>> On 3/1/2022 11:23 AM, 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), >>>>> + 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; >>>>> } >>>> >>>> Ping. I can also remove the height padding if preferred. >>> >>> It does not work. No? >> >> It doesn't fix the mpeg encoder issue with yuv422p streams and 64 stride >> alignment, no, but it's not strictly about that either. It's a >> simplification using existing helpers. > > Ok, if you need it. Applied without the vertical padding, to not change the behavior your introduced in 17a59a634c. _______________________________________________ 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".