diff mbox series

[FFmpeg-devel,2/9] avcodec/vvc/ctu: Simplify code at the end of pred_mode_decode()

Message ID 20240519024915.1944150-2-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
This simplification assumes that the code is correct

Fixes: CID1560036 Logically dead code

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

Comments

Michael Niedermayer July 12, 2024, 9:24 p.m. UTC | #1
On Sun, May 19, 2024 at 04:49:08AM +0200, Michael Niedermayer wrote:
> This simplification assumes that the code is correct
> 
> Fixes: CID1560036 Logically dead code
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vvc/ctu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

will apply

[...]
Nuo Mi July 13, 2024, 2:06 a.m. UTC | #2
On Sun, May 19, 2024 at 10:49 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> This simplification assumes that the code is correct
>
> Fixes: CID1560036 Logically dead code
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vvc/ctu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
> index 53f92ca10f7..7495ced0d5a 100644
> --- a/libavcodec/vvc/ctu.c
> +++ b/libavcodec/vvc/ctu.c
> @@ -1080,12 +1080,10 @@ static PredMode pred_mode_decode(VVCLocalContext
> *lc,
>          }
>          if (pred_mode_ibc_flag)
>              pred_mode = MODE_IBC;
> +        return pred_mode;
>      } else {
> -        pred_mode_flag = is_4x4 || mode_type == MODE_TYPE_INTRA ||
> -            mode_type != MODE_TYPE_INTER || IS_I(rsh);
> -        pred_mode = pred_mode_flag ? MODE_INTRA : MODE_INTER;
> +        return MODE_INTRA;
>      }
> -    return pred_mode;
>  }
>
LGTM.
We can also remove the else branch since the if branch returns.

>
>  static void sbt_info(VVCLocalContext *lc, const VVCSPS *sps)
> --
> 2.45.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".
>
diff mbox series

Patch

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index 53f92ca10f7..7495ced0d5a 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1080,12 +1080,10 @@  static PredMode pred_mode_decode(VVCLocalContext *lc,
         }
         if (pred_mode_ibc_flag)
             pred_mode = MODE_IBC;
+        return pred_mode;
     } else {
-        pred_mode_flag = is_4x4 || mode_type == MODE_TYPE_INTRA ||
-            mode_type != MODE_TYPE_INTER || IS_I(rsh);
-        pred_mode = pred_mode_flag ? MODE_INTRA : MODE_INTER;
+        return MODE_INTRA;
     }
-    return pred_mode;
 }
 
 static void sbt_info(VVCLocalContext *lc, const VVCSPS *sps)