Opened 9 years ago

Closed 7 years ago

#5017 closed defect (fixed)

New Driver: DDS

Reported by: aboudreault Owned by: aboudreault
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc: Jeff McKenna

Description

This is a proposal for a new driver for the DDS format. The DDS file format (from Microsoft), is a standard for storing data compressed with the lossy S3 Texture Compression. See more information at http://en.wikipedia.org/wiki/DirectDraw_Surface . We use that driver with MapServer? as a gdal output format. We built it for the Nasa Worldwind project. The current implementation is write-only and supports RGB and RGBA raster.

The driver uses the library *crunch* for the s3 texture compression and dds file writing, which is compatible Windows, Mac and Linux.

http://code.google.com/p/crunch/

Attachments (1)

gdal-dds.patch (23.1 KB) - added by aboudreault 9 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by Even Rouault

A few remarks :

  • do you really intend to assigning copyright to Frank ? (refering to "Copyright (c) 2012, Frank Warmerdam")
  • wrong error message at line 126 : "Unable to create png file"
  • First time I see STRCASECMP macro used, not sure where it is defined. We generally use EQUAL in GDAL, in a more natual way i.e. EQUAL(a,b) <==> !STRCASECMP(a,b) (no need for the binary negation ! for EQUAL)
  • Not sure how endianness is defined in the DDS on-disk format, but there might be endianness problems when serializing structures like VSIFWriteL(&ddsDesc, 1, sizeof(ddsDesc), fpImage) (and possible other places) on non-Intel architectures (if that matters)
  • The code assumes that the width and height of the source images are multiples of cDXTBlockSize (4), at least in the poSrcDS->RasterIO() call that will certainly return an out-of-window error if the number of lines is not a multiple of 4. If not, I think that the right or bottom pixels will be lost. Either this must be enforced (or warned) by a preliminary check, either non multiple of 4 dimensions must be deal with.
  • For the XML <CreationOptionList?>, you can use "string-select" as the type for the options and put each value as a separate entry (see frmts/gtiff/geotiff.cpp for examples)
  • You can advertize poDriver->SetMetadataItem?( GDAL_DCAP_VIRTUALIO, "YES" );
  • A small help page (or a new section in frmt_various.html) would be welcome with the associated poDriver->SetMetadataItem?( GDAL_DMD_HELPTOPIC, "frmt_XXXX.html" )
  • A link from formats_list.html to the help page would be welcome.
  • I believe the code has never been compiled with MSVC since crn_uint32 src_image[nXSize*cDXTBlockSize]; will not compile AFAIR (not sure about crn_uint32 pixels[cDXTBlockSize * cDXTBlockSize]; where cDXTBlockSize is a const int). And on Linux it should also be avoided and replaced by a dynamic allocation.
  • I find it amusing that the build scripts available are for Linux only, for a Microsoft format ;-)

comment:2 Changed 9 years ago by Jeff McKenna

Maybe one of the outcomes of this ticket could be a new DDS page in the BuildHints wiki (http://trac.osgeo.org/gdal/wiki/BuildHints).

comment:3 Changed 9 years ago by Jeff McKenna

Cc: Jeff McKenna added

comment:4 Changed 9 years ago by aboudreault

Thanks EvenR. I'll modify my patch with your comments and attach a new patch. FYI, yeah, I don't have any Windows env to try the compilation. Emm.. will try to provide a makefile to let someone test though.

Changed 9 years ago by aboudreault

Attachment: gdal-dds.patch added

comment:5 Changed 9 years ago by aboudreault

Ok, I modified my patch with your comments roualt. I will also add a page in BuildHints as soon as my changes to libcrunch have been merged.

comment:6 Changed 9 years ago by aboudreault

Committed in r25798.

comment:7 Changed 9 years ago by aboudreault

Keeping open the ticket, a doc page in the wiki still need to be done...

comment:8 Changed 8 years ago by Jukka Rahkonen

Not especially large doc page, but at least driver is mentioned in http://www.gdal.org/frmt_various.html.

comment:9 Changed 7 years ago by Daniel Morissette

Resolution: fixed
Status: newclosed

Thank you for the mention in docs. Closing.

Note: See TracTickets for help on using tickets.