[FFmpeg-devel] [PATCH 01/39] avcodec/hevcdsp: Constify src pointers

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Jul 27 00:47:13 EEST 2022


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/aarch64/hevcdsp_init_aarch64.c |  28 +-
 libavcodec/arm/hevcdsp_init_neon.c        |  78 ++---
 libavcodec/hevcdsp.h                      |  72 ++---
 libavcodec/hevcdsp_template.c             | 240 +++++++--------
 libavcodec/loongarch/hevcdsp_lsx.h        |  30 +-
 libavcodec/mips/hevc_idct_msa.c           |  16 +-
 libavcodec/mips/hevc_lpf_sao_msa.c        | 118 ++++----
 libavcodec/mips/hevc_mc_bi_msa.c          | 336 ++++++++++-----------
 libavcodec/mips/hevc_mc_biw_msa.c         | 338 +++++++++++-----------
 libavcodec/mips/hevc_mc_uni_msa.c         | 168 +++++------
 libavcodec/mips/hevc_mc_uniw_msa.c        | 174 +++++------
 libavcodec/mips/hevcdsp_mips.h            |  54 ++--
 libavcodec/mips/hevcdsp_mmi.c             |  28 +-
 libavcodec/mips/hevcdsp_msa.c             | 166 +++++------
 libavcodec/x86/hevc_add_res.asm           |  12 +-
 libavcodec/x86/hevc_mc.asm                |  14 +-
 libavcodec/x86/hevc_sao.asm               |   2 +-
 libavcodec/x86/hevc_sao_10bit.asm         |   2 +-
 libavcodec/x86/hevcdsp.h                  | 104 +++----
 libavcodec/x86/hevcdsp_init.c             | 111 ++++---
 20 files changed, 1047 insertions(+), 1044 deletions(-)

diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c
index 2002530266..9cbe983870 100644
--- a/libavcodec/aarch64/hevcdsp_init_aarch64.c
+++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c
@@ -25,21 +25,21 @@
 #include "libavutil/aarch64/cpu.h"
 #include "libavcodec/hevcdsp.h"
 
-void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                      ptrdiff_t stride);
-void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                       ptrdiff_t stride);
-void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                      ptrdiff_t stride);
-void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                       ptrdiff_t stride);
-void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                        ptrdiff_t stride);
-void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                         ptrdiff_t stride);
-void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                        ptrdiff_t stride);
-void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                         ptrdiff_t stride);
 void ff_hevc_idct_8x8_8_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_idct_8x8_10_neon(int16_t *coeffs, int col_limit);
@@ -53,14 +53,14 @@ void ff_hevc_idct_4x4_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_8x8_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_16x16_dc_10_neon(int16_t *coeffs);
 void ff_hevc_idct_32x32_dc_10_neon(int16_t *coeffs);
-void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, uint8_t *_src,
+void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, const uint8_t *_src,
                                   ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                  int16_t *sao_offset_val, int sao_left_class,
+                                  const int16_t *sao_offset_val, int sao_left_class,
                                   int width, int height);
-void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
-                                          int16_t *sao_offset_val, int eo, int width, int height);
-void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
-                                          int16_t *sao_offset_val, int eo, int width, int height);
+void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst,
+                                          const int16_t *sao_offset_val, int eo, int width, int height);
+void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst,
+                                        const int16_t *sao_offset_val, int eo, int width, int height);
 
 av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
 {
diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
index 112edb5edd..8094e6c62e 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -24,32 +24,32 @@
 #include "libavcodec/avcodec.h"
 #include "hevcdsp_arm.h"
 
-void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src,
+void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, const uint8_t *_src,
                                   ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                  int16_t *sao_offset_val, int sao_left_class,
+                                  const int16_t *sao_offset_val, int sao_left_class,
                                   int width, int height);
-void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,
+void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, const int16_t *sao_offset_val,
                                   int eo, int width, int height);
 
-void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
-void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
-void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
-void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
-void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
+void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
+void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
+void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q);
+void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                      ptrdiff_t stride);
-void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                       ptrdiff_t stride);
-void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                      ptrdiff_t stride);
-void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                       ptrdiff_t stride);
-void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                        ptrdiff_t stride);
-void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                         ptrdiff_t stride);
-void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, const int16_t *coeffs,
                                        ptrdiff_t stride);
-void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs,
+void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, const int16_t *coeffs,
                                         ptrdiff_t stride);
 void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
 void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
@@ -70,7 +70,7 @@ void ff_hevc_idct_32x32_10_neon(int16_t *coeffs, int col_limit);
 void ff_hevc_transform_luma_4x4_neon_8(int16_t *coeffs);
 
 #define PUT_PIXELS(name) \
-    void name(int16_t *dst, uint8_t *src, \
+    void name(int16_t *dst, const uint8_t *src, \
                                 ptrdiff_t srcstride, int height, \
                                 intptr_t mx, intptr_t my, int width)
 PUT_PIXELS(ff_hevc_put_pixels_w2_neon_8);
@@ -85,19 +85,19 @@ PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8);
 PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8);
 #undef PUT_PIXELS
 
-static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
+static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
                                    int height, int width);
-static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                   int width, int height, int16_t* src2, ptrdiff_t src2stride);
-void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
+static void (*put_hevc_qpel_uw_neon[4][4])(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t _srcstride,
+                                   int width, int height, const int16_t *src2, ptrdiff_t src2stride);
+void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
                                    int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
+void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
                                    int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
-                                       int16_t *src2,
+void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride,
+                                      const uint8_t *src, ptrdiff_t srcstride, const int16_t *src2,
                                        int height, intptr_t mx, intptr_t my, int width);
 #define QPEL_FUNC(name) \
-    void name(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, \
+    void name(int16_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride, \
                                    int height, int width)
 
 QPEL_FUNC(ff_hevc_put_qpel_v1_neon_8);
@@ -118,7 +118,7 @@ QPEL_FUNC(ff_hevc_put_qpel_h3v3_neon_8);
 #undef QPEL_FUNC
 
 #define QPEL_FUNC_UW_PIX(name) \
-    void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \
+    void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t _srcstride, \
                                    int height, intptr_t mx, intptr_t my, int width);
 QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w4_neon_8);
 QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w8_neon_8);
@@ -130,8 +130,8 @@ QPEL_FUNC_UW_PIX(ff_hevc_put_qpel_uw_pixels_w64_neon_8);
 #undef QPEL_FUNC_UW_PIX
 
 #define QPEL_FUNC_UW(name) \
-    void name(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride, \
-                                   int width, int height, int16_t* src2, ptrdiff_t src2stride);
+    void name(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t _srcstride, \
+              int width, int height, const int16_t* src2, ptrdiff_t src2stride);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_pixels_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v1_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_v2_neon_8);
@@ -150,14 +150,14 @@ QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v2_neon_8);
 QPEL_FUNC_UW(ff_hevc_put_qpel_uw_h3v3_neon_8);
 #undef QPEL_FUNC_UW
 
-void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table);
+void ff_hevc_sao_band_filter_neon_8(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height, int16_t *offset_table);
 
-void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src,
+void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, const uint8_t *_src,
                                   ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                  int16_t *sao_offset_val, int sao_left_class,
+                                  const int16_t *sao_offset_val, int sao_left_class,
                                   int width, int height) {
     uint8_t *dst = _dst;
-    uint8_t *src = _src;
+    const uint8_t *src = _src;
     int16_t offset_table[32] = {0};
     int k;
 
@@ -168,10 +168,10 @@ void ff_hevc_sao_band_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src,
     ff_hevc_sao_band_filter_neon_8(dst, src, stride_dst, stride_src, width, height, offset_table);
 }
 
-void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height,
-                                    int a_stride, int b_stride, int16_t *sao_offset_val, uint8_t *edge_idx);
+void ff_hevc_sao_edge_filter_neon_8(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst, ptrdiff_t stride_src, int width, int height,
+                                    int a_stride, int b_stride, const int16_t *sao_offset_val, const uint8_t *edge_idx);
 
-void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,
+void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, const int16_t *sao_offset_val,
                                   int eo, int width, int height) {
     static uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
     static const int8_t pos[4][2][2] = {
@@ -181,7 +181,7 @@ void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdif
         { {  1, -1 }, { -1, 1 } }, // 135 degree
     };
     uint8_t *dst = _dst;
-    uint8_t *src = _src;
+    const uint8_t *src = _src;
     int a_stride, b_stride;
     ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
 
@@ -191,20 +191,20 @@ void ff_hevc_sao_edge_filter_neon_8_wrapper(uint8_t *_dst, uint8_t *_src, ptrdif
     ff_hevc_sao_edge_filter_neon_8(dst, src, stride_dst, stride_src, width, height, a_stride, b_stride, sao_offset_val, edge_idx);
 }
 
-void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
+void ff_hevc_put_qpel_neon_wrapper(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
                                    int height, intptr_t mx, intptr_t my, int width) {
 
     put_hevc_qpel_neon[my][mx](dst, MAX_PB_SIZE, src, srcstride, height, width);
 }
 
-void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
+void ff_hevc_put_qpel_uni_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
                                    int height, intptr_t mx, intptr_t my, int width) {
 
     put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, NULL, 0);
 }
 
-void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
-                                       int16_t *src2,
+void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
+                                       const int16_t *src2,
                                        int height, intptr_t mx, intptr_t my, int width) {
     put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE);
 }
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index d642ecf9c6..1b9c5bb6bc 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -48,7 +48,7 @@ typedef struct HEVCDSPContext {
     void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height,
                     struct GetBitContext *gb, int pcm_bit_depth);
 
-    void (*add_residual[4])(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+    void (*add_residual[4])(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
     void (*dequant)(int16_t *coeffs, int16_t log2_size);
 
@@ -60,68 +60,68 @@ typedef struct HEVCDSPContext {
 
     void (*idct_dc[4])(int16_t *coeffs);
 
-    void (*sao_band_filter[5])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
-                               int16_t *sao_offset_val, int sao_left_class, int width, int height);
+    void (*sao_band_filter[5])(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
+                               const int16_t *sao_offset_val, int sao_left_class, int width, int height);
 
     /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE */
-    void (*sao_edge_filter[5])(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst,
-                               int16_t *sao_offset_val, int sao_eo_class, int width, int height);
+    void (*sao_edge_filter[5])(uint8_t *_dst /* align 16 */, const uint8_t *_src /* align 32 */, ptrdiff_t stride_dst,
+                               const int16_t *sao_offset_val, int sao_eo_class, int width, int height);
 
-    void (*sao_edge_restore[2])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
-                                struct SAOParams *sao, int *borders, int _width, int _height, int c_idx,
-                                uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge);
+    void (*sao_edge_restore[2])(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
+                                const struct SAOParams *sao, const int *borders, int _width, int _height, int c_idx,
+                                const uint8_t *vert_edge, const uint8_t *horiz_edge, const uint8_t *diag_edge);
 
-    void (*put_hevc_qpel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
+    void (*put_hevc_qpel[10][2][2])(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
                                     int height, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_qpel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
+    void (*put_hevc_qpel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
                                         int height, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_qpel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+    void (*put_hevc_qpel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                           int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
 
-    void (*put_hevc_qpel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+    void (*put_hevc_qpel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                        int height, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_qpel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                         int16_t *src2,
+    void (*put_hevc_qpel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride,
+                                         const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                          int height, int denom, int wx0, int wx1,
                                          int ox0, int ox1, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_epel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
+    void (*put_hevc_epel[10][2][2])(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
                                     int height, intptr_t mx, intptr_t my, int width);
 
-    void (*put_hevc_epel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
+    void (*put_hevc_epel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                         int height, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_epel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+    void (*put_hevc_epel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                           int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_epel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+    void (*put_hevc_epel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, const uint8_t *_src, ptrdiff_t _srcstride,
+                                       const int16_t *src2,
                                        int height, intptr_t mx, intptr_t my, int width);
-    void (*put_hevc_epel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                         int16_t *src2,
+    void (*put_hevc_epel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride,
+                                         const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                          int height, int denom, int wx0, int ox0, int wx1,
                                          int ox1, intptr_t mx, intptr_t my, int width);
 
     void (*hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
-                                    int beta, int32_t *tc,
-                                    uint8_t *no_p, uint8_t *no_q);
+                                    int beta, const int32_t *tc,
+                                    const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
-                                    int beta, int32_t *tc,
-                                    uint8_t *no_p, uint8_t *no_q);
+                                    int beta, const int32_t *tc,
+                                    const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
-                                      int32_t *tc, uint8_t *no_p, uint8_t *no_q);
+                                      const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
-                                      int32_t *tc, uint8_t *no_p, uint8_t *no_q);
+                                      const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_h_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
-                                      int beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q);
+                                      int beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_v_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
-                                      int beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q);
+                                      int beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q);
     void (*hevc_h_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q);
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q);
     void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q);
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q);
 } HEVCDSPContext;
 
 void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth);
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 61425975cd..725fab99ed 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -41,7 +41,7 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int width, int height
     }
 }
 
-static av_always_inline void FUNC(add_residual)(uint8_t *_dst, int16_t *res,
+static av_always_inline void FUNC(add_residual)(uint8_t *_dst, const int16_t *res,
                                                 ptrdiff_t stride, int size)
 {
     int x, y;
@@ -58,25 +58,25 @@ static av_always_inline void FUNC(add_residual)(uint8_t *_dst, int16_t *res,
     }
 }
 
-static void FUNC(add_residual4x4)(uint8_t *_dst, int16_t *res,
+static void FUNC(add_residual4x4)(uint8_t *_dst, const int16_t *res,
                                   ptrdiff_t stride)
 {
     FUNC(add_residual)(_dst, res, stride, 4);
 }
 
-static void FUNC(add_residual8x8)(uint8_t *_dst, int16_t *res,
+static void FUNC(add_residual8x8)(uint8_t *_dst, const int16_t *res,
                                   ptrdiff_t stride)
 {
     FUNC(add_residual)(_dst, res, stride, 8);
 }
 
-static void FUNC(add_residual16x16)(uint8_t *_dst, int16_t *res,
+static void FUNC(add_residual16x16)(uint8_t *_dst, const int16_t *res,
                                     ptrdiff_t stride)
 {
     FUNC(add_residual)(_dst, res, stride, 16);
 }
 
-static void FUNC(add_residual32x32)(uint8_t *_dst, int16_t *res,
+static void FUNC(add_residual32x32)(uint8_t *_dst, const int16_t *res,
                                     ptrdiff_t stride)
 {
     FUNC(add_residual)(_dst, res, stride, 32);
@@ -295,13 +295,13 @@ IDCT_DC(32)
 #undef SET
 #undef SCALE
 
-static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
+static void FUNC(sao_band_filter)(uint8_t *_dst, const uint8_t *_src,
                                   ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                  int16_t *sao_offset_val, int sao_left_class,
+                                  const int16_t *sao_offset_val, int sao_left_class,
                                   int width, int height)
 {
     pixel *dst = (pixel *)_dst;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     int offset_table[32] = { 0 };
     int k, y, x;
     int shift  = BIT_DEPTH - 5;
@@ -321,7 +321,7 @@ static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
 
 #define CMP(a, b) (((a) > (b)) - ((a) < (b)))
 
-static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,
+static void FUNC(sao_edge_filter)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, const int16_t *sao_offset_val,
                                   int eo, int width, int height) {
 
     static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
@@ -332,7 +332,7 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride
         { {  1, -1 }, { -1, 1 } }, // 135 degree
     };
     pixel *dst = (pixel *)_dst;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     int a_stride, b_stride;
     int x, y;
     ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel);
@@ -352,16 +352,16 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride
     }
 }
 
-static void FUNC(sao_edge_restore_0)(uint8_t *_dst, uint8_t *_src,
-                                    ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao,
-                                    int *borders, int _width, int _height,
-                                    int c_idx, uint8_t *vert_edge,
-                                    uint8_t *horiz_edge, uint8_t *diag_edge)
+static void FUNC(sao_edge_restore_0)(uint8_t *_dst, const uint8_t *_src,
+                                    ptrdiff_t stride_dst, ptrdiff_t stride_src, const SAOParams *sao,
+                                    const int *borders, int _width, int _height,
+                                    int c_idx, const uint8_t *vert_edge,
+                                    const uint8_t *horiz_edge, const uint8_t *diag_edge)
 {
     int x, y;
     pixel *dst = (pixel *)_dst;
-    pixel *src = (pixel *)_src;
-    int16_t *sao_offset_val = sao->offset_val[c_idx];
+    const pixel *src = (const pixel *)_src;
+    const int16_t *sao_offset_val = sao->offset_val[c_idx];
     int sao_eo_class    = sao->eo_class[c_idx];
     int init_x = 0, width = _width, height = _height;
 
@@ -402,16 +402,16 @@ static void FUNC(sao_edge_restore_0)(uint8_t *_dst, uint8_t *_src,
     }
 }
 
-static void FUNC(sao_edge_restore_1)(uint8_t *_dst, uint8_t *_src,
-                                    ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao,
-                                    int *borders, int _width, int _height,
-                                    int c_idx, uint8_t *vert_edge,
-                                    uint8_t *horiz_edge, uint8_t *diag_edge)
+static void FUNC(sao_edge_restore_1)(uint8_t *_dst, const uint8_t *_src,
+                                    ptrdiff_t stride_dst, ptrdiff_t stride_src, const SAOParams *sao,
+                                    const int *borders, int _width, int _height,
+                                    int c_idx, const uint8_t *vert_edge,
+                                    const uint8_t *horiz_edge, const uint8_t *diag_edge)
 {
     int x, y;
     pixel *dst = (pixel *)_dst;
-    pixel *src = (pixel *)_src;
-    int16_t *sao_offset_val = sao->offset_val[c_idx];
+    const pixel *src = (const pixel *)_src;
+    const int16_t *sao_offset_val = sao->offset_val[c_idx];
     int sao_eo_class    = sao->eo_class[c_idx];
     int init_x = 0, init_y = 0, width = _width, height = _height;
 
@@ -494,11 +494,11 @@ static void FUNC(sao_edge_restore_1)(uint8_t *_dst, uint8_t *_src,
 //
 ////////////////////////////////////////////////////////////////////////////////
 static void FUNC(put_hevc_pel_pixels)(int16_t *dst,
-                                      uint8_t *_src, ptrdiff_t _srcstride,
+                                      const uint8_t *_src, ptrdiff_t _srcstride,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src          = (pixel *)_src;
+    const pixel *src    = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
 
     for (y = 0; y < height; y++) {
@@ -509,11 +509,11 @@ static void FUNC(put_hevc_pel_pixels)(int16_t *dst,
     }
 }
 
-static void FUNC(put_hevc_pel_uni_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_pel_uni_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                           int height, intptr_t mx, intptr_t my, int width)
 {
     int y;
-    pixel *src          = (pixel *)_src;
+    const pixel *src    = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -525,12 +525,12 @@ static void FUNC(put_hevc_pel_uni_pixels)(uint8_t *_dst, ptrdiff_t _dststride, u
     }
 }
 
-static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                         int16_t *src2,
+static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
+                                         const int16_t *src2,
                                          int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src          = (pixel *)_src;
+    const pixel *src    = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -551,11 +551,11 @@ static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, ui
     }
 }
 
-static void FUNC(put_hevc_pel_uni_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_pel_uni_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                             int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src          = (pixel *)_src;
+    const pixel *src    = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -575,13 +575,13 @@ static void FUNC(put_hevc_pel_uni_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                           int16_t *src2,
+static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
+                                           const int16_t *src2,
                                            int height, int denom, int wx0, int wx1,
                                            int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src          = (pixel *)_src;
+    const pixel *src    = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -615,11 +615,11 @@ static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride,
      filter[7] * src[x + 4 * stride])
 
 static void FUNC(put_hevc_qpel_h)(int16_t *dst,
-                                  uint8_t *_src, ptrdiff_t _srcstride,
+                                  const uint8_t *_src, ptrdiff_t _srcstride,
                                   int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     const int8_t *filter    = ff_hevc_qpel_filters[mx - 1];
     for (y = 0; y < height; y++) {
@@ -631,11 +631,11 @@ static void FUNC(put_hevc_qpel_h)(int16_t *dst,
 }
 
 static void FUNC(put_hevc_qpel_v)(int16_t *dst,
-                                  uint8_t *_src, ptrdiff_t _srcstride,
+                                  const uint8_t *_src, ptrdiff_t _srcstride,
                                   int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     const int8_t *filter    = ff_hevc_qpel_filters[my - 1];
     for (y = 0; y < height; y++)  {
@@ -647,14 +647,14 @@ static void FUNC(put_hevc_qpel_v)(int16_t *dst,
 }
 
 static void FUNC(put_hevc_qpel_hv)(int16_t *dst,
-                                   uint8_t *_src,
+                                   const uint8_t *_src,
                                    ptrdiff_t _srcstride,
                                    int height, intptr_t mx,
                                    intptr_t my, int width)
 {
     int x, y;
     const int8_t *filter;
-    pixel *src = (pixel*)_src;
+    const pixel *src = (const pixel*)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
     int16_t *tmp = tmp_array;
@@ -679,11 +679,11 @@ static void FUNC(put_hevc_qpel_hv)(int16_t *dst,
 }
 
 static void FUNC(put_hevc_qpel_uni_h)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                      uint8_t *_src, ptrdiff_t _srcstride,
+                                      const uint8_t *_src, ptrdiff_t _srcstride,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -704,12 +704,12 @@ static void FUNC(put_hevc_qpel_uni_h)(uint8_t *_dst,  ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                     int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
+                                     const int16_t *src2,
                                      int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -733,11 +733,11 @@ static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_
 }
 
 static void FUNC(put_hevc_qpel_uni_v)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                     uint8_t *_src, ptrdiff_t _srcstride,
+                                      const uint8_t *_src, ptrdiff_t _srcstride,
                                      int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -759,12 +759,12 @@ static void FUNC(put_hevc_qpel_uni_v)(uint8_t *_dst,  ptrdiff_t _dststride,
 }
 
 
-static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                     int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
+                                     const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                      int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -788,12 +788,12 @@ static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_
 }
 
 static void FUNC(put_hevc_qpel_uni_hv)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                       uint8_t *_src, ptrdiff_t _srcstride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride,
                                        int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
     const int8_t *filter;
-    pixel *src = (pixel*)_src;
+    const pixel *src = (const pixel*)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -827,13 +827,13 @@ static void FUNC(put_hevc_qpel_uni_hv)(uint8_t *_dst,  ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                      int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
+                                      const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
     const int8_t *filter;
-    pixel *src = (pixel*)_src;
+    const pixel *src = (const pixel*)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -868,12 +868,12 @@ static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8
 }
 
 static void FUNC(put_hevc_qpel_uni_w_h)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                        uint8_t *_src, ptrdiff_t _srcstride,
+                                        const uint8_t *_src, ptrdiff_t _srcstride,
                                         int height, int denom, int wx, int ox,
                                         intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -894,13 +894,13 @@ static void FUNC(put_hevc_qpel_uni_w_h)(uint8_t *_dst,  ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                        int height, int denom, int wx0, int wx1,
                                        int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -923,12 +923,12 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
 }
 
 static void FUNC(put_hevc_qpel_uni_w_v)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                        uint8_t *_src, ptrdiff_t _srcstride,
+                                        const uint8_t *_src, ptrdiff_t _srcstride,
                                         int height, int denom, int wx, int ox,
                                         intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -949,13 +949,13 @@ static void FUNC(put_hevc_qpel_uni_w_v)(uint8_t *_dst,  ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                        int height, int denom, int wx0, int wx1,
                                        int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel        *src       = (pixel*)_src;
+    const pixel  *src       = (const pixel*)_src;
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -978,13 +978,13 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
 }
 
 static void FUNC(put_hevc_qpel_uni_w_hv)(uint8_t *_dst,  ptrdiff_t _dststride,
-                                         uint8_t *_src, ptrdiff_t _srcstride,
+                                         const uint8_t *_src, ptrdiff_t _srcstride,
                                          int height, int denom, int wx, int ox,
                                          intptr_t mx, intptr_t my, int width)
 {
     int x, y;
     const int8_t *filter;
-    pixel *src = (pixel*)_src;
+    const pixel *src = (const pixel*)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1018,14 +1018,14 @@ static void FUNC(put_hevc_qpel_uni_w_hv)(uint8_t *_dst,  ptrdiff_t _dststride,
     }
 }
 
-static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                        int16_t *src2,
+static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
+                                        const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                         int height, int denom, int wx0, int wx1,
                                         int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
     const int8_t *filter;
-    pixel *src = (pixel*)_src;
+    const pixel *src = (const pixel*)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1068,11 +1068,11 @@ static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uin
      filter[3] * src[x + 2 * stride])
 
 static void FUNC(put_hevc_epel_h)(int16_t *dst,
-                                  uint8_t *_src, ptrdiff_t _srcstride,
+                                  const uint8_t *_src, ptrdiff_t _srcstride,
                                   int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     const int8_t *filter = ff_hevc_epel_filters[mx - 1];
     for (y = 0; y < height; y++) {
@@ -1084,11 +1084,11 @@ static void FUNC(put_hevc_epel_h)(int16_t *dst,
 }
 
 static void FUNC(put_hevc_epel_v)(int16_t *dst,
-                                  uint8_t *_src, ptrdiff_t _srcstride,
+                                  const uint8_t *_src, ptrdiff_t _srcstride,
                                   int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     const int8_t *filter = ff_hevc_epel_filters[my - 1];
 
@@ -1101,11 +1101,11 @@ static void FUNC(put_hevc_epel_v)(int16_t *dst,
 }
 
 static void FUNC(put_hevc_epel_hv)(int16_t *dst,
-                                   uint8_t *_src, ptrdiff_t _srcstride,
+                                   const uint8_t *_src, ptrdiff_t _srcstride,
                                    int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     const int8_t *filter = ff_hevc_epel_filters[mx - 1];
     int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
@@ -1131,11 +1131,11 @@ static void FUNC(put_hevc_epel_hv)(int16_t *dst,
     }
 }
 
-static void FUNC(put_hevc_epel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1155,12 +1155,12 @@ static void FUNC(put_hevc_epel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8
     }
 }
 
-static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                     int16_t *src2,
+static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride,
+                                     const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                      int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1182,11 +1182,11 @@ static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_
     }
 }
 
-static void FUNC(put_hevc_epel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1206,12 +1206,12 @@ static void FUNC(put_hevc_epel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8
     }
 }
 
-static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                     int16_t *src2,
+static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
+                                     const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                      int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     const int8_t *filter = ff_hevc_epel_filters[my - 1];
     pixel *dst          = (pixel *)_dst;
@@ -1232,11 +1232,11 @@ static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_
     }
 }
 
-static void FUNC(put_hevc_epel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                        int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1270,12 +1270,12 @@ static void FUNC(put_hevc_epel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint
     }
 }
 
-static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                      int16_t *src2,
+static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
+                                      const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                       int height, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1310,11 +1310,11 @@ static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8
     }
 }
 
-static void FUNC(put_hevc_epel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                         int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1336,13 +1336,13 @@ static void FUNC(put_hevc_epel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uin
     }
 }
 
-static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                        int height, int denom, int wx0, int wx1,
                                        int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1362,11 +1362,11 @@ static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint
     }
 }
 
-static void FUNC(put_hevc_epel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                         int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1388,13 +1388,13 @@ static void FUNC(put_hevc_epel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uin
     }
 }
 
-static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                       int16_t *src2,
+static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
+                                       const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                        int height, int denom, int wx0, int wx1,
                                        int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride  = _srcstride / sizeof(pixel);
     const int8_t *filter = ff_hevc_epel_filters[my - 1];
     pixel *dst          = (pixel *)_dst;
@@ -1414,11 +1414,11 @@ static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint
     }
 }
 
-static void FUNC(put_hevc_epel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
+static void FUNC(put_hevc_epel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
                                          int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1453,13 +1453,13 @@ static void FUNC(put_hevc_epel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, ui
     }
 }
 
-static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
-                                        int16_t *src2,
+static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
+                                        const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
                                         int height, int denom, int wx0, int wx1,
                                         int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 {
     int x, y;
-    pixel *src = (pixel *)_src;
+    const pixel *src = (const pixel *)_src;
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);
     pixel *dst          = (pixel *)_dst;
     ptrdiff_t dststride = _dststride / sizeof(pixel);
@@ -1515,8 +1515,8 @@ static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uin
 
 static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
                                         ptrdiff_t _xstride, ptrdiff_t _ystride,
-                                        int beta, int *_tc,
-                                        uint8_t *_no_p, uint8_t *_no_q)
+                                        int beta, const int *_tc,
+                                        const uint8_t *_no_p, const uint8_t *_no_q)
 {
     int d, j;
     pixel *pix        = (pixel *)_pix;
@@ -1610,8 +1610,8 @@ static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
 }
 
 static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
