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 8CBE443174 for ; Thu, 23 Jun 2022 14:48:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 32A5F68B683; Thu, 23 Jun 2022 17:48:13 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2EAEF68A6B5 for ; Thu, 23 Jun 2022 17:48:06 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 921AB240179 for ; Thu, 23 Jun 2022 16:48:05 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Cxs1K-H95-t5 for ; Thu, 23 Jun 2022 16:48:04 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 410482400F5 for ; Thu, 23 Jun 2022 16:48:04 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 7778C1601B2; Thu, 23 Jun 2022 16:48:04 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CDB6PR0101MB2214DF70FF18BB95459CAD608FB59=40DB6PR01?= =?utf-8?q?01MB2214=2Eeurprd01=2Eprod=2Eexchangelabs=2Ecom=3E?= References: <9642852e9da11714c8643833562b6e86133ce1a1.camel@amazon.it> <0215838ca87728a7e2742ab19af7fe1d5c3f9abc.camel@amazon.it> <165556480189.13099.7220862156046633312@lain> <80f0b155c25cfbba992dfb7ca79e1b37b8dfc12e.camel@amazon.it> <165599096835.13099.14253738660427313095@lain> =?utf-8?q?=3CDB6PR0101MB2214?= =?utf-8?q?DF70FF18BB95459CAD608FB59=40DB6PR0101MB2214=2Eeurprd01=2Eprod=2Ee?= =?utf-8?q?xchangelabs=2Ecom=3E?= Mail-Followup-To: FFmpeg development discussions and patches Date: Thu, 23 Jun 2022 16:48:04 +0200 Message-ID: <165599568445.12703.13879461885645668680@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] Added support for MB_INFO 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: Quoting Andreas Rheinhardt (2022-06-23 16:21:18) > Anton Khirnov: > > Quoting Carotti, Elias (2022-06-21 10:48:07) > >> Hi, > >> > >> extending AVVideoEncParams was the first hypothesis I made but it > >> didn't seem it was the proper place to add the mb_info flags. > >> > >> I may be wrong but my impression is that AVVideoEncParams is used to > >> carry encoding parameters read from the bitstream at the decoder side > >> while here were going the other direction, i.e., were passing > >> information from the application to the encoder. > >> > >> Secondly, mb_info can't be strictly considered encoding parameters and > >> it's not present in the bitstream at all. > >> It's just a way to give hints to the libx264 encoder on which > >> macroblock we know have not changed since the previous frame and could > >> be coded as P_SKIPs. Libx264 however, may or may not oblige according > >> to its logic, and this specific information is not transmitted in the > >> bitstream nor can be recovered at the decoder. > > > > Right, seems I was too hasty in reading your patch. > > > > But then I have to wonder whether this really needs a new installed > > header, with a struct and a destructor, given that it's specific to a > > single encoder for a single codec that is about 20 years old now. > > > > Wouldn't AV_FRAME_DATA_X264_MBINFO that would be just a raw array of > > uint8_t serve your needs just as fine? You could even get custom buffer > > management by using AVFrameSideData.buf. > > > > There is one problem though: libx264's free functions don't accept an > opaque parameter, so one can't easily create a reference for libx264 to > unref. I don't see a way around duplicating this buffer in the encoder. > (Or is there a way to know when libx264 is done with using this buffer?) An ugly, but workable hack could be - user allocates the AVBuffer with extra space at the end - lavc/libx264.c checks that there is extra space AND the buffer is writable (so the same side data wasn't passed to multiple encoders), then stores its AVBufferRef* in there -- Anton Khirnov _______________________________________________ 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".