static void RENAME(spatial_compose_daub97i_dy)(DWTContext *d, int level, int width, int height, int stride) { vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; vertical_compose_3tap vertical_compose_l1 = (void*)d->vertical_compose_l1; vertical_compose_3tap vertical_compose_h1 = (void*)d->vertical_compose_h1; DWTCompose *cs = d->cs + level; int i, y = cs->y; uint8_t *b[6]; for (i = 0; i < 4; i++) b[i] = cs->b[i]; b[4] = d->buffer + avpriv_mirror(y+3, height-1)*stride; b[5] = d->buffer + avpriv_mirror(y+4, height-1)*stride; if(y+3<(unsigned)height) vertical_compose_l1(b[3], b[4], b[5], width); if(y+2<(unsigned)height) vertical_compose_h1(b[2], b[3], b[4], width); if(y+1<(unsigned)height) vertical_compose_l0(b[1], b[2], b[3], width); if(y+0<(unsigned)height) vertical_compose_h0(b[0], b[1], b[2], width); if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); for (i = 0; i < 4; i++) cs->b[i] = b[i+2]; cs->y += 2; }
static void RENAME(spatial_compose97i_init)(DWTCompose *cs, uint8_t *buffer, int height, int stride) { cs->b[0] = buffer + avpriv_mirror(-3-1, height-1)*stride; cs->b[1] = buffer + avpriv_mirror(-3 , height-1)*stride; cs->b[2] = buffer + avpriv_mirror(-3+1, height-1)*stride; cs->b[3] = buffer + avpriv_mirror(-3+2, height-1)*stride; cs->y = -3; }
int avfilter_transform(const uint8_t *src, uint8_t *dst, int src_stride, int dst_stride, int width, int height, const float *matrix, enum InterpolateMethod interpolate, enum FillMethod fill) { int x, y; float x_s, y_s; uint8_t def = 0; uint8_t (*func)(float, float, const uint8_t *, int, int, int, uint8_t) = NULL; switch(interpolate) { case INTERPOLATE_NEAREST: func = interpolate_nearest; break; case INTERPOLATE_BILINEAR: func = interpolate_bilinear; break; case INTERPOLATE_BIQUADRATIC: func = interpolate_biquadratic; break; default: return AVERROR(EINVAL); } for (y = 0; y < height; y++) { for(x = 0; x < width; x++) { x_s = x * matrix[0] + y * matrix[1] + matrix[2]; y_s = x * matrix[3] + y * matrix[4] + matrix[5]; switch(fill) { case FILL_ORIGINAL: def = src[y * src_stride + x]; break; case FILL_CLAMP: y_s = av_clipf(y_s, 0, height - 1); x_s = av_clipf(x_s, 0, width - 1); def = src[(int)y_s * src_stride + (int)x_s]; break; case FILL_MIRROR: x_s = avpriv_mirror(x_s, width-1); y_s = avpriv_mirror(y_s, height-1); av_assert2(x_s >= 0 && y_s >= 0); av_assert2(x_s < width && y_s < height); def = src[(int)y_s * src_stride + (int)x_s]; } dst[y * dst_stride + x] = func(x_s, y_s, src, width, height, src_stride, def); } } return 0; }
static void RENAME(spatial_compose_dirac53i_dy)(DWTContext *d, int level, int width, int height, int stride) { vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; DWTCompose *cs = d->cs + level; int y= cs->y; uint8_t *b[4] = { cs->b[0], cs->b[1] }; b[2] = d->buffer + avpriv_mirror(y+1, height-1)*stride; b[3] = d->buffer + avpriv_mirror(y+2, height-1)*stride; if(y+1<(unsigned)height) vertical_compose_l0(b[1], b[2], b[3], width); if(y+0<(unsigned)height) vertical_compose_h0(b[0], b[1], b[2], width); if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); cs->b[0] = b[2]; cs->b[1] = b[3]; cs->y += 2; }
static void RENAME(spatial_compose53i_init)(DWTCompose *cs, uint8_t *buffer, int height, int stride) { cs->b[0] = buffer + avpriv_mirror(-1-1, height-1)*stride; cs->b[1] = buffer + avpriv_mirror(-1 , height-1)*stride; cs->y = -1; }