mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
TAV: dead zone defaults
This commit is contained in:
@@ -201,7 +201,7 @@ struct tav_encoder_context {
|
|||||||
int gop_size;
|
int gop_size;
|
||||||
int enable_two_pass;
|
int enable_two_pass;
|
||||||
int quality_level;
|
int quality_level;
|
||||||
int dead_zone_threshold;
|
float dead_zone_threshold;
|
||||||
int entropy_coder;
|
int entropy_coder;
|
||||||
int zstd_level;
|
int zstd_level;
|
||||||
int num_threads;
|
int num_threads;
|
||||||
@@ -1213,20 +1213,20 @@ static int encode_gop_intra_only(tav_encoder_context_t *ctx, gop_slot_t *slot) {
|
|||||||
// Quantize
|
// Quantize
|
||||||
if (ctx->perceptual_tuning) {
|
if (ctx->perceptual_tuning) {
|
||||||
tav_quantise_perceptual(ctx->compat_enc, frame_y, quant_y, num_pixels,
|
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,
|
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,
|
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 {
|
} else {
|
||||||
tav_quantise_uniform(frame_y, quant_y, num_pixels, base_quantiser_y,
|
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);
|
ctx->decomp_levels, 0);
|
||||||
tav_quantise_uniform(frame_co, quant_co, num_pixels, base_quantiser_co,
|
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);
|
ctx->decomp_levels, 1);
|
||||||
tav_quantise_uniform(frame_cg, quant_cg, num_pixels, base_quantiser_cg,
|
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);
|
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
|
// Quantize tile coefficients
|
||||||
if (ctx->perceptual_tuning) {
|
if (ctx->perceptual_tuning) {
|
||||||
tav_quantise_perceptual(ctx->compat_enc, tile_y, quant_y, padded_pixels,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 0, 0);
|
ctx->decomp_levels, 0, 0);
|
||||||
tav_quantise_perceptual(ctx->compat_enc, tile_co, quant_co, padded_pixels,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 1, 0);
|
ctx->decomp_levels, 1, 0);
|
||||||
tav_quantise_perceptual(ctx->compat_enc, tile_cg, quant_cg, padded_pixels,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 1, 0);
|
ctx->decomp_levels, 1, 0);
|
||||||
} else {
|
} else {
|
||||||
tav_quantise_uniform(tile_y, quant_y, padded_pixels, base_quantiser_y,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 0);
|
ctx->decomp_levels, 0);
|
||||||
tav_quantise_uniform(tile_co, quant_co, padded_pixels, base_quantiser_co,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 1);
|
ctx->decomp_levels, 1);
|
||||||
tav_quantise_uniform(tile_cg, quant_cg, padded_pixels, base_quantiser_cg,
|
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,
|
TAV_PADDED_TILE_SIZE_X, TAV_PADDED_TILE_SIZE_Y,
|
||||||
ctx->decomp_levels, 1);
|
ctx->decomp_levels, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,8 +306,8 @@ static void print_usage(const char *program) {
|
|||||||
printf(" --zstd-level N Zstd level 3-22 (default: 7)\n");
|
printf(" --zstd-level N Zstd level 3-22 (default: 7)\n");
|
||||||
printf(" --no-perceptual-tuning Disable HVS perceptual quantization\n");
|
printf(" --no-perceptual-tuning Disable HVS perceptual quantization\n");
|
||||||
printf(" --no-dead-zone Disable dead-zone 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(" --dead-zone-threshold N Dead-zone threshold. Defaults by quality level:\n");
|
||||||
printf(" Note: EZBC entropy coder is always used (Twobitmap deprecated)\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("\nEncoder Presets:\n");
|
||||||
printf(" --preset-sports Sports mode (finer temporal quantization)\n");
|
printf(" --preset-sports Sports mode (finer temporal quantization)\n");
|
||||||
printf(" --preset-anime Anime mode (disable grain)\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;
|
cli.enc_params.perceptual_tuning = 0;
|
||||||
break;
|
break;
|
||||||
case 1007: // --no-dead-zone
|
case 1007: // --no-dead-zone
|
||||||
cli.enc_params.dead_zone_threshold = 0;
|
cli.enc_params.dead_zone_threshold = 0.0;
|
||||||
break;
|
break;
|
||||||
case 1009: // --encode-limit
|
case 1009: // --encode-limit
|
||||||
cli.encode_limit = atoi(optarg);
|
cli.encode_limit = atoi(optarg);
|
||||||
@@ -2431,7 +2431,7 @@ int main(int argc, char *argv[]) {
|
|||||||
cli.enc_params.temporal_wavelet = atoi(optarg);
|
cli.enc_params.temporal_wavelet = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 1023: // --dead-zone-threshold
|
case 1023: // --dead-zone-threshold
|
||||||
cli.enc_params.dead_zone_threshold = atoi(optarg);
|
cli.enc_params.dead_zone_threshold = atof(optarg);
|
||||||
break;
|
break;
|
||||||
case 1024: // --decomp-levels
|
case 1024: // --decomp-levels
|
||||||
cli.enc_params.decomp_levels = atoi(optarg);
|
cli.enc_params.decomp_levels = atoi(optarg);
|
||||||
|
|||||||
Reference in New Issue
Block a user