-                                          ptrdiff_t _ystride, int *_tc,
-                                          uint8_t *_no_p, uint8_t *_no_q)
+                                          ptrdiff_t _ystride, const int *_tc,
+                                          const uint8_t *_no_p, const uint8_t *_no_q)
 {
     int d, j, no_p, no_q;
     pixel *pix        = (pixel *)_pix;
@@ -1644,30 +1644,30 @@ static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
 }
 
 static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
-                                            int32_t *tc, uint8_t *no_p,
-                                            uint8_t *no_q)
+                                            const int32_t *tc, const uint8_t *no_p,
+                                            const uint8_t *no_q)
 {
     FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q);
 }
 
 static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
-                                            int32_t *tc, uint8_t *no_p,
-                                            uint8_t *no_q)
+                                            const int32_t *tc, const uint8_t *no_p,
+                                            const uint8_t *no_q)
 {
     FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q);
 }
 
 static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
-                                          int beta, int32_t *tc, uint8_t *no_p,
-                                          uint8_t *no_q)
+                                          int beta, const int32_t *tc, const uint8_t *no_p,
+                                          const uint8_t *no_q)
 {
     FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel),
                                 beta, tc, no_p, no_q);
 }
 
 static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
-                                          int beta, int32_t *tc, uint8_t *no_p,
-                                          uint8_t *no_q)
+                                          int beta, const int32_t *tc, const uint8_t *no_p,
+                                          const uint8_t *no_q)
 {
     FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride,
                                 beta, tc, no_p, no_q);
diff --git a/libavcodec/loongarch/hevcdsp_lsx.h b/libavcodec/loongarch/hevcdsp_lsx.h
index 0c517af887..0d54196caf 100644
--- a/libavcodec/loongarch/hevcdsp_lsx.h
+++ b/libavcodec/loongarch/hevcdsp_lsx.h
@@ -27,7 +27,7 @@
 
 #define MC(PEL, DIR, WIDTH)                                               \
 void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_lsx(int16_t *dst,          \
-                                                   uint8_t *src,          \
+                                                   const uint8_t *src,    \
                                                    ptrdiff_t src_stride,  \
                                                    int height,            \
                                                    intptr_t mx,           \
@@ -88,9 +88,9 @@ MC(epel, hv, 32);
 #define BI_MC(PEL, DIR, WIDTH)                                               \
 void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst,          \
                                                       ptrdiff_t dst_stride,  \
-                                                      uint8_t *src,          \
+                                                      const uint8_t *src,    \
                                                       ptrdiff_t src_stride,  \
-                                                      int16_t *src_16bit,    \
+                                                      const int16_t *src_16bit, \
                                                       int height,            \
                                                       intptr_t mx,           \
                                                       intptr_t my,           \
@@ -145,7 +145,7 @@ BI_MC(epel, hv, 32);
 #define UNI_MC(PEL, DIR, WIDTH)                                              \
 void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst,         \
                                                        ptrdiff_t dst_stride, \
-                                                       uint8_t *src,         \
+                                                       const uint8_t *src,   \
                                                        ptrdiff_t src_stride, \
                                                        int height,           \
                                                        intptr_t mx,          \
@@ -181,7 +181,7 @@ UNI_MC(epel, hv, 32);
 void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst,  \
                                                          ptrdiff_t      \
                                                          dst_stride,    \
-                                                         uint8_t *src,  \
+                                                         const uint8_t *src,  \
                                                          ptrdiff_t      \
                                                          src_stride,    \
                                                          int height,    \
@@ -202,24 +202,24 @@ UNI_W_MC(qpel, hv, 64);
 #undef UNI_W_MC
 
 void ff_hevc_loop_filter_luma_h_8_lsx(uint8_t *src, ptrdiff_t stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *p_is_pcm, uint8_t *q_is_pcm);
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *p_is_pcm, const uint8_t *q_is_pcm);
 
 void ff_hevc_loop_filter_luma_v_8_lsx(uint8_t *src, ptrdiff_t stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *p_is_pcm, uint8_t *q_is_pcm);
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *p_is_pcm, const uint8_t *q_is_pcm);
 
 void ff_hevc_loop_filter_chroma_h_8_lsx(uint8_t *src, ptrdiff_t stride,
-                                        int32_t *tc, uint8_t *p_is_pcm,
-                                        uint8_t *q_is_pcm);
+                                        const int32_t *tc, const uint8_t *p_is_pcm,
+                                        const uint8_t *q_is_pcm);
 
 void ff_hevc_loop_filter_chroma_v_8_lsx(uint8_t *src, ptrdiff_t stride,
-                                        int32_t *tc, uint8_t *p_is_pcm,
-                                        uint8_t *q_is_pcm);
+                                        const int32_t *tc, const uint8_t *p_is_pcm,
+                                        const uint8_t *q_is_pcm);
 
-void ff_hevc_sao_edge_filter_8_lsx(uint8_t *dst, uint8_t *src,
+void ff_hevc_sao_edge_filter_8_lsx(uint8_t *dst, const uint8_t *src,
                                    ptrdiff_t stride_dst,
-                                   int16_t *sao_offset_val,
+                                   const int16_t *sao_offset_val,
                                    int eo, int width, int height);
 
 void ff_hevc_idct_4x4_lsx(int16_t *coeffs, int col_limit);
diff --git a/libavcodec/mips/hevc_idct_msa.c b/libavcodec/mips/hevc_idct_msa.c
index 5ab6acd1df..5f34fd8fa7 100644
--- a/libavcodec/mips/hevc_idct_msa.c
+++ b/libavcodec/mips/hevc_idct_msa.c
@@ -713,7 +713,7 @@ static void hevc_idct_dc_32x32_msa(int16_t *coeffs)
     }
 }
 
-static void hevc_addblk_4x4_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
+static void hevc_addblk_4x4_msa(const int16_t *coeffs, uint8_t *dst, int32_t stride)
 {
     uint32_t dst0, dst1, dst2, dst3;
     v8i16 dst_r0, dst_l0, in0, in1;
@@ -730,7 +730,7 @@ static void hevc_addblk_4x4_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
     ST_W4(dst_vec, 0, 1, 2, 3, dst, stride);
 }
 
-static void hevc_addblk_8x8_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
+static void hevc_addblk_8x8_msa(const int16_t *coeffs, uint8_t *dst, int32_t stride)
 {
     uint8_t *temp_dst = dst;
     uint64_t dst0, dst1, dst2, dst3;
@@ -766,7 +766,7 @@ static void hevc_addblk_8x8_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
     ST_D4(dst_r0, dst_r1, 0, 1, 0, 1, dst + 4 * stride, stride);
 }
 
-static void hevc_addblk_16x16_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
+static void hevc_addblk_16x16_msa(const int16_t *coeffs, uint8_t *dst, int32_t stride)
 {
     uint8_t loop_cnt;
     uint8_t *temp_dst = dst;
@@ -833,7 +833,7 @@ static void hevc_addblk_16x16_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
     ST_UB4(dst0, dst1, dst2, dst3, dst, stride);
 }
 
-static void hevc_addblk_32x32_msa(int16_t *coeffs, uint8_t *dst, int32_t stride)
+static void hevc_addblk_32x32_msa(const int16_t *coeffs, uint8_t *dst, int32_t stride)
 {
     uint8_t loop_cnt;
     uint8_t *temp_dst = dst;
@@ -980,22 +980,22 @@ void ff_hevc_idct_32x32_msa(int16_t *coeffs, int col_limit)
     hevc_idct_32x32_msa(coeffs);
 }
 
-void ff_hevc_addblk_4x4_msa(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
+void ff_hevc_addblk_4x4_msa(uint8_t *dst, const int16_t *coeffs, ptrdiff_t stride)
 {
     hevc_addblk_4x4_msa(coeffs, dst, stride);
 }
 
-void ff_hevc_addblk_8x8_msa(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
+void ff_hevc_addblk_8x8_msa(uint8_t *dst, const int16_t *coeffs, ptrdiff_t stride)
 {
     hevc_addblk_8x8_msa(coeffs, dst, stride);
 }
 
-void ff_hevc_addblk_16x16_msa(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
+void ff_hevc_addblk_16x16_msa(uint8_t *dst, const int16_t *coeffs, ptrdiff_t stride)
 {
     hevc_addblk_16x16_msa(coeffs, dst, stride);
 }
 
-void ff_hevc_addblk_32x32_msa(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
+void ff_hevc_addblk_32x32_msa(uint8_t *dst, const int16_t *coeffs, ptrdiff_t stride)
 {
     hevc_addblk_32x32_msa(coeffs, dst, stride);
 }
diff --git a/libavcodec/mips/hevc_lpf_sao_msa.c b/libavcodec/mips/hevc_lpf_sao_msa.c
index 26663dd89b..cd94460f97 100644
--- a/libavcodec/mips/hevc_lpf_sao_msa.c
+++ b/libavcodec/mips/hevc_lpf_sao_msa.c
@@ -22,8 +22,8 @@
 #include "libavcodec/mips/hevcdsp_mips.h"
 
 static void hevc_loopfilter_luma_hor_msa(uint8_t *src, int32_t stride,
-                                         int32_t beta, int32_t *tc,
-                                         uint8_t *p_is_pcm, uint8_t *q_is_pcm)
+                                         int32_t beta, const int32_t *tc,
+                                         const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
 {
     uint8_t *p3 = src - (stride << 2);
     uint8_t *p2 = src - ((stride << 1) + stride);
@@ -448,8 +448,8 @@ static void hevc_loopfilter_luma_hor_msa(uint8_t *src, int32_t stride,
 }
 
 static void hevc_loopfilter_luma_ver_msa(uint8_t *src, int32_t stride,
-                                         int32_t beta, int32_t *tc,
-                                         uint8_t *p_is_pcm, uint8_t *q_is_pcm)
+                                         int32_t beta, const int32_t *tc,
+                                         const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
 {
     uint8_t *p3 = src;
     uint8_t *p2 = src + 3 * stride;
@@ -914,8 +914,8 @@ static void hevc_loopfilter_luma_ver_msa(uint8_t *src, int32_t stride,
 }
 
 static void hevc_loopfilter_chroma_hor_msa(uint8_t *src, int32_t stride,
-                                           int32_t *tc, uint8_t *p_is_pcm,
-                                           uint8_t *q_is_pcm)
+                                           const int32_t *tc, const uint8_t *p_is_pcm,
+                                           const uint8_t *q_is_pcm)
 {
     uint8_t *p1_ptr = src - (stride << 1);
     uint8_t *p0_ptr = src - stride;
@@ -977,8 +977,8 @@ static void hevc_loopfilter_chroma_hor_msa(uint8_t *src, int32_t stride,
 }
 
 static void hevc_loopfilter_chroma_ver_msa(uint8_t *src, int32_t stride,
-                                           int32_t *tc, uint8_t *p_is_pcm,
-                                           uint8_t *q_is_pcm)
+                                           const int32_t *tc, const uint8_t *p_is_pcm,
+                                           const uint8_t *q_is_pcm)
 {
     v2i64 cmp0, cmp1, p_is_pcm_vec, q_is_pcm_vec;
     v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
@@ -1038,9 +1038,9 @@ static void hevc_loopfilter_chroma_ver_msa(uint8_t *src, int32_t stride,
 }
 
 static void hevc_sao_band_filter_4width_msa(uint8_t *dst, int32_t dst_stride,
-                                            uint8_t *src, int32_t src_stride,
+                                            const uint8_t *src, int32_t src_stride,
                                             int32_t sao_left_class,
-                                            int16_t *sao_offset_val,
+                                            const int16_t *sao_offset_val,
                                             int32_t height)
 {
     v16u8 src0, src1, src2, src3;
@@ -1100,9 +1100,9 @@ static void hevc_sao_band_filter_4width_msa(uint8_t *dst, int32_t dst_stride,
 }
 
 static void hevc_sao_band_filter_8width_msa(uint8_t *dst, int32_t dst_stride,
-                                            uint8_t *src, int32_t src_stride,
+                                            const uint8_t *src, int32_t src_stride,
                                             int32_t sao_left_class,
-                                            int16_t *sao_offset_val,
+                                            const int16_t *sao_offset_val,
                                             int32_t height)
 {
     v16u8 src0, src1, src2, src3;
@@ -1172,10 +1172,10 @@ static void hevc_sao_band_filter_8width_msa(uint8_t *dst, int32_t dst_stride,
 
 static void hevc_sao_band_filter_16multiple_msa(uint8_t *dst,
                                                 int32_t dst_stride,
-                                                uint8_t *src,
+                                                const uint8_t *src,
                                                 int32_t src_stride,
                                                 int32_t sao_left_class,
-                                                int16_t *sao_offset_val,
+                                                const int16_t *sao_offset_val,
                                                 int32_t width, int32_t height)
 {
     int32_t w_cnt;
@@ -1254,9 +1254,9 @@ static void hevc_sao_band_filter_16multiple_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_0degree_4width_msa(uint8_t *dst,
                                                     int32_t dst_stride,
-                                                    uint8_t *src,
+                                                    const uint8_t *src,
                                                     int32_t src_stride,
-                                                    int16_t *sao_offset_val,
+                                                    const int16_t *sao_offset_val,
                                                     int32_t height)
 {
     uint32_t dst_val0, dst_val1;
@@ -1346,9 +1346,9 @@ static void hevc_sao_edge_filter_0degree_4width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_0degree_8width_msa(uint8_t *dst,
                                                     int32_t dst_stride,
-                                                    uint8_t *src,
+                                                    const uint8_t *src,
                                                     int32_t src_stride,
-                                                    int16_t *sao_offset_val,
+                                                    const int16_t *sao_offset_val,
                                                     int32_t height)
 {
     uint64_t dst_val0, dst_val1;
@@ -1440,13 +1440,14 @@ static void hevc_sao_edge_filter_0degree_8width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_0degree_16multiple_msa(uint8_t *dst,
                                                         int32_t dst_stride,
-                                                        uint8_t *src,
+                                                        const uint8_t *src,
                                                         int32_t src_stride,
-                                                        int16_t *sao_offset_val,
+                                                        const int16_t *sao_offset_val,
                                                         int32_t width,
                                                         int32_t height)
 {
-    uint8_t *dst_ptr, *src_minus1;
+    const uint8_t *src_minus1;
+    uint8_t *dst_ptr;
     int32_t v_cnt;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -1556,9 +1557,9 @@ static void hevc_sao_edge_filter_0degree_16multiple_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_90degree_4width_msa(uint8_t *dst,
                                                      int32_t dst_stride,
-                                                     uint8_t *src,
+                                                     const uint8_t *src,
                                                      int32_t src_stride,
-                                                     int16_t *sao_offset_val,
+                                                     const int16_t *sao_offset_val,
                                                      int32_t height)
 {
     uint32_t dst_val0, dst_val1;
@@ -1661,9 +1662,9 @@ static void hevc_sao_edge_filter_90degree_4width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_90degree_8width_msa(uint8_t *dst,
                                                      int32_t dst_stride,
-                                                     uint8_t *src,
+                                                     const uint8_t *src,
                                                      int32_t src_stride,
-                                                     int16_t *sao_offset_val,
+                                                     const int16_t *sao_offset_val,
                                                      int32_t height)
 {
     uint64_t dst_val0, dst_val1;
@@ -1763,14 +1764,14 @@ static void hevc_sao_edge_filter_90degree_8width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_90degree_16multiple_msa(uint8_t *dst,
                                                          int32_t dst_stride,
-                                                         uint8_t *src,
+                                                         const uint8_t *src,
                                                          int32_t src_stride,
-                                                         int16_t *
+                                                         const int16_t *
                                                          sao_offset_val,
                                                          int32_t width,
                                                          int32_t height)
 {
-    uint8_t *src_orig = src;
+    const uint8_t *src_orig = src;
     uint8_t *dst_orig = dst;
     int32_t h_cnt, v_cnt;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -1865,12 +1866,12 @@ static void hevc_sao_edge_filter_90degree_16multiple_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_45degree_4width_msa(uint8_t *dst,
                                                      int32_t dst_stride,
-                                                     uint8_t *src,
+                                                     const uint8_t *src,
                                                      int32_t src_stride,
-                                                     int16_t *sao_offset_val,
+                                                     const int16_t *sao_offset_val,
                                                      int32_t height)
 {
-    uint8_t *src_orig;
+    const uint8_t *src_orig;
     uint32_t dst_val0, dst_val1;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -1978,12 +1979,12 @@ static void hevc_sao_edge_filter_45degree_4width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_45degree_8width_msa(uint8_t *dst,
                                                      int32_t dst_stride,
-                                                     uint8_t *src,
+                                                     const uint8_t *src,
                                                      int32_t src_stride,
-                                                     int16_t *sao_offset_val,
+                                                     const int16_t *sao_offset_val,
                                                      int32_t height)
 {
-    uint8_t *src_orig;
+    const uint8_t *src_orig;
     uint64_t dst_val0, dst_val1;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -2094,14 +2095,14 @@ static void hevc_sao_edge_filter_45degree_8width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_45degree_16multiple_msa(uint8_t *dst,
                                                          int32_t dst_stride,
-                                                         uint8_t *src,
+                                                         const uint8_t *src,
                                                          int32_t src_stride,
-                                                         int16_t *
+                                                         const int16_t *
                                                          sao_offset_val,
                                                          int32_t width,
                                                          int32_t height)
 {
-    uint8_t *src_orig = src;
+    const uint8_t *src_orig = src;
     uint8_t *dst_orig = dst;
     int32_t v_cnt;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -2214,12 +2215,12 @@ static void hevc_sao_edge_filter_45degree_16multiple_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_135degree_4width_msa(uint8_t *dst,
                                                       int32_t dst_stride,
-                                                      uint8_t *src,
+                                                      const uint8_t *src,
                                                       int32_t src_stride,
-                                                      int16_t *sao_offset_val,
+                                                      const int16_t *sao_offset_val,
                                                       int32_t height)
 {
-    uint8_t *src_orig;
+    const uint8_t *src_orig;
     uint32_t dst_val0, dst_val1;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -2329,12 +2330,12 @@ static void hevc_sao_edge_filter_135degree_4width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_135degree_8width_msa(uint8_t *dst,
                                                       int32_t dst_stride,
-                                                      uint8_t *src,
+                                                      const uint8_t *src,
                                                       int32_t src_stride,
-                                                      int16_t *sao_offset_val,
+                                                      const int16_t *sao_offset_val,
                                                       int32_t height)
 {
-    uint8_t *src_orig;
+    const uint8_t *src_orig;
     uint64_t dst_val0, dst_val1;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -2441,14 +2442,15 @@ static void hevc_sao_edge_filter_135degree_8width_msa(uint8_t *dst,
 
 static void hevc_sao_edge_filter_135degree_16multiple_msa(uint8_t *dst,
                                                           int32_t dst_stride,
-                                                          uint8_t *src,
+                                                          const uint8_t *src,
                                                           int32_t src_stride,
-                                                          int16_t *
+                                                          const int16_t *
                                                           sao_offset_val,
                                                           int32_t width,
                                                           int32_t height)
 {
-    uint8_t *src_orig, *dst_orig;
+    const uint8_t *src_orig;
+    uint8_t *dst_orig;
     int32_t v_cnt;
     v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     v16u8 const1 = (v16u8) __msa_ldi_b(1);
@@ -2563,39 +2565,39 @@ static void hevc_sao_edge_filter_135degree_16multiple_msa(uint8_t *dst,
 
 void ff_hevc_loop_filter_luma_h_8_msa(uint8_t *src,
                                       ptrdiff_t src_stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q)
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q)
 {
     hevc_loopfilter_luma_hor_msa(src, src_stride, beta, tc, no_p, no_q);
 }
 
 void ff_hevc_loop_filter_luma_v_8_msa(uint8_t *src,
                                       ptrdiff_t src_stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q)
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q)
 {
     hevc_loopfilter_luma_ver_msa(src, src_stride, beta, tc, no_p, no_q);
 }
 
 void ff_hevc_loop_filter_chroma_h_8_msa(uint8_t *src,
                                         ptrdiff_t src_stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q)
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q)
 {
     hevc_loopfilter_chroma_hor_msa(src, src_stride, tc, no_p, no_q);
 }
 
 void ff_hevc_loop_filter_chroma_v_8_msa(uint8_t *src,
                                         ptrdiff_t src_stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q)
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q)
 {
     hevc_loopfilter_chroma_ver_msa(src, src_stride, tc, no_p, no_q);
 }
 
-void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, uint8_t *src,
+void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, const uint8_t *src,
                                      ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                     int16_t *sao_offset_val, int sao_left_class,
+                                     const int16_t *sao_offset_val, int sao_left_class,
                                      int width, int height)
 {
     if (width >> 4) {
@@ -2621,9 +2623,9 @@ void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, uint8_t *src,
     }
 }
 
-void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, uint8_t *src,
+void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, const uint8_t *src,
                                    ptrdiff_t stride_dst,
-                                   int16_t *sao_offset_val,
+                                   const int16_t *sao_offset_val,
                                    int eo, int width, int height)
 {
     ptrdiff_t stride_src = (2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(uint8_t);
diff --git a/libavcodec/mips/hevc_mc_bi_msa.c b/libavcodec/mips/hevc_mc_bi_msa.c
index c6c8d2705d..701e12ab86 100644
--- a/libavcodec/mips/hevc_mc_bi_msa.c
+++ b/libavcodec/mips/hevc_mc_bi_msa.c
@@ -58,9 +58,9 @@ static const uint8_t ff_hevc_mask_arr[16 * 2] __attribute__((aligned(0x40))) = {
     HEVC_BI_RND_CLIP2_MAX_SATU(in2, in3, vec2, vec3, rnd_val, out2, out3);  \
 }
 
-static void hevc_bi_copy_4w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_4w_msa(const uint8_t *src0_ptr,
                                 int32_t src_stride,
-                                int16_t *src1_ptr,
+                                const int16_t *src1_ptr,
                                 int32_t src2_stride,
                                 uint8_t *dst,
                                 int32_t dst_stride,
@@ -126,9 +126,9 @@ static void hevc_bi_copy_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_6w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_6w_msa(const uint8_t *src0_ptr,
                                 int32_t src_stride,
-                                int16_t *src1_ptr,
+                                const int16_t *src1_ptr,
                                 int32_t src2_stride,
                                 uint8_t *dst,
                                 int32_t dst_stride,
@@ -178,9 +178,9 @@ static void hevc_bi_copy_6w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_8w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_8w_msa(const uint8_t *src0_ptr,
                                 int32_t src_stride,
-                                int16_t *src1_ptr,
+                                const int16_t *src1_ptr,
                                 int32_t src2_stride,
                                 uint8_t *dst,
                                 int32_t dst_stride,
@@ -266,9 +266,9 @@ static void hevc_bi_copy_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_12w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_12w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -305,9 +305,9 @@ static void hevc_bi_copy_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_16w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_16w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -343,9 +343,9 @@ static void hevc_bi_copy_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_24w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_24w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -389,9 +389,9 @@ static void hevc_bi_copy_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_32w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_32w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -433,9 +433,9 @@ static void hevc_bi_copy_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_48w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_48w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -487,9 +487,9 @@ static void hevc_bi_copy_48w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_bi_copy_64w_msa(uint8_t *src0_ptr,
+static void hevc_bi_copy_64w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -526,9 +526,9 @@ static void hevc_bi_copy_64w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -599,9 +599,9 @@ static void hevc_hz_bi_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -667,9 +667,9 @@ static void hevc_hz_bi_8t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -755,9 +755,9 @@ static void hevc_hz_bi_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -826,9 +826,9 @@ static void hevc_hz_bi_8t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -898,9 +898,9 @@ static void hevc_hz_bi_8t_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -970,9 +970,9 @@ static void hevc_hz_bi_8t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_48w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1062,9 +1062,9 @@ static void hevc_hz_bi_8t_48w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_8t_64w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1172,9 +1172,9 @@ static void hevc_hz_bi_8t_64w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -1258,9 +1258,9 @@ static void hevc_vt_bi_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -1336,9 +1336,9 @@ static void hevc_vt_bi_8t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1443,17 +1443,17 @@ static void hevc_vt_bi_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_8t_16multx2mult_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_16multx2mult_msa(const uint8_t *src0_ptr,
                                            int32_t src_stride,
-                                           int16_t *src1_ptr,
+                                           const int16_t *src1_ptr,
                                            int32_t src2_stride,
                                            uint8_t *dst,
                                            int32_t dst_stride,
                                            const int8_t *filter,
                                            int32_t height, int32_t width)
 {
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     uint32_t loop_cnt;
     uint32_t cnt;
@@ -1549,9 +1549,9 @@ static void hevc_vt_bi_8t_16multx2mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1562,9 +1562,9 @@ static void hevc_vt_bi_8t_16w_msa(uint8_t *src0_ptr,
                                    dst, dst_stride, filter, height, 16);
 }
 
-static void hevc_vt_bi_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1577,9 +1577,9 @@ static void hevc_vt_bi_8t_24w_msa(uint8_t *src0_ptr,
                          dst + 16, dst_stride, filter, height);
 }
 
-static void hevc_vt_bi_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1590,9 +1590,9 @@ static void hevc_vt_bi_8t_32w_msa(uint8_t *src0_ptr,
                                    dst, dst_stride, filter, height, 32);
 }
 
-static void hevc_vt_bi_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_48w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1603,9 +1603,9 @@ static void hevc_vt_bi_8t_48w_msa(uint8_t *src0_ptr,
                                    dst, dst_stride, filter, height, 48);
 }
 
-static void hevc_vt_bi_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_8t_64w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1616,9 +1616,9 @@ static void hevc_vt_bi_8t_64w_msa(uint8_t *src0_ptr,
                                    dst, dst_stride, filter, height, 64);
 }
 
-static void hevc_hv_bi_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -1741,9 +1741,9 @@ static void hevc_hv_bi_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_8t_8multx1mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_8multx1mult_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -1753,8 +1753,8 @@ static void hevc_hv_bi_8t_8multx1mult_msa(uint8_t *src0_ptr,
 {
     uint32_t loop_cnt;
     uint32_t cnt;
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     v16u8 out;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
@@ -1874,9 +1874,9 @@ static void hevc_hv_bi_8t_8multx1mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -1889,9 +1889,9 @@ static void hevc_hv_bi_8t_8w_msa(uint8_t *src0_ptr,
                                   height, 8);
 }
 
-static void hevc_hv_bi_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1900,8 +1900,9 @@ static void hevc_hv_bi_8t_12w_msa(uint8_t *src0_ptr,
                                   int32_t height)
 {
     uint32_t loop_cnt;
-    uint8_t *src0_ptr_tmp, *dst_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    uint8_t *dst_tmp;
+    const int16_t *src1_ptr_tmp;
     uint64_t tp0, tp1;
     v16u8 out;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
@@ -2103,9 +2104,9 @@ static void hevc_hv_bi_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2118,9 +2119,9 @@ static void hevc_hv_bi_8t_16w_msa(uint8_t *src0_ptr,
                                   height, 16);
 }
 
-static void hevc_hv_bi_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2133,9 +2134,9 @@ static void hevc_hv_bi_8t_24w_msa(uint8_t *src0_ptr,
                                   height, 24);
 }
 
-static void hevc_hv_bi_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2148,9 +2149,9 @@ static void hevc_hv_bi_8t_32w_msa(uint8_t *src0_ptr,
                                   height, 32);
 }
 
-static void hevc_hv_bi_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_48w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2163,9 +2164,9 @@ static void hevc_hv_bi_8t_48w_msa(uint8_t *src0_ptr,
                                   height, 48);
 }
 
-static void hevc_hv_bi_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_8t_64w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2178,9 +2179,9 @@ static void hevc_hv_bi_8t_64w_msa(uint8_t *src0_ptr,
                                   height, 64);
 }
 
-static void hevc_hz_bi_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_4x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2221,9 +2222,9 @@ static void hevc_hz_bi_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(dst0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_bi_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_4x4_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2267,9 +2268,9 @@ static void hevc_hz_bi_4t_4x4_msa(uint8_t *src0_ptr,
     ST_W4(dst0, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hz_bi_4t_4x8multiple_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_4x8multiple_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -2330,9 +2331,9 @@ static void hevc_hz_bi_4t_4x8multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -2352,9 +2353,9 @@ static void hevc_hz_bi_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_6w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -2413,9 +2414,9 @@ static void hevc_hz_bi_4t_6w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_8x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2456,9 +2457,9 @@ static void hevc_hz_bi_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(dst0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_bi_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_8x6_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2520,9 +2521,9 @@ static void hevc_hz_bi_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(dst2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hz_bi_4t_8x4multiple_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_8x4multiple_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -2578,9 +2579,9 @@ static void hevc_hz_bi_4t_8x4multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -2600,9 +2601,9 @@ static void hevc_hz_bi_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2674,9 +2675,9 @@ static void hevc_hz_bi_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2734,16 +2735,16 @@ static void hevc_hz_bi_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
                                   const int8_t *filter,
                                   int32_t height)
 {
-    int16_t *src1_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     uint32_t loop_cnt;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
@@ -2840,9 +2841,9 @@ static void hevc_hz_bi_4t_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_bi_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hz_bi_4t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2901,9 +2902,9 @@ static void hevc_hz_bi_4t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_4x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2949,9 +2950,9 @@ static void hevc_vt_bi_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(dst10, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_bi_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_4x4_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -2998,9 +2999,9 @@ static void hevc_vt_bi_4t_4x4_msa(uint8_t *src0_ptr,
     ST_W4(dst10, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_vt_bi_4t_4x8multiple_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_4x8multiple_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -3071,9 +3072,9 @@ static void hevc_vt_bi_4t_4x8multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -3093,9 +3094,9 @@ static void hevc_vt_bi_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_6w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -3191,9 +3192,9 @@ static void hevc_vt_bi_4t_6w_msa(uint8_t *src0_ptr,
     dst += (4 * dst_stride);
 }
 
-static void hevc_vt_bi_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_8x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3235,9 +3236,9 @@ static void hevc_vt_bi_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(dst0_r, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_bi_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_8x6_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3295,9 +3296,9 @@ static void hevc_vt_bi_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(dst2_r, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_vt_bi_4t_8x4multiple_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_8x4multiple_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -3357,9 +3358,9 @@ static void hevc_vt_bi_4t_8x4multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -3379,9 +3380,9 @@ static void hevc_vt_bi_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3462,9 +3463,9 @@ static void hevc_vt_bi_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3547,9 +3548,9 @@ static void hevc_vt_bi_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3671,9 +3672,9 @@ static void hevc_vt_bi_4t_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_bi_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_vt_bi_4t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3781,9 +3782,9 @@ static void hevc_vt_bi_4t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_4x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3848,9 +3849,9 @@ static void hevc_hv_bi_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_bi_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_4x4_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3924,9 +3925,9 @@ static void hevc_hv_bi_4t_4x4_msa(uint8_t *src0_ptr,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hv_bi_4t_4multx8mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_4multx8mult_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -4043,9 +4044,9 @@ static void hevc_hv_bi_4t_4multx8mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_4w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -4067,9 +4068,9 @@ static void hevc_hv_bi_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_6w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -4217,9 +4218,9 @@ static void hevc_hv_bi_4t_6w_msa(uint8_t *src0_ptr,
     ST_H8(out2, 0, 1, 2, 3, 4, 5, 6, 7, dst + 4, dst_stride);
 }
 
-static void hevc_hv_bi_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_8x2_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4291,9 +4292,9 @@ static void hevc_hv_bi_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_bi_4t_8multx4_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_8multx4_msa(const uint8_t *src0_ptr,
                                       int32_t src_stride,
-                                      int16_t *src1_ptr,
+                                      const int16_t *src1_ptr,
                                       int32_t src2_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4387,9 +4388,9 @@ static void hevc_hv_bi_4t_8multx4_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_8x6_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4503,9 +4504,9 @@ static void hevc_hv_bi_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hv_bi_4t_8multx4mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_8multx4mult_msa(const uint8_t *src0_ptr,
                                           int32_t src_stride,
-                                          int16_t *src1_ptr,
+                                          const int16_t *src1_ptr,
                                           int32_t src2_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -4515,8 +4516,8 @@ static void hevc_hv_bi_4t_8multx4mult_msa(uint8_t *src0_ptr,
                                           int32_t width)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6;
@@ -4628,9 +4629,9 @@ static void hevc_hv_bi_4t_8multx4mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_8w_msa(const uint8_t *src0_ptr,
                                  int32_t src_stride,
-                                 int16_t *src1_ptr,
+                                 const int16_t *src1_ptr,
                                  int32_t src2_stride,
                                  uint8_t *dst,
                                  int32_t dst_stride,
@@ -4655,9 +4656,9 @@ static void hevc_hv_bi_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_12w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4667,8 +4668,9 @@ static void hevc_hv_bi_4t_12w_msa(uint8_t *src0_ptr,
 {
     uint32_t loop_cnt;
     uint64_t tp0, tp1;
-    uint8_t *src0_ptr_tmp, *dst_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    uint8_t *dst_tmp;
+    const int16_t *src1_ptr_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
@@ -4857,9 +4859,9 @@ static void hevc_hv_bi_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_16w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4877,9 +4879,9 @@ static void hevc_hv_bi_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_bi_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_24w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4892,9 +4894,9 @@ static void hevc_hv_bi_4t_24w_msa(uint8_t *src0_ptr,
                                   height, 24);
 }
 
-static void hevc_hv_bi_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hv_bi_4t_32w_msa(const uint8_t *src0_ptr,
                                   int32_t src_stride,
-                                  int16_t *src1_ptr,
+                                  const int16_t *src1_ptr,
                                   int32_t src2_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -4910,9 +4912,9 @@ static void hevc_hv_bi_4t_32w_msa(uint8_t *src0_ptr,
 #define BI_MC_COPY(WIDTH)                                                 \
 void ff_hevc_put_hevc_bi_pel_pixels##WIDTH##_8_msa(uint8_t *dst,          \
                                                    ptrdiff_t dst_stride,  \
-                                                   uint8_t *src,          \
+                                                   const uint8_t *src,    \
                                                    ptrdiff_t src_stride,  \
-                                                   int16_t *src_16bit,    \
+                                                   const int16_t *src_16bit, \
                                                    int height,            \
                                                    intptr_t mx,           \
                                                    intptr_t my,           \
@@ -4937,9 +4939,9 @@ BI_MC_COPY(64);
 #define BI_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR)                          \
 void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,          \
                                                       ptrdiff_t dst_stride,  \
-                                                      uint8_t *src,          \
+                                                      const uint8_t *src,    \
                                                       ptrdiff_t src_stride,  \
-                                                      int16_t *src_16bit,    \
+                                                      const int16_t *src_16bit, \
                                                       int height,            \
                                                       intptr_t mx,           \
                                                       intptr_t my,           \
@@ -4991,9 +4993,9 @@ BI_MC(epel, v, 32, 4, vt, my);
 #define BI_MC_HV(PEL, WIDTH, TAP)                                         \
 void ff_hevc_put_hevc_bi_##PEL##_hv##WIDTH##_8_msa(uint8_t *dst,          \
                                                    ptrdiff_t dst_stride,  \
-                                                   uint8_t *src,          \
+                                                   const uint8_t *src,    \
                                                    ptrdiff_t src_stride,  \
-                                                   int16_t *src_16bit,    \
+                                                   const int16_t *src_16bit, \
                                                    int height,            \
                                                    intptr_t mx,           \
                                                    intptr_t my,           \
diff --git a/libavcodec/mips/hevc_mc_biw_msa.c b/libavcodec/mips/hevc_mc_biw_msa.c
index f775ea8592..981c37d7e8 100644
--- a/libavcodec/mips/hevc_mc_biw_msa.c
+++ b/libavcodec/mips/hevc_mc_biw_msa.c
@@ -79,9 +79,9 @@ static const uint8_t ff_hevc_mask_arr[16 * 2] __attribute__((aligned(0x40))) = {
                                 out2, out3);                               \
 }
 
-static void hevc_biwgt_copy_4w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_4w_msa(const uint8_t *src0_ptr,
                                    int32_t src_stride,
-                                   int16_t *src1_ptr,
+                                   const int16_t *src1_ptr,
                                    int32_t src2_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -168,9 +168,9 @@ static void hevc_biwgt_copy_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_6w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_6w_msa(const uint8_t *src0_ptr,
                                    int32_t src_stride,
-                                   int16_t *src1_ptr,
+                                   const int16_t *src1_ptr,
                                    int32_t src2_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -222,9 +222,9 @@ static void hevc_biwgt_copy_6w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_8w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_8w_msa(const uint8_t *src0_ptr,
                                    int32_t src_stride,
-                                   int16_t *src1_ptr,
+                                   const int16_t *src1_ptr,
                                    int32_t src2_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -310,9 +310,9 @@ static void hevc_biwgt_copy_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_12w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_12w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -369,9 +369,9 @@ static void hevc_biwgt_copy_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_16w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_16w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -424,9 +424,9 @@ static void hevc_biwgt_copy_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_24w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_24w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -488,9 +488,9 @@ static void hevc_biwgt_copy_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_32w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_32w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -549,9 +549,9 @@ static void hevc_biwgt_copy_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_48w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_48w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -601,9 +601,9 @@ static void hevc_biwgt_copy_48w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_biwgt_copy_64w_msa(uint8_t *src0_ptr,
+static void hevc_biwgt_copy_64w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -656,9 +656,9 @@ static void hevc_biwgt_copy_64w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -728,9 +728,9 @@ static void hevc_hz_biwgt_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -808,9 +808,9 @@ static void hevc_hz_biwgt_8t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -903,9 +903,9 @@ static void hevc_hz_biwgt_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -987,9 +987,9 @@ static void hevc_hz_biwgt_8t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1109,9 +1109,9 @@ static void hevc_hz_biwgt_8t_24w_msa(uint8_t *src0_ptr,
     dst += dst_stride;
 }
 
-static void hevc_hz_biwgt_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1195,9 +1195,9 @@ static void hevc_hz_biwgt_8t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_48w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1299,9 +1299,9 @@ static void hevc_hz_biwgt_8t_48w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_8t_64w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1313,9 +1313,9 @@ static void hevc_hz_biwgt_8t_64w_msa(uint8_t *src0_ptr,
                                      int32_t offset1,
                                      int32_t rnd_val)
 {
-    uint8_t *src0_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
     uint8_t *dst_tmp;
-    int16_t *src1_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint32_t loop_cnt, cnt;
     int32_t offset, weight, constant;
     v16i8 src0, src1, src2;
@@ -1398,9 +1398,9 @@ static void hevc_hz_biwgt_8t_64w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -1496,9 +1496,9 @@ static void hevc_vt_biwgt_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -1584,9 +1584,9 @@ static void hevc_vt_biwgt_8t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1694,9 +1694,9 @@ static void hevc_vt_biwgt_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_8t_16multx2mult_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_16multx2mult_msa(const uint8_t *src0_ptr,
                                               int32_t src_stride,
-                                              int16_t *src1_ptr,
+                                              const int16_t *src1_ptr,
                                               int32_t src2_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -1709,8 +1709,8 @@ static void hevc_vt_biwgt_8t_16multx2mult_msa(uint8_t *src0_ptr,
                                               int32_t rnd_val,
                                               int32_t width)
 {
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     uint32_t loop_cnt, cnt;
     int32_t offset, weight;
@@ -1810,9 +1810,9 @@ static void hevc_vt_biwgt_8t_16multx2mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1831,9 +1831,9 @@ static void hevc_vt_biwgt_8t_16w_msa(uint8_t *src0_ptr,
                                       rnd_val, 16);
 }
 
-static void hevc_vt_biwgt_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1856,9 +1856,9 @@ static void hevc_vt_biwgt_8t_24w_msa(uint8_t *src0_ptr,
                             weight0, weight1, offset0, offset1, rnd_val);
 }
 
-static void hevc_vt_biwgt_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1877,9 +1877,9 @@ static void hevc_vt_biwgt_8t_32w_msa(uint8_t *src0_ptr,
                                       rnd_val, 32);
 }
 
-static void hevc_vt_biwgt_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_48w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1898,9 +1898,9 @@ static void hevc_vt_biwgt_8t_48w_msa(uint8_t *src0_ptr,
                                       rnd_val, 48);
 }
 
-static void hevc_vt_biwgt_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_8t_64w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1919,9 +1919,9 @@ static void hevc_vt_biwgt_8t_64w_msa(uint8_t *src0_ptr,
                                       rnd_val, 64);
 }
 
-static void hevc_hv_biwgt_8t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -2064,9 +2064,9 @@ static void hevc_hv_biwgt_8t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_8t_8multx2mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_8multx2mult_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -2082,8 +2082,8 @@ static void hevc_hv_biwgt_8t_8multx2mult_msa(uint8_t *src0_ptr,
 {
     uint32_t loop_cnt, cnt;
     int32_t offset, weight;
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     v16u8 out;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
@@ -2247,9 +2247,9 @@ static void hevc_hv_biwgt_8t_8multx2mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_8t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -2269,9 +2269,9 @@ static void hevc_hv_biwgt_8t_8w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 1);
 }
 
-static void hevc_hv_biwgt_8t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2285,8 +2285,9 @@ static void hevc_hv_biwgt_8t_12w_msa(uint8_t *src0_ptr,
                                      int32_t rnd_val)
 {
     uint32_t loop_cnt;
-    uint8_t *src0_ptr_tmp, *dst_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    uint8_t *dst_tmp;
+    const int16_t *src1_ptr_tmp;
     int32_t offset, weight;
     uint64_t tp0, tp1;
     v16u8 out;
@@ -2519,9 +2520,9 @@ static void hevc_hv_biwgt_8t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_8t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2541,9 +2542,9 @@ static void hevc_hv_biwgt_8t_16w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 2);
 }
 
-static void hevc_hv_biwgt_8t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2563,9 +2564,9 @@ static void hevc_hv_biwgt_8t_24w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 3);
 }
 
-static void hevc_hv_biwgt_8t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2585,9 +2586,9 @@ static void hevc_hv_biwgt_8t_32w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 4);
 }
 
-static void hevc_hv_biwgt_8t_48w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_48w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2607,9 +2608,9 @@ static void hevc_hv_biwgt_8t_48w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 6);
 }
 
-static void hevc_hv_biwgt_8t_64w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_8t_64w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2629,9 +2630,9 @@ static void hevc_hv_biwgt_8t_64w_msa(uint8_t *src0_ptr,
                                      offset1, rnd_val, 8);
 }
 
-static void hevc_hz_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_4x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2689,9 +2690,9 @@ static void hevc_hz_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(out0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_4x4_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2749,9 +2750,9 @@ static void hevc_hz_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
     ST_W4(dst0, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hz_biwgt_4t_4x8multiple_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_4x8multiple_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -2824,9 +2825,9 @@ static void hevc_hz_biwgt_4t_4x8multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -2855,9 +2856,9 @@ static void hevc_hz_biwgt_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_6w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -2929,9 +2930,9 @@ static void hevc_hz_biwgt_4t_6w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_8x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2985,9 +2986,9 @@ static void hevc_hz_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(dst0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_8x6_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3059,9 +3060,9 @@ static void hevc_hz_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(dst3, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hz_biwgt_4t_8x4multiple_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_8x4multiple_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -3129,9 +3130,9 @@ static void hevc_hz_biwgt_4t_8x4multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -3160,9 +3161,9 @@ static void hevc_hz_biwgt_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3246,9 +3247,9 @@ static void hevc_hz_biwgt_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3335,9 +3336,9 @@ static void hevc_hz_biwgt_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3422,9 +3423,9 @@ static void hevc_hz_biwgt_4t_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hz_biwgt_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hz_biwgt_4t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3495,9 +3496,9 @@ static void hevc_hz_biwgt_4t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_4x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3560,9 +3561,9 @@ static void hevc_vt_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_4x4_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3627,9 +3628,9 @@ static void hevc_vt_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
     dst += (4 * dst_stride);
 }
 
-static void hevc_vt_biwgt_4t_4x8multiple_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_4x8multiple_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -3713,9 +3714,9 @@ static void hevc_vt_biwgt_4t_4x8multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -3744,9 +3745,9 @@ static void hevc_vt_biwgt_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_6w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -3821,9 +3822,9 @@ static void hevc_vt_biwgt_4t_6w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_8x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3878,9 +3879,9 @@ static void hevc_vt_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(tmp0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_8x6_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3949,9 +3950,9 @@ static void hevc_vt_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(tmp3, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_vt_biwgt_4t_8x4multiple_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_8x4multiple_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -4023,9 +4024,9 @@ static void hevc_vt_biwgt_4t_8x4multiple_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -4054,9 +4055,9 @@ static void hevc_vt_biwgt_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4146,9 +4147,9 @@ static void hevc_vt_biwgt_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4240,9 +4241,9 @@ static void hevc_vt_biwgt_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4377,9 +4378,9 @@ static void hevc_vt_biwgt_4t_24w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_vt_biwgt_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_vt_biwgt_4t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4496,9 +4497,9 @@ static void hevc_vt_biwgt_4t_32w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_4x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4580,9 +4581,9 @@ static void hevc_hv_biwgt_4t_4x2_msa(uint8_t *src0_ptr,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_4x4_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4677,9 +4678,9 @@ static void hevc_hv_biwgt_4t_4x4_msa(uint8_t *src0_ptr,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hv_biwgt_4t_4multx8mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_4multx8mult_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -4821,9 +4822,9 @@ static void hevc_hv_biwgt_4t_4multx8mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_4w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_4w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -4853,9 +4854,9 @@ static void hevc_hv_biwgt_4t_4w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_6w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_6w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -5035,9 +5036,9 @@ static void hevc_hv_biwgt_4t_6w_msa(uint8_t *src0_ptr,
     ST_H8(out2, 0, 1, 2, 3, 4, 5, 6, 7, dst + 4, dst_stride);
 }
 
-static void hevc_hv_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_8x2_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5131,9 +5132,9 @@ static void hevc_hv_biwgt_4t_8x2_msa(uint8_t *src0_ptr,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_biwgt_4t_8multx4_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_8multx4_msa(const uint8_t *src0_ptr,
                                          int32_t src_stride,
-                                         int16_t *src1_ptr,
+                                         const int16_t *src1_ptr,
                                          int32_t src2_stride,
                                          uint8_t *dst,
                                          int32_t dst_stride,
@@ -5255,9 +5256,9 @@ static void hevc_hv_biwgt_4t_8multx4_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_8x6_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5405,9 +5406,9 @@ static void hevc_hv_biwgt_4t_8x6_msa(uint8_t *src0_ptr,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hv_biwgt_4t_8multx4mult_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_8multx4mult_msa(const uint8_t *src0_ptr,
                                              int32_t src_stride,
-                                             int16_t *src1_ptr,
+                                             const int16_t *src1_ptr,
                                              int32_t src2_stride,
                                              uint8_t *dst,
                                              int32_t dst_stride,
@@ -5424,8 +5425,8 @@ static void hevc_hv_biwgt_4t_8multx4mult_msa(uint8_t *src0_ptr,
     uint32_t loop_cnt;
     uint32_t cnt;
     int32_t offset, weight;
-    uint8_t *src0_ptr_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
     uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6;
@@ -5555,9 +5556,9 @@ static void hevc_hv_biwgt_4t_8multx4mult_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_8w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_8w_msa(const uint8_t *src0_ptr,
                                     int32_t src_stride,
-                                    int16_t *src1_ptr,
+                                    const int16_t *src1_ptr,
                                     int32_t src2_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -5592,9 +5593,9 @@ static void hevc_hv_biwgt_4t_8w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_12w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_12w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5610,8 +5611,9 @@ static void hevc_hv_biwgt_4t_12w_msa(uint8_t *src0_ptr,
     uint32_t loop_cnt;
     uint64_t tp0, tp1;
     int32_t offset, weight;
-    uint8_t *src0_ptr_tmp, *dst_tmp;
-    int16_t *src1_ptr_tmp;
+    const uint8_t *src0_ptr_tmp;
+    const int16_t *src1_ptr_tmp;
+    uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
@@ -5831,9 +5833,9 @@ static void hevc_hv_biwgt_4t_12w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_16w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_16w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5859,9 +5861,9 @@ static void hevc_hv_biwgt_4t_16w_msa(uint8_t *src0_ptr,
     }
 }
 
-static void hevc_hv_biwgt_4t_24w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_24w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5881,9 +5883,9 @@ static void hevc_hv_biwgt_4t_24w_msa(uint8_t *src0_ptr,
                                      weight1, offset0, offset1, rnd_val, 24);
 }
 
-static void hevc_hv_biwgt_4t_32w_msa(uint8_t *src0_ptr,
+static void hevc_hv_biwgt_4t_32w_msa(const uint8_t *src0_ptr,
                                      int32_t src_stride,
-                                     int16_t *src1_ptr,
+                                     const int16_t *src1_ptr,
                                      int32_t src2_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5906,9 +5908,9 @@ static void hevc_hv_biwgt_4t_32w_msa(uint8_t *src0_ptr,
 #define BI_W_MC_COPY(WIDTH)                                                  \
 void ff_hevc_put_hevc_bi_w_pel_pixels##WIDTH##_8_msa(uint8_t *dst,           \
                                                      ptrdiff_t dst_stride,   \
-                                                     uint8_t *src,           \
+                                                     const uint8_t *src,     \
                                                      ptrdiff_t src_stride,   \
-                                                     int16_t *src_16bit,     \
+                                                     const int16_t *src_16bit, \
                                                      int height,             \
                                                      int denom,              \
                                                      int weight0,            \
@@ -5944,10 +5946,10 @@ BI_W_MC_COPY(64);
 void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,         \
                                                         ptrdiff_t             \
                                                         dst_stride,           \
-                                                        uint8_t *src,         \
+                                                        const uint8_t *src,   \
                                                         ptrdiff_t             \
                                                         src_stride,           \
-                                                        int16_t *src_16bit,   \
+                                                        const int16_t *src_16bit, \
                                                         int height,           \
                                                         int denom,            \
                                                         int weight0,          \
@@ -6007,9 +6009,9 @@ BI_W_MC(epel, v, 32, 4, vt, my);
 #define BI_W_MC_HV(PEL, WIDTH, TAP)                                         \
 void ff_hevc_put_hevc_bi_w_##PEL##_hv##WIDTH##_8_msa(uint8_t *dst,          \
                                                      ptrdiff_t dst_stride,  \
-                                                     uint8_t *src,          \
+                                                     const uint8_t *src,    \
                                                      ptrdiff_t src_stride,  \
-                                                     int16_t *src_16bit,    \
+                                                     const int16_t *src_16bit, \
                                                      int height,            \
                                                      int denom,             \
                                                      int weight0,           \
diff --git a/libavcodec/mips/hevc_mc_uni_msa.c b/libavcodec/mips/hevc_mc_uni_msa.c
index 36e65527af..c0571e1231 100644
--- a/libavcodec/mips/hevc_mc_uni_msa.c
+++ b/libavcodec/mips/hevc_mc_uni_msa.c
@@ -101,7 +101,7 @@ static const uint8_t ff_hevc_mask_arr[16 * 3] __attribute__((aligned(0x40))) = {
                  out0, out1, out2, out3);                                     \
 }
 
-static void copy_width8_msa(uint8_t *src, int32_t src_stride,
+static void copy_width8_msa(const uint8_t *src, int32_t src_stride,
                             uint8_t *dst, int32_t dst_stride,
                             int32_t height)
 {
@@ -143,7 +143,7 @@ static void copy_width8_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void copy_width12_msa(uint8_t *src, int32_t src_stride,
+static void copy_width12_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -157,7 +157,7 @@ static void copy_width12_msa(uint8_t *src, int32_t src_stride,
     ST12x8_UB(src0, src1, src2, src3, src4, src5, src6, src7, dst, dst_stride);
 }
 
-static void copy_width16_msa(uint8_t *src, int32_t src_stride,
+static void copy_width16_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -193,7 +193,7 @@ static void copy_width16_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void copy_width24_msa(uint8_t *src, int32_t src_stride,
+static void copy_width24_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -216,7 +216,7 @@ static void copy_width24_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void copy_width32_msa(uint8_t *src, int32_t src_stride,
+static void copy_width32_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -233,7 +233,7 @@ static void copy_width32_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void copy_width48_msa(uint8_t *src, int32_t src_stride,
+static void copy_width48_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -254,7 +254,7 @@ static void copy_width48_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void copy_width64_msa(uint8_t *src, int32_t src_stride,
+static void copy_width64_msa(const uint8_t *src, int32_t src_stride,
                              uint8_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -283,7 +283,7 @@ static void copy_width64_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_4x4_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_4x4_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -312,7 +312,7 @@ static void common_hz_8t_4x4_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void common_hz_8t_4x8_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_4x8_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -349,7 +349,7 @@ static void common_hz_8t_4x8_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst + 4 * dst_stride, dst_stride);
 }
 
-static void common_hz_8t_4x16_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_4x16_msa(const uint8_t *src, int32_t src_stride,
                                   uint8_t *dst, int32_t dst_stride,
                                   const int8_t *filter)
 {
@@ -405,7 +405,7 @@ static void common_hz_8t_4x16_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst + 4 * dst_stride, dst_stride);
 }
 
-static void common_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_4w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -418,7 +418,7 @@ static void common_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_8w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_8w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -470,7 +470,7 @@ static void common_hz_8t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_12w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_12w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -549,7 +549,7 @@ static void common_hz_8t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_16w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_16w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -607,7 +607,7 @@ static void common_hz_8t_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_24w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_24w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -677,7 +677,7 @@ static void common_hz_8t_24w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_32w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_32w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -738,7 +738,7 @@ static void common_hz_8t_32w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_48w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_48w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -824,7 +824,7 @@ static void common_hz_8t_48w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_8t_64w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_8t_64w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -903,7 +903,7 @@ static void common_hz_8t_64w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_4w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_4w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -972,7 +972,7 @@ static void common_vt_8t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_8w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_8w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -1027,7 +1027,7 @@ static void common_vt_8t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_12w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_12w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1129,7 +1129,7 @@ static void common_vt_8t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_16w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_16w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1208,12 +1208,12 @@ static void common_vt_8t_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_16w_mult_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_16w_mult_msa(const uint8_t *src, int32_t src_stride,
                                       uint8_t *dst, int32_t dst_stride,
                                       const int8_t *filter, int32_t height,
                                       int32_t width)
 {
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     uint32_t loop_cnt, cnt;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
@@ -1297,7 +1297,7 @@ static void common_vt_8t_16w_mult_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_8t_24w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_24w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1308,7 +1308,7 @@ static void common_vt_8t_24w_msa(uint8_t *src, int32_t src_stride,
                         height);
 }
 
-static void common_vt_8t_32w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_32w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1316,7 +1316,7 @@ static void common_vt_8t_32w_msa(uint8_t *src, int32_t src_stride,
                               32);
 }
 
-static void common_vt_8t_48w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_48w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1324,7 +1324,7 @@ static void common_vt_8t_48w_msa(uint8_t *src, int32_t src_stride,
                               48);
 }
 
-static void common_vt_8t_64w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_8t_64w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -1332,7 +1332,7 @@ static void common_vt_8t_64w_msa(uint8_t *src, int32_t src_stride,
                               64);
 }
 
-static void hevc_hv_uni_8t_4w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_4w_msa(const uint8_t *src,
                                   int32_t src_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1466,7 +1466,7 @@ static void hevc_hv_uni_8t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_8t_8multx2mult_msa(uint8_t *src,
+static void hevc_hv_uni_8t_8multx2mult_msa(const uint8_t *src,
                                            int32_t src_stride,
                                            uint8_t *dst,
                                            int32_t dst_stride,
@@ -1475,7 +1475,7 @@ static void hevc_hv_uni_8t_8multx2mult_msa(uint8_t *src,
                                            int32_t height, int32_t width)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     v16u8 out;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
@@ -1605,7 +1605,7 @@ static void hevc_hv_uni_8t_8multx2mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_8t_8w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_8w_msa(const uint8_t *src,
                                   int32_t src_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -1617,7 +1617,7 @@ static void hevc_hv_uni_8t_8w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 8);
 }
 
-static void hevc_hv_uni_8t_12w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_12w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1626,7 +1626,8 @@ static void hevc_hv_uni_8t_12w_msa(uint8_t *src,
                                    int32_t height)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp, *dst_tmp;
+    const uint8_t *src_tmp;
+    uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 src11, src12, src13, src14;
@@ -1851,7 +1852,7 @@ static void hevc_hv_uni_8t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_8t_16w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_16w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1863,7 +1864,7 @@ static void hevc_hv_uni_8t_16w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 16);
 }
 
-static void hevc_hv_uni_8t_24w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_24w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1875,7 +1876,7 @@ static void hevc_hv_uni_8t_24w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 24);
 }
 
-static void hevc_hv_uni_8t_32w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_32w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1887,7 +1888,7 @@ static void hevc_hv_uni_8t_32w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 32);
 }
 
-static void hevc_hv_uni_8t_48w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_48w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1899,7 +1900,7 @@ static void hevc_hv_uni_8t_48w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 48);
 }
 
-static void hevc_hv_uni_8t_64w_msa(uint8_t *src,
+static void hevc_hv_uni_8t_64w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -1911,7 +1912,7 @@ static void hevc_hv_uni_8t_64w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 64);
 }
 
-static void common_hz_4t_4x2_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_4x2_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -1938,7 +1939,7 @@ static void common_hz_4t_4x2_msa(uint8_t *src, int32_t src_stride,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void common_hz_4t_4x4_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_4x4_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -1965,7 +1966,7 @@ static void common_hz_4t_4x4_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void common_hz_4t_4x8_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_4x8_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -2000,7 +2001,7 @@ static void common_hz_4t_4x8_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst + 4 * dst_stride, dst_stride);
 }
 
-static void common_hz_4t_4x16_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_4x16_msa(const uint8_t *src, int32_t src_stride,
                                   uint8_t *dst, int32_t dst_stride,
                                   const int8_t *filter)
 {
@@ -2048,7 +2049,7 @@ static void common_hz_4t_4x16_msa(uint8_t *src, int32_t src_stride,
     ST_W4(out, 0, 1, 2, 3, dst + 4 * dst_stride, dst_stride);
 }
 
-static void common_hz_4t_4w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_4w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2063,7 +2064,7 @@ static void common_hz_4t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_6w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_6w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2112,7 +2113,7 @@ static void common_hz_4t_6w_msa(uint8_t *src, int32_t src_stride,
     ST_H2(out5, 2, 6, dst + 2 * dst_stride + 4, dst_stride);
 }
 
-static void common_hz_4t_8x2mult_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_8x2mult_msa(const uint8_t *src, int32_t src_stride,
                                      uint8_t *dst, int32_t dst_stride,
                                      const int8_t *filter, int32_t height)
 {
@@ -2146,7 +2147,7 @@ static void common_hz_4t_8x2mult_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_8x4mult_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_8x4mult_msa(const uint8_t *src, int32_t src_stride,
                                      uint8_t *dst, int32_t dst_stride,
                                      const int8_t *filter, int32_t height)
 {
@@ -2180,7 +2181,7 @@ static void common_hz_4t_8x4mult_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_8w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_8w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2193,7 +2194,7 @@ static void common_hz_4t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_12w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_12w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2247,7 +2248,7 @@ static void common_hz_4t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_16w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_16w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2310,7 +2311,7 @@ static void common_hz_4t_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_24w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_24w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2393,7 +2394,7 @@ static void common_hz_4t_24w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_hz_4t_32w_msa(uint8_t *src, int32_t src_stride,
+static void common_hz_4t_32w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2461,7 +2462,7 @@ static void common_hz_4t_32w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_4x2_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_4x2_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -2492,7 +2493,7 @@ static void common_vt_4t_4x2_msa(uint8_t *src, int32_t src_stride,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void common_vt_4t_4x4multiple_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_4x4multiple_msa(const uint8_t *src, int32_t src_stride,
                                          uint8_t *dst, int32_t dst_stride,
                                          const int8_t *filter, int32_t height)
 {
@@ -2538,7 +2539,7 @@ static void common_vt_4t_4x4multiple_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_4w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_4w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2550,7 +2551,7 @@ static void common_vt_4t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_6w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_6w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2621,7 +2622,7 @@ static void common_vt_4t_6w_msa(uint8_t *src, int32_t src_stride,
     ST_H2(out1, 2, 6, dst + 2 * dst_stride + 4, dst_stride);
 }
 
-static void common_vt_4t_8x2_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_8x2_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -2647,7 +2648,7 @@ static void common_vt_4t_8x2_msa(uint8_t *src, int32_t src_stride,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void common_vt_4t_8x6_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_8x6_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter)
 {
@@ -2700,7 +2701,7 @@ static void common_vt_4t_8x6_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_8x4mult_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_8x4mult_msa(const uint8_t *src, int32_t src_stride,
                                      uint8_t *dst, int32_t dst_stride,
                                      const int8_t *filter, int32_t height)
 {
@@ -2745,7 +2746,7 @@ static void common_vt_4t_8x4mult_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_8w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_8w_msa(const uint8_t *src, int32_t src_stride,
                                 uint8_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2759,7 +2760,7 @@ static void common_vt_4t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_12w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_12w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2822,7 +2823,7 @@ static void common_vt_4t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_16w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_16w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2880,7 +2881,7 @@ static void common_vt_4t_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_24w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_24w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -2991,7 +2992,7 @@ static void common_vt_4t_24w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void common_vt_4t_32w_msa(uint8_t *src, int32_t src_stride,
+static void common_vt_4t_32w_msa(const uint8_t *src, int32_t src_stride,
                                  uint8_t *dst, int32_t dst_stride,
                                  const int8_t *filter, int32_t height)
 {
@@ -3084,7 +3085,7 @@ static void common_vt_4t_32w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hv_uni_4t_4x2_msa(uint8_t *src,
+static void hevc_hv_uni_4t_4x2_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -3139,7 +3140,7 @@ static void hevc_hv_uni_4t_4x2_msa(uint8_t *src,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_uni_4t_4x4_msa(uint8_t *src,
+static void hevc_hv_uni_4t_4x4_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -3198,7 +3199,7 @@ static void hevc_hv_uni_4t_4x4_msa(uint8_t *src,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hv_uni_4t_4multx8mult_msa(uint8_t *src,
+static void hevc_hv_uni_4t_4multx8mult_msa(const uint8_t *src,
                                            int32_t src_stride,
                                            uint8_t *dst,
                                            int32_t dst_stride,
@@ -3296,7 +3297,7 @@ static void hevc_hv_uni_4t_4multx8mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_4w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_4w_msa(const uint8_t *src,
                                   int32_t src_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3316,7 +3317,7 @@ static void hevc_hv_uni_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_6w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_6w_msa(const uint8_t *src,
                                   int32_t src_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3435,7 +3436,7 @@ static void hevc_hv_uni_4t_6w_msa(uint8_t *src,
     ST_H8(out2, 0, 1, 2, 3, 4, 5, 6, 7, dst + 4, dst_stride);
 }
 
-static void hevc_hv_uni_4t_8x2_msa(uint8_t *src,
+static void hevc_hv_uni_4t_8x2_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -3497,7 +3498,7 @@ static void hevc_hv_uni_4t_8x2_msa(uint8_t *src,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_uni_4t_8multx4_msa(uint8_t *src,
+static void hevc_hv_uni_4t_8multx4_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        uint8_t *dst,
                                        int32_t dst_stride,
@@ -3582,7 +3583,7 @@ static void hevc_hv_uni_4t_8multx4_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_8x6_msa(uint8_t *src,
+static void hevc_hv_uni_4t_8x6_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -3685,7 +3686,7 @@ static void hevc_hv_uni_4t_8x6_msa(uint8_t *src,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hv_uni_4t_8multx4mult_msa(uint8_t *src,
+static void hevc_hv_uni_4t_8multx4mult_msa(const uint8_t *src,
                                            int32_t src_stride,
                                            uint8_t *dst,
                                            int32_t dst_stride,
@@ -3695,7 +3696,7 @@ static void hevc_hv_uni_4t_8multx4mult_msa(uint8_t *src,
                                            int32_t width8mult)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6;
@@ -3799,7 +3800,7 @@ static void hevc_hv_uni_4t_8multx4mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_8w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_8w_msa(const uint8_t *src,
                                   int32_t src_stride,
                                   uint8_t *dst,
                                   int32_t dst_stride,
@@ -3822,7 +3823,7 @@ static void hevc_hv_uni_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_12w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_12w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -3831,7 +3832,8 @@ static void hevc_hv_uni_4t_12w_msa(uint8_t *src,
                                    int32_t height)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp, *dst_tmp;
+    const uint8_t *src_tmp;
+    uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
@@ -3990,7 +3992,7 @@ static void hevc_hv_uni_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_16w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_16w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -4007,7 +4009,7 @@ static void hevc_hv_uni_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uni_4t_24w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_24w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -4019,7 +4021,7 @@ static void hevc_hv_uni_4t_24w_msa(uint8_t *src,
                                    filter_x, filter_y, height, 3);
 }
 
-static void hevc_hv_uni_4t_32w_msa(uint8_t *src,
+static void hevc_hv_uni_4t_32w_msa(const uint8_t *src,
                                    int32_t src_stride,
                                    uint8_t *dst,
                                    int32_t dst_stride,
@@ -4034,7 +4036,7 @@ static void hevc_hv_uni_4t_32w_msa(uint8_t *src,
 #define UNI_MC_COPY(WIDTH)                                                 \
 void ff_hevc_put_hevc_uni_pel_pixels##WIDTH##_8_msa(uint8_t *dst,          \
                                                     ptrdiff_t dst_stride,  \
-                                                    uint8_t *src,          \
+                                                    const uint8_t *src,    \
                                                     ptrdiff_t src_stride,  \
                                                     int height,            \
                                                     intptr_t mx,           \
@@ -4057,7 +4059,7 @@ UNI_MC_COPY(64);
 #define UNI_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR)                           \
 void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,           \
                                                        ptrdiff_t dst_stride,   \
-                                                       uint8_t *src,           \
+                                                       const uint8_t *src,     \
                                                        ptrdiff_t src_stride,   \
                                                        int height,             \
                                                        intptr_t mx,            \
@@ -4109,7 +4111,7 @@ UNI_MC(epel, v, 32, 4, vt, my);
 #define UNI_MC_HV(PEL, WIDTH, TAP)                                         \
 void ff_hevc_put_hevc_uni_##PEL##_hv##WIDTH##_8_msa(uint8_t *dst,          \
                                                     ptrdiff_t dst_stride,  \
-                                                    uint8_t *src,          \
+                                                    const uint8_t *src,    \
                                                     ptrdiff_t src_stride,  \
                                                     int height,            \
                                                     intptr_t mx,           \
diff --git a/libavcodec/mips/hevc_mc_uniw_msa.c b/libavcodec/mips/hevc_mc_uniw_msa.c
index 1a8c251534..3c3d7a0da2 100644
--- a/libavcodec/mips/hevc_mc_uniw_msa.c
+++ b/libavcodec/mips/hevc_mc_uniw_msa.c
@@ -54,7 +54,7 @@ static const uint8_t ff_hevc_mask_arr[16 * 2] __attribute__((aligned(0x40))) = {
                                    out2_h, out3_h);                        \
 }
 
-static void hevc_uniwgt_copy_4w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_4w_msa(const uint8_t *src,
                                     int32_t src_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -121,7 +121,7 @@ static void hevc_uniwgt_copy_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_6w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_6w_msa(const uint8_t *src,
                                     int32_t src_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -183,7 +183,7 @@ static void hevc_uniwgt_copy_6w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_8w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_8w_msa(const uint8_t *src,
                                     int32_t src_stride,
                                     uint8_t *dst,
                                     int32_t dst_stride,
@@ -278,7 +278,7 @@ static void hevc_uniwgt_copy_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_12w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_12w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -323,7 +323,7 @@ static void hevc_uniwgt_copy_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_16w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_16w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -366,7 +366,7 @@ static void hevc_uniwgt_copy_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_24w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_24w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -419,7 +419,7 @@ static void hevc_uniwgt_copy_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_32w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_32w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -465,7 +465,7 @@ static void hevc_uniwgt_copy_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_48w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_48w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -522,7 +522,7 @@ static void hevc_uniwgt_copy_48w_msa(uint8_t *src,
     }
 }
 
-static void hevc_uniwgt_copy_64w_msa(uint8_t *src,
+static void hevc_uniwgt_copy_64w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -585,7 +585,7 @@ static void hevc_uniwgt_copy_64w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_4w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -661,7 +661,7 @@ static void hevc_hz_uniwgt_8t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_8w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -739,7 +739,7 @@ static void hevc_hz_uniwgt_8t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_12w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -833,7 +833,7 @@ static void hevc_hz_uniwgt_8t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_16w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -911,7 +911,7 @@ static void hevc_hz_uniwgt_8t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_24w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1004,7 +1004,7 @@ static void hevc_hz_uniwgt_8t_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_32w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1106,7 +1106,7 @@ static void hevc_hz_uniwgt_8t_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_48w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_48w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1200,7 +1200,7 @@ static void hevc_hz_uniwgt_8t_48w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_8t_64w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_8t_64w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1210,7 +1210,7 @@ static void hevc_hz_uniwgt_8t_64w_msa(uint8_t *src,
                                       int32_t offset,
                                       int32_t rnd_val)
 {
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     uint32_t loop_cnt, cnt;
     v16u8 out0, out1;
@@ -1291,7 +1291,7 @@ static void hevc_hz_uniwgt_8t_64w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_8t_4w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1383,7 +1383,7 @@ static void hevc_vt_uniwgt_8t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_8t_8w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1462,7 +1462,7 @@ static void hevc_vt_uniwgt_8t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_8t_12w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1565,7 +1565,7 @@ static void hevc_vt_uniwgt_8t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_8t_16multx4mult_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_16multx4mult_msa(const uint8_t *src,
                                                int32_t src_stride,
                                                uint8_t *dst,
                                                int32_t dst_stride,
@@ -1576,7 +1576,7 @@ static void hevc_vt_uniwgt_8t_16multx4mult_msa(uint8_t *src,
                                                int32_t rnd_val,
                                                int32_t weightmul16)
 {
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     int32_t loop_cnt, cnt;
     v16u8 out0, out1, out2, out3;
@@ -1676,7 +1676,7 @@ static void hevc_vt_uniwgt_8t_16multx4mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_8t_16w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1691,7 +1691,7 @@ static void hevc_vt_uniwgt_8t_16w_msa(uint8_t *src,
                                        offset, rnd_val, 1);
 }
 
-static void hevc_vt_uniwgt_8t_24w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1709,7 +1709,7 @@ static void hevc_vt_uniwgt_8t_24w_msa(uint8_t *src,
                              filter, 32, weight, offset, rnd_val);
 }
 
-static void hevc_vt_uniwgt_8t_32w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1724,7 +1724,7 @@ static void hevc_vt_uniwgt_8t_32w_msa(uint8_t *src,
                                        offset, rnd_val, 2);
 }
 
-static void hevc_vt_uniwgt_8t_48w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_48w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1739,7 +1739,7 @@ static void hevc_vt_uniwgt_8t_48w_msa(uint8_t *src,
                                        offset, rnd_val, 3);
 }
 
-static void hevc_vt_uniwgt_8t_64w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_8t_64w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -1754,7 +1754,7 @@ static void hevc_vt_uniwgt_8t_64w_msa(uint8_t *src,
                                        offset, rnd_val, 4);
 }
 
-static void hevc_hv_uniwgt_8t_4w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -1879,7 +1879,7 @@ static void hevc_hv_uniwgt_8t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_8t_8multx2mult_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_8multx2mult_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -1892,7 +1892,7 @@ static void hevc_hv_uniwgt_8t_8multx2mult_msa(uint8_t *src,
                                               int32_t width)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
     v8i16 filt0, filt1, filt2, filt3;
@@ -2041,7 +2041,7 @@ static void hevc_hv_uniwgt_8t_8multx2mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_8t_8w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2057,7 +2057,7 @@ static void hevc_hv_uniwgt_8t_8w_msa(uint8_t *src,
                                       offset, rnd_val, 8);
 }
 
-static void hevc_hv_uniwgt_8t_12w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2069,7 +2069,8 @@ static void hevc_hv_uniwgt_8t_12w_msa(uint8_t *src,
                                       int32_t rnd_val)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp, *dst_tmp;
+    const uint8_t *src_tmp;
+    uint8_t *dst_tmp;
     v16u8 out;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 mask0, mask1, mask2, mask3, mask4, mask5, mask6, mask7;
@@ -2262,7 +2263,7 @@ static void hevc_hv_uniwgt_8t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_8t_16w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2278,7 +2279,7 @@ static void hevc_hv_uniwgt_8t_16w_msa(uint8_t *src,
                                       offset, rnd_val, 16);
 }
 
-static void hevc_hv_uniwgt_8t_24w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2294,7 +2295,7 @@ static void hevc_hv_uniwgt_8t_24w_msa(uint8_t *src,
                                       offset, rnd_val, 24);
 }
 
-static void hevc_hv_uniwgt_8t_32w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2310,7 +2311,7 @@ static void hevc_hv_uniwgt_8t_32w_msa(uint8_t *src,
                                       offset, rnd_val, 32);
 }
 
-static void hevc_hv_uniwgt_8t_48w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_48w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2326,7 +2327,7 @@ static void hevc_hv_uniwgt_8t_48w_msa(uint8_t *src,
                                       offset, rnd_val, 48);
 }
 
-static void hevc_hv_uniwgt_8t_64w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_8t_64w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2342,7 +2343,7 @@ static void hevc_hv_uniwgt_8t_64w_msa(uint8_t *src,
                                       offset, rnd_val, 64);
 }
 
-static void hevc_hz_uniwgt_4t_4x2_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_4x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2400,7 +2401,7 @@ static void hevc_hz_uniwgt_4t_4x2_msa(uint8_t *src,
     dst += (4 * dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_4x4_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_4x4_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2457,7 +2458,7 @@ static void hevc_hz_uniwgt_4t_4x4_msa(uint8_t *src,
     dst += (4 * dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_4x8multiple_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_4x8multiple_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -2525,7 +2526,7 @@ static void hevc_hz_uniwgt_4t_4x8multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_4w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2548,7 +2549,7 @@ static void hevc_hz_uniwgt_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_6w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_6w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2629,7 +2630,7 @@ static void hevc_hz_uniwgt_4t_6w_msa(uint8_t *src,
     ST_H2(out3, 2, 6, dst + 2 * dst_stride + 4, dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_8x2_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_8x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2684,7 +2685,7 @@ static void hevc_hz_uniwgt_4t_8x2_msa(uint8_t *src,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_8x4_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_8x4_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2741,7 +2742,7 @@ static void hevc_hz_uniwgt_4t_8x4_msa(uint8_t *src,
     ST_D4(out0, out1, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_8x6_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_8x6_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2811,7 +2812,7 @@ static void hevc_hz_uniwgt_4t_8x6_msa(uint8_t *src,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hz_uniwgt_4t_8x8multiple_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_8x8multiple_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -2891,7 +2892,7 @@ static void hevc_hz_uniwgt_4t_8x8multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_8w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -2917,7 +2918,7 @@ static void hevc_hz_uniwgt_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_12w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -2997,7 +2998,7 @@ static void hevc_hz_uniwgt_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_16w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3080,7 +3081,7 @@ static void hevc_hz_uniwgt_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_24w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3158,7 +3159,7 @@ static void hevc_hz_uniwgt_4t_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_uniwgt_4t_32w_msa(uint8_t *src,
+static void hevc_hz_uniwgt_4t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3245,7 +3246,7 @@ static void hevc_hz_uniwgt_4t_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_4x2_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_4x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3300,7 +3301,7 @@ static void hevc_vt_uniwgt_4t_4x2_msa(uint8_t *src,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_4x4_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_4x4_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3354,7 +3355,7 @@ static void hevc_vt_uniwgt_4t_4x4_msa(uint8_t *src,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_4x8multiple_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_4x8multiple_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -3430,7 +3431,7 @@ static void hevc_vt_uniwgt_4t_4x8multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_4w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3453,7 +3454,7 @@ static void hevc_vt_uniwgt_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_6w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_6w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3531,7 +3532,7 @@ static void hevc_vt_uniwgt_4t_6w_msa(uint8_t *src,
     ST_H2(out3, 2, 6, dst + 2 * dst_stride + 4, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_8x2_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_8x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3582,7 +3583,7 @@ static void hevc_vt_uniwgt_4t_8x2_msa(uint8_t *src,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_8x4_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_8x4_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3637,7 +3638,7 @@ static void hevc_vt_uniwgt_4t_8x4_msa(uint8_t *src,
     ST_D4(out0, out1, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_8x6_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_8x6_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3700,7 +3701,7 @@ static void hevc_vt_uniwgt_4t_8x6_msa(uint8_t *src,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_vt_uniwgt_4t_8x8mult_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_8x8mult_msa(const uint8_t *src,
                                           int32_t src_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -3779,7 +3780,7 @@ static void hevc_vt_uniwgt_4t_8x8mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_8w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -3805,7 +3806,7 @@ static void hevc_vt_uniwgt_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_12w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3910,7 +3911,7 @@ static void hevc_vt_uniwgt_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_16w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -3992,7 +3993,7 @@ static void hevc_vt_uniwgt_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_24w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4094,7 +4095,7 @@ static void hevc_vt_uniwgt_4t_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_uniwgt_4t_32w_msa(uint8_t *src,
+static void hevc_vt_uniwgt_4t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4188,7 +4189,7 @@ static void hevc_vt_uniwgt_4t_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_4x2_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_4x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4252,7 +4253,7 @@ static void hevc_hv_uniwgt_4t_4x2_msa(uint8_t *src,
     ST_W2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_uniwgt_4t_4x4_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_4x4_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4321,7 +4322,7 @@ static void hevc_hv_uniwgt_4t_4x4_msa(uint8_t *src,
     ST_W4(out, 0, 1, 2, 3, dst, dst_stride);
 }
 
-static void hevc_hv_uniwgt_4t_4multx8mult_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_4multx8mult_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -4428,7 +4429,7 @@ static void hevc_hv_uniwgt_4t_4multx8mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_4w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_4w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4454,7 +4455,7 @@ static void hevc_hv_uniwgt_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_6w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_6w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -4581,7 +4582,7 @@ static void hevc_hv_uniwgt_4t_6w_msa(uint8_t *src,
     ST_H8(out2, 0, 1, 2, 3, 4, 5, 6, 7, dst + 4, dst_stride);
 }
 
-static void hevc_hv_uniwgt_4t_8x2_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_8x2_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4657,7 +4658,7 @@ static void hevc_hv_uniwgt_4t_8x2_msa(uint8_t *src,
     ST_D2(out, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_uniwgt_4t_8multx4_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_8multx4_msa(const uint8_t *src,
                                           int32_t src_stride,
                                           uint8_t *dst,
                                           int32_t dst_stride,
@@ -4752,7 +4753,7 @@ static void hevc_hv_uniwgt_4t_8multx4_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_8x6_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_8x6_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -4868,7 +4869,7 @@ static void hevc_hv_uniwgt_4t_8x6_msa(uint8_t *src,
     ST_D2(out2, 0, 1, dst + 4 * dst_stride, dst_stride);
 }
 
-static void hevc_hv_uniwgt_4t_8multx4mult_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_8multx4mult_msa(const uint8_t *src,
                                               int32_t src_stride,
                                               uint8_t *dst,
                                               int32_t dst_stride,
@@ -4881,7 +4882,7 @@ static void hevc_hv_uniwgt_4t_8multx4mult_msa(uint8_t *src,
                                               int32_t width8mult)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6;
@@ -4990,7 +4991,7 @@ static void hevc_hv_uniwgt_4t_8multx4mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_8w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_8w_msa(const uint8_t *src,
                                      int32_t src_stride,
                                      uint8_t *dst,
                                      int32_t dst_stride,
@@ -5021,7 +5022,7 @@ static void hevc_hv_uniwgt_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_12w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_12w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -5033,7 +5034,8 @@ static void hevc_hv_uniwgt_4t_12w_msa(uint8_t *src,
                                       int32_t rnd_val)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp, *dst_tmp;
+    const uint8_t *src_tmp;
+    uint8_t *dst_tmp;
     v16u8 out0, out1;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
@@ -5198,7 +5200,7 @@ static void hevc_hv_uniwgt_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_16w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_16w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -5220,7 +5222,7 @@ static void hevc_hv_uniwgt_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_uniwgt_4t_24w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_24w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -5236,7 +5238,7 @@ static void hevc_hv_uniwgt_4t_24w_msa(uint8_t *src,
                                       offset, rnd_val, 3);
 }
 
-static void hevc_hv_uniwgt_4t_32w_msa(uint8_t *src,
+static void hevc_hv_uniwgt_4t_32w_msa(const uint8_t *src,
                                       int32_t src_stride,
                                       uint8_t *dst,
                                       int32_t dst_stride,
@@ -5255,7 +5257,7 @@ static void hevc_hv_uniwgt_4t_32w_msa(uint8_t *src,
 #define UNIWGT_MC_COPY(WIDTH)                                                \
 void ff_hevc_put_hevc_uni_w_pel_pixels##WIDTH##_8_msa(uint8_t *dst,          \
                                                       ptrdiff_t dst_stride,  \
-                                                      uint8_t *src,          \
+                                                      const uint8_t *src,    \
                                                       ptrdiff_t src_stride,  \
                                                       int height,            \
                                                       int denom,             \
@@ -5286,7 +5288,7 @@ UNIWGT_MC_COPY(64);
 void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,        \
                                                          ptrdiff_t            \
                                                          dst_stride,          \
-                                                         uint8_t *src,        \
+                                                         const uint8_t *src,  \
                                                          ptrdiff_t            \
                                                          src_stride,          \
                                                          int height,          \
@@ -5344,7 +5346,7 @@ UNI_W_MC(epel, v, 32, 4, vt, my);
 #define UNI_W_MC_HV(PEL, WIDTH, TAP)                                          \
 void ff_hevc_put_hevc_uni_w_##PEL##_hv##WIDTH##_8_msa(uint8_t *dst,           \
                                                       ptrdiff_t dst_stride,   \
-                                                      uint8_t *src,           \
+                                                      const uint8_t *src,     \
                                                       ptrdiff_t src_stride,   \
                                                       int height,             \
                                                       int denom,              \
diff --git a/libavcodec/mips/hevcdsp_mips.h b/libavcodec/mips/hevcdsp_mips.h
index c84e08d160..a8f78ff73a 100644
--- a/libavcodec/mips/hevcdsp_mips.h
+++ b/libavcodec/mips/hevcdsp_mips.h
@@ -25,7 +25,7 @@
 
 #define MC(PEL, DIR, WIDTH)                                                 \
 void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst,            \
-                                                     uint8_t *src,          \
+                                                   const uint8_t *src,      \
                                                      ptrdiff_t src_stride,  \
                                                      int height,            \
                                                      intptr_t mx,           \
@@ -104,7 +104,7 @@ MC(epel, hv, 64);
 #define UNI_MC(PEL, DIR, WIDTH)                                                \
 void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,           \
                                                          ptrdiff_t dst_stride, \
-                                                         uint8_t *src,         \
+                                                         const uint8_t *src,   \
                                                          ptrdiff_t src_stride, \
                                                          int height,           \
                                                          intptr_t mx,          \
@@ -184,7 +184,7 @@ UNI_MC(epel, hv, 64);
 void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,    \
                                                            ptrdiff_t      \
                                                            dst_stride,    \
-                                                           uint8_t *src,  \
+                                                           const uint8_t *src,  \
                                                            ptrdiff_t      \
                                                            src_stride,    \
                                                            int height,    \
@@ -267,9 +267,9 @@ UNI_W_MC(epel, hv, 64);
 #define BI_MC(PEL, DIR, WIDTH)                                                 \
 void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,            \
                                                         ptrdiff_t dst_stride,  \
-                                                        uint8_t *src,          \
+                                                        const uint8_t *src,    \
                                                         ptrdiff_t src_stride,  \
-                                                        int16_t *src_16bit,    \
+                                                        const int16_t *src_16bit,    \
                                                         int height,            \
                                                         intptr_t mx,           \
                                                         intptr_t my,           \
@@ -348,10 +348,10 @@ BI_MC(epel, hv, 64);
 void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,          \
                                                           ptrdiff_t            \
                                                           dst_stride,          \
-                                                          uint8_t *src,        \
+                                                          const uint8_t *src,  \
                                                           ptrdiff_t            \
                                                           src_stride,          \
-                                                          int16_t *src_16bit,  \
+                                                          const int16_t *src_16bit, \
                                                           int height,          \
                                                           int denom,           \
                                                           int weight0,         \
@@ -433,32 +433,32 @@ BI_W_MC(epel, hv, 64);
 
 void ff_hevc_loop_filter_luma_h_8_msa(uint8_t *src,
                                       ptrdiff_t src_stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q);
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q);
 
 void ff_hevc_loop_filter_luma_v_8_msa(uint8_t *src,
                                       ptrdiff_t src_stride,
-                                      int32_t beta, int32_t *tc,
-                                      uint8_t *no_p, uint8_t *no_q);
+                                      int32_t beta, const int32_t *tc,
+                                      const uint8_t *no_p, const uint8_t *no_q);
 
 void ff_hevc_loop_filter_chroma_h_8_msa(uint8_t *src,
                                         ptrdiff_t src_stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q);
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q);
 
 void ff_hevc_loop_filter_chroma_v_8_msa(uint8_t *src,
                                         ptrdiff_t src_stride,
-                                        int32_t *tc, uint8_t *no_p,
-                                        uint8_t *no_q);
+                                        const int32_t *tc, const uint8_t *no_p,
+                                        const uint8_t *no_q);
 
-void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, uint8_t *src,
+void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, const uint8_t *src,
                                      ptrdiff_t stride_dst, ptrdiff_t stride_src,
-                                     int16_t *sao_offset_val, int sao_left_class,
+                                     const int16_t *sao_offset_val, int sao_left_class,
                                      int width, int height);
 
-void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, uint8_t *src,
+void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, const uint8_t *src,
                                    ptrdiff_t stride_dst,
-                                   int16_t *sao_offset_val,
+                                   const int16_t *sao_offset_val,
                                    int eo, int width, int height);
 
 void ff_hevc_idct_4x4_msa(int16_t *coeffs, int col_limit);
@@ -469,20 +469,20 @@ void ff_hevc_idct_dc_4x4_msa(int16_t *coeffs);
 void ff_hevc_idct_dc_8x8_msa(int16_t *coeffs);
 void ff_hevc_idct_dc_16x16_msa(int16_t *coeffs);
 void ff_hevc_idct_dc_32x32_msa(int16_t *coeffs);
-void ff_hevc_addblk_4x4_msa(uint8_t *dst, int16_t *pi16Coeffs,
+void ff_hevc_addblk_4x4_msa(uint8_t *dst, const int16_t *pi16Coeffs,
                             ptrdiff_t stride);
-void ff_hevc_addblk_8x8_msa(uint8_t *dst, int16_t *pi16Coeffs,
+void ff_hevc_addblk_8x8_msa(uint8_t *dst, const int16_t *pi16Coeffs,
                             ptrdiff_t stride);
-void ff_hevc_addblk_16x16_msa(uint8_t *dst, int16_t *pi16Coeffs,
+void ff_hevc_addblk_16x16_msa(uint8_t *dst, const int16_t *pi16Coeffs,
                               ptrdiff_t stride);
-void ff_hevc_addblk_32x32_msa(uint8_t *dst, int16_t *pi16Coeffs,
+void ff_hevc_addblk_32x32_msa(uint8_t *dst, const int16_t *pi16Coeffs,
                               ptrdiff_t stride);
 void ff_hevc_idct_luma_4x4_msa(int16_t *pi16Coeffs);
 
 /* Loongson optimization */
 #define L_MC(PEL, DIR, WIDTH, TYPE)                                          \
 void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_##TYPE(int16_t *dst,          \
-                                                      uint8_t *src,          \
+                                                      const uint8_t *src,    \
                                                       ptrdiff_t src_stride,  \
                                                       int height,            \
                                                       intptr_t mx,           \
@@ -509,9 +509,9 @@ L_MC(qpel, hv, 64, mmi);
 #define L_BI_MC(PEL, DIR, WIDTH, TYPE)                                          \
 void ff_hevc_put_hevc_##PEL##_bi_##DIR##WIDTH##_8_##TYPE(uint8_t *dst,          \
                                                          ptrdiff_t dst_stride,  \
-                                                         uint8_t *src,          \
+                                                         const uint8_t *src,    \
                                                          ptrdiff_t src_stride,  \
-                                                         int16_t *src2,         \
+                                                         const int16_t *src2,   \
                                                          int height,            \
                                                          intptr_t mx,           \
                                                          intptr_t my,           \
@@ -553,7 +553,7 @@ L_BI_MC(epel, hv, 32, mmi);
 #define L_UNI_MC(PEL, DIR, WIDTH, TYPE)                                         \
 void ff_hevc_put_hevc_##PEL##_uni_##DIR##WIDTH##_8_##TYPE(uint8_t *dst,         \
                                                           ptrdiff_t dst_stride, \
-                                                          uint8_t *src,         \
+                                                          const uint8_t *src,   \
                                                           ptrdiff_t src_stride, \
                                                           int height,           \
                                                           intptr_t mx,          \
diff --git a/libavcodec/mips/hevcdsp_mmi.c b/libavcodec/mips/hevcdsp_mmi.c
index 6583bef5da..0ea88a7c08 100644
--- a/libavcodec/mips/hevcdsp_mmi.c
+++ b/libavcodec/mips/hevcdsp_mmi.c
@@ -24,13 +24,13 @@
 #include "libavutil/mips/mmiutils.h"
 
 #define PUT_HEVC_QPEL_H(w, x_step, src_step, dst_step)                   \
-void ff_hevc_put_hevc_qpel_h##w##_8_mmi(int16_t *dst, uint8_t *_src,     \
+void ff_hevc_put_hevc_qpel_h##w##_8_mmi(int16_t *dst, const uint8_t *_src, \
                                         ptrdiff_t _srcstride,            \
                                         int height, intptr_t mx,         \
                                         intptr_t my, int width)          \
 {                                                                        \
     int x, y;                                                            \
-    pixel *src = (pixel*)_src - 3;                                       \
+    const pixel *src = (const pixel*)_src - 3;                           \
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);                    \
     double ftmp[15];                                                     \
     uint64_t rtmp[1];                                                    \
@@ -118,14 +118,14 @@ PUT_HEVC_QPEL_H(48, 12, -48, -96);
 PUT_HEVC_QPEL_H(64, 16, -64, -128);
 
 #define PUT_HEVC_QPEL_HV(w, x_step, src_step, dst_step)                  \
-void ff_hevc_put_hevc_qpel_hv##w##_8_mmi(int16_t *dst, uint8_t *_src,    \
+void ff_hevc_put_hevc_qpel_hv##w##_8_mmi(int16_t *dst, const uint8_t *_src,\
                                      ptrdiff_t _srcstride,               \
                                      int height, intptr_t mx,            \
                                      intptr_t my, int width)             \
 {                                                                        \
     int x, y;                                                            \
     const int8_t *filter;                                                \
-    pixel *src = (pixel*)_src;                                           \
+    const pixel *src = (const pixel*)_src;                               \
     ptrdiff_t srcstride = _srcstride / sizeof(pixel);                    \
     int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];         \
     int16_t *tmp = tmp_array;                                            \
@@ -303,14 +303,14 @@ PUT_HEVC_QPEL_HV(64, 16, -64, -128);
 #define PUT_HEVC_QPEL_BI_H(w, x_step, src_step, src2_step, dst_step)    \
 void ff_hevc_put_hevc_qpel_bi_h##w##_8_mmi(uint8_t *_dst,               \
                                            ptrdiff_t _dststride,        \
-                                           uint8_t *_src,               \
+                                           const uint8_t *_src,         \
                                            ptrdiff_t _srcstride,        \
-                                           int16_t *src2, int height,   \
+                                           const int16_t *src2, int height, \
                                            intptr_t mx, intptr_t my,    \
                                            int width)                   \
 {                                                                       \
     int x, y;                                                           \
-    pixel        *src       = (pixel*)_src - 3;                         \
+    const pixel  *src       = (const pixel*)_src - 3;                   \
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);               \
     pixel *dst          = (pixel *)_dst;                                \
     ptrdiff_t dststride = _dststride / sizeof(pixel);                   \
@@ -434,9 +434,9 @@ PUT_HEVC_QPEL_BI_H(64, 16, -64, -128, -64);
 #define PUT_HEVC_QPEL_BI_HV(w, x_step, src_step, src2_step, dst_step)   \
 void ff_hevc_put_hevc_qpel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
                                             ptrdiff_t _dststride,       \
-                                            uint8_t *_src,              \
+                                            const uint8_t *_src,        \
                                             ptrdiff_t _srcstride,       \
-                                            int16_t *src2, int height,  \
+                                            const int16_t *src2, int height, \
                                             intptr_t mx, intptr_t my,   \
                                             int width)                  \
 {                                                                       \
@@ -654,9 +654,9 @@ PUT_HEVC_QPEL_BI_HV(64, 16, -64, -128, -64);
 #define PUT_HEVC_EPEL_BI_HV(w, x_step, src_step, src2_step, dst_step)   \
 void ff_hevc_put_hevc_epel_bi_hv##w##_8_mmi(uint8_t *_dst,              \
                                             ptrdiff_t _dststride,       \
-                                            uint8_t *_src,              \
+                                            const uint8_t *_src,        \
                                             ptrdiff_t _srcstride,       \
-                                            int16_t *src2, int height,  \
+                                            const int16_t *src2, int height, \
                                             intptr_t mx, intptr_t my,   \
                                             int width)                  \
 {                                                                       \
@@ -835,9 +835,9 @@ PUT_HEVC_EPEL_BI_HV(32, 8, -32, -64, -32);
 #define PUT_HEVC_PEL_BI_PIXELS(w, x_step, src_step, dst_step, src2_step)  \
 void ff_hevc_put_hevc_pel_bi_pixels##w##_8_mmi(uint8_t *_dst,             \
                                                ptrdiff_t _dststride,      \
-                                               uint8_t *_src,             \
+                                               const uint8_t *_src,       \
                                                ptrdiff_t _srcstride,      \
-                                               int16_t *src2, int height, \
+                                               const int16_t *src2, int height, \
                                                intptr_t mx, intptr_t my,  \
                                                int width)                 \
 {                                                                         \
@@ -945,7 +945,7 @@ PUT_HEVC_PEL_BI_PIXELS(64, 8, -64, -64, -128);
 #define PUT_HEVC_QPEL_UNI_HV(w, x_step, src_step, dst_step, tmp_step)   \
 void ff_hevc_put_hevc_qpel_uni_hv##w##_8_mmi(uint8_t *_dst,             \
                                              ptrdiff_t _dststride,      \
-                                             uint8_t *_src,             \
+                                             const uint8_t *_src,       \
                                              ptrdiff_t _srcstride,      \
                                              int height,                \
                                              intptr_t mx, intptr_t my,  \
diff --git a/libavcodec/mips/hevcdsp_msa.c b/libavcodec/mips/hevcdsp_msa.c
index 2c57ec857a..8841a31369 100644
--- a/libavcodec/mips/hevcdsp_msa.c
+++ b/libavcodec/mips/hevcdsp_msa.c
@@ -29,7 +29,7 @@ static const uint8_t ff_hevc_mask_arr[16 * 2] __attribute__((aligned(0x40))) = {
     0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20
 };
 
-static void hevc_copy_4w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_4w_msa(const uint8_t *src, int32_t src_stride,
                              int16_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -77,7 +77,7 @@ static void hevc_copy_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_6w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_6w_msa(const uint8_t *src, int32_t src_stride,
                              int16_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -101,7 +101,7 @@ static void hevc_copy_6w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_8w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_8w_msa(const uint8_t *src, int32_t src_stride,
                              int16_t *dst, int32_t dst_stride,
                              int32_t height)
 {
@@ -162,7 +162,7 @@ static void hevc_copy_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_12w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_12w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -199,7 +199,7 @@ static void hevc_copy_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_16w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_16w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -290,7 +290,7 @@ static void hevc_copy_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_24w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_24w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -319,7 +319,7 @@ static void hevc_copy_24w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_32w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_32w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -357,7 +357,7 @@ static void hevc_copy_32w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_48w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_48w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -408,7 +408,7 @@ static void hevc_copy_48w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_copy_64w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_copy_64w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)
 {
@@ -445,7 +445,7 @@ static void hevc_copy_64w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_4w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter, int32_t height)
 {
@@ -500,7 +500,7 @@ static void hevc_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_8w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_8w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter, int32_t height)
 {
@@ -555,7 +555,7 @@ static void hevc_hz_8t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_12w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_12w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -630,7 +630,7 @@ static void hevc_hz_8t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_16w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_16w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -687,7 +687,7 @@ static void hevc_hz_8t_16w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_24w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_24w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -762,7 +762,7 @@ static void hevc_hz_8t_24w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_32w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_32w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -822,7 +822,7 @@ static void hevc_hz_8t_32w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_48w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_48w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -893,7 +893,7 @@ static void hevc_hz_8t_48w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hz_8t_64w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hz_8t_64w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -987,7 +987,7 @@ static void hevc_hz_8t_64w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_vt_8t_4w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_4w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter, int32_t height)
 {
@@ -1057,7 +1057,7 @@ static void hevc_vt_8t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_vt_8t_8w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_8w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter, int32_t height)
 {
@@ -1120,7 +1120,7 @@ static void hevc_vt_8t_8w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_vt_8t_12w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_12w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1207,7 +1207,7 @@ static void hevc_vt_8t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_vt_8t_16multx4mult_msa(uint8_t *src,
+static void hevc_vt_8t_16multx4mult_msa(const uint8_t *src,
                                         int32_t src_stride,
                                         int16_t *dst,
                                         int32_t dst_stride,
@@ -1215,7 +1215,7 @@ static void hevc_vt_8t_16multx4mult_msa(uint8_t *src,
                                         int32_t height,
                                         int32_t width)
 {
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     int16_t *dst_tmp;
     int32_t loop_cnt, cnt;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
@@ -1315,7 +1315,7 @@ static void hevc_vt_8t_16multx4mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_8t_16w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_16w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1323,7 +1323,7 @@ static void hevc_vt_8t_16w_msa(uint8_t *src, int32_t src_stride,
                                 filter, height, 16);
 }
 
-static void hevc_vt_8t_24w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_24w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1333,7 +1333,7 @@ static void hevc_vt_8t_24w_msa(uint8_t *src, int32_t src_stride,
                       filter, height);
 }
 
-static void hevc_vt_8t_32w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_32w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1341,7 +1341,7 @@ static void hevc_vt_8t_32w_msa(uint8_t *src, int32_t src_stride,
                                 filter, height, 32);
 }
 
-static void hevc_vt_8t_48w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_48w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1349,7 +1349,7 @@ static void hevc_vt_8t_48w_msa(uint8_t *src, int32_t src_stride,
                                 filter, height, 48);
 }
 
-static void hevc_vt_8t_64w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_8t_64w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter, int32_t height)
 {
@@ -1357,7 +1357,7 @@ static void hevc_vt_8t_64w_msa(uint8_t *src, int32_t src_stride,
                                 filter, height, 64);
 }
 
-static void hevc_hv_8t_4w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_4w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter_x, const int8_t *filter_y,
                               int32_t height)
@@ -1464,7 +1464,7 @@ static void hevc_hv_8t_4w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hv_8t_8multx1mult_msa(uint8_t *src,
+static void hevc_hv_8t_8multx1mult_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -1473,7 +1473,7 @@ static void hevc_hv_8t_8multx1mult_msa(uint8_t *src,
                                        int32_t height, int32_t width)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     int16_t *dst_tmp;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
     v8i16 filt0, filt1, filt2, filt3;
@@ -1591,7 +1591,7 @@ static void hevc_hv_8t_8multx1mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_8t_8w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_8w_msa(const uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               const int8_t *filter_x, const int8_t *filter_y,
                               int32_t height)
@@ -1600,13 +1600,13 @@ static void hevc_hv_8t_8w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 8);
 }
 
-static void hevc_hv_8t_12w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_12w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     int16_t *dst_tmp;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 mask0, mask1, mask2, mask3, mask4, mask5, mask6, mask7;
@@ -1795,7 +1795,7 @@ static void hevc_hv_8t_12w_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hv_8t_16w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_16w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
@@ -1804,7 +1804,7 @@ static void hevc_hv_8t_16w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 16);
 }
 
-static void hevc_hv_8t_24w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_24w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
@@ -1813,7 +1813,7 @@ static void hevc_hv_8t_24w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 24);
 }
 
-static void hevc_hv_8t_32w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_32w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
@@ -1822,7 +1822,7 @@ static void hevc_hv_8t_32w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 32);
 }
 
-static void hevc_hv_8t_48w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_48w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
@@ -1831,7 +1831,7 @@ static void hevc_hv_8t_48w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 48);
 }
 
-static void hevc_hv_8t_64w_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_8t_64w_msa(const uint8_t *src, int32_t src_stride,
                                int16_t *dst, int32_t dst_stride,
                                const int8_t *filter_x, const int8_t *filter_y,
                                int32_t height)
@@ -1840,7 +1840,7 @@ static void hevc_hv_8t_64w_msa(uint8_t *src, int32_t src_stride,
                                filter_x, filter_y, height, 64);
 }
 
-static void hevc_hz_4t_4x2_msa(uint8_t *src,
+static void hevc_hz_4t_4x2_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -1873,7 +1873,7 @@ static void hevc_hz_4t_4x2_msa(uint8_t *src,
     ST_D2(dst0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_4t_4x4_msa(uint8_t *src,
+static void hevc_hz_4t_4x4_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -1910,7 +1910,7 @@ static void hevc_hz_4t_4x4_msa(uint8_t *src,
     ST_D4(dst0, dst1, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hz_4t_4x8multiple_msa(uint8_t *src,
+static void hevc_hz_4t_4x8multiple_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -1959,7 +1959,7 @@ static void hevc_hz_4t_4x8multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_4w_msa(uint8_t *src,
+static void hevc_hz_4t_4w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -1976,7 +1976,7 @@ static void hevc_hz_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_6w_msa(uint8_t *src,
+static void hevc_hz_4t_6w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -2047,7 +2047,7 @@ static void hevc_hz_4t_6w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_8x2multiple_msa(uint8_t *src,
+static void hevc_hz_4t_8x2multiple_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -2091,7 +2091,7 @@ static void hevc_hz_4t_8x2multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_8x4multiple_msa(uint8_t *src,
+static void hevc_hz_4t_8x4multiple_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -2144,7 +2144,7 @@ static void hevc_hz_4t_8x4multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_8w_msa(uint8_t *src,
+static void hevc_hz_4t_8w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -2160,7 +2160,7 @@ static void hevc_hz_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_12w_msa(uint8_t *src,
+static void hevc_hz_4t_12w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2221,7 +2221,7 @@ static void hevc_hz_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_16w_msa(uint8_t *src,
+static void hevc_hz_4t_16w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2293,7 +2293,7 @@ static void hevc_hz_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_24w_msa(uint8_t *src,
+static void hevc_hz_4t_24w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2394,7 +2394,7 @@ static void hevc_hz_4t_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hz_4t_32w_msa(uint8_t *src,
+static void hevc_hz_4t_32w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2446,7 +2446,7 @@ static void hevc_hz_4t_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_4x2_msa(uint8_t *src,
+static void hevc_vt_4t_4x2_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2479,7 +2479,7 @@ static void hevc_vt_4t_4x2_msa(uint8_t *src,
     ST_D2(dst10, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_4t_4x4_msa(uint8_t *src,
+static void hevc_vt_4t_4x4_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2516,7 +2516,7 @@ static void hevc_vt_4t_4x4_msa(uint8_t *src,
     ST_D4(dst10, dst32, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_4t_4x8_msa(uint8_t *src,
+static void hevc_vt_4t_4x8_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2565,7 +2565,7 @@ static void hevc_vt_4t_4x8_msa(uint8_t *src,
     ST_D8(dst10, dst32, dst54, dst76, 0, 1, 0, 1, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_4t_4x16_msa(uint8_t *src, int32_t src_stride,
+static void hevc_vt_4t_4x16_msa(const uint8_t *src, int32_t src_stride,
                                 int16_t *dst, int32_t dst_stride,
                                 const int8_t *filter, int32_t height)
 {
@@ -2635,7 +2635,7 @@ static void hevc_vt_4t_4x16_msa(uint8_t *src, int32_t src_stride,
     ST_D8(dst10, dst32, dst54, dst76, 0, 1, 0, 1, 0, 1, 0, 1, dst, dst_stride);
 }
 
-static void hevc_vt_4t_4w_msa(uint8_t *src,
+static void hevc_vt_4t_4w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -2653,7 +2653,7 @@ static void hevc_vt_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_6w_msa(uint8_t *src,
+static void hevc_vt_4t_6w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -2727,7 +2727,7 @@ static void hevc_vt_4t_6w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_8x2_msa(uint8_t *src,
+static void hevc_vt_4t_8x2_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2762,7 +2762,7 @@ static void hevc_vt_4t_8x2_msa(uint8_t *src,
     ST_SH2(dst0_r, dst1_r, dst, dst_stride);
 }
 
-static void hevc_vt_4t_8x6_msa(uint8_t *src,
+static void hevc_vt_4t_8x6_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2824,7 +2824,7 @@ static void hevc_vt_4t_8x6_msa(uint8_t *src,
     ST_SH2(dst0_r, dst1_r, dst, dst_stride);
 }
 
-static void hevc_vt_4t_8x4multiple_msa(uint8_t *src,
+static void hevc_vt_4t_8x4multiple_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -2873,7 +2873,7 @@ static void hevc_vt_4t_8x4multiple_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_8w_msa(uint8_t *src,
+static void hevc_vt_4t_8w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -2890,7 +2890,7 @@ static void hevc_vt_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_12w_msa(uint8_t *src,
+static void hevc_vt_4t_12w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -2961,7 +2961,7 @@ static void hevc_vt_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_16w_msa(uint8_t *src,
+static void hevc_vt_4t_16w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3028,7 +3028,7 @@ static void hevc_vt_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_24w_msa(uint8_t *src,
+static void hevc_vt_4t_24w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3126,7 +3126,7 @@ static void hevc_vt_4t_24w_msa(uint8_t *src,
     }
 }
 
-static void hevc_vt_4t_32w_msa(uint8_t *src,
+static void hevc_vt_4t_32w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3232,7 +3232,7 @@ static void hevc_vt_4t_32w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_4x2_msa(uint8_t *src,
+static void hevc_hv_4t_4x2_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3286,7 +3286,7 @@ static void hevc_hv_4t_4x2_msa(uint8_t *src,
     ST_D2(dst0, 0, 1, dst, dst_stride);
 }
 
-static void hevc_hv_4t_4x4_msa(uint8_t *src,
+static void hevc_hv_4t_4x4_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3349,7 +3349,7 @@ static void hevc_hv_4t_4x4_msa(uint8_t *src,
 }
 
 
-static void hevc_hv_4t_4multx8mult_msa(uint8_t *src,
+static void hevc_hv_4t_4multx8mult_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -3445,7 +3445,7 @@ static void hevc_hv_4t_4multx8mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_4w_msa(uint8_t *src,
+static void hevc_hv_4t_4w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -3465,7 +3465,7 @@ static void hevc_hv_4t_4w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_6w_msa(uint8_t *src,
+static void hevc_hv_4t_6w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -3590,7 +3590,7 @@ static void hevc_hv_4t_6w_msa(uint8_t *src,
     ST_W4(tmp5, 0, 1, 2, 3, dst + 4, dst_stride);
 }
 
-static void hevc_hv_4t_8x2_msa(uint8_t *src,
+static void hevc_hv_4t_8x2_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3657,7 +3657,7 @@ static void hevc_hv_4t_8x2_msa(uint8_t *src,
     ST_SW2(dst0_r, dst1_r, dst, dst_stride);
 }
 
-static void hevc_hv_4t_8multx4_msa(uint8_t *src, int32_t src_stride,
+static void hevc_hv_4t_8multx4_msa(const uint8_t *src, int32_t src_stride,
                                    int16_t *dst, int32_t dst_stride,
                                    const int8_t *filter_x,
                                    const int8_t *filter_y, int32_t width8mult)
@@ -3741,7 +3741,7 @@ static void hevc_hv_4t_8multx4_msa(uint8_t *src, int32_t src_stride,
     }
 }
 
-static void hevc_hv_4t_8x6_msa(uint8_t *src,
+static void hevc_hv_4t_8x6_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -3852,7 +3852,7 @@ static void hevc_hv_4t_8x6_msa(uint8_t *src,
     ST_SW2(dst4_r, dst5_r, dst, dst_stride);
 }
 
-static void hevc_hv_4t_8multx4mult_msa(uint8_t *src,
+static void hevc_hv_4t_8multx4mult_msa(const uint8_t *src,
                                        int32_t src_stride,
                                        int16_t *dst,
                                        int32_t dst_stride,
@@ -3862,7 +3862,7 @@ static void hevc_hv_4t_8multx4mult_msa(uint8_t *src,
                                        int32_t width8mult)
 {
     uint32_t loop_cnt, cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     int16_t *dst_tmp;
     v16i8 src0, src1, src2, src3, src4, src5, src6;
     v8i16 filt0, filt1;
@@ -3969,7 +3969,7 @@ static void hevc_hv_4t_8multx4mult_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_8w_msa(uint8_t *src,
+static void hevc_hv_4t_8w_msa(const uint8_t *src,
                               int32_t src_stride,
                               int16_t *dst,
                               int32_t dst_stride,
@@ -3993,7 +3993,7 @@ static void hevc_hv_4t_8w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_12w_msa(uint8_t *src,
+static void hevc_hv_4t_12w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -4002,7 +4002,7 @@ static void hevc_hv_4t_12w_msa(uint8_t *src,
                                int32_t height)
 {
     uint32_t loop_cnt;
-    uint8_t *src_tmp;
+    const uint8_t *src_tmp;
     int16_t *dst_tmp;
     v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
     v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
@@ -4166,7 +4166,7 @@ static void hevc_hv_4t_12w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_16w_msa(uint8_t *src,
+static void hevc_hv_4t_16w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -4183,7 +4183,7 @@ static void hevc_hv_4t_16w_msa(uint8_t *src,
     }
 }
 
-static void hevc_hv_4t_24w_msa(uint8_t *src,
+static void hevc_hv_4t_24w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -4195,7 +4195,7 @@ static void hevc_hv_4t_24w_msa(uint8_t *src,
                                filter_x, filter_y, height, 3);
 }
 
-static void hevc_hv_4t_32w_msa(uint8_t *src,
+static void hevc_hv_4t_32w_msa(const uint8_t *src,
                                int32_t src_stride,
                                int16_t *dst,
                                int32_t dst_stride,
@@ -4209,7 +4209,7 @@ static void hevc_hv_4t_32w_msa(uint8_t *src,
 
 #define MC_COPY(WIDTH)                                                    \
 void ff_hevc_put_hevc_pel_pixels##WIDTH##_8_msa(int16_t *dst,             \
-                                                uint8_t *src,             \
+                                                const uint8_t *src,       \
                                                 ptrdiff_t src_stride,     \
                                                 int height,               \
                                                 intptr_t mx,              \
@@ -4233,7 +4233,7 @@ MC_COPY(64);
 
 #define MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR)                          \
 void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst,          \
-                                                   uint8_t *src,          \
+                                                   const uint8_t *src,    \
                                                    ptrdiff_t src_stride,  \
                                                    int height,            \
                                                    intptr_t mx,           \
@@ -4284,7 +4284,7 @@ MC(epel, v, 32, 4, vt, my);
 
 #define MC_HV(PEL, WIDTH, TAP)                                          \
 void ff_hevc_put_hevc_##PEL##_hv##WIDTH##_8_msa(int16_t *dst,           \
-                                                uint8_t *src,           \
+                                                const uint8_t *src,     \
                                                 ptrdiff_t src_stride,   \
                                                 int height,             \
                                                 intptr_t mx,            \
diff --git a/libavcodec/x86/hevc_add_res.asm b/libavcodec/x86/hevc_add_res.asm
index c6c40078a0..3ecbd4269c 100644
--- a/libavcodec/x86/hevc_add_res.asm
+++ b/libavcodec/x86/hevc_add_res.asm
@@ -47,7 +47,7 @@ cextern pw_1023
 
 
 INIT_MMX mmxext
-; void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, int16_t *res, ptrdiff_t stride)
+; void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
 cglobal hevc_add_residual_4_8, 3, 3, 6
     pxor              m4, m4
     ADD_RES_MMX_4_8
@@ -118,7 +118,7 @@ cglobal hevc_add_residual_4_8, 3, 3, 6
 
 
 %macro TRANSFORM_ADD_8 0
-; void ff_hevc_add_residual_8_8_<opt>(uint8_t *dst, int16_t *res, ptrdiff_t stride)
+; void ff_hevc_add_residual_8_8_<opt>(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
 cglobal hevc_add_residual_8_8, 3, 4, 8
     pxor              m4, m4
     lea               r3, [r2*3]
@@ -128,7 +128,7 @@ cglobal hevc_add_residual_8_8, 3, 4, 8
     ADD_RES_SSE_8_8
     RET
 
-; void ff_hevc_add_residual_16_8_<opt>(uint8_t *dst, int16_t *res, ptrdiff_t stride)
+; void ff_hevc_add_residual_16_8_<opt>(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
 cglobal hevc_add_residual_16_8, 3, 5, 7
     pxor                m0, m0
     lea                 r3, [r2*3]
@@ -142,7 +142,7 @@ cglobal hevc_add_residual_16_8, 3, 5, 7
     jg .loop
     RET
 
-; void ff_hevc_add_residual_32_8_<opt>(uint8_t *dst, int16_t *res, ptrdiff_t stride)
+; void ff_hevc_add_residual_32_8_<opt>(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
 cglobal hevc_add_residual_32_8, 3, 5, 7
     pxor                m0, m0
     mov                r4d, 16
@@ -163,7 +163,7 @@ TRANSFORM_ADD_8
 
 %if HAVE_AVX2_EXTERNAL
 INIT_YMM avx2
-; void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, int16_t *res, ptrdiff_t stride)
+; void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
 cglobal hevc_add_residual_32_8, 3, 5, 7
     pxor                 m0, m0
     lea                  r3, [r2*3]
@@ -289,7 +289,7 @@ cglobal hevc_add_residual_32_8, 3, 5, 7
     mova      [%1+%2+32], m3
 %endmacro
 
-; void ff_hevc_add_residual_<4|8|16|32>_10(pixel *dst, int16_t *block, ptrdiff_t stride)
+; void ff_hevc_add_residual_<4|8|16|32>_10(pixel *dst, const int16_t *block, ptrdiff_t stride)
 INIT_MMX mmxext
 cglobal hevc_add_residual_4_10, 3, 3, 6
     pxor              m2, m2
diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm
index e159adccc7..eb267453fe 100644
--- a/libavcodec/x86/hevc_mc.asm
+++ b/libavcodec/x86/hevc_mc.asm
@@ -711,7 +711,7 @@ SECTION .text
 
 ; ******************************
 ; void put_hevc_mc_pixels(int16_t *dst, ptrdiff_t dststride,
-;                         uint8_t *_src, ptrdiff_t _srcstride,
+;                         const uint8_t *_src, ptrdiff_t _srcstride,
 ;                         int height, int mx, int my)
 ; ******************************
 
@@ -765,7 +765,7 @@ cglobal hevc_put_hevc_bi_pel_pixels%1_%2, 6, 6, 6, dst, dststride, src, srcstrid
 
 ; ******************************
 ; void put_hevc_epel_hX(int16_t *dst, ptrdiff_t dststride,
-;                       uint8_t *_src, ptrdiff_t _srcstride,
+;                       const uint8_t *_src, ptrdiff_t _srcstride,
 ;                       int height, int mx, int my, int width);
 ; ******************************
 
@@ -820,7 +820,7 @@ cglobal hevc_put_hevc_bi_epel_h%1_%2, 7, 8, XMM_REGS, dst, dststride, src, srcst
 
 ; ******************************
 ; void put_hevc_epel_v(int16_t *dst, ptrdiff_t dststride,
-;                      uint8_t *_src, ptrdiff_t _srcstride,
+;                      const uint8_t *_src, ptrdiff_t _srcstride,
 ;                      int height, int mx, int my, int width)
 ; ******************************
 
@@ -877,7 +877,7 @@ cglobal hevc_put_hevc_bi_epel_v%1_%2, 6, 8, XMM_REGS, dst, dststride, src, srcst
 
 ; ******************************
 ; void put_hevc_epel_hv(int16_t *dst, ptrdiff_t dststride,
-;                       uint8_t *_src, ptrdiff_t _srcstride,
+;                       const uint8_t *_src, ptrdiff_t _srcstride,
 ;                       int height, int mx, int my, int width)
 ; ******************************
 
@@ -1088,7 +1088,7 @@ cglobal hevc_put_hevc_bi_epel_hv%1_%2, 8, 9, 16, dst, dststride, src, srcstride,
 
 ; ******************************
 ; void put_hevc_qpel_hX_X_X(int16_t *dst, ptrdiff_t dststride,
-;                       uint8_t *_src, ptrdiff_t _srcstride,
+;                           const uint8_t *_src, ptrdiff_t _srcstride,
 ;                       int height, int mx, int my, int width)
 ; ******************************
 
@@ -1144,7 +1144,7 @@ cglobal hevc_put_hevc_bi_qpel_h%1_%2, 7, 8, 16 , dst, dststride, src, srcstride,
 
 ; ******************************
 ; void put_hevc_qpel_vX_X_X(int16_t *dst, ptrdiff_t dststride,
-;                       uint8_t *_src, ptrdiff_t _srcstride,
+;                           const uint8_t *_src, ptrdiff_t _srcstride,
 ;                       int height, int mx, int my, int width)
 ; ******************************
 
@@ -1206,7 +1206,7 @@ cglobal hevc_put_hevc_bi_qpel_v%1_%2, 6, 10, 16, dst, dststride, src, srcstride,
 
 ; ******************************
 ; void put_hevc_qpel_hvX_X(int16_t *dst, ptrdiff_t dststride,
-;                       uint8_t *_src, ptrdiff_t _srcstride,
+;                          const uint8_t *_src, ptrdiff_t _srcstride,
 ;                       int height, int mx, int my)
 ; ******************************
 %macro HEVC_PUT_HEVC_QPEL_HV 2
diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm
index 756adfee57..2eb8924da8 100644
--- a/libavcodec/x86/hevc_sao.asm
+++ b/libavcodec/x86/hevc_sao.asm
@@ -119,7 +119,7 @@ DEFINE_ARGS dst, src, dststride, srcstride, offset, height
 %endif ; ARCH
 %endmacro
 
-;void ff_hevc_sao_band_filter_<width>_8_<opt>(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
+;void ff_hevc_sao_band_filter_<width>_8_<opt>(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
 ;                                             int16_t *sao_offset_val, int sao_left_class, int width, int height);
 %macro HEVC_SAO_BAND_FILTER 2
 cglobal hevc_sao_band_filter_%1_8, 6, 6, 15, 7*mmsize*ARCH_X86_32, dst, src, dststride, srcstride, offset, left
diff --git a/libavcodec/x86/hevc_sao_10bit.asm b/libavcodec/x86/hevc_sao_10bit.asm
index b30583dd2f..38005740e5 100644
--- a/libavcodec/x86/hevc_sao_10bit.asm
+++ b/libavcodec/x86/hevc_sao_10bit.asm
@@ -92,7 +92,7 @@ DEFINE_ARGS dst, src, dststride, srcstride, offset, height
     mov          heightd, r7m
 %endmacro
 
-;void ff_hevc_sao_band_filter_<width>_<depth>_<opt>(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
+;void ff_hevc_sao_band_filter_<width>_<depth>_<opt>(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
 ;                                                   int16_t *sao_offset_val, int sao_left_class, int width, int height);
 %macro HEVC_SAO_BAND_FILTER 3
 cglobal hevc_sao_band_filter_%2_%1, 6, 6, 15, 7*mmsize*ARCH_X86_32, dst, src, dststride, srcstride, offset, left
diff --git a/libavcodec/x86/hevcdsp.h b/libavcodec/x86/hevcdsp.h
index 24e35bc032..037519fad4 100644
--- a/libavcodec/x86/hevcdsp.h
+++ b/libavcodec/x86/hevcdsp.h
@@ -38,11 +38,11 @@ dst ## _bi_w[idx1][idx2][idx3] = ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##
 
 
 #define PEL_PROTOTYPE(name, D, opt) \
-void ff_hevc_put_hevc_ ## name ## _ ## D ## _##opt(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width); \
-void ff_hevc_put_hevc_bi_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width); \
-void ff_hevc_put_hevc_uni_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width); \
-void ff_hevc_put_hevc_uni_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width); \
-void ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
+void ff_hevc_put_hevc_ ## name ## _ ## D ## _##opt(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width); \
+void ff_hevc_put_hevc_bi_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width); \
+void ff_hevc_put_hevc_uni_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width); \
+void ff_hevc_put_hevc_uni_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width); \
+void ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
 
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -71,8 +71,8 @@ void ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t
         PEL_PROTOTYPE(fname##64, bitd, opt)
 
 #define WEIGHTING_PROTOTYPE(width, bitd, opt) \
-void ff_hevc_put_hevc_uni_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, int16_t *_src, int height, int denom,  int _wx, int _ox); \
-void ff_hevc_put_hevc_bi_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, int16_t *_src, int16_t *_src2, int height, int denom,  int _wx0,  int _wx1, int _ox0, int _ox1)
+void ff_hevc_put_hevc_uni_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, const int16_t *_src, int height, int denom,  int _wx, int _ox); \
+void ff_hevc_put_hevc_bi_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, const int16_t *_src, const int16_t *_src2, int height, int denom,  int _wx0,  int _wx1, int _ox0, int _ox1)
 
 #define WEIGHTING_PROTOTYPES(bitd, opt) \
         WEIGHTING_PROTOTYPE(2, bitd, opt); \
@@ -94,38 +94,38 @@ EPEL_PROTOTYPES(pel_pixels ,  8, sse4);
 EPEL_PROTOTYPES(pel_pixels , 10, sse4);
 EPEL_PROTOTYPES(pel_pixels , 12, sse4);
 
-void ff_hevc_put_hevc_pel_pixels16_8_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels24_8_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels32_8_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels48_8_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels64_8_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels16_8_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels24_8_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels32_8_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels48_8_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels64_8_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
 
-void ff_hevc_put_hevc_pel_pixels16_10_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels24_10_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels32_10_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels48_10_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_pel_pixels64_10_avx2(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels16_10_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels24_10_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels32_10_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels48_10_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_pel_pixels64_10_avx2(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
 
 
 
-void ff_hevc_put_hevc_uni_pel_pixels32_8_avx2(uint8_t *dst, ptrdiff_t dststride,uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_uni_pel_pixels48_8_avx2(uint8_t *dst, ptrdiff_t dststride,uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_uni_pel_pixels64_8_avx2(uint8_t *dst, ptrdiff_t dststride,uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
-void ff_hevc_put_hevc_uni_pel_pixels96_8_avx2(uint8_t *dst, ptrdiff_t dststride,uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width); //used for 10bit
-void ff_hevc_put_hevc_uni_pel_pixels128_8_avx2(uint8_t *dst, ptrdiff_t dststride,uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);//used for 10bit
+void ff_hevc_put_hevc_uni_pel_pixels32_8_avx2(uint8_t *dst, ptrdiff_t dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_uni_pel_pixels48_8_avx2(uint8_t *dst, ptrdiff_t dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_uni_pel_pixels64_8_avx2(uint8_t *dst, ptrdiff_t dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);
+void ff_hevc_put_hevc_uni_pel_pixels96_8_avx2(uint8_t *dst, ptrdiff_t dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width); //used for 10bit
+void ff_hevc_put_hevc_uni_pel_pixels128_8_avx2(uint8_t *dst, ptrdiff_t dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width);//used for 10bit
 
 
-void ff_hevc_put_hevc_bi_pel_pixels16_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels24_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels32_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels48_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels64_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels16_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels24_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels32_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels48_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels64_8_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
 
-void ff_hevc_put_hevc_bi_pel_pixels16_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels24_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels32_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels48_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_bi_pel_pixels64_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels16_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels24_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels32_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels48_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_bi_pel_pixels64_10_avx2(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width);
 
 ///////////////////////////////////////////////////////////////////////////////
 // EPEL
@@ -233,34 +233,34 @@ WEIGHTING_PROTOTYPES(8, sse4);
 WEIGHTING_PROTOTYPES(10, sse4);
 WEIGHTING_PROTOTYPES(12, sse4);
 
-void ff_hevc_put_hevc_qpel_h4_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_qpel_h8_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_qpel_h16_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_qpel_h32_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_qpel_h64_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
-void ff_hevc_put_hevc_qpel_hv8_8_avx512icl(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_h4_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_h8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_h16_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_h32_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_h64_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_hevc_qpel_hv8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
 
 ///////////////////////////////////////////////////////////////////////////////
 // TRANSFORM_ADD
 ///////////////////////////////////////////////////////////////////////////////
 
-void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_8_8_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_16_8_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_32_8_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_8_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_16_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_32_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
-void ff_hevc_add_residual_8_8_avx(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_16_8_avx(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_32_8_avx(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_8_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_16_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_32_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
-void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
-void ff_hevc_add_residual_4_10_mmxext(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_8_10_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_16_10_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_32_10_sse2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_4_10_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_8_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_16_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_32_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
-void ff_hevc_add_residual_16_10_avx2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
-void ff_hevc_add_residual_32_10_avx2(uint8_t *dst, int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_16_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
+void ff_hevc_add_residual_32_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
 
 #endif // AVCODEC_X86_HEVCDSP_H
diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index f7a5b28bec..6f45e5e0db 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -29,10 +29,10 @@
 #include "libavcodec/x86/hevcdsp.h"
 
 #define LFC_FUNC(DIR, DEPTH, OPT) \
-void ff_hevc_ ## DIR ## _loop_filter_chroma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int *tc, uint8_t *no_p, uint8_t *no_q);
+void ff_hevc_ ## DIR ## _loop_filter_chroma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, const int *tc, const uint8_t *no_p, const uint8_t *no_q);
 
 #define LFL_FUNC(DIR, DEPTH, OPT) \
-void ff_hevc_ ## DIR ## _loop_filter_luma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int beta, int *tc, uint8_t *no_p, uint8_t *no_q);
+void ff_hevc_ ## DIR ## _loop_filter_luma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int beta, const int *tc, const uint8_t *no_p, const uint8_t *no_q);
 
 #define LFC_FUNCS(type, depth, opt) \
     LFC_FUNC(h, depth, opt)  \
@@ -85,46 +85,42 @@ IDCT_FUNCS(avx)
 
 #define mc_rep_func(name, bitd, step, W, opt) \
 void ff_hevc_put_hevc_##name##W##_##bitd##_##opt(int16_t *_dst,                                                 \
-                                                uint8_t *_src, ptrdiff_t _srcstride, int height,                \
+                                                 const uint8_t *_src, ptrdiff_t _srcstride, int height,         \
                                                 intptr_t mx, intptr_t my, int width)                            \
 {                                                                                                               \
     int i;                                                                                                      \
-    uint8_t *src;                                                                                               \
     int16_t *dst;                                                                                               \
     for (i = 0; i < W; i += step) {                                                                             \
-        src  = _src + (i * ((bitd + 7) / 8));                                                                   \
+        const uint8_t *src  = _src + (i * ((bitd + 7) / 8));                                                    \
         dst = _dst + i;                                                                                         \
         ff_hevc_put_hevc_##name##step##_##bitd##_##opt(dst, src, _srcstride, height, mx, my, width);            \
     }                                                                                                           \
 }
 #define mc_rep_uni_func(name, bitd, step, W, opt) \
 void ff_hevc_put_hevc_uni_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride,                        \
-                                                    uint8_t *_src, ptrdiff_t _srcstride, int height,            \
+                                                     const uint8_t *_src, ptrdiff_t _srcstride, int height,     \
                                                     intptr_t mx, intptr_t my, int width)                        \
 {                                                                                                               \
     int i;                                                                                                      \
-    uint8_t *src;                                                                                               \
     uint8_t *dst;                                                                                               \
     for (i = 0; i < W; i += step) {                                                                             \
-        src = _src + (i * ((bitd + 7) / 8));                                                                    \
+        const uint8_t *src = _src + (i * ((bitd + 7) / 8));                                                     \
         dst = _dst + (i * ((bitd + 7) / 8));                                                                    \
         ff_hevc_put_hevc_uni_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride,                     \
                                                           height, mx, my, width);                               \
     }                                                                                                           \
 }
 #define mc_rep_bi_func(name, bitd, step, W, opt) \
-void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, uint8_t *_src,          \
-                                                   ptrdiff_t _srcstride, int16_t* _src2,                        \
+void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, const uint8_t *_src,    \
+                                                    ptrdiff_t _srcstride, const int16_t *_src2,                 \
                                                    int height, intptr_t mx, intptr_t my, int width)             \
 {                                                                                                               \
     int i;                                                                                                      \
-    uint8_t  *src;                                                                                              \
     uint8_t  *dst;                                                                                              \
-    int16_t  *src2;                                                                                             \
     for (i = 0; i < W ; i += step) {                                                                            \
-        src  = _src + (i * ((bitd + 7) / 8));                                                                   \
+        const uint8_t *src  = _src + (i * ((bitd + 7) / 8));                                                    \
+        const int16_t *src2 = _src2 + i;                                                                        \
         dst  = _dst + (i * ((bitd + 7) / 8));                                                                   \
-        src2 = _src2 + i;                                                                                       \
         ff_hevc_put_hevc_bi_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, src2,                \
                                                           height, mx, my, width);                               \
     }                                                                                                           \
@@ -137,7 +133,7 @@ void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dst
 
 #define mc_rep_func2(name, bitd, step1, step2, W, opt) \
 void ff_hevc_put_hevc_##name##W##_##bitd##_##opt(int16_t *dst,                                                  \
-                                                 uint8_t *src, ptrdiff_t _srcstride, int height,                \
+                                                 const uint8_t *src, ptrdiff_t _srcstride, int height,          \
                                                  intptr_t mx, intptr_t my, int width)                           \
 {                                                                                                               \
     ff_hevc_put_hevc_##name##step1##_##bitd##_##opt(dst, src, _srcstride, height, mx, my, width);               \
@@ -146,7 +142,7 @@ void ff_hevc_put_hevc_##name##W##_##bitd##_##opt(int16_t *dst,
 }
 #define mc_rep_uni_func2(name, bitd, step1, step2, W, opt) \
 void ff_hevc_put_hevc_uni_##name##W##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride,                         \
-                                                     uint8_t *src, ptrdiff_t _srcstride, int height,            \
+                                                     const uint8_t *src, ptrdiff_t _srcstride, int height,      \
                                                      intptr_t mx, intptr_t my, int width)                       \
 {                                                                                                               \
     ff_hevc_put_hevc_uni_##name##step1##_##bitd##_##opt(dst, dststride, src, _srcstride, height, mx, my, width);\
@@ -155,8 +151,8 @@ void ff_hevc_put_hevc_uni_##name##W##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dst
                                                         height, mx, my, width);                                 \
 }
 #define mc_rep_bi_func2(name, bitd, step1, step2, W, opt) \
-void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,            \
-                                                    ptrdiff_t _srcstride, int16_t* src2,                        \
+void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,      \
+                                                    ptrdiff_t _srcstride, const int16_t *src2,                  \
                                                     int height, intptr_t mx, intptr_t my, int width)            \
 {                                                                                                               \
     ff_hevc_put_hevc_bi_##name##step1##_##bitd##_##opt(dst, dststride, src, _srcstride, src2, height, mx, my, width);\
@@ -173,7 +169,7 @@ void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dsts
 #if ARCH_X86_64 && HAVE_SSE4_EXTERNAL
 
 #define mc_rep_mix_10(name, width1, width2, width3, opt1, opt2, width4)                                       \
-void ff_hevc_put_hevc_##name##width1##_10_##opt1(int16_t *dst, uint8_t *src, ptrdiff_t _srcstride,            \
+void ff_hevc_put_hevc_##name##width1##_10_##opt1(int16_t *dst, const uint8_t *src, ptrdiff_t _srcstride,      \
                                                  int height, intptr_t mx, intptr_t my, int width)             \
                                                                                                               \
 {                                                                                                             \
@@ -182,8 +178,8 @@ void ff_hevc_put_hevc_##name##width1##_10_##opt1(int16_t *dst, uint8_t *src, ptr
 }
 
 #define mc_bi_rep_mix_10(name, width1, width2, width3, opt1, opt2, width4)                                    \
-void ff_hevc_put_hevc_bi_##name##width1##_10_##opt1(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,          \
-                                                    ptrdiff_t _srcstride, int16_t *src2,                      \
+void ff_hevc_put_hevc_bi_##name##width1##_10_##opt1(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,    \
+                                                    ptrdiff_t _srcstride, const int16_t *src2,                \
                                                     int height, intptr_t mx, intptr_t my, int width)          \
 {                                                                                                             \
     ff_hevc_put_hevc_bi_##name##width2##_10_##opt1(dst, dststride, src, _srcstride, src2,                     \
@@ -194,7 +190,7 @@ void ff_hevc_put_hevc_bi_##name##width1##_10_##opt1(uint8_t *dst, ptrdiff_t dsts
 
 #define mc_uni_rep_mix_10(name, width1, width2, width3, opt1, opt2, width4)                                   \
 void ff_hevc_put_hevc_uni_##name##width1##_10_##opt1(uint8_t *dst, ptrdiff_t dststride,                       \
-                                                     uint8_t *src, ptrdiff_t _srcstride, int height,          \
+                                                     const uint8_t *src, ptrdiff_t _srcstride, int height,    \
                                                      intptr_t mx, intptr_t my, int width)                     \
 {                                                                                                             \
     ff_hevc_put_hevc_uni_##name##width2##_10_##opt1(dst, dststride, src, _srcstride,                          \
@@ -209,7 +205,7 @@ mc_bi_rep_mix_10(name, width1, width2, width3, opt1, opt2, width4)         \
 mc_uni_rep_mix_10(name, width1, width2, width3, opt1, opt2, width4)
 
 #define mc_rep_mix_8(name, width1, width2, width3, opt1, opt2)                                                \
-void ff_hevc_put_hevc_##name##width1##_8_##opt1(int16_t *dst, uint8_t *src, ptrdiff_t _srcstride,             \
+void ff_hevc_put_hevc_##name##width1##_8_##opt1(int16_t *dst, const uint8_t *src, ptrdiff_t _srcstride,       \
                                                 int height, intptr_t mx, intptr_t my, int width)              \
                                                                                                               \
 {                                                                                                             \
@@ -218,8 +214,8 @@ void ff_hevc_put_hevc_##name##width1##_8_##opt1(int16_t *dst, uint8_t *src, ptrd
 }
 
 #define mc_bi_rep_mix_8(name, width1, width2, width3, opt1, opt2)                                             \
-void ff_hevc_put_hevc_bi_##name##width1##_8_##opt1(uint8_t *dst, ptrdiff_t dststride, uint8_t *src,           \
-                                                   ptrdiff_t _srcstride, int16_t* src2,                       \
+void ff_hevc_put_hevc_bi_##name##width1##_8_##opt1(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src,     \
+                                                   ptrdiff_t _srcstride, const int16_t *src2,                 \
                                                    int height, intptr_t mx, intptr_t my, int width)           \
 {                                                                                                             \
     ff_hevc_put_hevc_bi_##name##width2##_8_##opt1(dst, dststride, src, _srcstride,                            \
@@ -230,7 +226,7 @@ void ff_hevc_put_hevc_bi_##name##width1##_8_##opt1(uint8_t *dst, ptrdiff_t dstst
 
 #define mc_uni_rep_mix_8(name, width1, width2, width3, opt1, opt2)                                            \
 void ff_hevc_put_hevc_uni_##name##width1##_8_##opt1(uint8_t *dst, ptrdiff_t dststride,                        \
-                                                    uint8_t *src, ptrdiff_t _srcstride, int height,           \
+                                                    const uint8_t *src, ptrdiff_t _srcstride, int height,     \
                                                     intptr_t mx, intptr_t my, int width)                      \
 {                                                                                                             \
     ff_hevc_put_hevc_uni_##name##width2##_8_##opt1(dst, dststride, src, _srcstride,                           \
@@ -434,14 +430,13 @@ mc_rep_funcs(qpel_hv,12,  8, 16, sse4)
 mc_rep_funcs(qpel_hv,12,  4, 12, sse4)
 
 #define mc_rep_uni_w(bitd, step, W, opt) \
-void ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, \
+void ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, const int16_t *_src, \
                                                int height, int denom,  int _wx, int _ox)                                \
 {                                                                                                                       \
     int i;                                                                                                              \
-    int16_t *src;                                                                                                       \
     uint8_t *dst;                                                                                                       \
     for (i = 0; i < W; i += step) {                                                                                     \
-        src= _src + i;                                                                                                  \
+        const int16_t *src = _src + i;                                                                                  \
         dst= _dst + (i * ((bitd + 7) / 8));                                                                             \
         ff_hevc_put_hevc_uni_w##step##_##bitd##_##opt(dst, dststride, src,                                   \
                                                      height, denom, _wx, _ox);                                          \
@@ -470,17 +465,15 @@ mc_rep_uni_w(12, 8, 48, sse4)
 mc_rep_uni_w(12, 8, 64, sse4)
 
 #define mc_rep_bi_w(bitd, step, W, opt) \
-void ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, \
-                                              int16_t *_src2, int height,                                               \
+void ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, const int16_t *_src, \
+                                               const int16_t *_src2, int height,                                        \
                                               int denom,  int _wx0,  int _wx1, int _ox0, int _ox1)                      \
 {                                                                                                                       \
     int i;                                                                                                              \
-    int16_t *src;                                                                                                       \
-    int16_t *src2;                                                                                                      \
     uint8_t *dst;                                                                                                       \
     for (i = 0; i < W; i += step) {                                                                                     \
-        src  = _src  + i;                                                                                               \
-        src2 = _src2 + i;                                                                                               \
+        const int16_t *src  = _src  + i;                                                                                \
+        const int16_t *src2 = _src2 + i;                                                                                \
         dst  = _dst  + (i * ((bitd + 7) / 8));                                                                          \
         ff_hevc_put_hevc_bi_w##step##_##bitd##_##opt(dst, dststride, src, src2,                             \
                                                      height, denom, _wx0, _wx1, _ox0, _ox1);                             \
@@ -510,7 +503,7 @@ mc_rep_bi_w(12, 8, 64, sse4)
 
 #define mc_uni_w_func(name, bitd, W, opt) \
 void ff_hevc_put_hevc_uni_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride,         \
-                                                      uint8_t *_src, ptrdiff_t _srcstride,          \
+                                                       const uint8_t *_src, ptrdiff_t _srcstride,   \
                                                       int height, int denom,                        \
                                                       int _wx, int _ox,                             \
                                                       intptr_t mx, intptr_t my, int width)          \
@@ -568,8 +561,8 @@ mc_uni_w_funcs(qpel_hv, 12, sse4)
 
 #define mc_bi_w_func(name, bitd, W, opt) \
 void ff_hevc_put_hevc_bi_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride,           \
-                                                     uint8_t *_src, ptrdiff_t _srcstride,            \
-                                                     int16_t *_src2,                                 \
+                                                      const uint8_t *_src, ptrdiff_t _srcstride,     \
+                                                      const int16_t *_src2,                          \
                                                      int height, int denom,                          \
                                                      int _wx0, int _wx1, int _ox0, int _ox1,         \
                                                      intptr_t mx, intptr_t my, int width)            \
@@ -628,16 +621,16 @@ mc_bi_w_funcs(qpel_hv, 12, sse4)
 #endif //ARCH_X86_64 && HAVE_SSE4_EXTERNAL
 
 #define SAO_BAND_FILTER_FUNCS(bitd, opt)                                                                                   \
-void ff_hevc_sao_band_filter_8_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,  \
-                                            int16_t *sao_offset_val, int sao_left_class, int width, int height);           \
-void ff_hevc_sao_band_filter_16_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
-                                            int16_t *sao_offset_val, int sao_left_class, int width, int height);           \
-void ff_hevc_sao_band_filter_32_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
-                                            int16_t *sao_offset_val, int sao_left_class, int width, int height);           \
-void ff_hevc_sao_band_filter_48_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
-                                            int16_t *sao_offset_val, int sao_left_class, int width, int height);           \
-void ff_hevc_sao_band_filter_64_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
-                                             int16_t *sao_offset_val, int sao_left_class, int width, int height);
+void ff_hevc_sao_band_filter_8_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,  \
+                                              const int16_t *sao_offset_val, int sao_left_class, int width, int height);         \
+void ff_hevc_sao_band_filter_16_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
+                                               const int16_t *sao_offset_val, int sao_left_class, int width, int height);        \
+void ff_hevc_sao_band_filter_32_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
+                                               const int16_t *sao_offset_val, int sao_left_class, int width, int height);        \
+void ff_hevc_sao_band_filter_48_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
+                                               const int16_t *sao_offset_val, int sao_left_class, int width, int height);        \
+void ff_hevc_sao_band_filter_64_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src, \
+                                               const int16_t *sao_offset_val, int sao_left_class, int width, int height);
 
 SAO_BAND_FILTER_FUNCS(8,  sse2)
 SAO_BAND_FILTER_FUNCS(10, sse2)
@@ -657,17 +650,17 @@ SAO_BAND_FILTER_FUNCS(12, avx2)
     c->sao_band_filter[4]      = ff_hevc_sao_band_filter_64_##bitd##_##opt; \
 } while (0)
 
-#define SAO_EDGE_FILTER_FUNCS(bitd, opt)                                                                                    \
-void ff_hevc_sao_edge_filter_8_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,  \
-                                              int eo, int width, int height);                                               \
-void ff_hevc_sao_edge_filter_16_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, \
-                                               int eo, int width, int height);                                              \
-void ff_hevc_sao_edge_filter_32_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, \
-                                               int eo, int width, int height);                                              \
-void ff_hevc_sao_edge_filter_48_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, \
-                                               int eo, int width, int height);                                              \
-void ff_hevc_sao_edge_filter_64_##bitd##_##opt(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, \
-                                               int eo, int width, int height);                                              \
+#define SAO_EDGE_FILTER_FUNCS(bitd, opt)                                                                      \
+void ff_hevc_sao_edge_filter_8_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst,       \
+                                              const int16_t *sao_offset_val, int eo, int width, int height);  \
+void ff_hevc_sao_edge_filter_16_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst,      \
+                                               const int16_t *sao_offset_val, int eo, int width, int height); \
+void ff_hevc_sao_edge_filter_32_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst,      \
+                                               const int16_t *sao_offset_val, int eo, int width, int height); \
+void ff_hevc_sao_edge_filter_48_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst,      \
+                                               const int16_t *sao_offset_val, int eo, int width, int height); \
+void ff_hevc_sao_edge_filter_64_##bitd##_##opt(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst,      \
+                                               const int16_t *sao_offset_val, int eo, int width, int height); \
 
 SAO_EDGE_FILTER_FUNCS(8, ssse3)
 SAO_EDGE_FILTER_FUNCS(8, avx2)
-- 
2.34.1



More information about the ffmpeg-devel mailing list