avcodec/me_cmp: Constify me_cmp_func buffer parameters

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/388/head
Andreas Rheinhardt 2 years ago
parent e7cb7c762a
commit abb85429f3
  1. 6
      libavcodec/aarch64/me_cmp_init_aarch64.c
  2. 12
      libavcodec/alpha/me_cmp_alpha.c
  3. 2
      libavcodec/alpha/me_cmp_mvi_asm.S
  4. 10
      libavcodec/arm/me_cmp_init_arm.c
  5. 80
      libavcodec/me_cmp.c
  6. 6
      libavcodec/me_cmp.h
  7. 32
      libavcodec/mips/me_cmp_mips.h
  8. 80
      libavcodec/mips/me_cmp_msa.c
  9. 2
      libavcodec/motion_est.c
  10. 30
      libavcodec/ppc/me_cmp.c
  11. 14
      libavcodec/snow_dwt.c
  12. 4
      libavcodec/snow_dwt.h
  13. 24
      libavcodec/x86/me_cmp.asm
  14. 72
      libavcodec/x86/me_cmp_init.c

@ -23,11 +23,11 @@
#include "libavutil/aarch64/cpu.h"
#include "libavcodec/mpegvideo.h"
int ff_pix_abs16_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs16_neon(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_pix_abs16_xy2_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs16_xy2_neon(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_pix_abs16_x2_neon(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_x2_neon(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
av_cold void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx)

@ -23,7 +23,7 @@
#include "libavcodec/me_cmp.h"
#include "asm.h"
int pix_abs16x16_mvi_asm(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
int pix_abs16x16_mvi_asm(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h);
static inline uint64_t avg2(uint64_t a, uint64_t b)
{
@ -44,7 +44,7 @@ static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
return r1 + r2;
}
static int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
static int pix_abs8x8_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h)
{
int result = 0;
@ -77,7 +77,7 @@ static int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
}
#if 0 /* now done in assembly */
int pix_abs16x16_mvi(uint8_t *pix1, uint8_t *pix2, int line_size)
int pix_abs16x16_mvi(const uint8_t *pix1, const uint8_t *pix2, int line_size)
{
int result = 0;
int h = 16;
@ -119,7 +119,7 @@ int pix_abs16x16_mvi(uint8_t *pix1, uint8_t *pix2, int line_size)
}
#endif
static int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
static int pix_abs16x16_x2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h)
{
int result = 0;
uint64_t disalign = (size_t) pix2 & 0x7;
@ -192,7 +192,7 @@ static int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_s
return result;
}
static int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
static int pix_abs16x16_y2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h)
{
int result = 0;
@ -245,7 +245,7 @@ static int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_s
return result;
}
static int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
static int pix_abs16x16_xy2_mvi(void *v, const uint8_t *pix1, const uint8_t *pix2, int line_size, int h)
{
int result = 0;

@ -38,7 +38,7 @@
.text
/*****************************************************************************
* int pix_abs16x16_mvi_asm(uint8_t *pix1, uint8_t *pix2, int line_size)
* int pix_abs16x16_mvi_asm(const uint8_t *pix1, const uint8_t *pix2, int line_size)
*
* This code is written with a pca56 in mind. For ev6, one should
* really take the increased latency of 3 cycles for MVI instructions

@ -25,17 +25,17 @@
#include "libavcodec/me_cmp.h"
#include "libavcodec/mpegvideo.h"
int ff_pix_abs16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs16_armv6(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_pix_abs16_x2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs16_x2_armv6(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_pix_abs16_y2_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs16_y2_armv6(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_pix_abs8_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_abs8_armv6(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
int ff_sse16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_sse16_armv6(MpegEncContext *s, const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h);
av_cold void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx)

@ -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; \

@ -46,12 +46,12 @@ struct MpegEncContext;
* Although currently h < 4 is not used as functions with
* width < 8 are neither used nor implemented. */
typedef int (*me_cmp_func)(struct MpegEncContext *c,
uint8_t *blk1 /* align width (8 or 16) */,
uint8_t *blk2 /* align 1 */, ptrdiff_t stride,
const uint8_t *blk1 /* align width (8 or 16) */,
const uint8_t *blk2 /* align 1 */, ptrdiff_t stride,
int h);
typedef struct MECmpContext {
int (*sum_abs_dctelem)(int16_t *block /* align 16 */);
int (*sum_abs_dctelem)(const int16_t *block /* align 16 */);
me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
me_cmp_func sse[6];

@ -24,37 +24,37 @@
#include "../mpegvideo.h"
#include "libavcodec/bit_depth_template.c"
int ff_hadamard8_diff8x8_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_diff8x8_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h);
int ff_hadamard8_intra8x8_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_intra8x8_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h);
int ff_hadamard8_diff16_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_diff16_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h);
int ff_hadamard8_intra16_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_intra16_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h);
int ff_pix_abs16_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs16_x2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_x2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs16_y2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_y2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs16_xy2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_xy2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs8_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs8_x2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_x2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs8_y2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_y2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_pix_abs8_xy2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_xy2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sse16_msa(MpegEncContext *v, uint8_t *pu8Src, uint8_t *pu8Ref,
int ff_sse16_msa(MpegEncContext *v, const uint8_t *pu8Src, const uint8_t *pu8Ref,
ptrdiff_t stride, int i32Height);
int ff_sse8_msa(MpegEncContext *v, uint8_t *pu8Src, uint8_t *pu8Ref,
int ff_sse8_msa(MpegEncContext *v, const uint8_t *pu8Src, const uint8_t *pu8Ref,
ptrdiff_t stride, int i32Height);
int ff_sse4_msa(MpegEncContext *v, uint8_t *pu8Src, uint8_t *pu8Ref,
int ff_sse4_msa(MpegEncContext *v, const uint8_t *pu8Src, const uint8_t *pu8Ref,
ptrdiff_t stride, int i32Height);
void ff_add_pixels8_msa(uint8_t *av_restrict pixels, int16_t *block,
void ff_add_pixels8_msa(const uint8_t *av_restrict pixels, int16_t *block,
ptrdiff_t stride);
#endif // #ifndef AVCODEC_MIPS_ME_CMP_MIPS_H

@ -21,8 +21,8 @@
#include "libavutil/mips/generic_macros_msa.h"
#include "me_cmp_mips.h"
static uint32_t sad_8width_msa(uint8_t *src, int32_t src_stride,
uint8_t *ref, int32_t ref_stride,
static uint32_t sad_8width_msa(const uint8_t *src, int32_t src_stride,
const uint8_t *ref, int32_t ref_stride,
int32_t height)
{
int32_t ht_cnt;
@ -43,8 +43,8 @@ static uint32_t sad_8width_msa(uint8_t *src, int32_t src_stride,
return (HADD_UH_U32(sad));
}
static uint32_t sad_16width_msa(uint8_t *src, int32_t src_stride,
uint8_t *ref, int32_t ref_stride,
static uint32_t sad_16width_msa(const uint8_t *src, int32_t src_stride,
const uint8_t *ref, int32_t ref_stride,
int32_t height)
{
int32_t ht_cnt;
@ -68,9 +68,9 @@ static uint32_t sad_16width_msa(uint8_t *src, int32_t src_stride,
return (HADD_UH_U32(sad));
}
static uint32_t sad_horiz_bilinear_filter_8width_msa(uint8_t *src,
static uint32_t sad_horiz_bilinear_filter_8width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -110,9 +110,9 @@ static uint32_t sad_horiz_bilinear_filter_8width_msa(uint8_t *src,
return (HADD_UH_U32(sad));
}
static uint32_t sad_horiz_bilinear_filter_16width_msa(uint8_t *src,
static uint32_t sad_horiz_bilinear_filter_16width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -148,9 +148,9 @@ static uint32_t sad_horiz_bilinear_filter_16width_msa(uint8_t *src,
return (HADD_UH_U32(sad));
}
static uint32_t sad_vert_bilinear_filter_8width_msa(uint8_t *src,
static uint32_t sad_vert_bilinear_filter_8width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -186,9 +186,9 @@ static uint32_t sad_vert_bilinear_filter_8width_msa(uint8_t *src,
return (HADD_UH_U32(sad));
}
static uint32_t sad_vert_bilinear_filter_16width_msa(uint8_t *src,
static uint32_t sad_vert_bilinear_filter_16width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -224,9 +224,9 @@ static uint32_t sad_vert_bilinear_filter_16width_msa(uint8_t *src,
return (HADD_UH_U32(sad));
}
static uint32_t sad_hv_bilinear_filter_8width_msa(uint8_t *src,
static uint32_t sad_hv_bilinear_filter_8width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -280,9 +280,9 @@ static uint32_t sad_hv_bilinear_filter_8width_msa(uint8_t *src,
return (HADD_UH_U32(sad));
}
static uint32_t sad_hv_bilinear_filter_16width_msa(uint8_t *src,
static uint32_t sad_hv_bilinear_filter_16width_msa(const uint8_t *src,
int32_t src_stride,
uint8_t *ref,
const uint8_t *ref,
int32_t ref_stride,
int32_t height)
{
@ -403,8 +403,8 @@ static uint32_t sad_hv_bilinear_filter_16width_msa(uint8_t *src,
DPADD_SH2_SW(res_l0_m, res_l1_m, res_l0_m, res_l1_m, var, var); \
}
static uint32_t sse_4width_msa(uint8_t *src_ptr, int32_t src_stride,
uint8_t *ref_ptr, int32_t ref_stride,
static uint32_t sse_4width_msa(const uint8_t *src_ptr, int32_t src_stride,
const uint8_t *ref_ptr, int32_t ref_stride,
int32_t height)
{
int32_t ht_cnt;
@ -431,8 +431,8 @@ static uint32_t sse_4width_msa(uint8_t *src_ptr, int32_t src_stride,
return sse;
}
static uint32_t sse_8width_msa(uint8_t *src_ptr, int32_t src_stride,
uint8_t *ref_ptr, int32_t ref_stride,
static uint32_t sse_8width_msa(const uint8_t *src_ptr, int32_t src_stride,
const uint8_t *ref_ptr, int32_t ref_stride,
int32_t height)
{
int32_t ht_cnt;
@ -458,8 +458,8 @@ static uint32_t sse_8width_msa(uint8_t *src_ptr, int32_t src_stride,
return sse;
}
static uint32_t sse_16width_msa(uint8_t *src_ptr, int32_t src_stride,
uint8_t *ref_ptr, int32_t ref_stride,
static uint32_t sse_16width_msa(const uint8_t *src_ptr, int32_t src_stride,
const uint8_t *ref_ptr, int32_t ref_stride,
int32_t height)
{
int32_t ht_cnt;
@ -498,8 +498,8 @@ static uint32_t sse_16width_msa(uint8_t *src_ptr, int32_t src_stride,
return sse;
}
static int32_t hadamard_diff_8x8_msa(uint8_t *src, int32_t src_stride,
uint8_t *ref, int32_t ref_stride)
static int32_t hadamard_diff_8x8_msa(const uint8_t *src, int32_t src_stride,
const uint8_t *ref, int32_t ref_stride)
{
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
v16u8 ref0, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
@ -543,8 +543,8 @@ static int32_t hadamard_diff_8x8_msa(uint8_t *src, int32_t src_stride,
return (HADD_UH_U32(sum));
}
static int32_t hadamard_intra_8x8_msa(uint8_t *src, int32_t src_stride,
uint8_t *ref, int32_t ref_stride)
static int32_t hadamard_intra_8x8_msa(const uint8_t *src, int32_t src_stride,
const uint8_t *ref, int32_t ref_stride)
{
int32_t sum_res = 0;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
@ -587,79 +587,79 @@ static int32_t hadamard_intra_8x8_msa(uint8_t *src, int32_t src_stride,
return sum_res;
}
int ff_pix_abs16_msa(MpegEncContext *v, uint8_t *src, uint8_t *ref,
int ff_pix_abs16_msa(MpegEncContext *v, const uint8_t *src, const uint8_t *ref,
ptrdiff_t stride, int height)
{
return sad_16width_msa(src, stride, ref, stride, height);
}
int ff_pix_abs8_msa(MpegEncContext *v, uint8_t *src, uint8_t *ref,
int ff_pix_abs8_msa(MpegEncContext *v, const uint8_t *src, const uint8_t *ref,
ptrdiff_t stride, int height)
{
return sad_8width_msa(src, stride, ref, stride, height);
}
int ff_pix_abs16_x2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_x2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_horiz_bilinear_filter_16width_msa(pix1, stride, pix2, stride, h);
}
int ff_pix_abs16_y2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_y2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_vert_bilinear_filter_16width_msa(pix1, stride, pix2, stride, h);
}
int ff_pix_abs16_xy2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs16_xy2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_hv_bilinear_filter_16width_msa(pix1, stride, pix2, stride, h);
}
int ff_pix_abs8_x2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_x2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_horiz_bilinear_filter_8width_msa(pix1, stride, pix2, stride, h);
}
int ff_pix_abs8_y2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_y2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_vert_bilinear_filter_8width_msa(pix1, stride, pix2, stride, h);
}
int ff_pix_abs8_xy2_msa(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_pix_abs8_xy2_msa(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
return sad_hv_bilinear_filter_8width_msa(pix1, stride, pix2, stride, h);
}
int ff_sse16_msa(MpegEncContext *v, uint8_t *src, uint8_t *ref,
int ff_sse16_msa(MpegEncContext *v, const uint8_t *src, const uint8_t *ref,
ptrdiff_t stride, int height)
{
return sse_16width_msa(src, stride, ref, stride, height);
}
int ff_sse8_msa(MpegEncContext *v, uint8_t *src, uint8_t *ref,
int ff_sse8_msa(MpegEncContext *v, const uint8_t *src, const uint8_t *ref,
ptrdiff_t stride, int height)
{
return sse_8width_msa(src, stride, ref, stride, height);
}
int ff_sse4_msa(MpegEncContext *v, uint8_t *src, uint8_t *ref,
int ff_sse4_msa(MpegEncContext *v, const uint8_t *src, const uint8_t *ref,
ptrdiff_t stride, int height)
{
return sse_4width_msa(src, stride, ref, stride, height);
}
int ff_hadamard8_diff8x8_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_diff8x8_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h)
{
return hadamard_diff_8x8_msa(src, stride, dst, stride);
}
int ff_hadamard8_intra8x8_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
int ff_hadamard8_intra8x8_msa(MpegEncContext *s, const uint8_t *dst, const uint8_t *src,
ptrdiff_t stride, int h)
{
return hadamard_intra_8x8_msa(src, stride, dst, stride);
@ -667,7 +667,7 @@ int ff_hadamard8_intra8x8_msa(MpegEncContext *s, uint8_t *dst, uint8_t *src,
/* Hadamard Transform functions */
#define WRAPPER8_16_SQ(name8, name16) \
int name16(MpegEncContext *s, uint8_t *dst, uint8_t *src, \
int name16(MpegEncContext *s, const uint8_t *dst, const uint8_t *src, \
ptrdiff_t stride, int h) \
{ \
int score = 0; \

@ -293,7 +293,7 @@ static int cmp_qpel(MpegEncContext *s, const int x, const int y, const int subx,
#include "motion_est_template.c"
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;

@ -51,7 +51,7 @@
iv = vec_vsx_ld(1, pix);\
}
#endif
static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sad16_x2_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -91,7 +91,7 @@ static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
return s;
}
static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sad16_y2_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -102,7 +102,7 @@ static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
vector unsigned int sad = (vector unsigned int) vec_splat_u32(0);
vector signed int sumdiffs;
uint8_t *pix3 = pix2 + stride;
const uint8_t *pix3 = pix2 + stride;
/* Due to the fact that pix3 = pix2 + stride, the pix3 of one
* iteration becomes pix2 in the next iteration. We can use this
@ -141,12 +141,12 @@ static int sad16_y2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
return s;
}
static int sad16_xy2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sad16_xy2_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
int __attribute__((aligned(16))) s = 0;
uint8_t *pix3 = pix2 + stride;
const uint8_t *pix3 = pix2 + stride;
const vector unsigned char zero =
(const vector unsigned char) vec_splat_u8(0);
const vector unsigned short two =
@ -230,7 +230,7 @@ static int sad16_xy2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
return s;
}
static int sad16_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sad16_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -265,7 +265,7 @@ static int sad16_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
return s;
}
static int sad8_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sad8_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -309,7 +309,7 @@ static int sad8_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
/* Sum of Squared Errors for an 8x8 block, AltiVec-enhanced.
* It's the sad8_altivec code above w/ squaring added. */
static int sse8_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sse8_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -354,7 +354,7 @@ static int sse8_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
/* Sum of Squared Errors for a 16x16 block, AltiVec-enhanced.
* It's the sad16_altivec code above w/ squaring added. */
static int sse16_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
static int sse16_altivec(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int i;
@ -392,8 +392,8 @@ static int sse16_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
return s;
}
static int hadamard8_diff8x8_altivec(MpegEncContext *s, uint8_t *dst,
uint8_t *src, ptrdiff_t stride, int h)
static int hadamard8_diff8x8_altivec(MpegEncContext *s, const uint8_t *dst,
const uint8_t *src, ptrdiff_t stride, int h)
{
int __attribute__((aligned(16))) sum;
register const vector unsigned char vzero =
@ -518,8 +518,8 @@ static int hadamard8_diff8x8_altivec(MpegEncContext *s, uint8_t *dst,
* On the 970, the hand-made RA is still a win (around 690 vs. around 780),
* but xlc goes to around 660 on the regular C code...
*/
static int hadamard8_diff16x8_altivec(MpegEncContext *s, uint8_t *dst,
uint8_t *src, ptrdiff_t stride, int h)
static int hadamard8_diff16x8_altivec(MpegEncContext *s, const uint8_t *dst,
const uint8_t *src, ptrdiff_t stride, int h)
{
int __attribute__((aligned(16))) sum;
register vector signed short
@ -709,8 +709,8 @@ static int hadamard8_diff16x8_altivec(MpegEncContext *s, uint8_t *dst,
return sum;
}
static int hadamard8_diff16_altivec(MpegEncContext *s, uint8_t *dst,
uint8_t *src, ptrdiff_t stride, int h)
static int hadamard8_diff16_altivec(MpegEncContext *s, const uint8_t *dst,
const uint8_t *src, ptrdiff_t stride, int h)
{
int score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);

@ -740,7 +740,7 @@ void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
decomposition_count, y);
}
static inline int w_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size,
static inline int w_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size,
int w, int h, int type)
{
int s, i, j;
@ -809,32 +809,32 @@ static inline int w_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, pt
return s >> 9;
}
static int w53_8_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
static int w53_8_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 8, h, 1);
}
static int w97_8_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
static int w97_8_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 8, h, 0);
}
static int w53_16_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
static int w53_16_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 16, h, 1);
}
static int w97_16_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
static int w97_16_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 16, h, 0);
}
int ff_w53_32_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
int ff_w53_32_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 32, h, 1);
}
int ff_w97_32_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h)
int ff_w97_32_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h)
{
return w_c(v, pix1, pix2, line_size, 32, h, 0);
}

@ -104,8 +104,8 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
int src_y, int src_stride, slice_buffer *sb,
int add, uint8_t *dst8);
int ff_w53_32_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h);
int ff_w97_32_c(struct MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t line_size, int h);
int ff_w53_32_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h);
int ff_w97_32_c(struct MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t line_size, int h);
void ff_spatial_dwt(int *buffer, int *temp, int width, int height, int stride,
int type, int decomposition_count);

@ -38,7 +38,7 @@ SECTION .text
psubw %1, %2
%endmacro
; %1=uint8_t *pix1, %2=uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3
; %1=const uint8_t *pix1, %2=const uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3
; %6=temporary storage location
; this macro requires $mmsize stack space (aligned) on %6 (except on SSE+x86-64)
%macro DIFF_PIXELS_8 6
@ -214,8 +214,8 @@ hadamard8x8_diff %+ SUFFIX:
hadamard8_16_wrapper %1, 3
%elif cpuflag(mmx)
ALIGN 16
; int ff_hadamard8_diff_ ## cpu(MpegEncContext *s, uint8_t *src1,
; uint8_t *src2, ptrdiff_t stride, int h)
; int ff_hadamard8_diff_ ## cpu(MpegEncContext *s, const uint8_t *src1,
; const uint8_t *src2, ptrdiff_t stride, int h)
; r0 = void *s = unused, int h = unused (always 8)
; note how r1, r2 and r3 are not clobbered in this function, so 16x16
; can simply call this 2x2x (and that's why we access rsp+gprsize
@ -278,7 +278,7 @@ INIT_XMM ssse3
%define ABS_SUM_8x8 ABS_SUM_8x8_64
HADAMARD8_DIFF 9
; int ff_sse*_*(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
; int ff_sse*_*(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
; ptrdiff_t line_size, int h)
%macro SUM_SQUARED_ERRORS 1
@ -357,7 +357,7 @@ INIT_XMM sse2
SUM_SQUARED_ERRORS 16
;-----------------------------------------------
;int ff_sum_abs_dctelem(int16_t *block)
;int ff_sum_abs_dctelem(const int16_t *block)
;-----------------------------------------------
; %1 = number of xmm registers used
; %2 = number of inline loops
@ -390,7 +390,7 @@ INIT_XMM ssse3
SUM_ABS_DCTELEM 6, 2
;------------------------------------------------------------------------------
; int ff_hf_noise*_mmx(uint8_t *pix1, ptrdiff_t lsize, int h)
; int ff_hf_noise*_mmx(const uint8_t *pix1, ptrdiff_t lsize, int h)
;------------------------------------------------------------------------------
; %1 = 8/16. %2-5=m#
%macro HF_NOISE_PART1 5
@ -466,7 +466,7 @@ HF_NOISE 8
HF_NOISE 16
;---------------------------------------------------------------------------------------
;int ff_sad_<opt>(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h);
;int ff_sad_<opt>(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h);
;---------------------------------------------------------------------------------------
;%1 = 8/16
%macro SAD 1
@ -521,7 +521,7 @@ INIT_XMM sse2
SAD 16
;------------------------------------------------------------------------------------------
;int ff_sad_x2_<opt>(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h);
;int ff_sad_x2_<opt>(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h);
;------------------------------------------------------------------------------------------
;%1 = 8/16
%macro SAD_X2 1
@ -598,7 +598,7 @@ INIT_XMM sse2
SAD_X2 16
;------------------------------------------------------------------------------------------
;int ff_sad_y2_<opt>(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h);
;int ff_sad_y2_<opt>(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h);
;------------------------------------------------------------------------------------------
;%1 = 8/16
%macro SAD_Y2 1
@ -668,7 +668,7 @@ INIT_XMM sse2
SAD_Y2 16
;-------------------------------------------------------------------------------------------
;int ff_sad_approx_xy2_<opt>(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, ptrdiff_t stride, int h);
;int ff_sad_approx_xy2_<opt>(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2, ptrdiff_t stride, int h);
;-------------------------------------------------------------------------------------------
;%1 = 8/16
%macro SAD_APPROX_XY2 1
@ -769,7 +769,7 @@ INIT_XMM sse2
SAD_APPROX_XY2 16
;--------------------------------------------------------------------
;int ff_vsad_intra(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
;int ff_vsad_intra(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
; ptrdiff_t line_size, int h);
;--------------------------------------------------------------------
; %1 = 8/16
@ -830,7 +830,7 @@ INIT_XMM sse2
VSAD_INTRA 16
;---------------------------------------------------------------------
;int ff_vsad_approx(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
;int ff_vsad_approx(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
; ptrdiff_t line_size, int h);
;---------------------------------------------------------------------
; %1 = 8/16

@ -30,65 +30,65 @@
#include "libavcodec/me_cmp.h"
#include "libavcodec/mpegvideo.h"
int ff_sum_abs_dctelem_sse2(int16_t *block);
int ff_sum_abs_dctelem_ssse3(int16_t *block);
int ff_sse8_mmx(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sum_abs_dctelem_sse2(const int16_t *block);
int ff_sum_abs_dctelem_ssse3(const int16_t *block);
int ff_sse8_mmx(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sse16_mmx(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sse16_mmx(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sse16_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sse16_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_hf_noise8_mmx(uint8_t *pix1, ptrdiff_t stride, int h);
int ff_hf_noise16_mmx(uint8_t *pix1, ptrdiff_t stride, int h);
int ff_sad8_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_hf_noise8_mmx(const uint8_t *pix1, ptrdiff_t stride, int h);
int ff_hf_noise16_mmx(const uint8_t *pix1, ptrdiff_t stride, int h);
int ff_sad8_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad8_x2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad8_x2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_x2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_x2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_x2_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_x2_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad8_y2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad8_y2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_y2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_y2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_y2_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_y2_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad8_approx_xy2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad8_approx_xy2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_approx_xy2_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_approx_xy2_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_sad16_approx_xy2_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_sad16_approx_xy2_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad_intra8_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad_intra8_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad_intra16_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad_intra16_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad_intra16_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad_intra16_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad8_approx_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad8_approx_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad16_approx_mmxext(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad16_approx_mmxext(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
int ff_vsad16_approx_sse2(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int ff_vsad16_approx_sse2(MpegEncContext *v, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h);
#define hadamard_func(cpu) \
int ff_hadamard8_diff_ ## cpu(MpegEncContext *s, uint8_t *src1, \
uint8_t *src2, ptrdiff_t stride, int h); \
int ff_hadamard8_diff16_ ## cpu(MpegEncContext *s, uint8_t *src1, \
uint8_t *src2, ptrdiff_t stride, int h);
int ff_hadamard8_diff_ ## cpu(MpegEncContext *s, const uint8_t *src1, \
const uint8_t *src2, ptrdiff_t stride, int h); \
int ff_hadamard8_diff16_ ## cpu(MpegEncContext *s, const uint8_t *src1, \
const uint8_t *src2, ptrdiff_t stride, int h);
hadamard_func(mmxext)
hadamard_func(sse2)
hadamard_func(ssse3)
#if HAVE_X86ASM
static int nsse16_mmx(MpegEncContext *c, uint8_t *pix1, uint8_t *pix2,
static int nsse16_mmx(MpegEncContext *c, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int score1, score2;
@ -106,7 +106,7 @@ static int nsse16_mmx(MpegEncContext *c, uint8_t *pix1, uint8_t *pix2,
return score1 + FFABS(score2) * 8;
}
static int nsse8_mmx(MpegEncContext *c, uint8_t *pix1, uint8_t *pix2,
static int nsse8_mmx(MpegEncContext *c, const uint8_t *pix1, const uint8_t *pix2,
ptrdiff_t stride, int h)
{
int score1 = ff_sse8_mmx(c, pix1, pix2, stride, h);
@ -129,7 +129,7 @@ DECLARE_ASM_CONST(8, uint64_t, round_tab)[3] = {
0x0002000200020002ULL,
};
static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2,
static inline void sad8_4_mmx(const uint8_t *blk1, const uint8_t *blk2,
ptrdiff_t stride, int h)
{
x86_reg len = -stride * h;
@ -199,8 +199,8 @@ static inline int sum_mmx(void)
}
#define PIX_SADXY(suf) \
static int sad8_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2, \
uint8_t *blk1, ptrdiff_t stride, int h) \
static int sad8_xy2_ ## suf(MpegEncContext *v, const uint8_t *blk2, \
const uint8_t *blk1, ptrdiff_t stride, int h) \
{ \
av_assert2(h == 8); \
__asm__ volatile ( \
@ -213,8 +213,8 @@ static int sad8_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2, \
return sum_ ## suf(); \
} \
\
static int sad16_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2, \
uint8_t *blk1, ptrdiff_t stride, int h) \
static int sad16_xy2_ ## suf(MpegEncContext *v, const uint8_t *blk2, \
const uint8_t *blk1, ptrdiff_t stride, int h) \
{ \
__asm__ volatile ( \
"pxor %%mm7, %%mm7 \n\t" \

Loading…
Cancel
Save