[FFmpeg-devel] [PATCH 3/3] avcodec/takdsp: fix const correctness

James Almer jamrial at gmail.com
Fri Dec 22 14:12:32 EET 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/riscv/takdsp_init.c |  4 ++--
 libavcodec/takdsp.c            |  6 +++---
 libavcodec/takdsp.h            |  6 +++---
 libavcodec/x86/takdsp_init.c   | 12 ++++++------
 tests/checkasm/takdsp.c        |  6 +++---
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/riscv/takdsp_init.c b/libavcodec/riscv/takdsp_init.c
index 0b4ec18086..2d5c974459 100644
--- a/libavcodec/riscv/takdsp_init.c
+++ b/libavcodec/riscv/takdsp_init.c
@@ -25,8 +25,8 @@
 #include "libavutil/riscv/cpu.h"
 #include "libavcodec/takdsp.h"
 
-void ff_decorrelate_ls_rvv(int32_t *p1, int32_t *p2, int length);
-void ff_decorrelate_sr_rvv(int32_t *p1, int32_t *p2, int length);
+void ff_decorrelate_ls_rvv(const int32_t *p1, int32_t *p2, int length);
+void ff_decorrelate_sr_rvv(int32_t *p1, const int32_t *p2, int length);
 
 av_cold void ff_takdsp_init_riscv(TAKDSPContext *dsp)
 {
diff --git a/libavcodec/takdsp.c b/libavcodec/takdsp.c
index 25cac558ce..51b6658de4 100644
--- a/libavcodec/takdsp.c
+++ b/libavcodec/takdsp.c
@@ -23,7 +23,7 @@
 #include "takdsp.h"
 #include "config.h"
 
-static void decorrelate_ls(int32_t *p1, int32_t *p2, int length)
+static void decorrelate_ls(const int32_t *p1, int32_t *p2, int length)
 {
     int i;
 
@@ -34,7 +34,7 @@ static void decorrelate_ls(int32_t *p1, int32_t *p2, int length)
     }
 }
 
-static void decorrelate_sr(int32_t *p1, int32_t *p2, int length)
+static void decorrelate_sr(int32_t *p1, const int32_t *p2, int length)
 {
     int i;
 
@@ -58,7 +58,7 @@ static void decorrelate_sm(int32_t *p1, int32_t *p2, int length)
     }
 }
 
-static void decorrelate_sf(int32_t *p1, int32_t *p2, int length, int dshift, int dfactor)
+static void decorrelate_sf(int32_t *p1, const int32_t *p2, int length, int dshift, int dfactor)
 {
     int i;
 
diff --git a/libavcodec/takdsp.h b/libavcodec/takdsp.h
index 55f1a10cd3..13b5e530b2 100644
--- a/libavcodec/takdsp.h
+++ b/libavcodec/takdsp.h
@@ -22,10 +22,10 @@
 #include <stdint.h>
 
 typedef struct TAKDSPContext {
-    void (*decorrelate_ls)(int32_t *p1, int32_t *p2, int length);
-    void (*decorrelate_sr)(int32_t *p1, int32_t *p2, int length);
+    void (*decorrelate_ls)(const int32_t *p1, int32_t *p2, int length);
+    void (*decorrelate_sr)(int32_t *p1, const int32_t *p2, int length);
     void (*decorrelate_sm)(int32_t *p1, int32_t *p2, int length);
-    void (*decorrelate_sf)(int32_t *p1, int32_t *p2, int length, int dshift, int dfactor);
+    void (*decorrelate_sf)(int32_t *p1, const int32_t *p2, int length, int dshift, int dfactor);
 } TAKDSPContext;
 
 void ff_takdsp_init(TAKDSPContext *c);
diff --git a/libavcodec/x86/takdsp_init.c b/libavcodec/x86/takdsp_init.c
index c99a057b24..9553f8442c 100644
--- a/libavcodec/x86/takdsp_init.c
+++ b/libavcodec/x86/takdsp_init.c
@@ -23,14 +23,14 @@
 #include "libavutil/x86/cpu.h"
 #include "config.h"
 
-void ff_tak_decorrelate_ls_sse2(int32_t *p1, int32_t *p2, int length);
-void ff_tak_decorrelate_ls_avx2(int32_t *p1, int32_t *p2, int length);
-void ff_tak_decorrelate_sr_sse2(int32_t *p1, int32_t *p2, int length);
-void ff_tak_decorrelate_sr_avx2(int32_t *p1, int32_t *p2, int length);
+void ff_tak_decorrelate_ls_sse2(const int32_t *p1, int32_t *p2, int length);
+void ff_tak_decorrelate_ls_avx2(const int32_t *p1, int32_t *p2, int length);
+void ff_tak_decorrelate_sr_sse2(int32_t *p1, const int32_t *p2, int length);
+void ff_tak_decorrelate_sr_avx2(int32_t *p1, const int32_t *p2, int length);
 void ff_tak_decorrelate_sm_sse2(int32_t *p1, int32_t *p2, int length);
 void ff_tak_decorrelate_sm_avx2(int32_t *p1, int32_t *p2, int length);
-void ff_tak_decorrelate_sf_sse4(int32_t *p1, int32_t *p2, int length, int dshift, int dfactor);
-void ff_tak_decorrelate_sf_avx2(int32_t *p1, int32_t *p2, int length, int dshift, int dfactor);
+void ff_tak_decorrelate_sf_sse4(int32_t *p1, const int32_t *p2, int length, int dshift, int dfactor);
+void ff_tak_decorrelate_sf_avx2(int32_t *p1, const int32_t *p2, int length, int dshift, int dfactor);
 
 av_cold void ff_takdsp_init_x86(TAKDSPContext *c)
 {
diff --git a/tests/checkasm/takdsp.c b/tests/checkasm/takdsp.c
index 78528b1c5d..fd4122f34b 100644
--- a/tests/checkasm/takdsp.c
+++ b/tests/checkasm/takdsp.c
@@ -37,7 +37,7 @@
 #define BUF_SIZE 1024
 
 static void test_decorrelate_ls(TAKDSPContext *s) {
-    declare_func(void, int32_t *, int32_t *, int);
+    declare_func(void, const int32_t *, int32_t *, int);
 
     if (check_func(s->decorrelate_ls, "decorrelate_ls")) {
         LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]);
@@ -62,7 +62,7 @@ static void test_decorrelate_ls(TAKDSPContext *s) {
 }
 
 static void test_decorrelate_sr(TAKDSPContext *s) {
-    declare_func(void, int32_t *, int32_t *, int);
+    declare_func(void, int32_t *, const int32_t *, int);
 
     if (check_func(s->decorrelate_sr, "decorrelate_sr")) {
         LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]);
@@ -115,7 +115,7 @@ static void test_decorrelate_sm(TAKDSPContext *s) {
 }
 
 static void test_decorrelate_sf(TAKDSPContext *s) {
-    declare_func(void, int32_t *, int32_t *, int, int, int);
+    declare_func(void, int32_t *, const int32_t *, int, int, int);
 
     if (check_func(s->decorrelate_sf, "decorrelate_sf")) {
         LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]);
-- 
2.43.0



More information about the ffmpeg-devel mailing list