summaryrefslogtreecommitdiffhomepage
path: root/migration/20220105_00-pt-grayscale.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-01-05 21:05:30 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-01-05 21:10:40 +0100
commitf531c3164271f69cb2caef0334b2e24fdd3f1efc (patch)
tree18093912f5927f55db418b1d8f6f7ad2f5a448e3 /migration/20220105_00-pt-grayscale.cpp
parentd98d36c9acc66fb3158f77274189c92b1330fbf6 (diff)
tracker/pt: clean up grayscale handling. add migration.
The averaging mode is slower than the opencv SIMD implementation for BT.709. Remove it. Make it optional to perform hardware grayscaling using the ps3eye sensor with the open driver. Default to grayscaling using the CPU.
Diffstat (limited to 'migration/20220105_00-pt-grayscale.cpp')
-rw-r--r--migration/20220105_00-pt-grayscale.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/migration/20220105_00-pt-grayscale.cpp b/migration/20220105_00-pt-grayscale.cpp
new file mode 100644
index 00000000..44bdc470
--- /dev/null
+++ b/migration/20220105_00-pt-grayscale.cpp
@@ -0,0 +1,38 @@
+#include "migration.hpp"
+#include "options/options.hpp"
+
+using namespace migrations;
+using namespace options;
+
+#include "api/plugin-support.hpp"
+#include "compat/library-path.hpp"
+
+struct pt_color_grayscale : migration
+{
+ bundle b { make_bundle("tracker-pt") };
+ enum : int { pt_color_average = 5, pt_color_bt709 = 2, };
+
+ QString unique_date() const override
+ {
+ return "20220105_00";
+ }
+
+ QString name() const override
+ {
+ return "pt color enum";
+ }
+
+ bool should_run() const override
+ {
+ auto x = b->get_variant("blob-color").toInt();
+ return x == pt_color_average;
+ }
+
+ void run() override
+ {
+ b->store_kv("blob-color", QVariant::fromValue((int)pt_color_bt709));
+ b->save();
+ }
+};
+
+OPENTRACK_MIGRATION(pt_color_grayscale)