wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
codec.hpp File Reference

The BLP pixel codecs (namespace wowlib::formats::blp::detail): DxtCodec, PaletteCodec, RawCodec and MipmapScaler. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include <wowlib/core/buffer.hpp>
#include <wowlib/core/error.hpp>
#include <wowlib/formats/blp/blp.hpp>
#include <wowlib/formats/common/types.hpp>
Include dependency graph for codec.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  wowlib::formats::blp::detail::DxtCodec
 The DXT/BC block codec. More...
class  wowlib::formats::blp::detail::PaletteCodec
 The palettized codec. More...
class  wowlib::formats::blp::detail::RawCodec
 The uncompressed-BGRA codec (ColorEncoding::Bgra / BgraAlt): a pure channel swizzle. More...
class  wowlib::formats::blp::detail::MipmapScaler
 The mip-chain downscaler: one box-filter halving step per call, the standard non-sRGB-aware average every BLP toolchain uses. More...

Namespaces

namespace  wowlib
namespace  wowlib::formats
namespace  wowlib::formats::blp
namespace  wowlib::formats::blp::detail

Typedefs

using wowlib::formats::blp::detail::BlockPixels = std::array<std::uint8_t, 16 * 4>
 One decoded 4x4 texel block: 16 RGBA pixels, row-major.

Detailed Description

The BLP pixel codecs (namespace wowlib::formats::blp::detail): DxtCodec, PaletteCodec, RawCodec and MipmapScaler.

Each codec moves one mip level between its on-disk payload bytes and the library's single in-memory pixel layout — 8-bit RGBA, row-major, top-left origin. Following the house rule (and the adt::detail::AlphaMapCodec precedent) each is a class with a small decode()/encode() surface and its per-format strategies as protected members: the block format / alpha depth is the codec's constructor state, the pixels are call parameters.

Decoding is wowlib's own (BC1/BC2/BC3/BC5 block decoders, palette lookup + alpha-plane unpacking, BGRA swizzle). DXT compression rides on stb_dxt (BC1 opaque, BC3, BC5) with two in-house additions stb_dxt lacks: BC1 punch-through blocks (1-bit alpha) and BC2's explicit 4-bit alpha. Definitions live in blp.cpp — the only TU that sees stb_dxt.

Definition in file codec.hpp.