FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
huffman_stage.h File Reference

Huffman entropy coding stage. More...

#include "stage/stage.h"
#include "fzm_format.h"
#include "coders/huffman/phf/hf.h"
#include "backend/types.h"
#include <cstdint>
#include <cstring>
#include <memory>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>

Go to the source code of this file.

Classes

struct  fz::HuffmanBookSpec
 
class  fz::HuffmanStage< T >
 

Namespaces

namespace  fz
 

Enumerations

enum class  fz::HuffmanEncodeMode { fz::Coarse , fz::Fine }
 
enum class  fz::HuffmanBookSource { fz::PerBlock , fz::Fixed , fz::Adaptive }
 
enum class  fz::HuffmanBookModel { fz::Gaussian , fz::Laplace , fz::GeneralizedNormal , fz::Uniform }
 

Detailed Description

Huffman entropy coding stage.

Forward: T[] → variable-length PHF bitstream (inline phf_header prepended). Inverse: PHF bitstream → T[].

The encode path is the multi-kernel coarse-grained path, which carries a CPU prefix-sum sync in the middle of encode. HuffmanEncodeMode::Fine selects an alternative single-kernel path without that sync, but it is experimental and does not engage on realistic data — see setEncodeMode().

Note: the histogram D2H is a CPU-sync operation in both modes. It disappears entirely under HuffmanBookSource::Fixed, which builds the codebook once up front instead of per call; see setBookSource(). The encoded stream is unchanged, so fixed-book output decodes with a stock decoder.

Supported input types: uint8_t, uint16_t, uint32_t.

Serialized header layout (11 bytes): [0] DataType of T (1 byte) [1..2] bklen_ (uint16_t LE) [3..10] original_len_ (uint64_t LE, element count)