diff mbox series

[FFmpeg-devel,v3,2/2] lavc/hevcdec: Update slice index before hwaccel decode slice

Message ID 20240624062331.189212-2-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v3,1/2] lavc/hevcdec: Put slice address checking after hwaccel decode slice | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W June 24, 2024, 6:23 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

Otherwise, slice index will never update for hwaccel decode, and slice
RPL will be always overlap into first one which use slice index to construct.

Fixes hwaccel decoding after 47d34ba7fbb81

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
1. Update commit message.

 libavcodec/hevc/hevcdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Hendrik Leppkes June 24, 2024, 7:46 p.m. UTC | #1
On Mon, Jun 24, 2024 at 8:32 AM <fei.w.wang-at-intel.com@ffmpeg.org> wrote:
>
> From: Fei Wang <fei.w.wang@intel.com>
>
> Otherwise, slice index will never update for hwaccel decode, and slice
> RPL will be always overlap into first one which use slice index to construct.
>
> Fixes hwaccel decoding after 47d34ba7fbb81
>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> 1. Update commit message.
>
>  libavcodec/hevc/hevcdec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
> index 39beb7e4dc..8bb564f1b3 100644
> --- a/libavcodec/hevc/hevcdec.c
> +++ b/libavcodec/hevc/hevcdec.c
> @@ -2770,6 +2770,9 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
>      const HEVCPPS *pps = s->pps;
>      int ret;
>
> +    if (!s->sh.first_slice_in_pic_flag)
> +        s->slice_idx += !s->sh.dependent_slice_segment_flag;
> +
>      if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) {
>          ret = ff_hevc_slice_rpl(s);
>          if (ret < 0) {
> @@ -2807,8 +2810,6 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
>      s->local_ctx[0].tu.cu_qp_offset_cb = 0;
>      s->local_ctx[0].tu.cu_qp_offset_cr = 0;
>
> -    s->slice_idx += !s->sh.dependent_slice_segment_flag;
> -
>      if (s->avctx->active_thread_type == FF_THREAD_SLICE  &&
>          s->sh.num_entry_point_offsets > 0                &&
>          pps->num_tile_rows == 1 && pps->num_tile_columns == 1)
> --
> 2.34.1

I can confirm that this set fixes hwaccel with slices, LGTM from me.
Hopefully Anton can also quickly look over it, its his changes
afterall.

- Hendrik
Anton Khirnov June 25, 2024, 7:45 a.m. UTC | #2
Quoting fei.w.wang-at-intel.com@ffmpeg.org (2024-06-24 08:23:31)
> From: Fei Wang <fei.w.wang@intel.com>
> 
> Otherwise, slice index will never update for hwaccel decode, and slice
> RPL will be always overlap into first one which use slice index to construct.
> 
> Fixes hwaccel decoding after 47d34ba7fbb81
> 
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>

ok
Wang, Fei W July 10, 2024, 2:17 a.m. UTC | #3
> -----Original Message-----
> From: Anton Khirnov <anton@khirnov.net>
> Sent: Tuesday, June 25, 2024 3:45 PM
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Cc: Wang, Fei W <fei.w.wang@intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavc/hevcdec: Update slice index
> before hwaccel decode slice
> 
> Quoting fei.w.wang-at-intel.com@ffmpeg.org (2024-06-24 08:23:31)
> > From: Fei Wang <fei.w.wang@intel.com>
> >
> > Otherwise, slice index will never update for hwaccel decode, and slice
> > RPL will be always overlap into first one which use slice index to construct.
> >
> > Fixes hwaccel decoding after 47d34ba7fbb81
> >
> > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> 
> ok

Will push the patchset in 3 days if no more objection.

--
Fei

> 
> --
> Anton Khirnov
diff mbox series

Patch

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 39beb7e4dc..8bb564f1b3 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -2770,6 +2770,9 @@  static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
     const HEVCPPS *pps = s->pps;
     int ret;
 
+    if (!s->sh.first_slice_in_pic_flag)
+        s->slice_idx += !s->sh.dependent_slice_segment_flag;
+
     if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) {
         ret = ff_hevc_slice_rpl(s);
         if (ret < 0) {
@@ -2807,8 +2810,6 @@  static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
     s->local_ctx[0].tu.cu_qp_offset_cb = 0;
     s->local_ctx[0].tu.cu_qp_offset_cr = 0;
 
-    s->slice_idx += !s->sh.dependent_slice_segment_flag;
-
     if (s->avctx->active_thread_type == FF_THREAD_SLICE  &&
         s->sh.num_entry_point_offsets > 0                &&
         pps->num_tile_rows == 1 && pps->num_tile_columns == 1)