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 A2A0E481A5 for ; Tue, 12 Dec 2023 11:23:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8FEC68D159; Tue, 12 Dec 2023 13:23:52 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 470AB68D0FE for ; Tue, 12 Dec 2023 13:23:46 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 952982405ED for ; Tue, 12 Dec 2023 12:23:45 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id wzKT3FaF_Sty for ; Tue, 12 Dec 2023 12:23:44 +0100 (CET) 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 E3C1C2400AC for ; Tue, 12 Dec 2023 12:23:44 +0100 (CET) Received: by lain.khirnov.net (Postfix, from userid 1000) id 26B981601B9; Tue, 12 Dec 2023 12:23:38 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <85f4ba43-ab24-2598-6346-28dfef2ee88e@passwd.hu> 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> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 12 Dec 2023 12:23:38 +0100 Message-ID: <170238021813.8914.858553900721142755@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 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: 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 Marton Balint (2023-12-08 00:11:21) > Wipe reminds me of the wipe effect. How about 'predecode_clear'? Fine with me I guess. > > > >> + */ > >> +#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 == AVMEDIA_TYPE_VIDEO) { > >> + uint32_t color[4] = {0}; > >> + ptrdiff_t linesize[4] = {frame->linesize[0], frame->linesize[1], frame->linesize[2], frame->linesize[3]}; > >> + av_image_fill_color(frame->data, linesize, frame->format, color, frame->width, frame->height); > > > > Should this check for errors? > > Lack of error checking is intentional. av_image_fill_color might not > support all pixel formats, definitely not support hwaccel formats. It > might make sense to warn the user once, but I don't think propagating the > error back is needed here. > > I primarily thought of this as a QC feature (even thought about making the > color fill green by default to make it more noticeable (YUV green happens > to be 0,0,0), but for that I'd need similar checks for colorspaces to > what I have for fill_black())... 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. For non-hwaccel pixel formats, you can fall back on memsetting the buffer to 0. -- 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".