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 81E8C481EB for ; Tue, 12 Dec 2023 22:19:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1E19C68D04C; Wed, 13 Dec 2023 00:18:59 +0200 (EET) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4422168CF5E for ; Wed, 13 Dec 2023 00:18:52 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 448BDC0002 for ; Tue, 12 Dec 2023 22:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1702419531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JSlhyUSMrxylxu+Ucc7+6uTYcMH0gQhyqG/oPvysrlE=; b=GzhRAyKFxAcuRrSwqHktig79tLQ68sDH8fLsv/nnJLCnpM63hHojLP3mJsNz7oI/jWp5Sz q3OScl1aZwc0QP2LlHPabxv+z4KoTJTaTTt2fspwdmHCDH9FciUi2l0zbC6EiwZRniZZZ5 EfVZi/sb8jbJIQ+Bxt6Qdthydvs4q5u5hQg7IQPQ6VBcG83ztN/slrxT9pAHYDwHFfV9qk OY14npe6JsGg0TGQR4MNbhNN0GzbO2bewnfcCOpf96U4900VGWTA/TspwL2L08GkSEBbRX fPo8lL70MJ/i08qMU9+VsuEv9MTMVr43knCzOsXvqsViKQZkTkYJGPjGKh6bEA== Date: Tue, 12 Dec 2023 23:18:50 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231212221850.GC6420@pb2> References: <20231206082220.5532-1-cus@passwd.hu> <20231206082220.5532-7-cus@passwd.hu> <170196664712.8914.15749136255711961223@lain.khirnov.net> <85f4ba43-ab24-2598-6346-28dfef2ee88e@passwd.hu> <170238021813.8914.858553900721142755@lain.khirnov.net> MIME-Version: 1.0 In-Reply-To: <170238021813.8914.858553900721142755@lain.khirnov.net> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR 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: multipart/mixed; boundary="===============1741757415101588887==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1741757415101588887== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3siQDZowHQqNOShm" Content-Disposition: inline --3siQDZowHQqNOShm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 12, 2023 at 12:23:38PM +0100, Anton Khirnov wrote: > Quoting Marton Balint (2023-12-08 00:11:21) > > Wipe reminds me of the wipe effect. How about 'predecode_clear'? >=20 > Fine with me I guess. >=20 > > > > > >> + */ > > >> +#define AV_CODEC_FLAG_CLEAR (1 << 12) > > >> /** > > >> * Only decode/encode grayscale. > > >> */ > > >> diff --git a/libavcodec/decode.c b/libavcodec/decode.c > > >> index 2cfb3fcf97..f9b18a2c35 100644 > > >> --- a/libavcodec/decode.c > > >> +++ b/libavcodec/decode.c > > >> @@ -1675,6 +1675,12 @@ FF_ENABLE_DEPRECATION_WARNINGS > > >> > > >> validate_avframe_allocation(avctx, frame); > > >> > > >> + if (avctx->flags & AV_CODEC_FLAG_CLEAR && avctx->codec_type =3D= =3D AVMEDIA_TYPE_VIDEO) { > > >> + uint32_t color[4] =3D {0}; > > >> + ptrdiff_t linesize[4] =3D {frame->linesize[0], frame->lines= ize[1], frame->linesize[2], frame->linesize[3]}; > > >> + av_image_fill_color(frame->data, linesize, frame->format, c= olor, frame->width, frame->height); > > > > > > Should this check for errors? > >=20 > > Lack of error checking is intentional. av_image_fill_color might not=20 > > support all pixel formats, definitely not support hwaccel formats. It= =20 > > might make sense to warn the user once, but I don't think propagating t= he=20 > > error back is needed here. > >=20 > > I primarily thought of this as a QC feature (even thought about making = the=20 > > color fill green by default to make it more noticeable (YUV green happe= ns=20 > > to be 0,0,0), but for that I'd need similar checks for colorspaces to= =20 > > what I have for fill_black())... >=20 > As Mark said, I expect people to want to use it as a security feature. > So either it should work reliably, or it should be made very clear that > it's for debugging only. >=20 > For non-hwaccel pixel formats, you can fall back on memsetting the > buffer to 0. For security, there may be other less vissible things that should be cleare= d too for example B frames in some codecs can use motion vectors from surrounding= frames. Also the correct thing is to apply error concealment to replace all parts w= hich have not been filled in. Not to leave them uninitialized. Not only does that preserve privacy it also produces much better looking fr= ames We have error concealment code, it should be used. Not arguing against this feature here. Just saying for security/privacy it = has a price as it needs to be done before we know if a frame is damaged, while = error concealment is done only on actually damaged frames Of course you may want to do both to be really "sure" ... thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Nations do behave wisely once they have exhausted all other alternatives.= =20 -- Abba Eban --3siQDZowHQqNOShm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZXjcQAAKCRBhHseHBAsP q3EpAJ9/tr1nep0gB/N9BcNxdegFzbXsTQCfTh4Q9VWMubo/PfjOwOmOx7xRHVg= =KGb6 -----END PGP SIGNATURE----- --3siQDZowHQqNOShm-- --===============1741757415101588887== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============1741757415101588887==--