diff mbox series

[FFmpeg-devel,v3,1/2] avcodec/vvc: Fix output and unref a frame which isn't decoding yet

Message ID tencent_574238C796204D3AA07B4D8E4FEE552FA707@qq.com
State New
Headers show
Series [FFmpeg-devel,v3,1/2] avcodec/vvc: Fix output and unref a frame which isn't decoding yet | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Sept. 15, 2024, 4:54 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

ff_vvc_output_frame is called before actually decoding. It's possible
for ff_vvc_output_frame to select current frame to output. If current
frame is nonref frame, it will be released by ff_vvc_unref_frame.

Fix this by always marking the current frame with
VVC_FRAME_FLAG_SHORT_REF, as is done by the HEVC decoder.
---
 libavcodec/vvc/refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nuo Mi Sept. 15, 2024, 8:49 a.m. UTC | #1
On Sun, Sep 15, 2024 at 1:04 PM Zhao Zhili <quinkblack@foxmail.com> wrote:

> From: Zhao Zhili <zhilizhao@tencent.com>
>
> ff_vvc_output_frame is called before actually decoding. It's possible
> for ff_vvc_output_frame to select current frame to output. If current
> frame is nonref frame, it will be released by ff_vvc_unref_frame.
>
> Fix this by always marking the current frame with
> VVC_FRAME_FLAG_SHORT_REF, as is done by the HEVC decoder.
> ---
>  libavcodec/vvc/refs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c
> index bebcef7fd6..133ff9eaba 100644
> --- a/libavcodec/vvc/refs.c
> +++ b/libavcodec/vvc/refs.c
> @@ -193,7 +193,7 @@ int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext
> *fc, AVFrame **frame)
>      if (s->no_output_before_recovery_flag && (IS_RASL(s) ||
> !GDR_IS_RECOVERED(s)))
>          ref->flags = VVC_FRAME_FLAG_SHORT_REF;
>      else if (ph->r->ph_pic_output_flag)
> -        ref->flags = VVC_FRAME_FLAG_OUTPUT;
> +        ref->flags = VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_SHORT_REF;
>
>      if (!ph->r->ph_non_ref_pic_flag)
>          ref->flags |= VVC_FRAME_FLAG_SHORT_REF;
> --
> 2.42.0
>
Thank you, Zhili.
Applied.

Hi James,
Could you help merge
https://patchwork.ffmpeg.org/project/ffmpeg/patch/tencent_60CD804FDAD504277B38A716714D13202007@qq.com/
and add the clip to fate?
Thank you


>
> _______________________________________________
> 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".
>
Anton Khirnov Sept. 15, 2024, 8:54 a.m. UTC | #2
Quoting Nuo Mi (2024-09-15 10:49:31)
> On Sun, Sep 15, 2024 at 1:04 PM Zhao Zhili <quinkblack@foxmail.com> wrote:
> 
> > From: Zhao Zhili <zhilizhao@tencent.com>
> >
> > ff_vvc_output_frame is called before actually decoding. It's possible
> > for ff_vvc_output_frame to select current frame to output. If current
> > frame is nonref frame, it will be released by ff_vvc_unref_frame.
> >
> > Fix this by always marking the current frame with
> > VVC_FRAME_FLAG_SHORT_REF, as is done by the HEVC decoder.
> > ---
> >  libavcodec/vvc/refs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c
> > index bebcef7fd6..133ff9eaba 100644
> > --- a/libavcodec/vvc/refs.c
> > +++ b/libavcodec/vvc/refs.c
> > @@ -193,7 +193,7 @@ int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext
> > *fc, AVFrame **frame)
> >      if (s->no_output_before_recovery_flag && (IS_RASL(s) ||
> > !GDR_IS_RECOVERED(s)))
> >          ref->flags = VVC_FRAME_FLAG_SHORT_REF;
> >      else if (ph->r->ph_pic_output_flag)
> > -        ref->flags = VVC_FRAME_FLAG_OUTPUT;
> > +        ref->flags = VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_SHORT_REF;
> >
> >      if (!ph->r->ph_non_ref_pic_flag)
> >          ref->flags |= VVC_FRAME_FLAG_SHORT_REF;
> > --
> > 2.42.0
> >
> Thank you, Zhili.
> Applied.
> 
> Hi James,
> Could you help merge
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/tencent_60CD804FDAD504277B38A716714D13202007@qq.com/
> and add the clip to fate?

