incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 121233] Lanczos3 resampling for Bitmaps
Date Fri, 19 Oct 2012 10:27:39 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=121233

--- Comment #10 from Tomaž Vajngerl <quikee@gmail.com> ---

> @Tomaž: Thanks for improving the bitmap resampling.
> At first I wondered why you reimplemented the convolution but then I looked
> at Bitmap::ImplConvolute3 in vcl/source/gdi/bitmap4.cxx an saw why.  Maybe
> we can replace it with your code.
In LO I replaced Blur filter with the same separable convolution code but I
don't think you can replace all convolution filters as all are not separable. 

> Two remarks:
> 
> 1. At about line 25 of your patch there is a line
> +	    else if( BMP_SCALE_LANCZOS == nScaleFlag )
> that exists twice (the copy is two lines down).
> 
> Remove the first to activate the Lanczos resampling.

OK

> 2. In ImplScaleConvolution you are using an separable kernel.  If I
> understand that method correctly then ImplConvolutionPass is used to do a
> horizontal application of the two one-dimensional kernels.  For this to work
> the image has to be transposed twice.  Either I am not understanding all
> this correctly or I fail to see where the transposition takes places.  Can
> you explain what I am missing?

ImplCalculateContributions always writes pixels to target image as if it is
transposed. The key thing is in pWriteAcc->SetPixel( x, y, aResultColor ); 
SetPixel definition uses y (height) as the first parameter any x (width) as the
second parameter! (this fact has bitten me a couple of times during development
as it is counter intuitive)

The second key thing is how you create intermediate bitmap : 
first pass - aNewBitmap = Bitmap( Size( nHeight, nNewWidth ), 24);  - height
and width are reversed
second pass -  aNewBitmap = Bitmap( Size( nNewWidth, nNewHeight ), 24);

With this you can have just one ConvolutionPass method instead two similar
ConvolutionPassHorizontal and ConvolutionPassVertical but it is a harder to
understand how it works.

Re, Tomaž

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message