• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Show posts

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.

Messages - JernejL

1
I'm trying to rotate an image for 309 degrees, and it results in a strange crash:

Quote
#0 SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR at :0
#1 SYSTEM_$$_SYSFREEMEM_VAR$PFREELISTS$PMEMCHUNK_VAR$$LONGWORD at :0
#2 ?? at :0
#3 FREEMEMNIL(<error reading variable: Attempt to dereference a generic pointer.>) at J:\\Top Down City\EDITORS\Imaging\Source\ImagingUtility.pas:325
#4 FREEIMAGE({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:792
#5 ROTATE45({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}, 22, 0x16af720) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:1970
#6 ROTATEIMAGE({WIDTH = 256, HEIGHT = 256, FORMAT = IFA8R8G8B8, SIZE = 262144, BITS = 0x13450070, PALETTE = 0x0}, 22) at J:\\Top Down City\EDITORS\Imaging\Source\Imaging.pas:2104
#7 MAKEADOOR(292, 0x16afa44) at u_cared.pas:2195
#8 TWND_CAREDITOR__BTN_GENERATEDOORSCLICK(0x17f4c48, <error reading variable>) at u_cared.pas:2348



The crash seems to be depending on which angle i set to rotate about, other angles (343, 326) work well, but 309 degrees seems to be causing an issue.

Image is in this format:

img_door_builder_temp =

record TIMAGEDATA {
  WIDTH = 256,
  HEIGHT = 256,
  FORMAT = IFA8R8G8B8,
  SIZE = 262144,
  BITS = $13450060,
  PALETTE = $0}

Reproducing this is rather easy:

Quote
procedure Twnd_careditor.BitBtn2Click(Sender: TObject);
var
    imgtest: TImageData;
begin

    InitImage(imgtest);

    NewImage(256, 256, IFA8R8G8B8, imgtest);

    RotateImage(imgtest, 309);

    FreeImage(imgtest);

end;


This example seems to show the crash starting at angles 46 and up, but not all ranges seem affected equally:

Quote
procedure Twnd_careditor.BitBtn2Click(Sender: TObject);
var
    imgtest: TImageData;
   i: Integer;
begin

   for i:= 0 to 360 - 1 do begin

      InitImage(imgtest);
       NewImage(256, 256, IFA8R8G8B8, imgtest);
        OutputDebugString(pchar(format('angle %d', [ i ])));
       RotateImage(imgtest, round(i));
       FreeImage(imgtest);

   end;

end;


I think an older imaging version rotated well, maybe i can figure out which one i used in past.
2
Even if it was last updated in 2012, this library is so solid and productive it could well have no updates for years :)

I would however suggest moving repo to github to attract more users and exposure.
3
I wish to share this find with galfar and the rest here, it's related to processing 16 bit floating point values:

http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf

There is already a pascal implementation of this that i have found:
https://github.com/SAmeis/xplib/blob/master/DeHL/Library/src/Math/DeHL.Math.Half.pas

I hope you find it useful, surely a lookup table based solution with no cpu code branching is a big improvement if you process 16 bit floating point values regularly.
SMF spam blocked by CleanTalk