diff mbox series

[FFmpeg-devel,3/7] avcodec/avfft: Remove dead code

Message ID 20240502004150.3627661-3-michael@niedermayer.cc
State New
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: CID1543204 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/avfft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lynne May 2, 2024, 1:21 a.m. UTC | #1
May 2, 2024, 02:42 by michael@niedermayer.cc:

> Fixes: CID1543204 Logically dead code
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/avfft.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
> index f6787937f67..0f43f30b776 100644
> --- a/libavcodec/avfft.c
> +++ b/libavcodec/avfft.c
> @@ -158,7 +158,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
>  return NULL;
>  }
>  
> -    s->stride = (trans == DFT_C2R) ? sizeof(AVComplexFloat) : sizeof(float);
> +    s->stride = sizeof(float);
>  s->len = 1 << nbits;
>  s->inv = trans == IDFT_C2R; 
>

That's not right.
While it's true that currently the stride parameter in av_tx_fn
is unused for RDFTs, that may not always be the case, and the
documentation requires that the stride is valid and set to the
value that the current implementation assumes, so that nothing
breaks once that is implemented.
Michael Niedermayer May 2, 2024, 1:28 a.m. UTC | #2
On Thu, May 02, 2024 at 03:21:11AM +0200, Lynne wrote:
> May 2, 2024, 02:42 by michael@niedermayer.cc:
> 
> > Fixes: CID1543204 Logically dead code
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/avfft.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
> > index f6787937f67..0f43f30b776 100644
> > --- a/libavcodec/avfft.c
> > +++ b/libavcodec/avfft.c
> > @@ -158,7 +158,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
> >  return NULL;
> >  }
> >  
> > -    s->stride = (trans == DFT_C2R) ? sizeof(AVComplexFloat) : sizeof(float);
> > +    s->stride = sizeof(float);
> >  s->len = 1 << nbits;
> >  s->inv = trans == IDFT_C2R; 
> >
> 
> That's not right.
> While it's true that currently the stride parameter in av_tx_fn
> is unused for RDFTs, that may not always be the case, and the
> documentation requires that the stride is valid and set to the
> value that the current implementation assumes, so that nothing
> breaks once that is implemented.

i kind of had the same feeling but wanted to post it anyway.
so patch withdrawn, ill mark the issue as "intentional" in coverity

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
index f6787937f67..0f43f30b776 100644
--- a/libavcodec/avfft.c
+++ b/libavcodec/avfft.c
@@ -158,7 +158,7 @@  RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
         return NULL;
     }
 
-    s->stride = (trans == DFT_C2R) ? sizeof(AVComplexFloat) : sizeof(float);
+    s->stride = sizeof(float);
     s->len = 1 << nbits;
     s->inv = trans == IDFT_C2R;