. Second, can they be done in fixed-point? Third, can it be merged with swscale? Though that looks hard, filters should be using it for scaling and transformation if possible. > +. > + return PIXEL(src, (int)round(x), (int)round(y), width, height, stride, def); Should be roundf(), and then it should be lrintf(). Unless (int)(x + .5f) is faster. (Of course, ignore all of this if you can do it in fixed-point) > +/** > + * Bilinear interpolation > + */ This won't work for downscaling because it won't sample any more than 4 source pixels. Same for the other methods. > + return (uint8_t) s; The cast doesn't do anything. > +/** > + * Biquadratic interpolation > + */ If you're going to provide something better than linear, at least make it bicubic or slower than that. swscale has several good kernels. > + x_c = (int)ceilf(x); > + x_f = (int)floorf(x); > + y_c = (int)ceilf(y); > + y_f = (int)floorf(y); These casts are unnecessary too. > . Just use a loop for add/sub/mul. > +void avfilter_transform(const uint8_t *src, uint8_t *dst, int src_stride, int dst_stride, int width, int height, const double *matrix, enum InterpolateMethod interpolate, enum FillMethod fill) This line is too long. > + case FILL_EXTRUDE: Call it CLAMP, maybe? > + def = src[(int)((y_s < 0) ? -y_s : (y_s >= height) ? (height + height - y_s) : y_s) * src_stride + (int)((x_s < 0) ? -x_s : (x_s >= width) ? (width + width - x_s) : x_s)]; Split this into multiple statements so the lines are shorter.