TAV: dead zone defaults

This commit is contained in:
minjaesong
2025-12-16 19:16:47 +09:00
parent 3a19b6aea8
commit 9e1191c0c2
2 changed files with 17 additions and 17 deletions

View File

@@ -201,7 +201,7 @@ struct tav_encoder_context {
int gop_size;
int enable_two_pass;
int quality_level;
int dead_zone_threshold;
float dead_zone_threshold;
int entropy_coder;
int zstd_level;
int num_threads;
@@ -1213,20 +1213,20 @@ static int encode_gop_intra_only(tav_encoder_context_t *ctx, gop_slot_t *slot) {
// Quantize
if (ctx->perceptual_tuning) {
tav_quantise_perceptual(ctx->compat_enc, frame_y, quant_y, num_pixels,
base_quantiser_y, (float)ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 0, 0);
base_quantiser_y, ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 0, 0);
tav_quantise_perceptual(ctx->compat_enc, frame_co, quant_co, num_pixels,
base_quantiser_co, (float)ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 1, 0);
base_quantiser_co, ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 1, 0);
tav_quantise_perceptual(ctx->compat_enc, frame_cg, quant_cg, num_pixels,
base_quantiser_cg, (float)ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 1, 0);
base_quantiser_cg, ctx->dead_zone_threshold, width, height, ctx->decomp_levels, 1, 0);
} else {
tav_quantise_uniform(frame_y, quant_y, num_pixels, base_quantiser_y,
(float)ctx->dead_zone_threshold, width, height,
ctx->dead_zone_threshold, width, height,
ctx->decomp_levels, 0);
tav_quantise_uniform(frame_co, quant_co, num_pixels, base_quantiser_co,
(float)ctx->dead_zone_threshold, width, height,
ctx->dead_zone_threshold, width, height,
ctx->decomp_levels, 1);
tav_quantise_uniform(frame_cg, quant_cg, num_pixels, base_quantiser_cg,
(float)ctx->dead_zone_threshold, width, height,
ctx->dead_zone_threshold, width, height,
ctx->decomp_levels, 1);
}
@@ -1276,28 +1276,28 @@ static int encode_gop_intra_only(tav_encoder_context_t *ctx, gop_slot_t *slot) {
// Quantize tile coefficients
if (ctx->perceptual_tuning) {
tav_quantise_perceptual(ctx->compat_enc, tile_y, quant_y, padded_pixels,
base_quantiser_y, (float)ctx->dead_zone_threshold,
base_quantiser_y, ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 0, 0);
tav_quantise_perceptual(ctx->compat_enc, tile_co, quant_co, padded_pixels,
base_quantiser_co, (float)ctx->dead_zone_threshold,
base_quantiser_co, ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 1, 0);
tav_quantise_perceptual(ctx->compat_enc, tile_cg, quant_cg, padded_pixels,
base_quantiser_cg, (float)ctx->dead_zone_threshold,
base_quantiser_cg, ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 1, 0);
} else {
tav_quantise_uniform(tile_y, quant_y, padded_pixels, base_quantiser_y,
(float)ctx->dead_zone_threshold,
ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 0);
tav_quantise_uniform(tile_co, quant_co, padded_pixels, base_quantiser_co,
(float)ctx->dead_zone_threshold,
ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 1);
tav_quantise_uniform(tile_cg, quant_cg, padded_pixels, base_quantiser_cg,
(float)ctx->dead_zone_threshold,
ctx->dead_zone_threshold,
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
ctx->decomp_levels, 1);
}

View File

@@ -306,8 +306,8 @@ static void print_usage(const char *program) {
printf(" --zstd-level N Zstd level 3-22 (default: 7)\n");
printf(" --no-perceptual-tuning Disable HVS perceptual quantization\n");
printf(" --no-dead-zone Disable dead-zone quantization\n");
printf(" --dead-zone-threshold N Dead-zone threshold 1-10 (default: 0=disabled)\n");
printf(" Note: EZBC entropy coder is always used (Twobitmap deprecated)\n");
printf(" --dead-zone-threshold N Dead-zone threshold. Defaults by quality level:\n");
printf(" 0=1.5, 1=1.5, 2=1.2, 3=1.1, 4=0.8, 5=0.6\n");
printf("\nEncoder Presets:\n");
printf(" --preset-sports Sports mode (finer temporal quantization)\n");
printf(" --preset-anime Anime mode (disable grain)\n");
@@ -2394,7 +2394,7 @@ int main(int argc, char *argv[]) {
cli.enc_params.perceptual_tuning = 0;
break;
case 1007: // --no-dead-zone
cli.enc_params.dead_zone_threshold = 0;
cli.enc_params.dead_zone_threshold = 0.0;
break;
case 1009: // --encode-limit
cli.encode_limit = atoi(optarg);
@@ -2431,7 +2431,7 @@ int main(int argc, char *argv[]) {
cli.enc_params.temporal_wavelet = atoi(optarg);
break;
case 1023: // --dead-zone-threshold
cli.enc_params.dead_zone_threshold = atoi(optarg);
cli.enc_params.dead_zone_threshold = atof(optarg);
break;
case 1024: // --decomp-levels
cli.enc_params.decomp_levels = atoi(optarg);