renderbackend: moved bulk of hashing code to static function so more code has access to it
This commit is contained in:
@@ -119,17 +119,9 @@ QFuture<QList<QByteArray> > RenderBackend::Hash(const QList<rational> ×)
|
|||||||
QList<QByteArray> hashes;
|
QList<QByteArray> hashes;
|
||||||
|
|
||||||
foreach (const rational& t, times) {
|
foreach (const rational& t, times) {
|
||||||
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
hashes.append(HashNode(copied_viewer_node_->texture_input()->get_connected_node(),
|
||||||
|
video_params_,
|
||||||
// Embed video parameters into this hash
|
t));
|
||||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_width()), sizeof(int));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.effective_height()), sizeof(int));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&video_params_.format()), sizeof(PixelFormat::Format));
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(&render_mode_), sizeof(RenderMode::Mode));
|
|
||||||
|
|
||||||
copied_viewer_node_->texture_input()->get_connected_node()->Hash(hasher, t);
|
|
||||||
|
|
||||||
hashes.append(hasher.result());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashes;
|
return hashes;
|
||||||
@@ -347,6 +339,20 @@ void RenderBackend::ProcessUpdateQueue()
|
|||||||
CopyNodeInputValue(viewer_node_->samples_input());
|
CopyNodeInputValue(viewer_node_->samples_input());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray RenderBackend::HashNode(const Node *n, const VideoParams ¶ms, const rational &time)
|
||||||
|
{
|
||||||
|
QCryptographicHash hasher(QCryptographicHash::Sha1);
|
||||||
|
|
||||||
|
// Embed video parameters into this hash
|
||||||
|
hasher.addData(reinterpret_cast<const char*>(¶ms.effective_width()), sizeof(int));
|
||||||
|
hasher.addData(reinterpret_cast<const char*>(¶ms.effective_height()), sizeof(int));
|
||||||
|
hasher.addData(reinterpret_cast<const char*>(¶ms.format()), sizeof(PixelFormat::Format));
|
||||||
|
|
||||||
|
n->Hash(hasher, time);
|
||||||
|
|
||||||
|
return hasher.result();
|
||||||
|
}
|
||||||
|
|
||||||
void RenderBackend::WorkerFinished()
|
void RenderBackend::WorkerFinished()
|
||||||
{
|
{
|
||||||
RenderWorker* worker = static_cast<RenderWorker*>(sender());
|
RenderWorker* worker = static_cast<RenderWorker*>(sender());
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public:
|
|||||||
|
|
||||||
void ProcessUpdateQueue();
|
void ProcessUpdateQueue();
|
||||||
|
|
||||||
|
static QByteArray HashNode(const Node* n, const VideoParams& params, const rational& time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Asynchronously generate a hash at a given time
|
* @brief Asynchronously generate a hash at a given time
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user