diff mbox series

[FFmpeg-devel,1/7] avcodec/av1dec: bit_depth cannot be another values than 8, 10, 12

Message ID 20240502004150.3627661-1-michael@niedermayer.cc
State Accepted
Commit fd7d24fa3f39fc1013fb0d06b42c98b8ff1f8942
Headers show
Series [FFmpeg-devel,1/7] avcodec/av1dec: bit_depth cannot be another values than 8, 10, 12 | expand

Commit Message

Michael Niedermayer May 2, 2024, 12:41 a.m. UTC
Fixes: CID1544265 Logically dead code

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

Comments

James Almer May 2, 2024, 12:56 a.m. UTC | #1
On 5/1/2024 9:41 PM, Michael Niedermayer wrote:
> Fixes: CID1544265 Logically dead code
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>   libavcodec/av1dec.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index 79a30a114da..4f9222cca27 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -493,7 +493,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
>               else if (bit_depth == 12)
>                   pix_fmt = AV_PIX_FMT_YUV444P12;
>               else
> -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> +                av_assert0(0);
>           } else if (seq->color_config.subsampling_x == 1 &&
>                      seq->color_config.subsampling_y == 0) {
>               if (bit_depth == 8)
> @@ -503,7 +503,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
>               else if (bit_depth == 12)
>                   pix_fmt = AV_PIX_FMT_YUV422P12;
>               else
> -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> +                av_assert0(0);
>           } else if (seq->color_config.subsampling_x == 1 &&
>                      seq->color_config.subsampling_y == 1) {
>               if (bit_depth == 8)
> @@ -513,7 +513,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
>               else if (bit_depth == 12)
>                   pix_fmt = AV_PIX_FMT_YUV420P12;
>               else
> -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> +                av_assert0(0);
>           }
>       } else {
>           if (bit_depth == 8)
> @@ -523,7 +523,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
>           else if (bit_depth == 12)
>               pix_fmt = AV_PIX_FMT_GRAY12;
>           else
> -            av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> +            av_assert0(0);
>       }
>   
>       return pix_fmt;

LGTM.

Can you change bit_depth into an int while at it? no reason for it to be 
uint8_t as a scalar.
Michael Niedermayer May 2, 2024, 10:12 p.m. UTC | #2
On Wed, May 01, 2024 at 09:56:53PM -0300, James Almer wrote:
> On 5/1/2024 9:41 PM, Michael Niedermayer wrote:
> > Fixes: CID1544265 Logically dead code
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >   libavcodec/av1dec.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> > index 79a30a114da..4f9222cca27 100644
> > --- a/libavcodec/av1dec.c
> > +++ b/libavcodec/av1dec.c
> > @@ -493,7 +493,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
> >               else if (bit_depth == 12)
> >                   pix_fmt = AV_PIX_FMT_YUV444P12;
> >               else
> > -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> > +                av_assert0(0);
> >           } else if (seq->color_config.subsampling_x == 1 &&
> >                      seq->color_config.subsampling_y == 0) {
> >               if (bit_depth == 8)
> > @@ -503,7 +503,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
> >               else if (bit_depth == 12)
> >                   pix_fmt = AV_PIX_FMT_YUV422P12;
> >               else
> > -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> > +                av_assert0(0);
> >           } else if (seq->color_config.subsampling_x == 1 &&
> >                      seq->color_config.subsampling_y == 1) {
> >               if (bit_depth == 8)
> > @@ -513,7 +513,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
> >               else if (bit_depth == 12)
> >                   pix_fmt = AV_PIX_FMT_YUV420P12;
> >               else
> > -                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> > +                av_assert0(0);
> >           }
> >       } else {
> >           if (bit_depth == 8)
> > @@ -523,7 +523,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
> >           else if (bit_depth == 12)
> >               pix_fmt = AV_PIX_FMT_GRAY12;
> >           else
> > -            av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
> > +            av_assert0(0);
> >       }
> >       return pix_fmt;
> 
> LGTM.

will apply


> 
> Can you change bit_depth into an int while at it? no reason for it to be
> uint8_t as a scalar.

ok, but its unrelated

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 79a30a114da..4f9222cca27 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -493,7 +493,7 @@  static enum AVPixelFormat get_sw_pixel_format(void *logctx,
             else if (bit_depth == 12)
                 pix_fmt = AV_PIX_FMT_YUV444P12;
             else
-                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
+                av_assert0(0);
         } else if (seq->color_config.subsampling_x == 1 &&
                    seq->color_config.subsampling_y == 0) {
             if (bit_depth == 8)
@@ -503,7 +503,7 @@  static enum AVPixelFormat get_sw_pixel_format(void *logctx,
             else if (bit_depth == 12)
                 pix_fmt = AV_PIX_FMT_YUV422P12;
             else
-                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
+                av_assert0(0);
         } else if (seq->color_config.subsampling_x == 1 &&
                    seq->color_config.subsampling_y == 1) {
             if (bit_depth == 8)
@@ -513,7 +513,7 @@  static enum AVPixelFormat get_sw_pixel_format(void *logctx,
             else if (bit_depth == 12)
                 pix_fmt = AV_PIX_FMT_YUV420P12;
             else
-                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
+                av_assert0(0);
         }
     } else {
         if (bit_depth == 8)
@@ -523,7 +523,7 @@  static enum AVPixelFormat get_sw_pixel_format(void *logctx,
         else if (bit_depth == 12)
             pix_fmt = AV_PIX_FMT_GRAY12;
         else
-            av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
+            av_assert0(0);
     }
 
     return pix_fmt;