mirror of
https://codeberg.org/armin/tcd.git
synced 2026-09-01 14:00:47 +02:00
fix: use 120sec window in the middle of the file, not from the start
when not using -F; further alg. bugfixes
This commit is contained in:
parent
1072dfba65
commit
68f05d2313
1 changed files with 19 additions and 5 deletions
24
tcd.c
24
tcd.c
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#define FFT_SIZE_DEFAULT 4096
|
#define FFT_SIZE_DEFAULT 4096
|
||||||
#define THRESHOLD_DEFAULT 50
|
#define THRESHOLD_DEFAULT 50
|
||||||
#define MAX_ANALYSIS_SECS 60
|
#define MAX_ANALYSIS_SECS 120
|
||||||
#define OVERLAP_FACTOR 2
|
#define OVERLAP_FACTOR 2
|
||||||
|
|
||||||
#define ANSI_RESET "\033[0m"
|
#define ANSI_RESET "\033[0m"
|
||||||
|
|
@ -1082,6 +1082,12 @@ static int process_file(const char *filename, const Options *opts)
|
||||||
int max_frames = opts->full ? INT_MAX : sample_rate * opts->max_secs;
|
int max_frames = opts->full ? INT_MAX : sample_rate * opts->max_secs;
|
||||||
int total_frames = 0;
|
int total_frames = 0;
|
||||||
|
|
||||||
|
if (!opts->full && fmt_ctx->duration > 0 && fmt_ctx->duration != AV_NOPTS_VALUE) {
|
||||||
|
int64_t seek_ts = fmt_ctx->duration / 2;
|
||||||
|
if (av_seek_frame(fmt_ctx, -1, seek_ts, AVSEEK_FLAG_BACKWARD) >= 0)
|
||||||
|
avcodec_flush_buffers(codec_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
float *ring = calloc(opts->fft_size * channels, sizeof(float));
|
float *ring = calloc(opts->fft_size * channels, sizeof(float));
|
||||||
int ring_pos = 0;
|
int ring_pos = 0;
|
||||||
|
|
||||||
|
|
@ -1183,8 +1189,12 @@ static int process_file(const char *filename, const Options *opts)
|
||||||
double expected_min = 0.90;
|
double expected_min = 0.90;
|
||||||
if (bitrate > 0 && bitrate < 192000) expected_min = 0.75;
|
if (bitrate > 0 && bitrate < 192000) expected_min = 0.75;
|
||||||
else if (bitrate > 0 && bitrate < 256000) expected_min = 0.85;
|
else if (bitrate > 0 && bitrate < 256000) expected_min = 0.85;
|
||||||
if (cutoff_ratio > 0 && cutoff_ratio < expected_min - 0.08)
|
if (cutoff_ratio > 0 && cutoff_ratio < expected_min - 0.08) {
|
||||||
upscaled = 1;
|
if (effective_cutoff > 0 && steepness / effective_cutoff > 0.30)
|
||||||
|
upscaled = 0;
|
||||||
|
else
|
||||||
|
upscaled = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render_visual_spectrum(
|
render_visual_spectrum(
|
||||||
|
|
@ -1244,8 +1254,12 @@ static int process_file(const char *filename, const Options *opts)
|
||||||
if (bitrate > 0 && bitrate < 192000) expected_min = 0.75;
|
if (bitrate > 0 && bitrate < 192000) expected_min = 0.75;
|
||||||
else if (bitrate > 0 && bitrate < 256000) expected_min = 0.85;
|
else if (bitrate > 0 && bitrate < 256000) expected_min = 0.85;
|
||||||
|
|
||||||
if (cutoff_ratio > 0 && cutoff_ratio < expected_min - 0.08)
|
if (cutoff_ratio > 0 && cutoff_ratio < expected_min - 0.08) {
|
||||||
upscaled = 1;
|
if (effective_cutoff > 0 && steepness / effective_cutoff > 0.30)
|
||||||
|
upscaled = 0;
|
||||||
|
else
|
||||||
|
upscaled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (upscaled) {
|
if (upscaled) {
|
||||||
printf(ANSI_YELLOW "UPSCALED" ANSI_RESET " (re-encoded from a lower-bitrate source)\n");
|
printf(ANSI_YELLOW "UPSCALED" ANSI_RESET " (re-encoded from a lower-bitrate source)\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue