[FFmpeg-devel] [PATCH v2 54/69] avcodec/motion_est: Constify mv-table parameters where possible

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Feb 1 15:06:51 EET 2022


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/motion_est.c          | 2 +-
 libavcodec/motion_est.h          | 6 +++---
 libavcodec/motion_est_template.c | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index cc305d06ff..3df1e4f40a 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1595,7 +1595,7 @@ void ff_estimate_b_frame_motion(MPVEncContext *s,
 }
 
 /* find best f_code for ME which do unlimited searches */
-int ff_get_best_fcode(MPVEncContext *s, int16_t (*mv_table)[2], int type)
+int ff_get_best_fcode(MPVEncContext *s, const int16_t (*mv_table)[2], int type)
 {
     if (s->motion_est != FF_ME_ZERO) {
         int score[8];
diff --git a/libavcodec/motion_est.h b/libavcodec/motion_est.h
index b52b91ab3f..01ca14f9a9 100644
--- a/libavcodec/motion_est.h
+++ b/libavcodec/motion_est.h
@@ -119,14 +119,14 @@ int ff_pre_estimate_p_frame_motion(struct MPVEncContext *s,
 
 int ff_epzs_motion_search(struct MPVEncContext *s, int *mx_ptr, int *my_ptr,
                           int P[10][2], int src_index, int ref_index,
-                          int16_t (*last_mv)[2], int ref_mv_scale, int size,
-                          int h);
+                          const int16_t (*last_mv)[2], int ref_mv_scale,
+                          int size, int h);
 
 int ff_get_mb_score(struct MPVEncContext *s, int mx, int my, int src_index,
                     int ref_index, int size, int h, int add_rate);
 
 int ff_get_best_fcode(struct MPVEncContext *s,
-                      int16_t (*mv_table)[2], int type);
+                      const int16_t (*mv_table)[2], int type);
 
 void ff_fix_long_p_mvs(struct MPVEncContext *s, int type);
 void ff_fix_long_mvs(struct MPVEncContext *s, uint8_t *field_select_table,
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index fc887b05b7..a8525afc6f 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -858,7 +858,7 @@ static av_always_inline int diamond_search(MPVEncContext *s, int *best, int dmin
    optimal mv.
  */
 static av_always_inline int epzs_motion_search_internal(MPVEncContext *s, int *mx_ptr, int *my_ptr,
-                             int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
+                             int P[10][2], int src_index, int ref_index, const int16_t (*last_mv)[2],
                              int ref_mv_scale, int flags, int size, int h)
 {
     MotionEstContext * const c= &s->me;
@@ -976,7 +976,7 @@ static av_always_inline int epzs_motion_search_internal(MPVEncContext *s, int *m
 //this function is dedicated to the brain damaged gcc
 int ff_epzs_motion_search(MPVEncContext *s, int *mx_ptr, int *my_ptr,
                           int P[10][2], int src_index, int ref_index,
-                          int16_t (*last_mv)[2], int ref_mv_scale,
+                          const int16_t (*last_mv)[2], int ref_mv_scale,
                           int size, int h)
 {
     MotionEstContext * const c= &s->me;
@@ -992,7 +992,7 @@ int ff_epzs_motion_search(MPVEncContext *s, int *mx_ptr, int *my_ptr,
 
 static int epzs_motion_search2(MPVEncContext *s,
                              int *mx_ptr, int *my_ptr, int P[10][2],
-                             int src_index, int ref_index, int16_t (*last_mv)[2],
+                             int src_index, int ref_index, const int16_t (*last_mv)[2],
                              int ref_mv_scale, const int size)
 {
     MotionEstContext * const c= &s->me;
-- 
2.32.0



More information about the ffmpeg-devel mailing list