diff --git a/app/common/power.h b/app/common/power.h
new file mode 100644
index 000000000..8e574b8c3
--- /dev/null
+++ b/app/common/power.h
@@ -0,0 +1,56 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2019 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
+#ifndef POWER_H
+#define POWER_H
+
+#include
+
+#include "common/define.h"
+
+OLIVE_NAMESPACE_ENTER
+
+uint32_t ceil_to_power_of_2(uint32_t v)
+{
+ v--;
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ v++;
+
+ return v;
+}
+
+uint32_t floor_to_power_of_2(uint32_t x)
+{
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ x = x | (x >> 4);
+ x = x | (x >> 8);
+ x = x | (x >> 16);
+
+ return x - (x >> 1);
+}
+
+OLIVE_NAMESPACE_EXIT
+
+#endif // POWER_H
diff --git a/app/config/config.cpp b/app/config/config.cpp
index 479f5b923..47a34c66e 100644
--- a/app/config/config.cpp
+++ b/app/config/config.cpp
@@ -77,7 +77,7 @@ void Config::SetDefaults()
config_map_["AutoscaleByDefault"] = false;
config_map_["Autoscroll"] = AutoScroll::kPage;
config_map_["DefaultViewerDivider"] = 2;
- config_map_["AutoSelectDivider"] = false;
+ config_map_["AutoSelectDivider"] = true;
config_map_["SetNameWithMarker"] = false;
config_map_["RectifiedWaveforms"] = false;
config_map_["DropWithoutSequenceBehavior"] = TimelineWidget::kDWSAsk;
diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp
index ab851ecdf..1904dfa86 100644
--- a/app/widget/viewer/viewer.cpp
+++ b/app/widget/viewer/viewer.cpp
@@ -31,6 +31,7 @@
#include
#include "audio/audiomanager.h"
+#include "common/power.h"
#include "common/timecodefunctions.h"
#include "config/config.h"
#include "project/item/sequence/sequence.h"
@@ -558,7 +559,7 @@ int ViewerWidget::CalculateDivider()
int long_side_of_video = qMax(GetConnectedNode()->video_params().width(), GetConnectedNode()->video_params().height());
int long_side_of_widget = qMax(display_widget_->width(), display_widget_->height());
- return qMax(1, long_side_of_video / long_side_of_widget);
+ return ceil_to_power_of_2(qMax(1, long_side_of_video / long_side_of_widget));
}
return divider_;