Ok, diky.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
{$IF Defined(DELPHI)}
{$IF CompilerVersion >= 23}
FloatFormatSettings := TFormatSettings.Create('en-US');
{$ELSE}
// FloatFormatSettings := GetLocaleFormatSettings(1033, Result); // 1.11.2011
GetLocaleFormatSettings(1033, FloatFormatSettings);
{$IFEND}
{$ELSE FPC}
FloatFormatSettings := DefaultFormatSettings;
FloatFormatSettings.DecimalSeparator := '.';
{$IFEND}
procedure EncodeRgbe(const Src: TColor96FPRec; var Dest: TRgbe); {$IFDEF USE_INLINE}inline;{$ENDIF}
var
V, M: Extended; // {$IFDEF FPC}Float{$ELSE}Single{$ENDIF}; // 1.11.2011
..
Frexp(V, M, E); // 1.11.2011, here it used to report the error for M variable (
Quote from: Galfar on 20 April 2010, 16:06:48
Thanks for locating the problem. I probably remove the "optimized" code path altogether, that's not the first problem with it and it's only marginally faster anyway.
Quote from: Galfar on 20 April 2010, 15:33:20
What about calling Canvas.Release or Canvas.Refresh after the pixels are set?
var IWeightR, IAccumAR, IAccumRR, IAccumGR, IAccumBR : single;
...
for J := 0 to DstHeight - 1 do
begin
ClusterY := MapY[J];
for X := XMinimum to XMaximum do
begin
IAccumAR := 0.0; // DMA
IAccumRR := 0.0; // DMA
IAccumGR := 0.0; // DMA
IAccumBR := 0.0; // DMA
for Y := 0 to Length(ClusterY) - 1 do
begin
// IWeight := Round(256 * ClusterY[Y].Weight); // DMA - do not use
IWeightR:= 256*ClusterY[Y].Weight; // DMA, remove rounding
CopyPixel(
@PByteArray(SrcImage.Bits)[(ClusterY[Y].Pos * SrcImage.Width + X) * Info.BytesPerPixel],
@SrcColor, Info.BytesPerPixel);
IAccumBR := IAccumBR + SrcColor.B * IWeightR; // DMA, use single instead of integer
IAccumGR := IAccumGR + SrcColor.G * IWeightR; // DMA, use single instead of integer
IAccumRR := IAccumRR + SrcColor.R * IWeightR; // DMA, use single instead of integer
IAccumAR := IAccumAR + SrcColor.A * IWeightR; // DMA, use single instead of integer
end;
with LineBufferInt[X - XMinimum] do
begin
A := round(IAccumAR); // DMA, round single
R := round (IAccumRR);// DMA, round single
G := round (IAccumGR);// DMA, round single
B := round (IAccumBR);// DMA, round single
end;
end;
DstLine := @PByteArray(DstImage.Bits)[((J + DstY) * DstImage.Width + DstX)* Info.BytesPerPixel];
for I := 0 to DstWidth - 1 do
begin
ClusterX := MapX[I];
IAccumAR := 0.0; // DMA, use single
IAccumRR := 0.0; // DMA, use single
IAccumGR := 0.0; // DMA, use single
IAccumBR := 0.0; // DMA, use single
for X := 0 to Length(ClusterX) - 1 do
begin
// IWeight := Round(256 * ClusterX[X].Weight); // DMA - do not use anymore
IWeightR:= 256*ClusterX[X].Weight; // DMA, use single, do not round
with LineBufferInt[ClusterX[X].Pos - XMinimum] do
begin
IAccumBR := IAccumBR + B * IWeightR; // DMA
IAccumGR := IAccumGR + G * IWeightR; // DMA
IAccumRR := IAccumRR + R * IWeightR; // DMA
IAccumAR := IAccumAR + A * IWeightR; // DMA
end;
end;
SrcColor.B := ClampInt(round(IAccumBR), 0, $00FF0000) shr 16; // DMA, added round on single
SrcColor.G := ClampInt(round(IAccumGR), 0, $00FF0000) shr 16; // DMA, added round on single
SrcColor.R := ClampInt(round(IAccumRR), 0, $00FF0000) shr 16; // DMA, added round on single
SrcColor.A := ClampInt(round(IAccumAR), 0, $00FF0000) shr 16; // DMA, added round on single
CopyPixel(@SrcColor, DstLine, Info.BytesPerPixel);
Inc(DstLine, Info.BytesPerPixel);
end;
end;
Page created in 0.035 seconds with 21 queries.