Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref
       [not found] <20250115214000.73826-2-nowrep@gmail.com>
@ 2025-03-03 13:47 ` David Rosca
  2025-03-04  1:54   ` Wang, Fei W
  0 siblings, 1 reply; 3+ messages in thread
From: David Rosca @ 2025-03-03 13:47 UTC (permalink / raw)
  To: ffmpeg-devel

On Wed, Jan 15, 2025 at 10:41 PM David Rosca <nowrep@gmail.com> wrote:
>
> Don't need to alternate when only one reference is used.
> Fixes fail after bf9f921ef7 ("avcodec/hw_base_encode: restrict size of next_prev")
> due to AV1 writer complaining about incorrect ref_order_hint value.

Ping.

> ---
>  libavcodec/vaapi_encode_av1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c
> index 1b350cd936..aca6c26aa2 100644
> --- a/libavcodec/vaapi_encode_av1.c
> +++ b/libavcodec/vaapi_encode_av1.c
> @@ -504,7 +504,7 @@ static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
>          fh->base_q_idx = priv->q_idx_p;
>          ref = pic->refs[0][pic->nb_refs[0] - 1];
>          href = ref->codec_priv;
> -        hpic->slot = !href->slot;
> +        hpic->slot = ctx->base.ref_l0 > 1 ? !href->slot : 0;
>          hpic->last_idr_frame = href->last_idr_frame;
>          fh->refresh_frame_flags = 1 << hpic->slot;
>
> --
> 2.48.1
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref
  2025-03-03 13:47 ` [FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref David Rosca
@ 2025-03-04  1:54   ` Wang, Fei W
  2025-03-04  7:43     ` David Rosca
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Fei W @ 2025-03-04  1:54 UTC (permalink / raw)
  To: ffmpeg-devel

On Mon, 2025-03-03 at 14:47 +0100, David Rosca wrote:
> On Wed, Jan 15, 2025 at 10:41 PM David Rosca <nowrep@gmail.com>
> wrote:
> > 
> > Don't need to alternate when only one reference is used.
> > Fixes fail after bf9f921ef7 ("avcodec/hw_base_encode: restrict size
> > of next_prev")
> > due to AV1 writer complaining about incorrect ref_order_hint value.
> 
> Ping.

Did you encode successful when ctx.base.ref_l0 equals to 1? There is an
error with this patch:

$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -c:v
av1_vaapi -y out.mp4
...
[av1_vaapi @ 0x6246182df640] frame_type does not match inferred value:
1, but should be 0.
[av1_vaapi @ 0x6246182df640] Failed to write unit 0 (type 3).
[av1_vaapi @ 0x6246182df640] Failed to write packed header.

Thanks
Fei

> 
> > ---
> >  libavcodec/vaapi_encode_av1.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/vaapi_encode_av1.c
> > b/libavcodec/vaapi_encode_av1.c
> > index 1b350cd936..aca6c26aa2 100644
> > --- a/libavcodec/vaapi_encode_av1.c
> > +++ b/libavcodec/vaapi_encode_av1.c
> > @@ -504,7 +504,7 @@ static int
> > vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
> >          fh->base_q_idx = priv->q_idx_p;
> >          ref = pic->refs[0][pic->nb_refs[0] - 1];
> >          href = ref->codec_priv;
> > -        hpic->slot = !href->slot;
> > +        hpic->slot = ctx->base.ref_l0 > 1 ? !href->slot : 0;
> >          hpic->last_idr_frame = href->last_idr_frame;
> >          fh->refresh_frame_flags = 1 << hpic->slot;
> > 
> > --
> > 2.48.1
> > 
> _______________________________________________
> 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".

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref
  2025-03-04  1:54   ` Wang, Fei W
@ 2025-03-04  7:43     ` David Rosca
  0 siblings, 0 replies; 3+ messages in thread
From: David Rosca @ 2025-03-04  7:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Mar 4, 2025 at 2:55 AM Wang, Fei W
<fei.w.wang-at-intel.com@ffmpeg.org> wrote:
>
> On Mon, 2025-03-03 at 14:47 +0100, David Rosca wrote:
> > On Wed, Jan 15, 2025 at 10:41 PM David Rosca <nowrep@gmail.com>
> > wrote:
> > >
> > > Don't need to alternate when only one reference is used.
> > > Fixes fail after bf9f921ef7 ("avcodec/hw_base_encode: restrict size
> > > of next_prev")
> > > due to AV1 writer complaining about incorrect ref_order_hint value.
> >
> > Ping.
>
> Did you encode successful when ctx.base.ref_l0 equals to 1? There is an
> error with this patch:
>
> $ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -c:v
> av1_vaapi -y out.mp4
> ...
> [av1_vaapi @ 0x6246182df640] frame_type does not match inferred value:
> 1, but should be 0.
> [av1_vaapi @ 0x6246182df640] Failed to write unit 0 (type 3).
> [av1_vaapi @ 0x6246182df640] Failed to write packed header.

I see, it's still broken for L0=1, L1=1 (also broken on master).
This patch fixes it for L0=1, L1=0 only.

David
>
> Thanks
> Fei
>
> >
> > > ---
> > >  libavcodec/vaapi_encode_av1.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/vaapi_encode_av1.c
> > > b/libavcodec/vaapi_encode_av1.c
> > > index 1b350cd936..aca6c26aa2 100644
> > > --- a/libavcodec/vaapi_encode_av1.c
> > > +++ b/libavcodec/vaapi_encode_av1.c
> > > @@ -504,7 +504,7 @@ static int
> > > vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
> > >          fh->base_q_idx = priv->q_idx_p;
> > >          ref = pic->refs[0][pic->nb_refs[0] - 1];
> > >          href = ref->codec_priv;
> > > -        hpic->slot = !href->slot;
> > > +        hpic->slot = ctx->base.ref_l0 > 1 ? !href->slot : 0;
> > >          hpic->last_idr_frame = href->last_idr_frame;
> > >          fh->refresh_frame_flags = 1 << hpic->slot;
> > >
> > > --
> > > 2.48.1
> > >
> > _______________________________________________
> > 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".
>
> _______________________________________________
> 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".
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-04  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250115214000.73826-2-nowrep@gmail.com>
2025-03-03 13:47 ` [FFmpeg-devel] [PATCH] lavc/vaapi_encode_av1: Always use slot 0 with 1 l0 ref David Rosca
2025-03-04  1:54   ` Wang, Fei W
2025-03-04  7:43     ` David Rosca

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