From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR
Date: Tue, 12 Dec 2023 23:18:50 +0100
Message-ID: <20231212221850.GC6420@pb2> (raw)
In-Reply-To: <170238021813.8914.858553900721142755@lain.khirnov.net>
[-- Attachment #1.1: Type: text/plain, Size: 2814 bytes --]
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'?
>
> 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.
For security, there may be other less vissible things that should be cleared 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 which
have not been filled in. Not to leave them uninitialized.
Not only does that preserve privacy it also produces much better looking frames
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Nations do behave wisely once they have exhausted all other alternatives.
-- Abba Eban
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next prev parent reply other threads:[~2023-12-12 22:19 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 0:27 [FFmpeg-devel] [PATCH 1/7] avutil/tests/imgutils: factorize basic tests to new function Marton Balint
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() Marton Balint
2023-12-03 23:47 ` Stefano Sabatini
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 3/7] avutil/imgutils: fix av_image_fill_black() for some pixel formats Marton Balint
2023-12-04 0:23 ` Stefano Sabatini
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 4/7] avutil/imgutils: add support for 32bit pixel format for av_image_fill_black() Marton Balint
2023-12-04 0:52 ` Stefano Sabatini
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 5/7] avutil/imgutils: factorize a fill color function Marton Balint
2023-12-04 1:04 ` Stefano Sabatini
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 6/7] avutil/imgutils: add new function av_image_fill_color() Marton Balint
2023-12-04 1:07 ` Stefano Sabatini
2023-12-03 0:27 ` [FFmpeg-devel] [PATCH 7/7] avcodec: add AV_CODEC_FLAG_CLEAR Marton Balint
2023-12-03 21:31 ` [FFmpeg-devel] [PATCH 1/7] avutil/tests/imgutils: factorize basic tests to new function Stefano Sabatini
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 " Marton Balint
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() Marton Balint
2023-12-06 22:46 ` Stefano Sabatini
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 3/7] avutil/imgutils: fix av_image_fill_black() for some pixel formats Marton Balint
2023-12-06 22:47 ` Stefano Sabatini
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 4/7] avutil/imgutils: add support for 32bit pixel format for av_image_fill_black() Marton Balint
2023-12-06 22:48 ` Stefano Sabatini
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 5/7] avutil/imgutils: factorize a fill color function Marton Balint
2023-12-06 22:52 ` Stefano Sabatini
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 6/7] avutil/imgutils: add new function av_image_fill_color() Marton Balint
2023-12-06 22:53 ` Stefano Sabatini
2023-12-07 16:15 ` Anton Khirnov
2023-12-09 19:25 ` [FFmpeg-devel] [PATCH v3 " Marton Balint
2023-12-11 23:05 ` Stefano Sabatini
2023-12-12 18:45 ` Marton Balint
2023-12-06 8:22 ` [FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR Marton Balint
2023-12-06 22:57 ` Stefano Sabatini
2023-12-07 1:44 ` Ronald S. Bultje
2023-12-07 16:19 ` Anton Khirnov
2023-12-07 22:47 ` Marton Balint
2023-12-08 5:12 ` Rémi Denis-Courmont
2023-12-07 2:37 ` Vittorio Giovara
2023-12-07 16:30 ` Anton Khirnov
2023-12-07 23:11 ` Marton Balint
2023-12-11 20:49 ` Mark Thompson
2023-12-12 11:23 ` Anton Khirnov
2023-12-12 18:37 ` Marton Balint
2023-12-13 8:59 ` Anton Khirnov
2023-12-13 17:09 ` Marton Balint
2023-12-14 8:03 ` Anton Khirnov
2023-12-12 22:18 ` Michael Niedermayer [this message]
2023-12-06 22:43 ` [FFmpeg-devel] [PATCH v2 1/7] avutil/tests/imgutils: factorize basic tests to new function Stefano Sabatini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231212221850.GC6420@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git