25 #define FILTER(src, stride) \
26 ((21*((src)[ 0*stride] + (src)[1*stride]) \
27 -7*((src)[-1*stride] + (src)[2*stride]) \
28 +3*((src)[-2*stride] + (src)[3*stride]) \
29 -1*((src)[-3*stride] + (src)[4*stride]) + 16) >> 5)
36 for (y = 0; y <
height; y++) {
37 for (x = -3; x < width+5; x++)
38 dstv[x] = av_clip_uint8(
FILTER(src+x, stride));
40 for (x = 0; x <
width; x++)
41 dstc[x] = av_clip_uint8(
FILTER(dstv+x, 1));
43 for (x = 0; x <
width; x++)
44 dsth[x] = av_clip_uint8(
FILTER(src+x, 1));
53 #define PIXOP_BILINEAR(PFX, OP, WIDTH) \
54 static void ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c(uint8_t *dst, const uint8_t *src[5], int stride, int h) \
57 const uint8_t *s0 = src[0]; \
58 const uint8_t *s1 = src[1]; \
59 const uint8_t *s2 = src[2]; \
60 const uint8_t *s3 = src[3]; \
61 const uint8_t *w = src[4]; \
64 for (x = 0; x < WIDTH; x++) { \
65 OP(dst[x], (s0[x]*w[0] + s1[x]*w[1] + s2[x]*w[2] + s3[x]*w[3] + 8) >> 4); \
76 #define OP_PUT(dst, val) (dst) = (val)
77 #define OP_AVG(dst, val) (dst) = (((dst) + (val) + 1)>>1)
86 #define op_scale1(x) block[x] = av_clip_uint8( (block[x]*weight + (1<<(log2_denom-1))) >> log2_denom)
87 #define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + (1<<(log2_denom-1))) >> log2_denom)
89 #define DIRAC_WEIGHT(W) \
90 static void weight_dirac_pixels ## W ## _c(uint8_t *block, int stride, int log2_denom, \
91 int weight, int h) { \
94 for (x = 0; x < W; x++) { \
101 static void biweight_dirac_pixels ## W ## _c(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, \
102 int weightd, int weights, int h) { \
105 for (x = 0; x < W; x++) { \
118 #define ADD_OBMC(xblen) \
119 static void add_obmc ## xblen ## _c(uint16_t *dst, const uint8_t *src, int stride, \
120 const uint8_t *obmc_weight, int yblen) \
124 for (x = 0; x < xblen; x += 2) { \
125 dst[x ] += src[x ] * obmc_weight[x ]; \
126 dst[x+1] += src[x+1] * obmc_weight[x+1]; \
141 for (y = 0; y <
height; y++) {
142 for (x = 0; x <
width; x+=4) {
143 dst[x ] = av_clip_uint8(src[x ] + 128);
144 dst[x+1] = av_clip_uint8(src[x+1] + 128);
145 dst[x+2] = av_clip_uint8(src[x+2] + 128);
146 dst[x+3] = av_clip_uint8(src[x+3] + 128);
154 const int16_t *idwt,
int idwt_stride,
159 for (y = 0; y <
height; y++) {
160 for (x = 0; x <
width; x+=2) {
161 dst[x ] = av_clip_uint8(((src[x ]+32)>>6) + idwt[x ]);
162 dst[x+1] = av_clip_uint8(((src[x+1]+32)>>6) + idwt[x+1]);
170 #define PIXFUNC(PFX, WIDTH) \
171 c->PFX ## _dirac_pixels_tab[WIDTH>>4][0] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _c; \
172 c->PFX ## _dirac_pixels_tab[WIDTH>>4][1] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l2_c; \
173 c->PFX ## _dirac_pixels_tab[WIDTH>>4][2] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l4_c; \
174 c->PFX ## _dirac_pixels_tab[WIDTH>>4][3] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c