[FFmpeg-cvslog] avcodec/ac3dsp: make len a size_t in float_to_fixed24

James Almer git at videolan.org
Wed Nov 22 23:38:39 EET 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Nov 22 16:41:00 2023 -0300| [567c67c6c8cb9be083f56198bfa979e4bda84c99] | committer: James Almer

avcodec/ac3dsp: make len a size_t in float_to_fixed24

Should simplify asm implementations, and prevent UB on at least win64.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=567c67c6c8cb9be083f56198bfa979e4bda84c99
---

 libavcodec/ac3dsp.c              | 2 +-
 libavcodec/ac3dsp.h              | 2 +-
 libavcodec/arm/ac3dsp_init_arm.c | 2 +-
 libavcodec/mips/ac3dsp_mips.c    | 2 +-
 libavcodec/x86/ac3dsp_init.c     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 302b786b15..8397e03d32 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -54,7 +54,7 @@ static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
     }
 }
 
-static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int len)
+static void float_to_fixed24_c(int32_t *dst, const float *src, size_t len)
 {
     const float scale = 1 << 24;
     do {
diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h
index a01bff3d11..9996ef19ec 100644
--- a/libavcodec/ac3dsp.h
+++ b/libavcodec/ac3dsp.h
@@ -53,7 +53,7 @@ typedef struct AC3DSPContext {
      * @param len number of elements to convert.
      *            constraints: multiple of 32 greater than zero
      */
-    void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len);
+    void (*float_to_fixed24)(int32_t *dst, const float *src, size_t len);
 
     /**
      * Calculate bit allocation pointers.
diff --git a/libavcodec/arm/ac3dsp_init_arm.c b/libavcodec/arm/ac3dsp_init_arm.c
index a64aa6ae82..ae989069c9 100644
--- a/libavcodec/arm/ac3dsp_init_arm.c
+++ b/libavcodec/arm/ac3dsp_init_arm.c
@@ -26,7 +26,7 @@
 #include "config.h"
 
 void ff_ac3_exponent_min_neon(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
-void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
+void ff_float_to_fixed24_neon(int32_t *dst, const float *src, size_t len);
 void ff_ac3_extract_exponents_neon(uint8_t *exp, int32_t *coef, int nb_coefs);
 void ff_ac3_sum_square_butterfly_int32_neon(int64_t sum[4],
                                             const int32_t *coef0,
diff --git a/libavcodec/mips/ac3dsp_mips.c b/libavcodec/mips/ac3dsp_mips.c
index a5eaaf8eb2..3ea3acc185 100644
--- a/libavcodec/mips/ac3dsp_mips.c
+++ b/libavcodec/mips/ac3dsp_mips.c
@@ -203,7 +203,7 @@ static void ac3_update_bap_counts_mips(uint16_t mant_cnt[16], uint8_t *bap,
 
 #if HAVE_MIPSFPU
 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
-static void float_to_fixed24_mips(int32_t *dst, const float *src, unsigned int len)
+static void float_to_fixed24_mips(int32_t *dst, const float *src, size_t len)
 {
     const float scale = 1 << 24;
     float src0, src1, src2, src3, src4, src5, src6, src7;
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 43b3b4ac85..472d39fa5e 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -26,7 +26,7 @@
 
 void ff_ac3_exponent_min_sse2  (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
 
-void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len);
+void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, size_t len);
 
 int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
 



More information about the ffmpeg-cvslog mailing list