rewrote hashing
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "config/config.h"
|
||||
#include "core.h"
|
||||
#include "node/hashtraverser.h"
|
||||
#include "render/opengl/openglrenderer.h"
|
||||
#include "render/rendererthreadwrapper.h"
|
||||
#include "renderprocessor.h"
|
||||
@@ -53,7 +54,6 @@ RenderManager::RenderManager(QObject *parent) :
|
||||
context_->Init();
|
||||
context_->PostInit();
|
||||
|
||||
still_cache_ = new StillImageCache();
|
||||
decoder_cache_ = new DecoderCache();
|
||||
shader_cache_ = new ShaderCache();
|
||||
default_shader_ = context_->CreateNativeShader(ShaderCode(QString(), QString()));
|
||||
@@ -64,7 +64,6 @@ RenderManager::RenderManager(QObject *parent) :
|
||||
} else {
|
||||
qCritical() << "Tried to initialize unknown graphics backend";
|
||||
context_ = nullptr;
|
||||
still_cache_ = nullptr;
|
||||
decoder_cache_ = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +75,6 @@ RenderManager::~RenderManager()
|
||||
|
||||
delete shader_cache_;
|
||||
delete decoder_cache_;
|
||||
delete still_cache_;
|
||||
|
||||
context_->Destroy();
|
||||
context_->PostDestroy();
|
||||
@@ -104,24 +102,13 @@ void RenderManager::ClearOldDecoders()
|
||||
|
||||
QByteArray RenderManager::Hash(const Node *n, const Node::ValueHint &output, const VideoParams ¶ms, const rational &time)
|
||||
{
|
||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
||||
HashTraverser hasher;
|
||||
return hasher.GetHash(n, output, params, TimeRange(time, time + params.frame_rate_as_time_base()));
|
||||
}
|
||||
|
||||
// Embed video parameters into this hash
|
||||
int width = params.effective_width();
|
||||
int height = params.effective_height();
|
||||
VideoParams::Format format = params.format();
|
||||
VideoParams::Interlacing interlacing = params.interlacing();
|
||||
|
||||
hasher.addData(reinterpret_cast<const char*>(&width), sizeof(width));
|
||||
hasher.addData(reinterpret_cast<const char*>(&height), sizeof(height));
|
||||
hasher.addData(reinterpret_cast<const char*>(&format), sizeof(format));
|
||||
hasher.addData(reinterpret_cast<const char*>(&interlacing), sizeof(interlacing));
|
||||
|
||||
if (n) {
|
||||
Node::Hash(n, output, hasher, NodeTraverser::GenerateGlobals(params, time), params);
|
||||
}
|
||||
|
||||
return hasher.result();
|
||||
QByteArray RenderManager::Hash(ViewerOutput *viewer, const VideoParams ¶ms, const rational &time)
|
||||
{
|
||||
return Hash(viewer->GetConnectedTextureOutput(), viewer->GetValueHintForInput(ViewerOutput::kTextureInput), params, time);
|
||||
}
|
||||
|
||||
RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* color_manager,
|
||||
@@ -236,7 +223,7 @@ RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr
|
||||
|
||||
void RenderManager::RunTicket(RenderTicketPtr ticket) const
|
||||
{
|
||||
RenderProcessor::Process(ticket, context_, still_cache_, decoder_cache_, shader_cache_, default_shader_);
|
||||
RenderProcessor::Process(ticket, context_, decoder_cache_, shader_cache_, default_shader_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user