enhance explanations in README, make tcd output more clear

This commit is contained in:
Armin 2026-07-04 19:59:09 +02:00
commit 2ec7d5ec1a
2 changed files with 256 additions and 203 deletions

26
tcd.c
View file

@ -616,19 +616,24 @@ static void render_visual_spectrum(
char title[256];
const char *short_name = strrchr(filename, '/');
short_name = short_name ? short_name + 1 : filename;
int info_len = snprintf(title, sizeof(title), " %s | %s | %d Hz | %d ch",
short_name, fmt_name, sample_rate, channels);
int info_len = snprintf(title, sizeof(title), " %s | %s | %d Hz | %d ch | %lldk",
short_name, fmt_name, sample_rate, channels, (long long)(bitrate / 1000));
int total_w = term_w;
if (info_len > total_w) {
char truncated[256];
snprintf(truncated, sizeof(truncated), " %s | %d Hz | %d ch",
short_name, sample_rate, channels);
snprintf(truncated, sizeof(truncated), " %s | %d Hz | %d ch | %lldk",
short_name, sample_rate, channels, (long long)(bitrate / 1000));
if ((int)strlen(truncated) > total_w) {
snprintf(truncated, sizeof(truncated), " %s | %d ch", short_name, channels);
snprintf(truncated, sizeof(truncated), " %s | %d ch | %lldk",
short_name, channels, (long long)(bitrate / 1000));
if ((int)strlen(truncated) > total_w) {
snprintf(truncated, sizeof(truncated), " %s", short_name);
snprintf(truncated, sizeof(truncated), " %s | %lldk",
short_name, (long long)(bitrate / 1000));
if ((int)strlen(truncated) > total_w) {
truncated[total_w] = '\0';
snprintf(truncated, sizeof(truncated), " %s", short_name);
if ((int)strlen(truncated) > total_w) {
truncated[total_w] = '\0';
}
}
}
}
@ -1294,7 +1299,7 @@ static int process_file(const char *filename, const Options *opts)
printf(ANSI_BOLD ANSI_CYAN "Channels:" ANSI_RESET " %d\n", channels);
printf(ANSI_BOLD ANSI_CYAN "Windows:" ANSI_RESET " %d\n", analyzer.count);
printf(ANSI_BOLD ANSI_CYAN "Peak:" ANSI_RESET " %.1f dBFS\n", peak_db);
printf(ANSI_BOLD ANSI_CYAN "Cutoff:" ANSI_RESET " %.0f Hz (%.1f%% of Nyquist)\n", cutoff_hz, 100.0 * cutoff_hz / nyquist);
printf(ANSI_BOLD ANSI_CYAN "Cutoff:" ANSI_RESET " %.0f / %.0f Hz = %.1f%%\n", cutoff_hz, nyquist, 100.0 * cutoff_hz / nyquist);
printf(ANSI_BOLD ANSI_CYAN "Steepness:" ANSI_RESET " %.0f Hz\n", steepness);
printf(ANSI_BOLD ANSI_CYAN "Roughness:" ANSI_RESET " %.3f\n", roughness);
printf(ANSI_BOLD ANSI_CYAN "Band ratio:" ANSI_RESET " %.3f\n", band_ratio);
@ -1329,8 +1334,9 @@ static int process_file(const char *filename, const Options *opts)
} else {
printf(ANSI_GREEN "NATIVE" ANSI_RESET " (single encode at this bitrate)\n");
}
printf(ANSI_BOLD ANSI_CYAN "Verdict Info:" ANSI_RESET " cutoff=%.1f%% Nyquist, expected≥%.0f%% for %lld kbps",
100.0 * cutoff_ratio, 100.0 * expected_min,
printf(ANSI_BOLD ANSI_CYAN "Verdict Info:" ANSI_RESET " bandwidth used=%.1f%% (%.0f/%.0f Hz), expected≥%.0f%% for %lld kbps",
100.0 * cutoff_ratio, effective_cutoff, nyquist,
100.0 * expected_min,
bitrate > 0 ? (long long)(bitrate / 1000) : 0);
if (upscaled) {
printf(" → suggests ");