]> git.sesse.net Git - nageru/commitdiff
Support turning off interpolation.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 12 Dec 2018 20:55:11 +0000 (21:55 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 12 Dec 2018 20:55:11 +0000 (21:55 +0100)
futatabi/flags.cpp
futatabi/player.cpp
futatabi/video_stream.cpp

index 0de7b0261937f42b1133e82b95e42d742acbab28..11ae71da864bdc62d9e9240b02ccf54bf7b86559 100644 (file)
@@ -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);
        }
index 684306f633181a50e87dda2b6ac3315763ae2516..d926974712e22a9da0a7346a7ee8ac218b012418 100644 (file)
@@ -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);
                                };
index 2f8f8848e37f4d962e72f339230f05aa7e453e1c..c4cf52e0779a9093709174466afdf79bc8df5c74 100644 (file)
@@ -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;