diff mbox series

[FFmpeg-devel,3/9] avcodec/vvc/ctu: Simplify pred_mode_plt_flag

Message ID 20240519024915.1944150-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avcodec/vqcdec: Check init_get_bits8() for failure | 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

Michael Niedermayer May 19, 2024, 2:49 a.m. UTC
Fixes: CID1560039 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vvc/ctu.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

Comments

Nuo Mi May 19, 2024, 2:40 p.m. UTC | #1
On Sun, May 19, 2024 at 10:49 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: CID1560039 Logically dead code
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vvc/ctu.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
> index 7495ced0d5a..b7089b9a004 100644
> --- a/libavcodec/vvc/ctu.c
> +++ b/libavcodec/vvc/ctu.c
> @@ -1793,7 +1793,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> x0, int y0, int cb_width, in
>      const int hs                    = sps->hshift[CHROMA];
>      const int vs                    = sps->vshift[CHROMA];
>      const int is_128                = cb_width > 64 || cb_height > 64;
> -    int pred_mode_plt_flag          = 0;
>      int ret;
>
>      CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth,
> tree_type);
> @@ -1811,7 +1810,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> x0, int y0, int cb_width, in
>          mode_type != MODE_TYPE_INTER && ((cb_width * cb_height) >
>          (tree_type != DUAL_TREE_CHROMA ? 16 : (16 << hs << vs))) &&
>          (mode_type != MODE_TYPE_INTRA || tree_type != DUAL_TREE_CHROMA)) {
> -        pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
> +        int pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
>          if (pred_mode_plt_flag) {
>              avpriv_report_missing_feature(fc->log_ctx, "Palette");
>              return AVERROR_PATCHWELCOME;
> @@ -1823,31 +1822,21 @@ static int hls_coding_unit(VVCLocalContext *lc,
> int x0, int y0, int cb_width, in
>      }
>      if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
>          if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
> -            if (pred_mode_plt_flag) {
> -                avpriv_report_missing_feature(fc->log_ctx, "Palette");
> -                return AVERROR_PATCHWELCOME;
> -            } else {
> -                intra_luma_pred_modes(lc);
> -            }
> +            intra_luma_pred_modes(lc);
>              ff_vvc_set_intra_mvf(lc, 0);
>          }
>          if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA)
> && sps->r->sps_chroma_format_idc) {
> -            if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
> -                avpriv_report_missing_feature(fc->log_ctx, "Palette");
> -                return AVERROR_PATCHWELCOME;
> -            } else if (!pred_mode_plt_flag) {
> -                if (!cu->act_enabled_flag)
> -                    intra_chroma_pred_modes(lc);
> -            }
> +            if (!cu->act_enabled_flag)
> +                intra_chroma_pred_modes(lc);
>          }
>      } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC
> */
>          if ((ret = inter_data(lc)) < 0)
>              return ret;
>      }
> -    if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag &&
> !lc->cu->pu.general_merge_flag)
> +    if (cu->pred_mode != MODE_INTRA && !lc->cu->pu.general_merge_flag)
>          cu->coded_flag = ff_vvc_cu_coded_flag(lc);
>      else
> -        cu->coded_flag = !(cu->skip_flag || pred_mode_plt_flag);
> +        cu->coded_flag = !(cu->skip_flag);
>
>      if (cu->coded_flag) {
>          sbt_info(lc, sps);
> --
> 2.45.1
>
Hi  Michael,
Could we skip this one?
Thanks to Jianhua's help. We may have Palette support in the next month.

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".
>
Michael Niedermayer May 19, 2024, 7:27 p.m. UTC | #2
On Sun, May 19, 2024 at 10:40:57PM +0800, Nuo Mi wrote:
> On Sun, May 19, 2024 at 10:49 AM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Fixes: CID1560039 Logically dead code
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vvc/ctu.c | 23 ++++++-----------------
> >  1 file changed, 6 insertions(+), 17 deletions(-)
> >
> > diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
> > index 7495ced0d5a..b7089b9a004 100644
> > --- a/libavcodec/vvc/ctu.c
> > +++ b/libavcodec/vvc/ctu.c
> > @@ -1793,7 +1793,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> > x0, int y0, int cb_width, in
> >      const int hs                    = sps->hshift[CHROMA];
> >      const int vs                    = sps->vshift[CHROMA];
> >      const int is_128                = cb_width > 64 || cb_height > 64;
> > -    int pred_mode_plt_flag          = 0;
> >      int ret;
> >
> >      CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth,
> > tree_type);
> > @@ -1811,7 +1810,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> > x0, int y0, int cb_width, in
> >          mode_type != MODE_TYPE_INTER && ((cb_width * cb_height) >
> >          (tree_type != DUAL_TREE_CHROMA ? 16 : (16 << hs << vs))) &&
> >          (mode_type != MODE_TYPE_INTRA || tree_type != DUAL_TREE_CHROMA)) {
> > -        pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
> > +        int pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
> >          if (pred_mode_plt_flag) {
> >              avpriv_report_missing_feature(fc->log_ctx, "Palette");
> >              return AVERROR_PATCHWELCOME;
> > @@ -1823,31 +1822,21 @@ static int hls_coding_unit(VVCLocalContext *lc,
> > int x0, int y0, int cb_width, in
> >      }
> >      if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
> >          if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
> > -            if (pred_mode_plt_flag) {
> > -                avpriv_report_missing_feature(fc->log_ctx, "Palette");
> > -                return AVERROR_PATCHWELCOME;
> > -            } else {
> > -                intra_luma_pred_modes(lc);
> > -            }
> > +            intra_luma_pred_modes(lc);
> >              ff_vvc_set_intra_mvf(lc, 0);
> >          }
> >          if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA)
> > && sps->r->sps_chroma_format_idc) {
> > -            if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
> > -                avpriv_report_missing_feature(fc->log_ctx, "Palette");
> > -                return AVERROR_PATCHWELCOME;
> > -            } else if (!pred_mode_plt_flag) {
> > -                if (!cu->act_enabled_flag)
> > -                    intra_chroma_pred_modes(lc);
> > -            }
> > +            if (!cu->act_enabled_flag)
> > +                intra_chroma_pred_modes(lc);
> >          }
> >      } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC
> > */
> >          if ((ret = inter_data(lc)) < 0)
> >              return ret;
> >      }
> > -    if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag &&
> > !lc->cu->pu.general_merge_flag)
> > +    if (cu->pred_mode != MODE_INTRA && !lc->cu->pu.general_merge_flag)
> >          cu->coded_flag = ff_vvc_cu_coded_flag(lc);
> >      else
> > -        cu->coded_flag = !(cu->skip_flag || pred_mode_plt_flag);
> > +        cu->coded_flag = !(cu->skip_flag);
> >
> >      if (cu->coded_flag) {
> >          sbt_info(lc, sps);
> > --
> > 2.45.1
> >
> Hi  Michael,
> Could we skip this one?
> Thanks to Jianhua's help. We may have Palette support in the next month.

of course, patch droped, issues marked as intentional in coverity

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index 7495ced0d5a..b7089b9a004 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1793,7 +1793,6 @@  static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in
     const int hs                    = sps->hshift[CHROMA];
     const int vs                    = sps->vshift[CHROMA];
     const int is_128                = cb_width > 64 || cb_height > 64;
-    int pred_mode_plt_flag          = 0;
     int ret;
 
     CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth, tree_type);
