TAV: improved compression using some coefficient preprocessing

This commit is contained in:
minjaesong
2025-09-29 01:17:53 +09:00
parent 01278815c7
commit 66909537a0
5 changed files with 280 additions and 47 deletions

View File

@@ -170,6 +170,7 @@ Peripheral memories can be accessed using `vm.peek()` and `vm.poke()` functions,
- **Perceptual quantization**: HVS-optimized coefficient scaling
- **YCoCg-R color space**: Efficient chroma representation with "simulated" subsampling using anisotropic quantization (search for "ANISOTROPY_MULT_CHROMA" on the encoder)
- **6-level DWT decomposition**: Deep frequency analysis for better compression (deeper levels possible but 6 is the maximum for the default TSVM size)
- **Significance Map Compression**: Improved coefficient storage format exploiting sparsity for 15-20% additional compression (2025-09-29 update)
- **Usage Examples**:
```bash
# Different wavelets
@@ -222,4 +223,23 @@ Peripheral memories can be accessed using `vm.peek()` and `vm.poke()` functions,
- **255**: Haar (demonstration only, simplest possible wavelet)
- **Format documentation**: `terranmon.txt` (search for "TSVM Advanced Video (TAV) Format")
- **Version**: Current (perceptual quantization, multi-wavelet support)
- **Version**: Current (perceptual quantization, multi-wavelet support, significance map compression)
#### TAV Significance Map Compression (Technical Details)
The significance map compression technique implemented on 2025-09-29 provides substantial compression improvements by exploiting the sparsity of quantized DWT coefficients:
**Implementation Files**:
- **C Encoder**: `video_encoder/encoder_tav.c` - `preprocess_coefficients()` function (lines 960-991)
- **C Decoder**: `video_encoder/decoder_tav.c` - `postprocess_coefficients()` function (lines 29-48)
- **Kotlin Decoder**: `GraphicsJSR223Delegate.kt` - `postprocessCoefficients()` function for TSVM runtime
**Technical Approach**:
```
Original: [coeff_array] → [significance_bits + nonzero_values]
- Significance map: 1 bit per coefficient (0=zero, 1=non-zero)
- Value array: Only non-zero coefficients in sequence
- Result: 15-20% compression improvement on typical video content
```
**Performance**: Tested on quantized DWT coefficients with 86.9% sparsity, achieving 16.4% compression improvement before Zstd compression. The technique is particularly effective on high-frequency subbands where sparsity often exceeds 95%.