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 AEFA741035 for ; Sat, 12 Feb 2022 12:33:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A744068B2A6; Sat, 12 Feb 2022 14:33:54 +0200 (EET) Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 08D3068003D for ; Sat, 12 Feb 2022 14:33:49 +0200 (EET) Received: by mail-oo1-f47.google.com with SMTP id q145-20020a4a3397000000b002e85c7234b1so13569268ooq.8 for ; Sat, 12 Feb 2022 04:33:48 -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=B5M4i6sms+VdJMGOXGnYEMoXU6+UjTSZPT8OcmSFbUo=; b=ga7Wjg1f/2HdqB+Qb9do5Pp2R4zHQOWQ7FG5ID1mEB1k82Erx9AYr8fHH1NchFhhui 3TZeSDUC9hteXXDHCXtNF4glssq129RQ8mJU67HeJghwfRTJKcXwRxLWNQzImiTRo/Ak oFTKdpCCt9hQwWuIEkZazJydjA3p/uGZHCecOTWblKHGf50zep0N45mFSiakavlG0igd n1aUeRiLlcRVoIrQH9yR+wqrA2PZ0WNUTdOmF8vIi2kg6vadoVoRnt4In0XOLNRMKAe8 GF/c/jeyiiC1AxoeTN/tVCPW7gp6dPJ+Dxkr60QXZCDg/YLydIDBTUE5v/RO0iKmj7Jv zKew== 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=B5M4i6sms+VdJMGOXGnYEMoXU6+UjTSZPT8OcmSFbUo=; b=hwSmZpvZLBneHS6hmuX3ZSsyko62kdtS5CfJE5upSSwT+f2TR0p6oLiH7rSdfpeogn JSyhRaM2MQQNvcQxIW3FSz2S1UjMlQ75GbFQE3nawORd7CmG6l07MOeJ7pNxiM3SIFii DTILZX6fttdMNcaroWqQs/bdjMN0Jls6oUWZQv2Uy/4r2wGQkxvuf4f2henOyv+ykwft wU5td9J1UrH36+lNvN2GDXiDY4Kn2y8uNaG5oq5dRffTv1/0M46DRih0hXTf5ppiTOxO lisQljwLJ6NongaL0UHFSQYlHIRy7FRr4bUeJVMI2hMwfPmr2hksuOgre3mpplaMxWY1 /G1w== X-Gm-Message-State: AOAM533V11iS/vq+EtkjR57K7UtAMcIcN544a9OMzB5mHpUFbVdUAeRo B/JaPm5VWiTcg0ffhSttTzUCpxCgH5A= X-Google-Smtp-Source: ABdhPJzBfOHEIWDlVEOTGdW/tnhRx/hio7U+/jYwsZ3zLUmYJqJTbykwhWkxw1hQezgDHwPfAoTgFw== X-Received: by 2002:a05:6870:a601:: with SMTP id e1mr1408180oam.141.1644669227051; Sat, 12 Feb 2022 04:33:47 -0800 (PST) Received: from [192.168.1.55] ([191.83.214.101]) by smtp.gmail.com with ESMTPSA id n11sm1504617oal.1.2022.02.12.04.33.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Feb 2022 04:33:46 -0800 (PST) Message-ID: Date: Sat, 12 Feb 2022 09:33:45 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220212001301.4090-1-jamrial@gmail.com> <6024556c-3f09-768a-0567-0ab8f8ba47aa@gmail.com> From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [RFC][PATCH 1/4] avutil/frame: add an internal field to store the size of AVFrame 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 2/12/2022 9:32 AM, Paul B Mahol wrote: > On Sat, Feb 12, 2022 at 1:28 PM James Almer wrote: > >> On 2/12/2022 9:25 AM, Paul B Mahol wrote: >>> On Sat, Feb 12, 2022 at 1:14 AM James Almer wrote: >>> >>>> This is unfortunately needed to remove (or reduce the awfulness) of >> certain >>>> modules violating the AVFrame API and using sizeof(AVFrame). >>>> >>> >>> Which modules? >> >> Anything using wrapped_avframe, so wrapped_avframe decoder and encoder, >> and vapoursynth demuxer, which exports wrapped_avframe packets. >> >> I gave porting the latter into a video source filter some time ago a >> try, which would let us remove the "demuxer", but never sent a patch. I >> can dig it and do that, but it will not change the fact both the >> wrapped_avframe decoder and encoder are still using sizeof(AVFrame). >> > > There was some talk that out VS demuxer is slower than it should be. Really? It's literally a zero copy implementation. It was the entire reason why it was written using wrapped_avframe instead of the proper rawvideo. I don't see it getting any faster than it is from our side. > > >> >>> >>> >>>> With this, the sizeof(AVFrame) value of the libavutil loaded at runtime >>>> can be >>>> used instead of the compile time value of whatever library included >> frame.h >>>> >>>> Signed-off-by: James Almer >>>> --- >>>> This is sucks, but at least less so than the current situation. >>>> >>>> I don't see wrapped_avframe going away anytime soon, so something must >> be >>>> done, >>>> and last time i tried to change how the packets are generated my >> approach >>>> was >>>> shut down, so here's another attempt. >>>> >>>> libavutil/frame.c | 3 +++ >>>> libavutil/frame_internal.h | 33 +++++++++++++++++++++++++++++++++ >>>> 2 files changed, 36 insertions(+) >>>> create mode 100644 libavutil/frame_internal.h >>>> >>>> diff --git a/libavutil/frame.c b/libavutil/frame.c >>>> index 8997c85e35..a63d2979db 100644 >>>> --- a/libavutil/frame.c >>>> +++ b/libavutil/frame.c >>>> @@ -23,6 +23,7 @@ >>>> #include "cpu.h" >>>> #include "dict.h" >>>> #include "frame.h" >>>> +#include "frame_internal.h" >>>> #include "imgutils.h" >>>> #include "mem.h" >>>> #include "samplefmt.h" >>>> @@ -33,6 +34,8 @@ >>>> (frame)->channels == \ >>>> >> av_get_channel_layout_nb_channels((frame)->channel_layout)) >>>> >>>> +const size_t avpriv_avframe_size = sizeof(AVFrame); >>>> + >>>> #if FF_API_COLORSPACE_NAME >>>> const char *av_get_colorspace_name(enum AVColorSpace val) >>>> { >>>> diff --git a/libavutil/frame_internal.h b/libavutil/frame_internal.h >>>> new file mode 100644 >>>> index 0000000000..07c246f86a >>>> --- /dev/null >>>> +++ b/libavutil/frame_internal.h >>>> @@ -0,0 +1,33 @@ >>>> +/* >>>> + * This file is part of FFmpeg. >>>> + * >>>> + * FFmpeg is free software; you can redistribute it and/or >>>> + * modify it under the terms of the GNU Lesser General Public >>>> + * License as published by the Free Software Foundation; either >>>> + * version 2.1 of the License, or (at your option) any later version. >>>> + * >>>> + * FFmpeg is distributed in the hope that it will be useful, >>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >>>> + * Lesser General Public License for more details. >>>> + * >>>> + * You should have received a copy of the GNU Lesser General Public >>>> + * License along with FFmpeg; if not, write to the Free Software >>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >>>> 02110-1301 USA >>>> + */ >>>> + >>>> +#ifndef AVUTIL_FRAME_INTERNAL_H >>>> +#define AVUTIL_FRAME_INTERNAL_H >>>> + >>>> +#include >>>> + >>>> +#include "frame.h" >>>> + >>>> +/** >>>> + * sizeof(AVFrame). If you think you need to use it, then you need to >>>> change >>>> + * your code so you don't instead. >>>> + * Meant for exceptions like wrapped_avframe. >>>> + */ >>>> +extern const size_t avpriv_avframe_size; >>>> + >>>> +#endif /* AVUTIL_FRAME_INTERNAL_H */ >>>> -- >>>> 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". _______________________________________________ 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".