diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-26 07:25:02 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-31 03:31:53 +0200 |
commit | abb85429f3424375f21bdd135656c2d88357b3d5 (patch) | |
tree | 208aa7d650abc4eae3d9c5b7653e7daf9a3b530d /libavcodec/me_cmp.c | |
parent | e7cb7c762abca7444ed3a5a2a839b10c05c455f3 (diff) | |
download | ffmpeg-abb85429f3424375f21bdd135656c2d88357b3d5.tar.gz |
avcodec/me_cmp: Constify me_cmp_func buffer parameters
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/me_cmp.c')
-rw-r--r-- | libavcodec/me_cmp.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c index d0cd14ad33..fa82ae54ae 100644 --- a/libavcodec/me_cmp.c +++ b/libavcodec/me_cmp.c @@ -67,7 +67,7 @@ const uint32_t ff_square_tab[512] = { 57600, 58081, 58564, 59049, 59536, 60025, 60516, 61009, 61504, 62001, 62500, 63001, 63504, 64009, 64516, 65025, }; -static int sse4_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int sse4_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -84,7 +84,7 @@ static int sse4_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int sse8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int sse8_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -105,7 +105,7 @@ static int sse8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int sse16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int sse16_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -135,7 +135,7 @@ static int sse16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int sum_abs_dctelem_c(int16_t *block) +static int sum_abs_dctelem_c(const int16_t *block) { int sum = 0, i; @@ -147,7 +147,7 @@ static int sum_abs_dctelem_c(int16_t *block) #define avg2(a, b) (((a) + (b) + 1) >> 1) #define avg4(a, b, c, d) (((a) + (b) + (c) + (d) + 2) >> 2) -static inline int pix_abs16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static inline int pix_abs16_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -175,7 +175,7 @@ static inline int pix_abs16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static inline int pix_median_abs16_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static inline int pix_median_abs16_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i, j; @@ -214,7 +214,7 @@ static inline int pix_median_abs16_c(MpegEncContext *v, uint8_t *pix1, uint8_t * return s; } -static int pix_abs16_x2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs16_x2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -242,11 +242,11 @@ static int pix_abs16_x2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int pix_abs16_y2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs16_y2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; - uint8_t *pix3 = pix2 + stride; + const uint8_t *pix3 = pix2 + stride; for (i = 0; i < h; i++) { s += abs(pix1[0] - avg2(pix2[0], pix3[0])); @@ -272,11 +272,11 @@ static int pix_abs16_y2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int pix_abs16_xy2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs16_xy2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; - uint8_t *pix3 = pix2 + stride; + const uint8_t *pix3 = pix2 + stride; for (i = 0; i < h; i++) { s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1])); @@ -302,7 +302,7 @@ static int pix_abs16_xy2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static inline int pix_abs8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static inline int pix_abs8_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -322,7 +322,7 @@ static inline int pix_abs8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static inline int pix_median_abs8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static inline int pix_median_abs8_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i, j; @@ -353,7 +353,7 @@ static inline int pix_median_abs8_c(MpegEncContext *v, uint8_t *pix1, uint8_t *p return s; } -static int pix_abs8_x2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs8_x2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; @@ -373,11 +373,11 @@ static int pix_abs8_x2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int pix_abs8_y2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs8_y2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; - uint8_t *pix3 = pix2 + stride; + const uint8_t *pix3 = pix2 + stride; for (i = 0; i < h; i++) { s += abs(pix1[0] - avg2(pix2[0], pix3[0])); @@ -395,11 +395,11 @@ static int pix_abs8_y2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int pix_abs8_xy2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, +static int pix_abs8_xy2_c(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h) { int s = 0, i; - uint8_t *pix3 = pix2 + stride; + const uint8_t *pix3 = pix2 + stride; for (i = 0; i < h; i++) { s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1])); @@ -417,7 +417,7 @@ static int pix_abs8_xy2_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, return s; } -static int nsse16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, +static int nsse16_c(MpegEncContext *c, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride, int h) { int score1 = 0, score2 = 0, x, y; @@ -442,7 +442,7 @@ static int nsse16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, return score1 + FFABS(score2) * 8; } -static int nsse8_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, +static int nsse8_c(MpegEncContext *c, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride, int h) { int score1 = 0, score2 = 0, x, y; @@ -467,7 +467,7 @@ static int nsse8_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, return score1 + FFABS(score2) * 8; } -static int zero_cmp(MpegEncContext *s, uint8_t *a, uint8_t *b, +static int zero_cmp(MpegEncContext *s, const uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h) { return 0; @@ -553,8 +553,8 @@ void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type) #define BUTTERFLYA(x, y) (FFABS((x) + (y)) + FFABS((x) - (y))) -static int hadamard8_diff8x8_c(MpegEncContext *s, uint8_t *dst, - uint8_t *src, ptrdiff_t stride, int h) +static int hadamard8_diff8x8_c(MpegEncContext *s, const uint8_t *dst, + const uint8_t *src, ptrdiff_t stride, int h) { int i, temp[64], sum = 0; @@ -605,8 +605,8 @@ static int hadamard8_diff8x8_c(MpegEncContext *s, uint8_t *dst, return sum; } -static int hadamard8_intra8x8_c(MpegEncContext *s, uint8_t *src, - uint8_t *dummy, ptrdiff_t stride, int h) +static int hadamard8_intra8x8_c(MpegEncContext *s, const uint8_t *src, + const uint8_t *dummy, ptrdiff_t stride, int h) { int i, temp[64], sum = 0; @@ -657,8 +657,8 @@ static int hadamard8_intra8x8_c(MpegEncContext *s, uint8_t *src, return sum; } -static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1, - uint8_t *src2, ptrdiff_t stride, int h) +static int dct_sad8x8_c(MpegEncContext *s, const uint8_t *src1, + const uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64]); @@ -698,8 +698,8 @@ static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1, DST(7, (a4 >> 2) - a7); \ } -static int dct264_sad8x8_c(MpegEncContext *s, uint8_t *src1, - uint8_t *src2, ptrdiff_t stride, int h) +static int dct264_sad8x8_c(MpegEncContext *s, const uint8_t *src1, + const uint8_t *src2, ptrdiff_t stride, int h) { int16_t dct[8][8]; int i, sum = 0; @@ -723,8 +723,8 @@ static int dct264_sad8x8_c(MpegEncContext *s, uint8_t *src1, } #endif -static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1, - uint8_t *src2, ptrdiff_t stride, int h) +static int dct_max8x8_c(MpegEncContext *s, const uint8_t *src1, + const uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64]); int sum = 0, i; @@ -740,8 +740,8 @@ static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1, return sum; } -static int quant_psnr8x8_c(MpegEncContext *s, uint8_t *src1, - uint8_t *src2, ptrdiff_t stride, int h) +static int quant_psnr8x8_c(MpegEncContext *s, const uint8_t *src1, + const uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64 * 2]); int16_t *const bak = temp + 64; @@ -765,7 +765,7 @@ static int quant_psnr8x8_c(MpegEncContext *s, uint8_t *src1, return sum; } -static int rd8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, +static int rd8x8_c(MpegEncContext *s, const uint8_t *src1, const uint8_t *src2, ptrdiff_t stride, int h) { const uint8_t *scantable = s->intra_scantable.permutated; @@ -842,7 +842,7 @@ static int rd8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, return distortion + ((bits * s->qscale * s->qscale * 109 + 64) >> 7); } -static int bit8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, +static int bit8x8_c(MpegEncContext *s, const uint8_t *src1, const uint8_t *src2, ptrdiff_t stride, int h) { const uint8_t *scantable = s->intra_scantable.permutated; @@ -905,7 +905,7 @@ static int bit8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, #define VSAD_INTRA(size) \ static int vsad_intra ## size ## _c(MpegEncContext *c, \ - uint8_t *s, uint8_t *dummy, \ + const uint8_t *s, const uint8_t *dummy, \ ptrdiff_t stride, int h) \ { \ int score = 0, x, y; \ @@ -927,7 +927,7 @@ VSAD_INTRA(16) #define VSAD(size) \ static int vsad ## size ## _c(MpegEncContext *c, \ - uint8_t *s1, uint8_t *s2, \ + const uint8_t *s1, const uint8_t *s2, \ ptrdiff_t stride, int h) \ { \ int score = 0, x, y; \ @@ -947,7 +947,7 @@ VSAD(16) #define SQ(a) ((a) * (a)) #define VSSE_INTRA(size) \ static int vsse_intra ## size ## _c(MpegEncContext *c, \ - uint8_t *s, uint8_t *dummy, \ + const uint8_t *s, const uint8_t *dummy, \ ptrdiff_t stride, int h) \ { \ int score = 0, x, y; \ @@ -968,7 +968,7 @@ VSSE_INTRA(8) VSSE_INTRA(16) #define VSSE(size) \ -static int vsse ## size ## _c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, \ +static int vsse ## size ## _c(MpegEncContext *c, const uint8_t *s1, const uint8_t *s2, \ ptrdiff_t stride, int h) \ { \ int score = 0, x, y; \ @@ -986,7 +986,7 @@ VSSE(8) VSSE(16) #define WRAPPER8_16_SQ(name8, name16) \ -static int name16(MpegEncContext *s, uint8_t *dst, uint8_t *src, \ +static int name16(MpegEncContext *s, const uint8_t *dst, const uint8_t *src, \ ptrdiff_t stride, int h) \ { \ int score = 0; \ |