@@ -1811,7 +1810,7 @@  static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in
         mode_type != MODE_TYPE_INTER && ((cb_width * cb_height) >
         (tree_type != DUAL_TREE_CHROMA ? 16 : (16 << hs << vs))) &&
         (mode_type != MODE_TYPE_INTRA || tree_type != DUAL_TREE_CHROMA)) {
-        pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
+        int pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
         if (pred_mode_plt_flag) {
             avpriv_report_missing_feature(fc->log_ctx, "Palette");
             return AVERROR_PATCHWELCOME;
@@ -1823,31 +1822,21 @@  static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in
     }
     if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
         if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
-            if (pred_mode_plt_flag) {
-                avpriv_report_missing_feature(fc->log_ctx, "Palette");
-                return AVERROR_PATCHWELCOME;
-            } else {
-                intra_luma_pred_modes(lc);
-            }
+            intra_luma_pred_modes(lc);
             ff_vvc_set_intra_mvf(lc, 0);
         }
         if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && sps->r->sps_chroma_format_idc) {
-            if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
-                avpriv_report_missing_feature(fc->log_ctx, "Palette");
-                return AVERROR_PATCHWELCOME;
-            } else if (!pred_mode_plt_flag) {
-                if (!cu->act_enabled_flag)
-                    intra_chroma_pred_modes(lc);
-            }
+            if (!cu->act_enabled_flag)
+                intra_chroma_pred_modes(lc);
         }
     } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC */
         if ((ret = inter_data(lc)) < 0)
             return ret;
     }
-    if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag && !lc->cu->pu.general_merge_flag)
+    if (cu->pred_mode != MODE_INTRA && !lc->cu->pu.general_merge_flag)
         cu->coded_flag = ff_vvc_cu_coded_flag(lc);
     else
-        cu->coded_flag = !(cu->skip_flag || pred_mode_plt_flag);
+        cu->coded_flag = !(cu->skip_flag);
 
     if (cu->coded_flag) {
         sbt_info(lc, sps);