sequence: made divider a sequence parameter rather than a viewer parameter
Doing this makes the preview resolution an explicit project setting rather than a temporary UI setting. This will allow more consistency when caching.
This commit is contained in:
+17
-81
@@ -20,120 +20,56 @@
|
||||
|
||||
#include "videoparams.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
VideoParams::VideoParams() :
|
||||
width_(0),
|
||||
height_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VideoParams::VideoParams(const int &width, const int &height, const rational &time_base) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
time_base_(time_base)
|
||||
{
|
||||
}
|
||||
|
||||
const int &VideoParams::width() const
|
||||
{
|
||||
return width_;
|
||||
}
|
||||
|
||||
const int &VideoParams::height() const
|
||||
{
|
||||
return height_;
|
||||
}
|
||||
|
||||
const rational &VideoParams::time_base() const
|
||||
{
|
||||
return time_base_;
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams() :
|
||||
format_(PixelFormat::PIX_FMT_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const int &width, const int &height, const PixelFormat::Format &format, const int& divider) :
|
||||
VideoParams(width, height, rational()),
|
||||
VideoParams::VideoParams(const int &width, const int &height, const PixelFormat::Format &format, const int& divider) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
format_(format),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const int &width, const int &height, const rational &time_base, const PixelFormat::Format &format, const RenderMode::Mode& mode, const int ÷r) :
|
||||
VideoParams(width, height, time_base),
|
||||
VideoParams::VideoParams(const int &width, const int &height, const rational &time_base, const PixelFormat::Format &format, const int ÷r) :
|
||||
width_(width),
|
||||
height_(height),
|
||||
time_base_(time_base),
|
||||
format_(format),
|
||||
mode_(mode),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
VideoRenderingParams::VideoRenderingParams(const VideoParams ¶ms, const PixelFormat::Format &format, const RenderMode::Mode& mode, const int& divider) :
|
||||
VideoParams(params),
|
||||
format_(format),
|
||||
mode_(mode),
|
||||
divider_(divider)
|
||||
{
|
||||
calculate_effective_size();
|
||||
}
|
||||
|
||||
const int &VideoRenderingParams::divider() const
|
||||
{
|
||||
return divider_;
|
||||
}
|
||||
|
||||
const int& VideoRenderingParams::effective_width() const
|
||||
{
|
||||
return effective_width_;
|
||||
}
|
||||
|
||||
const int& VideoRenderingParams::effective_height() const
|
||||
{
|
||||
return effective_height_;
|
||||
}
|
||||
|
||||
const PixelFormat::Format &VideoRenderingParams::format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
const RenderMode::Mode &VideoRenderingParams::mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::operator==(const VideoRenderingParams &rhs) const
|
||||
bool VideoParams::operator==(const VideoParams &rhs) const
|
||||
{
|
||||
return width() == rhs.width()
|
||||
&& height() == rhs.height()
|
||||
&& time_base() == rhs.time_base()
|
||||
&& format() == rhs.format()
|
||||
&& mode() == rhs.mode()
|
||||
&& divider() == rhs.divider();
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::operator!=(const VideoRenderingParams &rhs) const
|
||||
bool VideoParams::operator!=(const VideoParams &rhs) const
|
||||
{
|
||||
return width() != rhs.width()
|
||||
|| height() != rhs.height()
|
||||
|| time_base() != rhs.time_base()
|
||||
|| format() != rhs.format()
|
||||
|| mode() != rhs.mode()
|
||||
|| divider() != rhs.divider();
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
void VideoRenderingParams::calculate_effective_size()
|
||||
void VideoParams::calculate_effective_size()
|
||||
{
|
||||
effective_width_ = width() / divider_;
|
||||
effective_height_ = height() / divider_;
|
||||
// Fast rounding up to an even number
|
||||
effective_width_ = qCeil(width() / divider_ * 0.5) * 2;
|
||||
effective_height_ = qCeil(height() / divider_ * 0.5) * 2;
|
||||
}
|
||||
|
||||
bool VideoRenderingParams::is_valid() const
|
||||
bool VideoParams::is_valid() const
|
||||
{
|
||||
return (width() > 0
|
||||
&& height() > 0
|
||||
|
||||
Reference in New Issue
Block a user