From: Nuo Mi <nuomi2021@gmail.com>
To: Frank Plowman <post@frankplowman.com>
Cc: fei.w.wang@intel.com, ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3] lavc/vvc: Stop c->pix_fmt and s->pix_fmt diverging
Date: Sat, 18 Jan 2025 23:12:19 +0800
Message-ID: <CAFXK13fXB+91Q+B_VackvrzRG_zu5hXLqoNEF=Q=fP7GQ0B4xA@mail.gmail.com> (raw)
In-Reply-To: <20250117201839.55096-1-post@frankplowman.com>
On Sat, Jan 18, 2025 at 4:18 AM Frank Plowman <post@frankplowman.com> wrote:
> When the chroma format changes mid-sequence, c->pix_fmt and s->pix_fmt
> can get out-of-sync. More specifically,
> 1. export_frame_params is called.
> c->pix_fmt and s->pix_fmt are both set to their new values.
> 2. set_output_format is called.
> c->pix_fmt is set back to its old value.
>
> The two getting out of sync results in a memory error. The check in
> export_frame_params passes as it only tests the s->pix_fmt, therefore
> c->pix_fmt keeps the old value and the buffers are not allocated for the
> new pixel format.
>
> Patch fixes this by not setting c->pix_fmt in set_output_format.
>
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
> @Nuo Mi, Fei Wang:
> Does this look okay? I am not really sure why c->pix_fmt was set again
> in set_output_format, was this accounting for some specific scenario?
> In terms of bitstreams where the pix_fmt changes, I only have fuzzed
> bitstreams unfortunately, so while this prevents crashing it is
> difficult to know whether the output is correct.
>
Hi Frank,
I agree with you; it's better to remove the duplicate pix_fmt in the VVC
context.
If we need it for hardware, it should be renamed to hw_fmt or something
more descriptive.
Could you share the clip?
> ---
> libavcodec/vvc/dec.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> index 1cb168de7e..53e3eeec6d 100644
> --- a/libavcodec/vvc/dec.c
> +++ b/libavcodec/vvc/dec.c
> @@ -970,7 +970,6 @@ static int set_output_format(const VVCContext *s,
> const AVFrame *output)
> if ((ret = ff_set_dimensions(c, output->width, output->height)) <
> 0)
> return ret;
> }
> - c->pix_fmt = output->format;
> return 0;
> }
>
> --
> 2.47.0
>
>
_______________________________________________
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 parent reply other threads:[~2025-01-18 15:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250117201839.55096-1-post@frankplowman.com>
2025-01-18 15:12 ` Nuo Mi [this message]
2025-01-26 3:15 ` Nuo Mi
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='CAFXK13fXB+91Q+B_VackvrzRG_zu5hXLqoNEF=Q=fP7GQ0B4xA@mail.gmail.com' \
--to=nuomi2021@gmail.com \
--cc=fei.w.wang@intel.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=post@frankplowman.com \
/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