ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 fragmented memory
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

davenovo

USA
26 Posts

Posted - Jan 18 2014 :  15:39:52  Show Profile  Reply
Is there a way to ensure that ieMemory will store all the picture data as a single block all the time. The reason being I am going to be passing the memory block to other DLLS for processing and these DLLS need the memory to be in a contiguous block. I know I can go through the scanlines and copy them to a contiguous block, but I would rather just have imageEn keep it contiguous.

quantuz

Sweden
55 Posts

Posted - Jan 28 2014 :  15:31:01  Show Profile  Reply
Hi!

I have had the same problem needed all data in the same memory block, and Fabrizio had a solution for us som yease ago, sending a copy of what Fabrizio replied

--------------------------------------------------
Let me analyze with attention every email I received (from you and from Christer) about this problem, so pardon me if it will take some time.
First of all, I see:

TRGB48 * ie48ptr =
(TRGB48*)bitmap->iEBitmapPtr_->ScanLine[bitmap->height_-1];
TRGB48 val48;
for (y=0; y<bitmap->height_; y++)
for (x=0; x<bitmap->width_; x++)
val48 = ie48ptr[y*bitmap->stepBytes_/6+x]; //CG protest here
}

that code supposes that Scanline[height-1] returns a continuous block of memory: it is not always true!
If there isn't enough continue free space, ImageEn will allocate the image in chunks.

To avoid this behavior, I have to introduce another public field (like the other iegAutoLocateOnDisk), which disables this "feature". This time it is named "iegAutoFragmentBitmap".
So, for your necessities you have to set:

iegAutoFragmentBitmap = false;
iegAutoLocateOnDisk = false;

That must be done before allocate or use TIEBitmap objects.

Please accept my apologies if I done error or if I don't understood what you actually mean.

Regards,
Fabrizio

---------------------------------
Hi,
sorry I cannot understand this question:

> How can we decide if a memory-located bitmap is segmented ?

do you mean "How can we know..."?

In this case there isn't a property to know it.
In the attached version I added TIEBitmap.FragmentsCount property: if it is >1 then the image is fragmented.

Hope this helps.

Regards,
Fabrizio
--------------------

Best regards,
//Christer
Go to Top of Page

davenovo

USA
26 Posts

Posted - Jan 30 2014 :  14:25:41  Show Profile  Reply
Hi Nigel,

It seems there are some options there, i.e. IEGlobalSettings().AutoFragmentBitmap and it does seem like it at least TIEBitmap.AllocateImage tries to allocate a while block first and only does fragments if that fails.

Are you sure that there is no way to do this. Looking further, it seems allocating as a block is the default behavior.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: