Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: fixed a decoding corruption issue
@ 2022-11-01  2:32 Ruijing Dong
  2022-11-02  1:31 ` Wang, Fei W
  2022-11-02 19:35 ` [FFmpeg-devel] [PATCH v3] " Ruijing Dong
  0 siblings, 2 replies; 5+ messages in thread
From: Ruijing Dong @ 2022-11-01  2:32 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: ruijing.dong, fei.w.wang

v2: update commit message

 In av1_spec.pdf page 38/669, there is a sentence below:

 if ( frame_type == KEY_FRAME && show_frame ) {
    for ( i = 0; i < NUM_REF_FRAMES; i++) {
       RefValid[ i ] = 0
       ......
    }
    ......
 }

 This shows that the condition of invalidating current
 DPB frames should be the coming frame_type is KEY_FRAME plus
 show_frame is equal to 1. Otherwise, some of the frames
 in sequence after KEY_FRAME still refer to the reference frames
 before KEY_FRAME, and if these before KEY_FRAME reference
 frames were invalidated, these frames could not find their
 reference frames, and it could cause image corruption.

 Mesa fix is in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19386

cc: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
---
 libavcodec/vaapi_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 63374c31c9..d0339b2705 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
     };
 
     for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
-        if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY)
+        if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY && frame_header->show_frame)
             pic_param.ref_frame_map[i] = VA_INVALID_ID;
         else
             pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
-- 
2.25.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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: fixed a decoding corruption issue
  2022-11-01  2:32 [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: fixed a decoding corruption issue Ruijing Dong
@ 2022-11-02  1:31 ` Wang, Fei W
  2022-11-02 19:35 ` [FFmpeg-devel] [PATCH v3] " Ruijing Dong
  1 sibling, 0 replies; 5+ messages in thread
From: Wang, Fei W @ 2022-11-02  1:31 UTC (permalink / raw)
  To: ffmpeg-devel, ruijing.dong

On Mon, 2022-10-31 at 22:32 -0400, Ruijing Dong wrote:
> v2: update commit message

Updates shouldn't appear in commit message. You can use "--annotate" of
git send-email, then add your updates below "---" after sign-off. Thus
the patch can be applied without updates. For example:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200909033956.27248-1-fei.w.wang@intel.com/

BTW, please indicate your patch version in the title. You should use '-
-subject-prefix="PATCH v3"' in next time.

> 
>  In av1_spec.pdf page 38/669, there is a sentence below:
> 
>  if ( frame_type == KEY_FRAME && show_frame ) {
>     for ( i = 0; i < NUM_REF_FRAMES; i++) {
>        RefValid[ i ] = 0
>        ......
>     }
>     ......
>  }
> 
>  This shows that the condition of invalidating current
>  DPB frames should be the coming frame_type is KEY_FRAME plus
>  show_frame is equal to 1. Otherwise, some of the frames
>  in sequence after KEY_FRAME still refer to the reference frames
>  before KEY_FRAME, and if these before KEY_FRAME reference
>  frames were invalidated, these frames could not find their
>  reference frames, and it could cause image corruption.
> 
>  Mesa fix is in 
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19386

Don't need to reserve blank space at the beginning of each line.

Thanks
Fei

> 
> cc: Fei Wang <fei.w.wang@intel.com>
> Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
> ---
>  libavcodec/vaapi_av1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
> index 63374c31c9..d0339b2705 100644
> --- a/libavcodec/vaapi_av1.c
> +++ b/libavcodec/vaapi_av1.c
> @@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext
> *avctx,
>      };
>  
>      for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
> -        if (pic_param.pic_info_fields.bits.frame_type ==
> AV1_FRAME_KEY)
> +        if (pic_param.pic_info_fields.bits.frame_type ==
> AV1_FRAME_KEY && frame_header->show_frame)
>              pic_param.ref_frame_map[i] = VA_INVALID_ID;
>          else
>              pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH v3] avcodec/av1_vaapi: fixed a decoding corruption issue
  2022-11-01  2:32 [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: fixed a decoding corruption issue Ruijing Dong
  2022-11-02  1:31 ` Wang, Fei W
@ 2022-11-02 19:35 ` Ruijing Dong
  2022-11-03  2:21   ` Wang, Fei W
  1 sibling, 1 reply; 5+ messages in thread
From: Ruijing Dong @ 2022-11-02 19:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: ruijing.dong, fei.w.wang

In av1_spec.pdf page 38/669, there is a sentence below:

if ( frame_type == KEY_FRAME && show_frame ) {
   for ( i = 0; i < NUM_REF_FRAMES; i++) {
      RefValid[ i ] = 0
      ......
   }
   ......
}

This shows that the condition of invalidating current
DPB frames should be the coming frame_type is KEY_FRAME plus
show_frame is equal to 1. Otherwise, some of the frames
in sequence after KEY_FRAME still refer to the reference frames
before KEY_FRAME, and if these before KEY_FRAME reference
frames were invalidated, these frames could not find their
reference frames, and it could cause image corruption.

Mesa fix is in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19386

Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
---
update: re-organize commit message and title

 libavcodec/vaapi_av1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 63374c31c9..d0339b2705 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
     };

     for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
-        if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY)
+        if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY && frame_header->show_frame)
             pic_param.ref_frame_map[i] = VA_INVALID_ID;
         else
             pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
--
2.25.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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] avcodec/av1_vaapi: fixed a decoding corruption issue
  2022-11-02 19:35 ` [FFmpeg-devel] [PATCH v3] " Ruijing Dong
@ 2022-11-03  2:21   ` Wang, Fei W
  2022-11-04  2:06     ` Xiang, Haihao
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Fei W @ 2022-11-03  2:21 UTC (permalink / raw)
  To: ffmpeg-devel, ruijing.dong

On Wed, 2022-11-02 at 15:35 -0400, Ruijing Dong wrote:
> In av1_spec.pdf page 38/669, there is a sentence below:
> 
> if ( frame_type == KEY_FRAME && show_frame ) {
>    for ( i = 0; i < NUM_REF_FRAMES; i++) {
>       RefValid[ i ] = 0
>       ......
>    }
>    ......
> }
> 
> This shows that the condition of invalidating current
> DPB frames should be the coming frame_type is KEY_FRAME plus
> show_frame is equal to 1. Otherwise, some of the frames
> in sequence after KEY_FRAME still refer to the reference frames
> before KEY_FRAME, and if these before KEY_FRAME reference
> frames were invalidated, these frames could not find their
> reference frames, and it could cause image corruption.
> 
> Mesa fix is in 
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19386
> 
> Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
> ---
> update: re-organize commit message and title
> 
>  libavcodec/vaapi_av1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
> index 63374c31c9..d0339b2705 100644
> --- a/libavcodec/vaapi_av1.c
> +++ b/libavcodec/vaapi_av1.c
> @@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext
> *avctx,
>      };
> 
>      for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
> -        if (pic_param.pic_info_fields.bits.frame_type ==
> AV1_FRAME_KEY)
> +        if (pic_param.pic_info_fields.bits.frame_type ==
> AV1_FRAME_KEY && frame_header->show_frame)

