Can someone confirm if my idea is good. I have default parameters except: SCALE_INT_BITS = 5, SCALE_FRAC_BITS = 6 I have e.x. input stream 4x3 pixels and I want enlarge it to 16x12. inputSize/outputSize = 4/16 and 3/12 and they are not integers so I use second formula (p.13 in pdf) xScale = 2^6 (4-1)/(16-1)-1 = 11.8 => 01011.110011 = 11.796875 yScale = 2^6 (3-1)/(12-1)-1 = 10.(63) => 01010.101000 = 10.625
Those values should be correct. Use the numbers you have rounded down, so xScale = 11, yScale = 10. Note that with the reduced value of SCALE_FRAC_BITS, there's slightly more error in these values. The equations to set xScale and yScale are conservative to ensure the image is not scaled up too little, which would cause artifacts. With the default value for SCALE_FRAC_BITS, the error is extremely small, but it greater here due to the small resolutions in this example and the smaller SCALE_FRAC_BITS.
Can you have e how to set leftOffset and topFracOffset.