From c768958b335e6a30584d02107667558e454399ae Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 12 Dec 2018 21:55:11 +0100 Subject: [PATCH] Support turning off interpolation. --- futatabi/flags.cpp | 7 ++++--- futatabi/player.cpp | 3 ++- futatabi/video_stream.cpp | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/futatabi/flags.cpp b/futatabi/flags.cpp index 0de7b02..11ae71d 100644 --- a/futatabi/flags.cpp +++ b/futatabi/flags.cpp @@ -27,7 +27,8 @@ void usage() fprintf(stderr, " -h, --height output height in pixels (default 720)\n"); fprintf(stderr, " --slow-down-input slow down input to realtime (default on if no\n"); fprintf(stderr, " source URL given)\n"); - fprintf(stderr, " -q, --interpolation-quality N 1 = fastest\n"); + fprintf(stderr, " -q, --interpolation-quality N 0 = off\n"); + fprintf(stderr, " 1 = fastest\n"); fprintf(stderr, " 2 = default (realtime 720p on fast embedded GPUs)\n"); fprintf(stderr, " 3 = good (realtime 720p on GTX 970 or so)\n"); fprintf(stderr, " 4 = best (not realtime on any current GPU)\n"); @@ -84,8 +85,8 @@ void parse_flags(int argc, char * const argv[]) } } - if (global_flags.interpolation_quality < 1 || global_flags.interpolation_quality > 4) { - fprintf(stderr, "Interpolation quality must be 1, 2, 3 or 4.\n"); + if (global_flags.interpolation_quality < 0 || global_flags.interpolation_quality > 4) { + fprintf(stderr, "Interpolation quality must be 0, 1, 2, 3 or 4.\n"); usage(); exit(1); } diff --git a/futatabi/player.cpp b/futatabi/player.cpp index 684306f..d926974 100644 --- a/futatabi/player.cpp +++ b/futatabi/player.cpp @@ -4,6 +4,7 @@ #include "shared/context.h" #include "defs.h" #include "shared/ffmpeg_raii.h" +#include "flags.h" #include "frame_on_disk.h" #include "shared/httpd.h" #include "jpeg_frame_view.h" @@ -229,7 +230,7 @@ got_clip: } } - if (frame_lower.pts == frame_upper.pts) { + if (frame_lower.pts == frame_upper.pts || global_flags.interpolation_quality == 0) { auto display_func = [this, primary_stream_idx, frame_lower, secondary_frame, fade_alpha]{ destination->setFrame(primary_stream_idx, frame_lower, secondary_frame, fade_alpha); }; diff --git a/futatabi/video_stream.cpp b/futatabi/video_stream.cpp index 2f8f884..c4cf52e 100644 --- a/futatabi/video_stream.cpp +++ b/futatabi/video_stream.cpp @@ -207,7 +207,10 @@ VideoStream::VideoStream() check_error(); OperatingPoint op; - if (global_flags.interpolation_quality == 1) { + if (global_flags.interpolation_quality == 0) { + // Allocate something just for simplicity; we won't be using it. + op = operating_point1; + } else if (global_flags.interpolation_quality == 1) { op = operating_point1; } else if (global_flags.interpolation_quality == 2) { op = operating_point2; -- 2.39.2