Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems to me you have probably leveraged FreeImage as far as it can go.</p> <p>The FreeImage source (<a href="http://freeimage.sourceforge.net/download.html" rel="nofollow noreferrer">http://freeimage.sourceforge.net/download.html</a>, BitmapAccess.cpp::FreeImage_AllocateT) seems to malloc image storage as a one-dimensional array:</p> <pre><code>unsigned dib_size = FreeImage_GetImageSize(width, height, bpp); bitmap-&gt;data = (BYTE *)FreeImage_Aligned_Malloc(dib_size * sizeof(BYTE), FIBITMAP_ALIGNMENT); </code></pre> <p>Here, dib_size is "device independent bitmap size", and bpp is "bits per pixel".</p> <p>I assume you use PixelAccess.cpp::FreeImage_GetScanLine() to get the line to copy:</p> <pre><code>BYTE * DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { return (dib) ? CalculateScanLine(FreeImage_GetBits(dib), FreeImage_GetPitch(dib), scanline) : NULL; } </code></pre> <p>which calls </p> <pre><code>inline unsigned char * CalculateScanLine(unsigned char *bits, unsigned pitch, int scanline) { return (bits + (pitch * scanline)); } </code></pre> <p>which seems to be O(1) for array-based lookup.</p> <p>Since FreeImage internally uses static one-dimensional array storage, it does not seem readily apparent how you will achieve better than O(n) performance when growing the image (for example, when inserting copies of rows). It seems to me the best FreeImage can do is internally malloc new storage sufficient to grow the image, then copy the image data from the source to the new image. This would seem to be O(n).</p> <p>Using a new data structure (such as B-tree) would take some effort but would give you better insertion-time characteristics (O(log(n)). However, the trade-off for speedup is increased storage space--you would be storing each pixel in a larger amount of space.</p> <p>Since GDI+ seems closed-source, I am not sure how it implements bitmaps, but given the performance characteristics, it seems worse than FreeImage.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload