ffmpeg: store divided frames in memory cache

Since users will most likely be working with a divider most of the time,
there's no reason to waste memory space with undivided frames considering
the dividing process is quite fast.
This commit is contained in:
itsmattkc
2020-08-18 04:55:23 +10:00
parent d9851dc329
commit f3f81eb2be
7 changed files with 147 additions and 52 deletions
+7 -3
View File
@@ -145,9 +145,8 @@ bool VideoParams::operator!=(const VideoParams &rhs) const
void VideoParams::calculate_effective_size()
{
// Fast rounding up to an even number
effective_width_ = qCeil(width() / divider_ * 0.5) * 2;
effective_height_ = qCeil(height() / divider_ * 0.5) * 2;
effective_width_ = GetScaledDimension(width(), divider_);
effective_height_ = GetScaledDimension(height(), divider_);
}
void VideoParams::validate_pixel_aspect_ratio()
@@ -195,4 +194,9 @@ QString VideoParams::FormatPixelAspectRatioString(const QString &format, const r
return format.arg(QString::number(ratio.toDouble(), 'f', 4));
}
int VideoParams::GetScaledDimension(int dim, int divider)
{
return qCeil(dim / divider * 0.5) * 2;
}
OLIVE_NAMESPACE_EXIT