mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 11:51:49 +09:00
tav: fix: incorrect brightness jumping on MT mode
This commit is contained in:
16
CLAUDE.md
16
CLAUDE.md
@@ -153,7 +153,7 @@ Peripheral memories can be accessed using `vm.peek()` and `vm.poke()` functions,
|
|||||||
- **Usage Examples**:
|
- **Usage Examples**:
|
||||||
```bash
|
```bash
|
||||||
# Quality mode
|
# Quality mode
|
||||||
./encoder_tev -i input.mp4 -q 2 -o output.tev
|
./encoder_tev -i input.mp4 -o output.tev -q 3
|
||||||
|
|
||||||
# Playback
|
# Playback
|
||||||
playtev output.tev
|
playtev output.tev
|
||||||
@@ -180,18 +180,18 @@ Peripheral memories can be accessed using `vm.peek()` and `vm.poke()` functions,
|
|||||||
- **Usage Examples**:
|
- **Usage Examples**:
|
||||||
```bash
|
```bash
|
||||||
# Different wavelets
|
# Different wavelets
|
||||||
./encoder_tav -i input.mp4 -w 0 -q 2 -o output.tav # 5/3 reversible (lossless capable)
|
./encoder_tav -i input.mp4 -w 0 -o output.tav # 5/3 reversible (lossless capable)
|
||||||
./encoder_tav -i input.mp4 -w 1 -q 2 -o output.tav # 9/7 irreversible (default, best compression)
|
./encoder_tav -i input.mp4 -w 1 -o output.tav # 9/7 irreversible (default, best compression)
|
||||||
./encoder_tav -i input.mp4 -w 2 -q 2 -o output.tav # CDF 13/7 (experimental)
|
./encoder_tav -i input.mp4 -w 2 -o output.tav # CDF 13/7 (experimental)
|
||||||
./encoder_tav -i input.mp4 -w 16 -q 2 -o output.tav # DD-4 (four-point interpolating)
|
./encoder_tav -i input.mp4 -w 16 -o output.tav # DD-4 (four-point interpolating)
|
||||||
./encoder_tav -i input.mp4 -w 255 -q 2 -o output.tav # Haar (demonstration)
|
./encoder_tav -i input.mp4 -w 255 -o output.tav # Haar (demonstration)
|
||||||
|
|
||||||
# Quality levels (0-5)
|
# Quality levels (0-5)
|
||||||
./encoder_tav -i input.mp4 -q 0 -o output.tav # Lowest quality, smallest file
|
./encoder_tav -i input.mp4 -q 0 -o output.tav # Lowest quality, smallest file
|
||||||
./encoder_tav -i input.mp4 -q 5 -o output.tav # Highest quality, largest file
|
./encoder_tav -i input.mp4 -q 5 -o output.tav # Highest quality, largest file
|
||||||
|
|
||||||
# Temporal 3D DWT (GOP-based encoding)
|
# Temporal 3D DWT (GOP-based encoding)
|
||||||
./encoder_tav -i input.mp4 --temporal-dwt -q 2 -o output.tav
|
./encoder_tav -i input.mp4 --temporal-dwt -o output.tav
|
||||||
|
|
||||||
# Playback
|
# Playback
|
||||||
playtav output.tav
|
playtav output.tav
|
||||||
@@ -259,7 +259,7 @@ Implemented on 2025-10-15 for improved temporal compression through group-of-pic
|
|||||||
**Usage**:
|
**Usage**:
|
||||||
```bash
|
```bash
|
||||||
# Enable temporal 3D DWT
|
# Enable temporal 3D DWT
|
||||||
./encoder_tav -i input.mp4 --temporal-dwt -q 2 -o output.tav
|
./encoder_tav -i input.mp4 --temporal-dwt -o output.tav
|
||||||
|
|
||||||
# Inspect GOP structure
|
# Inspect GOP structure
|
||||||
./tav_inspector output.tav -v
|
./tav_inspector output.tav -v
|
||||||
|
|||||||
@@ -1797,6 +1797,8 @@ typedef struct tav_encoder_s {
|
|||||||
|
|
||||||
// Encoding parameters
|
// Encoding parameters
|
||||||
int quality_level;
|
int quality_level;
|
||||||
|
// IMPORTANT: quantiser_* stores RAW INDICES (0-255), not actual quantizer values
|
||||||
|
// When passing to quantization functions, MUST use QLUT[quantiser_*] to get actual values
|
||||||
int quantiser_y, quantiser_co, quantiser_cg;
|
int quantiser_y, quantiser_co, quantiser_cg;
|
||||||
int wavelet_filter;
|
int wavelet_filter;
|
||||||
int decomp_levels;
|
int decomp_levels;
|
||||||
@@ -3492,8 +3494,8 @@ static int worker_thread_main(void *arg) {
|
|||||||
|
|
||||||
// Step 3: Quantise coefficients (using 3D DWT quantisation for GOP)
|
// Step 3: Quantise coefficients (using 3D DWT quantisation for GOP)
|
||||||
// Use channel-specific quantisers from encoder settings
|
// Use channel-specific quantisers from encoder settings
|
||||||
// Apply QLUT mapping to chroma quantisers (matches single-threaded path)
|
// Apply QLUT mapping to ALL quantisers (matches single-threaded path)
|
||||||
int base_quantiser_y = enc->quantiser_y;
|
int base_quantiser_y = QLUT[enc->quantiser_y]; // Y quantiser from encoder (via QLUT)
|
||||||
int base_quantiser_co = QLUT[enc->quantiser_co]; // Co quantiser from encoder (via QLUT)
|
int base_quantiser_co = QLUT[enc->quantiser_co]; // Co quantiser from encoder (via QLUT)
|
||||||
int base_quantiser_cg = QLUT[enc->quantiser_cg]; // Cg quantiser from encoder (via QLUT)
|
int base_quantiser_cg = QLUT[enc->quantiser_cg]; // Cg quantiser from encoder (via QLUT)
|
||||||
|
|
||||||
@@ -5212,10 +5214,10 @@ static size_t encode_pframe_residual(tav_encoder_t *enc, int qY) {
|
|||||||
qY, enc->width, enc->height,
|
qY, enc->width, enc->height,
|
||||||
enc->decomp_levels, 0, 0);
|
enc->decomp_levels, 0, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
||||||
enc->quantiser_co, enc->width, enc->height,
|
QLUT[enc->quantiser_co], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
||||||
enc->quantiser_cg, enc->width, enc->height,
|
QLUT[enc->quantiser_cg], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
|
|
||||||
// Print max abs for debug
|
// Print max abs for debug
|
||||||
@@ -5232,10 +5234,10 @@ static size_t encode_pframe_residual(tav_encoder_t *enc, int qY) {
|
|||||||
qY, enc->width, enc->height,
|
qY, enc->width, enc->height,
|
||||||
enc->decomp_levels, 0, 0);
|
enc->decomp_levels, 0, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
||||||
enc->quantiser_co, enc->width, enc->height,
|
QLUT[enc->quantiser_co], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
||||||
enc->quantiser_cg, enc->width, enc->height,
|
QLUT[enc->quantiser_cg], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5528,10 +5530,10 @@ static size_t encode_pframe_adaptive(tav_encoder_t *enc, int qY) {
|
|||||||
qY, enc->width, enc->height,
|
qY, enc->width, enc->height,
|
||||||
enc->decomp_levels, 0, 0);
|
enc->decomp_levels, 0, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
||||||
enc->quantiser_co, enc->width, enc->height,
|
QLUT[enc->quantiser_co], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
||||||
enc->quantiser_cg, enc->width, enc->height,
|
QLUT[enc->quantiser_cg], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
|
|
||||||
// Step 8: Preprocess coefficients
|
// Step 8: Preprocess coefficients
|
||||||
@@ -5762,10 +5764,10 @@ static size_t encode_bframe_adaptive(tav_encoder_t *enc, int qY) {
|
|||||||
qY, enc->width, enc->height,
|
qY, enc->width, enc->height,
|
||||||
enc->decomp_levels, 0, 0);
|
enc->decomp_levels, 0, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_co_dwt, quantised_co, frame_size,
|
||||||
enc->quantiser_co, enc->width, enc->height,
|
QLUT[enc->quantiser_co], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
quantise_dwt_coefficients_perceptual_per_coeff(enc, residual_cg_dwt, quantised_cg, frame_size,
|
||||||
enc->quantiser_cg, enc->width, enc->height,
|
QLUT[enc->quantiser_cg], enc->width, enc->height,
|
||||||
enc->decomp_levels, 1, 0);
|
enc->decomp_levels, 1, 0);
|
||||||
|
|
||||||
// Step 8: Preprocess coefficients
|
// Step 8: Preprocess coefficients
|
||||||
|
|||||||
Reference in New Issue
Block a user