#include <dlfcn.h>
#include <math.h>
#include <stdio.h>
+#include <stdint.h>
#include <x264.h>
#include <algorithm>
#include <chrono>
#include <cmath>
-#include <ratio>
-#include <type_traits>
#include "flags.h"
#include "shared/metrics.h"
+#include "x264_dynamic.h"
using namespace std;
using namespace std::chrono;
#define SC_PRESETS 23
X264SpeedControl::X264SpeedControl(x264_t *x264, float f_speed, int i_buffer_size, float f_buffer_init)
- : dyn(load_x264_for_bit_depth(global_flags.x264_bit_depth)),
+ : dyn(load_x264_for_bit_depth(global_flags.bit_depth)),
x264(x264), f_speed(f_speed)
{
x264_param_t param;
stat.max_buffer = max(buffer_fill, stat.max_buffer);
if (buffer_fill >= buffer_size) { // oops, cpu was idle
- // not really an error, but we'll warn for debugging purposes
- static int64_t idle_t = 0;
- static steady_clock::time_point print_interval;
- static bool first = false;
- idle_t += buffer_fill - buffer_size;
- if (first || duration<double>(t - print_interval).count() > 0.1) {
- //fprintf(stderr, "speedcontrol idle (%.6f sec)\n", idle_t/1e6);
- print_interval = t;
- idle_t = 0;
- first = false;
- }
buffer_fill = buffer_size;
metric_x264_speedcontrol_buffer_available_seconds = buffer_fill * 1e-6;
++metric_x264_speedcontrol_idle_frames;