LGTM, Thanks.

Fei

>              pic_param.ref_frame_map[i] = VA_INVALID_ID;
>          else
>              pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
> --
> 2.25.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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3] avcodec/av1_vaapi: fixed a decoding corruption issue
  2022-11-03  2:21   ` Wang, Fei W
@ 2022-11-04  2:06     ` Xiang, Haihao
  0 siblings, 0 replies; 5+ messages in thread
From: Xiang, Haihao @ 2022-11-04  2:06 UTC (permalink / raw)
  To: ffmpeg-devel, ruijing.dong

On Thu, 2022-11-03 at 02:21 +0000, Wang, Fei W wrote:
> On Wed, 2022-11-02 at 15:35 -0400, Ruijing Dong wrote:
> > In av1_spec.pdf page 38/669, there is a sentence below:
> > 
> > if ( frame_type == KEY_FRAME && show_frame ) {
> >    for ( i = 0; i < NUM_REF_FRAMES; i++) {
> >       RefValid[ i ] = 0
> >       ......
> >    }
> >    ......
> > }
> > 
> > This shows that the condition of invalidating current
> > DPB frames should be the coming frame_type is KEY_FRAME plus
> > show_frame is equal to 1. Otherwise, some of the frames
> > in sequence after KEY_FRAME still refer to the reference frames
> > before KEY_FRAME, and if these before KEY_FRAME reference
> > frames were invalidated, these frames could not find their
> > reference frames, and it could cause image corruption.
> > 
> > Mesa fix is in 
> > https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19386
> > 
> > Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
> > ---
> > update: re-organize commit message and title
> > 
> >  libavcodec/vaapi_av1.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
> > index 63374c31c9..d0339b2705 100644
> > --- a/libavcodec/vaapi_av1.c
> > +++ b/libavcodec/vaapi_av1.c
> > @@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext
> > *avctx,
> >      };
> > 
> >      for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
> > -        if (pic_param.pic_info_fields.bits.frame_type ==
> > AV1_FRAME_KEY)
> > +        if (pic_param.pic_info_fields.bits.frame_type ==
> > AV1_FRAME_KEY && frame_header->show_frame)
> 
> LGTM, Thanks.
> 
> Fei
> 
> >              pic_param.ref_frame_map[i] = VA_INVALID_ID;
> >          else
> >              pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
> > --
> > 2.25.1

Applied, thx

-Haihao
_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2022-11-04  2:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  2:32 [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: fixed a decoding corruption issue Ruijing Dong
2022-11-02  1:31 ` Wang, Fei W
2022-11-02 19:35 ` [FFmpeg-devel] [PATCH v3] " Ruijing Dong
2022-11-03  2:21   ` Wang, Fei W
2022-11-04  2:06     ` Xiang, Haihao

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