Commit d67fcf28 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Don't enforce profile width multiple of 8.

Related to #954
parent 167aadd3
Pipeline #52358 canceled with stage
...@@ -416,7 +416,7 @@ bool Core::setCurrentProfile(const QString &profilePath) ...@@ -416,7 +416,7 @@ bool Core::setCurrentProfile(const QString &profilePath)
void Core::checkProfileValidity() 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) { if (offset > 0) {
// Profile is broken, warn user // Profile is broken, warn user
if (m_binWidget) { if (m_binWidget) {
......
...@@ -1439,7 +1439,7 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS ...@@ -1439,7 +1439,7 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
} }
} }
QString matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get()); 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 // Make sure profile width is a multiple of 8, required by some parts of mlt
profile->adjustDimensions(); profile->adjustDimensions();
matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get()); matchingProfile = ProfileRepository::get()->findMatchingProfile(profile.get());
......
...@@ -166,8 +166,8 @@ void LoadJob::checkProfile(const QString &clipId, const QDomElement &xml, const ...@@ -166,8 +166,8 @@ void LoadJob::checkProfile(const QString &clipId, const QDomElement &xml, const
if (service == QLatin1String("qimage") || service == QLatin1String("pixbuf")) { if (service == QLatin1String("qimage") || service == QLatin1String("pixbuf")) {
// This is an image, create profile from image size // This is an image, create profile from image size
int width = producer->get_int("meta.media.width"); int width = producer->get_int("meta.media.width");
if (width % 8 > 0) { if (width % 2 > 0) {
width += 8 - width % 8; width += width % 2;
} }
int height = producer->get_int("meta.media.height"); int height = producer->get_int("meta.media.height");
height += height % 2; height += height % 2;
......
...@@ -157,13 +157,11 @@ ProfileParam::ProfileParam(QDomElement element) ...@@ -157,13 +157,11 @@ ProfileParam::ProfileParam(QDomElement element)
// Ensure profile has viable width / height // Ensure profile has viable width / height
int width = element.attribute(QStringLiteral("width")).toInt(); int width = element.attribute(QStringLiteral("width")).toInt();
int height = element.attribute(QStringLiteral("height")).toInt(); int height = element.attribute(QStringLiteral("height")).toInt();
if ((width % 8) + (height % 2) > 0) { if ((width % 2) + (height % 2) > 0) {
pCore->displayBinMessage( 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); KMessageWidget::Warning);
if (width % 8 > 0) { width += width % 2;
width += 8 - width % 8;
}
height += height % 2; height += height % 2;
element.setAttribute(QStringLiteral("width"), width); element.setAttribute(QStringLiteral("width"), width);
element.setAttribute(QStringLiteral("height"), height); element.setAttribute(QStringLiteral("height"), height);
...@@ -271,8 +269,8 @@ double ProfileParam::sar() const ...@@ -271,8 +269,8 @@ double ProfileParam::sar() const
} }
void ProfileParam::adjustDimensions() void ProfileParam::adjustDimensions()
{ {
if (m_width % 8 > 0) { if (m_width % 2 > 0) {
m_width += 8 - m_width % 8; m_width += m_width % 2;
} }
m_height += m_height % 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