Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Tomas Härdin" <git@haerdin.se>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 3/4] avcodec/decode: Set KEY flag+pict_type generically for intra-only codecs
Date: Mon, 13 May 2024 19:02:56 +0200
Message-ID: <7c92fd1a50d9191b34e6678d111910c9adf737cb.camel@haerdin.se> (raw)
In-Reply-To: <GV1P250MB07374C0F3D40007B11FB271F8FE22@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

mån 2024-05-13 klockan 17:55 +0200 skrev Andreas Rheinhardt:
> Tomas Härdin:
> > mån 2024-05-13 klockan 10:54 +0200 skrev Andreas Rheinhardt:
> > > Tomas Härdin:
> > > > tor 2024-05-09 klockan 04:04 +0200 skrev Andreas Rheinhardt:
> > > > > This commit is the analog of
> > > > > 3f11eac75741888c7b2b6f93c458766f2613bab5
> > > > > for decoding: It sets the AV_FRAME_FLAG_KEY and (for video
> > > > > decoders)
> > > > > also pict_type to AV_PICTURE_TYPE_I. It furthermore stops
> > > > > setting
> > > > > audio frames as always being key frames -- it is wrong for
> > > > > e.g.
> > > > > TrueHD/MLP. The latter also affects TAK and DFPWM.
> > > > > 
> > > > > The change already improves output for several decoders where
> > > > > it has been forgotten to set e.g. pict_type like speedhq,
> > > > > wnv1
> > > > > or tiff. The latter is the reason for the change to the exif-
> > > > > image-
> > > > > tiff
> > > > > FATE test reference file.
> > > > > 
> > > > > Signed-off-by: Andreas Rheinhardt
> > > > > <andreas.rheinhardt@outlook.com>
> > > > > ---
> > > > >  libavcodec/decode.c            | 29
> > > > > +++++++++++++++++++++++++++-
> > > > > -
> > > > >  libavcodec/pthread_frame.c     | 17 ++++++++++++++---
> > > > >  tests/ref/fate/exif-image-tiff |  2 +-
> > > > >  3 files changed, 42 insertions(+), 6 deletions(-)
> > > > > 
> > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > > > index d031b1ca17..0ca5344ef5 100644
> > > > > --- a/libavcodec/decode.c
> > > > > +++ b/libavcodec/decode.c
> > > > > @@ -57,6 +57,20 @@
> > > > >  typedef struct DecodeContext {
> > > > >      AVCodecInternal avci;
> > > > >  
> > > > > +    /**
> > > > > +     * This is set to AV_FRAME_FLAG_KEY for decoders of
> > > > > intra-
> > > > > only
> > > > > formats
> > > > > +     * (those whose codec descriptor has
> > > > > AV_CODEC_PROP_INTRA_ONLY
> > > > > set)
> > > > > +     * to set the flag generically.
> > > > > +     */
> > > > > +    int intra_only_flag;
> > > > > +
> > > > > +    /**
> > > > > +     * This is set to AV_PICTURE_TYPE_I for intra only video
> > > > > decoders
> > > > > +     * and to AV_PICTURE_TYPE_NONE for other decoders. It is
> > > > > used to
> > > > > set
> > > > > +     * the AVFrame's pict_type before the decoder receives
> > > > > it.
> > > > > +     */
> > > > > +    enum AVPictureType initial_pict_type;
> > > > 
> > > > Carrying this around as state seems unnecessary when a small
> > > > static
> > > > function could do the same?
> > > > 
> > > 
> > > The aim of this is to avoid branches for every frame.
> > 
> > Checking a single value that will likely reside in cache once per
> > frame
> > is hardly expensive, especially when the branch predictor will
> > predict
> > it correctly.
> > 
> > When you carry state around you're carrying around multiple sources
> > of
> > truth, which is something that tends to cause bugs..
> > 
> 
> Given that this is immutable after init, it is not really "state".

State tends to live in memory..

Perhaps this borders on bikeshedding, but I have said my peace and look
forward to cashing in accrued I-told-you-so's in the future should my
fears come to pass.

/Tomas
_______________________________________________
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".

  reply	other threads:[~2024-05-13 17:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09  1:52 [FFmpeg-devel] [PATCH 1/5] avcodec/mlpdec: Set AV_FRAME_FLAG_KEY explicitly Andreas Rheinhardt
2024-05-09  2:04 ` [FFmpeg-devel] [PATCH 2/4] avcodec/codec_desc, jvdec: JV is not intra-only Andreas Rheinhardt
2024-05-09  2:04 ` [FFmpeg-devel] [PATCH 3/4] avcodec/decode: Set KEY flag+pict_type generically for intra-only codecs Andreas Rheinhardt
2024-05-13  8:28   ` Tomas Härdin
2024-05-13  8:54     ` Andreas Rheinhardt
2024-05-13 15:52       ` Tomas Härdin
2024-05-13 15:55         ` Andreas Rheinhardt
2024-05-13 17:02           ` Tomas Härdin [this message]
2024-05-09  2:04 ` [FFmpeg-devel] [PATCH 4/4] avcodec: Remove redundant setting of AV_FRAME_FLAG_KEY, AV_PICTURE_TYPE_I Andreas Rheinhardt
2024-05-10 18:05 ` [FFmpeg-devel] [PATCH 5/6] avcodec/yop: Add missing AV_CODEC_CAP_DR1 Andreas Rheinhardt
2024-05-10 18:06 ` [FFmpeg-devel] [PATCH 6/6] avcodec/codec_desc: Mark AVRN, TGQ, PhotoCD, VBN as intra-only Andreas Rheinhardt
2024-05-17 15:34 ` [FFmpeg-devel] [PATCH 1/5] avcodec/mlpdec: Set AV_FRAME_FLAG_KEY explicitly Andreas Rheinhardt

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=7c92fd1a50d9191b34e6678d111910c9adf737cb.camel@haerdin.se \
    --to=git@haerdin.se \
    --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