Opened 10 years ago

Closed 8 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


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 . 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.

Attachments (1)

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

Download all attachments as: .zip

Change History (10)

comment:1 by Even Rouault, 10 years ago

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 by Jeff McKenna, 10 years ago

Maybe one of the outcomes of this ticket could be a new DDS page in the BuildHints wiki (

comment:3 by Jeff McKenna, 10 years ago

Cc: Jeff McKenna added

comment:4 by aboudreault, 10 years ago

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.

by aboudreault, 10 years ago

Attachment: gdal-dds.patch added

comment:5 by aboudreault, 10 years ago

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 by aboudreault, 10 years ago

Committed in r25798.

comment:7 by aboudreault, 10 years ago

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

comment:8 by Jukka Rahkonen, 9 years ago

Not especially large doc page, but at least driver is mentioned in

comment:9 by Daniel Morissette, 8 years ago

Resolution: fixed
Status: newclosed

Thank you for the mention in docs. Closing.

Note: See TracTickets for help on using tickets.