renderer: fix divider regression

This commit is contained in:
itsmattkc
2022-05-07 16:27:10 -07:00
parent 601d08ce64
commit fca5f65899
3 changed files with 19 additions and 16 deletions
+1 -6
View File
@@ -118,12 +118,7 @@ void Footage::InputValueChangedEvent(const QString &input, int element)
decoder_ = footage_info.decoder();
for (int i=0; i<footage_info.GetVideoStreams().size(); i++) {
VideoParams vp = footage_info.GetVideoStreams().at(i);
// FIXME: Make this customizable
vp.set_divider(VideoParams::generate_auto_divider(vp.width(), vp.height()));
AddStream(Track::kVideo, QVariant::fromValue(vp));
AddStream(Track::kVideo, QVariant::fromValue(footage_info.GetVideoStreams().at(i)));
}
for (int i=0; i<footage_info.GetAudioStreams().size(); i++) {
+17
View File
@@ -349,6 +349,23 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range)
TexturePtr tex;
// Adjust footage job's divider
VideoParams render_params = GetCacheVideoParams();
VideoParams job_params = job.video_params();
// HACK/FIXME: Override old cached probe data that contains an invalid divider. Might be
// good in the future to version the probe data so we can automatically
// ignore older stuff.
job_params.set_divider(render_params.divider());
// See if we can make this divider larger (i.e. if the footage is smaller)
while (job_params.divider() > 1
&& VideoParams::GetScaledDimension(job_params.width(), job_params.divider()-1) < render_params.effective_width()
&& VideoParams::GetScaledDimension(job_params.height(), job_params.divider()-1) < render_params.effective_height()) {
job_params.set_divider(job_params.divider() - 1);
}
job.set_video_params(job_params);
if (footage_time.isNaN()) {
// Push dummy texture
tex = CreateDummyTexture(job.video_params());
+1 -10
View File
@@ -402,19 +402,10 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
// Check the still frame cache. On large frames such as high resolution still images, uploading
// and color managing them for every frame is a waste of time, so we implement a small cache here
// to optimize such a situation
const VideoParams& render_params = GetCacheVideoParams();
VideoParams stream_data = stream.video_params();
ColorManager* color_manager = Node::ValueToPtr<ColorManager>(ticket_->property("colormanager"));
// See if we can make this divider larger (i.e. if the fooage is smaller)
int footage_divider = render_params.divider();
while (footage_divider > 1
&& VideoParams::GetScaledDimension(stream_data.width(), footage_divider-1) < render_params.effective_width()
&& VideoParams::GetScaledDimension(stream_data.height(), footage_divider-1) < render_params.effective_height()) {
footage_divider--;
}
QString using_colorspace = stream_data.colorspace();
if (using_colorspace.isEmpty()) {
@@ -449,7 +440,7 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
if (decoder) {
Decoder::RetrieveVideoParams p;
p.divider = footage_divider;
p.divider = stream.video_params().divider();
p.src_interlacing = stream_data.interlacing();
p.dst_interlacing = GetCacheVideoParams().interlacing();