Vector Class Discussion

Bilinear interpolation of images
Author: Agner Date: 2013-02-06 00:11
Chad Jarvis wrote:
I have implemented bilinear interpolation of images in C++
Your code spends most of the time moving data around and converting between float, 8-bit, 16-bit and 32-bit integers. You may think about whether the data can be organized differently so that you don't need so much moving around, reordering and conversion.

Your functions return a single pixel. You may think about whether the data can be organized so that you keep everything in vectors and return a vector of multiple pixels, if this can reduce the number of conversions.

Division by 256 can be done faster by (unsigned) shift right by 8. (Or divide by const_uint(256)).
Multiplication by 256 is done faster by shift left by 8.
Permutation and blend is very slow unless you enable instruction set SSSE3 or higher.

You should add red, green and blue before doing the horizontal add, so that you only need one horizontal add.

 
thread Bilinear interpolation of images new - Chad Jarvis - 2013-02-05
last replythread Bilinear interpolation of images - Agner - 2013-02-06
last reply Bilinear interpolation of images new - Chad Jarvis - 2013-02-07