[FFmpeg-devel] [PATCH] avcodec/lpc: account for odd len values

Rémi Denis-Courmont remi at remlab.net
Fri May 31 16:04:36 EEST 2024



Le 31 mai 2024 15:39:35 GMT+03:00, James Almer <jamrial at gmail.com> a écrit :
>Signed-off-by: James Almer <jamrial at gmail.com>
>---
> libavcodec/lpc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
>index dfd6114690..e793e54038 100644
>--- a/libavcodec/lpc.c
>+++ b/libavcodec/lpc.c
>@@ -120,9 +120,8 @@ static void lpc_compute_autocorr_c(const double *data, ptrdiff_t len, int lag,
> 
>     if(j==lag){
>         double sum = 1.0;
>-        for(i=j-1; i<len; i+=2){
>-            sum += data[i  ] * data[i-j  ]
>-                 + data[i+1] * data[i-j+1];
>+        for(i=j-1; i<len; i++){
>+            sum += data[i] * data[i-j];
>         }
>         autoc[j] = sum;
>     }

LGTM 


More information about the ffmpeg-devel mailing list