Minimal EDDS reader/writer for Arma/DayZ with LZ4 chunk-stream support.
edds reads and writes EDDS files (DDS header + block table + block bodies),
supports COPY/LZ4 blocks, and decodes the largest mipmap into RGBA.
- EDDS read (config + decode largest mip)
- EDDS write (RGBA/BGRA and BC1/BC2/BC3, optional mipmaps)
- Stream-oriented encode/decode APIs for
io.Reader/io.Writer - Reusable
Encoder/Decoderfor batch pipelines - Optional passthrough of
bcn.EncodeOptions(quality/workers/etc.) - LZ4 Enfusion chunk-stream compress/decompress (COPY/LZ4 blocks)
- DDS header interop via
github.com/woozymasta/bcn
img, err := edds.Read("atlas.edds")
if err != nil {
/* handle */
}
_ = imgcfg, err := edds.ReadConfig("atlas.edds")
if err != nil {
/* handle */
}
_ = cfgerr := edds.WriteWithMipmaps(img, "atlas.edds", 0) // 0 = full chain
if err != nil {
/* handle */
}err := edds.WriteWithFormat(img, "atlas_bc5.edds", bcn.FormatBC5, 0)
if err != nil {
/* handle */
}err := edds.WriteWithOptions(img, "atlas_dxt5.edds", &edds.WriteOptions{
Format: bcn.FormatDXT5,
MaxMipMaps: 0,
Compression: edds.CompressionOptions{
Mode: edds.CompressionLZ4,
},
EncodeOptions: &bcn.EncodeOptions{
QualityLevel: 8,
Workers: 0,
},
})
if err != nil {
/* handle */
}Use CompressionNone for COPY blocks
or CompressionLZ4HC with HCLevel for slower size-priority compression.
err := edds.WriteFromBlocks("atlas_bc3.edds", bcn.FormatDXT5, width, height, mipPayloads)
if err != nil {
/* handle */
}var buf bytes.Buffer
if err := edds.Encode(&buf, img); err != nil {
/* handle */
}
decoded, err := edds.Decode(bytes.NewReader(buf.Bytes()))
if err != nil {
/* handle */
}
_ = decodedPre-encoded mip payloads can be written to any io.Writer:
err := edds.EncodeFromBlocks(&buf, bcn.FormatDXT5, width, height, mipPayloads)
if err != nil {
/* handle */
}Use one Encoder or Decoder per worker goroutine to reuse internal buffers:
enc := edds.NewEncoder()
dec := edds.NewDecoder()
_ = enc.Encode(w, img)
decoded, err := dec.Decode(r)
_ = decoded
_ = errEncoder and Decoder are not safe for concurrent use.
Images returned by Decoder share its reusable pixel buffer
and remain valid only until the next decode call on the same decoder.
Copy the image if it must be retained.
- Package-level encode/decode supports
BGRA8,RGBA8,DXT1/3/5,BC4,BC5. DXT3,BC4,BC5may decode in tooling but may not display correctly in-game/Workbench.- Only 2D textures are handled.