Just FYI, the official way to request samples upload is add
samples-request@ffmpeg.org to Cc. James is one of the people on that
list, but not the only one.
Nuo Mi Sept. 16, 2024, 3:42 a.m. UTC | #3
On Sun, Sep 15, 2024 at 4:54 PM Anton Khirnov <anton@khirnov.net> wrote:

> Quoting Nuo Mi (2024-09-15 10:49:31)
> > On Sun, Sep 15, 2024 at 1:04 PM Zhao Zhili <quinkblack@foxmail.com>
> wrote:
> >
> > > From: Zhao Zhili <zhilizhao@tencent.com>
> > >
> > > ff_vvc_output_frame is called before actually decoding. It's possible
> > > for ff_vvc_output_frame to select current frame to output. If current
> > > frame is nonref frame, it will be released by ff_vvc_unref_frame.
> > >
> > > Fix this by always marking the current frame with
> > > VVC_FRAME_FLAG_SHORT_REF, as is done by the HEVC decoder.
> > > ---
> > >  libavcodec/vvc/refs.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c
> > > index bebcef7fd6..133ff9eaba 100644
> > > --- a/libavcodec/vvc/refs.c
> > > +++ b/libavcodec/vvc/refs.c
> > > @@ -193,7 +193,7 @@ int ff_vvc_set_new_ref(VVCContext *s,
> VVCFrameContext
> > > *fc, AVFrame **frame)
> > >      if (s->no_output_before_recovery_flag && (IS_RASL(s) ||
> > > !GDR_IS_RECOVERED(s)))
> > >          ref->flags = VVC_FRAME_FLAG_SHORT_REF;
> > >      else if (ph->r->ph_pic_output_flag)
> > > -        ref->flags = VVC_FRAME_FLAG_OUTPUT;
> > > +        ref->flags = VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_SHORT_REF;
> > >
> > >      if (!ph->r->ph_non_ref_pic_flag)
> > >          ref->flags |= VVC_FRAME_FLAG_SHORT_REF;
> > > --
> > > 2.42.0
> > >
> > Thank you, Zhili.
> > Applied.
> >
> > Hi James,
> > Could you help merge
> >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/tencent_60CD804FDAD504277B38A716714D13202007@qq.com/
> > and add the clip to fate?
>
> Just FYI, the official way to request samples upload is add
> samples-request@ffmpeg.org to Cc. James is one of the people on that
> list, but not the only one.

sure, thank you for the reminder

>


> --
> 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".
>
diff mbox series

Patch

diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c
index bebcef7fd6..133ff9eaba 100644
--- a/libavcodec/vvc/refs.c
+++ b/libavcodec/vvc/refs.c
@@ -193,7 +193,7 @@  int ff_vvc_set_new_ref(VVCContext *s, VVCFrameContext *fc, AVFrame **frame)
     if (s->no_output_before_recovery_flag && (IS_RASL(s) || !GDR_IS_RECOVERED(s)))
         ref->flags = VVC_FRAME_FLAG_SHORT_REF;
     else if (ph->r->ph_pic_output_flag)
-        ref->flags = VVC_FRAME_FLAG_OUTPUT;
+        ref->flags = VVC_FRAME_FLAG_OUTPUT | VVC_FRAME_FLAG_SHORT_REF;
 
     if (!ph->r->ph_non_ref_pic_flag)
         ref->flags |= VVC_FRAME_FLAG_SHORT_REF;