Re: How do I rotate a bitmap fast with high quality?



On Nov 21, 9:32 pm, "[Jongware]" <so...@xxxxxxxxxxx> wrote:
hitxinyu wrote:
the following Demo method is know as this:
// method one is faster,but has a low quality.
// method two has a high quality, but It's too slow for me.
though,I could change double type to float type,
and change float to int using fixed point algorithm.
I want to know a new algorithm, with high quality and faster speed.

void CTestBmpRotateView::RotateAnyAngle(HDC dcSrc,int SrcWidth,int
SrcHeight,double angle,HDC hDC)

[snip heavy example, straight out of starters' manual]

Both methods use Windows functions, either BitBlt or GetPixel/PutPixel.
Using your own buffer is msot likely faster than anything Windows can do.

Method 1: using a BitBlt to copy *a single pixel* from one image to
another? Madness.

Method 2: this samples the pixels at the source image around the
transformed (rotated) point and recalculates the target in RGB. Not bad,
but using Windows' read/write methods, extremely slow. I did this in
plain C, in true color, in real time, a decade ago.

 >though,I could change double type to float type,
 >and change float to int using fixed point algorithm.

About that same time, I learned that everything I knew about converting
floats to fixed point was useless because the floating point
calculations were made vastly faster. Currently, the same goes for
converting doubles to floats -- the "native" format of FPUs is now
double, and converting to /floats/ may take time.

To improve on /this/ algorithm, you should not concentrate on making it
do its dumb stuff faster. Instead, re-write the routine to use
incremental updating of its variables.

[Jongware]

1. Get(Set) pixel;
Method 1: using a BitBlt to copy *a single pixel* from one image
to
another? Madness.
I have said that this just a demo to show bilinear interpolation.and I
also don't know the name of the method one
2.incremental? how to do it in detail?
3.this method may be using in a device with no hardware implement of
the floating point calculations
4.waite later, I will show another implement for bilinear
interpolation.
it will be complex for some reason.
.



Relevant Pages

  • Re: How do I rotate a bitmap fast with high quality?
    ... and change float to int using fixed point algorithm. ... I want to know a new algorithm, with high quality and faster speed. ... >though,I could change double type to float type, ...
    (comp.graphics.algorithms)
  • Re: Standard Deviation
    ... Depending on the input data, this might be int64, extended, or perhaps even a large integer or large float class. ... If you look at the formula, you will see that the value for the SS is computed as a relatively small difference between two numbers that can become very large if the number of values thrown at the algorithm is very large. ... After the loop the average needs no further adjustment, while Std contains the sum of squares and needs to be adjusted if you want the standard deviation. ...
    (borland.public.delphi.non-technical)
  • Re: How to calculate a square root of an integer fast?
    ... > I am now using an algorithm here ... > But I find it is slower than float version of sqrtin the ... SSE2 includes a SIMD floating point square root instruction - ...
    (sci.math.num-analysis)
  • Re: why float
    ... A double *is* a float with more precision. ... It is possibly to do with spurious precision in the doubles - in numerical ... I think it depends on teh algorithm as well. ... single-precision in order to stop rounding errors from amplifying ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How do I rotate a bitmap fast with high quality?
    ... I want to know a new algorithm, with high quality and faster speed. ...  >and change float to int using fixed point algorithm. ... I have said that this just a demo to show bilinear interpolation.and I ...
    (comp.graphics.algorithms)