Don't enforce profile width multiple of 8.

Related to #954
parent c320c2f1
......@@ -389,7 +389,7 @@ bool Core::setCurrentProfile(const QString &profilePath)
void Core::checkProfileValidity()
{
int offset = (getCurrentProfile()->profile().width() % 8) + (getCurrentProfile()->profile().height() % 2);
int offset = (getCurrentProfile()->profile().width() % 2) + (getCurrentProfile()->profile().height() % 2);
if (offset > 0) {
// Profile is broken, warn user
if (m_binWidget) {
......
......@@ -1439,7 +1439,7 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
}
}
QString matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get());
if (matchingProfile.isEmpty() && (profile->width() % 8 != 0)) {
if (matchingProfile.isEmpty() && (profile->width() % 2 != 0)) {
// Make sure profile width is a multiple of 8, required by some parts of mlt
profile->adjustDimensions();
matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get());
......
......@@ -166,8 +166,8 @@ void LoadJob::checkProfile(const QString &clipId, const QDomElement &xml, const
if (service == QLatin1String("qimage") || service == QLatin1String("pixbuf")) {
// This is an image, create profile from image size
int width = producer->get_int("meta.media.width");
if (width % 8 > 0) {
width += 8 - width % 8;
if (width % 2 > 0) {
width += width % 2;
}
int height = producer->get_int("meta.media.height");
height += height % 2;
......
......@@ -157,13 +157,11 @@ ProfileParam::ProfileParam(QDomElement element)
// Ensure profile has viable width / height
int width = element.attribute(QStringLiteral("width")).toInt();
int height = element.attribute(QStringLiteral("height")).toInt();
if ((width % 8) + (height % 2) > 0) {
if ((width % 2) + (height % 2) > 0) {
pCore->displayBinMessage(
i18n("The project profile is invalid (%1x%2), it was adjusted to %3x%4.", width, height, width + (width % 8), height + (height % 2)),
i18n("The project profile is invalid (%1x%2), it was adjusted to %3x%4.", width, height, width + (width % 2), height + (height % 2)),
KMessageWidget::Warning);
if (width % 8 > 0) {
width += 8 - width % 8;
}
width += width % 2;
height += height % 2;
element.setAttribute(QStringLiteral("width"), width);
element.setAttribute(QStringLiteral("height"), height);
......@@ -271,8 +269,8 @@ double ProfileParam::sar() const
}
void ProfileParam::adjustDimensions()
{
if (m_width % 8 > 0) {
m_width += 8 - m_width % 8;
if (m_width % 2 > 0) {
m_width += m_width % 2;
}
m_height += m_height % 2;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment