Menu ▾ ▴

#21 Refactoring TARGA plugin

closed
None
5
2012-10-31
2009-07-15
No

Im including the first step of refactoring the PluginTARGA
All the loading code, including the RLE decoding, is modified to use cached IO, speeding loading by A LOT

Here are some benchmarks:
FI 3.12 this file

BGRA 17374 998
555 16905 970
8bit ch-map RLE 14851 639
BGRA RLE 9190 1115
BGR RLE 8830 1148
555 RLE 2961 729

The results are in milliseconds, the file is 12055 x 9026 and has the same pixel data in all format.

The next step is obviously adding RLE save, but will not happen tomorrow :)

And the next next step is adding some metadata support, may be keywords (IDs) and some "flag" to let the user in what format the file was when loading it.

As for the attached file, I cosider the loading part complete, thats why Im uploading it

Discussion

  • Mihail Naydenov

    Mihail Naydenov - 2009-07-15

    Oops the formating is gone.

    type is the first column
    'FI 3.12' is the second column
    'this file' is the third

     
  • Hervé Drolon

    Hervé Drolon - 2009-07-19

    There's an error in cacheIO_free where you should free ch->home instead of ch->ptr.
    Even with this correction, the new plugin crash on my test images when calling cacheIO_free, probably because the cache read more bytes than available in the cache.
    Moreover, the RLE decoding fails on some images.
    You can test the plugin on my test images located here :
    http://freeimage.sourceforge.net/contribs/targa.zip

     
  • Mihail Naydenov

    Mihail Naydenov - 2009-07-22

    I will look into it, thanks.

     
  • Mihail Naydenov

    Mihail Naydenov - 2009-07-22

    Fixed issue loading some images

     
  • Mihail Naydenov

    Mihail Naydenov - 2009-07-22

    Besides the stupid ptr vs home release, crushing others/CBW8, CCM8,
    all other problems ware because my (wrong?) assumption that images are always compressed line by line. Indeed the spec. say "Run-length Packets should not wrap from one line to another.", but this is explicitly for compressed packets, raw ones may cross lines, I guess...but this does not make sense, because how can one know if given line's first pixel is a (raw) value from prev lines's row pachet or a start of a new packet (header)?

    Anyway, I fixed this (basicaly reverted to the original code) and added the cache.
    The code is a bit slower now (testing for EoL for every rle entry), here the new timing of the original image:

    org / befor / now

    BGRA RLE 9190 / 1115 / 1393
    BGR RLE 8830 / 1148 / 1398
    555 RLE 2961 / 729 / 960

    And (of course) every test image from targa.zip opens correctly!

    Ptr/home release is also fixed.

    I have upoaded the new file

    Hope this is all...

     
  • Hervé Drolon

    Hervé Drolon - 2009-07-23

    Thanks for this new patch : it is now in the CVS :)
    Hervé

     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Anonymous
Anonymous

Add attachments
Cancel