various: conformed frame usages to respect stride
This commit is contained in:
@@ -132,7 +132,7 @@ void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable*
|
||||
|
||||
VideoRenderingParams footage_params(frame->width(), frame->height(), frame->format());
|
||||
|
||||
footage_tex_ref = texture_cache_.Get(ctx_, footage_params, frame->data());
|
||||
footage_tex_ref = texture_cache_.Get(ctx_, footage_params, frame->data(), frame->linesize_pixels());
|
||||
|
||||
if (ocio_method == ColorManager::kOCIOFast) {
|
||||
if (!color_processor->IsEnabled()) {
|
||||
@@ -426,7 +426,7 @@ void OpenGLProxy::RunNodeAccelerated(const Node *node, const TimeRange &range, N
|
||||
output_params.Push(NodeParam::kTexture, QVariant::fromValue(output_tex));
|
||||
}
|
||||
|
||||
void OpenGLProxy::TextureToBuffer(const QVariant &tex_in, void *buffer)
|
||||
void OpenGLProxy::TextureToBuffer(const QVariant &tex_in, void *buffer, int linesize)
|
||||
{
|
||||
OpenGLTextureCache::ReferencePtr texture = tex_in.value<OpenGLTextureCache::ReferencePtr>();
|
||||
|
||||
@@ -438,6 +438,8 @@ void OpenGLProxy::TextureToBuffer(const QVariant &tex_in, void *buffer)
|
||||
buffer_.Attach(texture->texture());
|
||||
buffer_.Bind();
|
||||
|
||||
f->glPixelStorei(GL_PACK_ROW_LENGTH, linesize);
|
||||
|
||||
f->glReadPixels(0,
|
||||
0,
|
||||
video_params_.effective_width(),
|
||||
@@ -446,6 +448,8 @@ void OpenGLProxy::TextureToBuffer(const QVariant &tex_in, void *buffer)
|
||||
OpenGLRenderFunctions::GetPixelType(video_params_.format()),
|
||||
buffer);
|
||||
|
||||
f->glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
|
||||
buffer_.Release();
|
||||
buffer_.Detach();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
void RunNodeAccelerated(const Node *node, const TimeRange &range, NodeValueDatabase &input_params, NodeValueTable& output_params);
|
||||
|
||||
void TextureToBuffer(const QVariant& texture, void *buffer);
|
||||
void TextureToBuffer(const QVariant& texture, void *buffer, int linesize);
|
||||
|
||||
void SetParameters(const VideoRenderingParams& params);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const Pix
|
||||
|
||||
void OpenGLTexture::Create(QOpenGLContext *ctx, FramePtr frame)
|
||||
{
|
||||
Create(ctx, frame->width(), frame->height(), frame->format(), frame->data(), frame->linesize());
|
||||
Create(ctx, frame->width(), frame->height(), frame->format(), frame->data(), frame->linesize_pixels());
|
||||
}
|
||||
|
||||
void OpenGLTexture::Destroy()
|
||||
|
||||
@@ -29,7 +29,7 @@ OpenGLTextureCache::~OpenGLTextureCache()
|
||||
}
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoRenderingParams ¶ms, const void *data)
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, const VideoRenderingParams ¶ms, const void *data, int linesize)
|
||||
{
|
||||
OpenGLTexturePtr texture = nullptr;
|
||||
|
||||
@@ -60,12 +60,17 @@ OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext* ctx, co
|
||||
lock_.unlock();
|
||||
|
||||
if (data) {
|
||||
texture->Upload(data);
|
||||
texture->Upload(data, linesize);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
OpenGLTextureCache::ReferencePtr OpenGLTextureCache::Get(QOpenGLContext *ctx, const VideoRenderingParams ¶ms)
|
||||
{
|
||||
return Get(ctx, params, nullptr, 0);
|
||||
}
|
||||
|
||||
void OpenGLTextureCache::Relinquish(OpenGLTextureCache::Reference *ref)
|
||||
{
|
||||
OpenGLTexturePtr tex = ref->texture();
|
||||
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
|
||||
DISABLE_COPY_MOVE(OpenGLTextureCache)
|
||||
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, const void *data = nullptr);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params, const void *data, int linesize);
|
||||
ReferencePtr Get(QOpenGLContext *ctx, const VideoRenderingParams& params);
|
||||
|
||||
private:
|
||||
void Relinquish(Reference* ref);
|
||||
|
||||
@@ -50,9 +50,9 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range,
|
||||
emit RequestRunNodeAccelerated(node, range, input_params, output_params);
|
||||
}
|
||||
|
||||
void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, void *buffer)
|
||||
void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, void *buffer, int linesize)
|
||||
{
|
||||
emit RequestTextureToBuffer(tex_in, buffer);
|
||||
emit RequestTextureToBuffer(tex_in, buffer, linesize);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -42,14 +42,14 @@ signals:
|
||||
|
||||
void RequestRunNodeAccelerated(const Node *node, const TimeRange &range, NodeValueDatabase &input_params, NodeValueTable& output_params);
|
||||
|
||||
void RequestTextureToBuffer(const QVariant& texture, void *buffer);
|
||||
void RequestTextureToBuffer(const QVariant& texture, void *buffer, int linesize);
|
||||
|
||||
protected:
|
||||
virtual void FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable* table) override;
|
||||
|
||||
virtual void RunNodeAccelerated(const Node *node, const TimeRange &range, NodeValueDatabase &input_params, NodeValueTable& output_params) override;
|
||||
|
||||
virtual void TextureToBuffer(const QVariant& texture, void *buffer) override;
|
||||
virtual void TextureToBuffer(const QVariant& texture, void *buffer, int linesize) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ void VideoRenderWorker::Download(const rational& time, QVariant texture, QString
|
||||
{
|
||||
if (operating_mode_ & kDownloadOnly) {
|
||||
|
||||
TextureToBuffer(texture, download_buffer_.data());
|
||||
TextureToBuffer(texture, download_buffer_.data(), 0);
|
||||
|
||||
switch (video_params().format()) {
|
||||
case PixelFormat::PIX_FMT_RGB8:
|
||||
@@ -342,7 +342,7 @@ void VideoRenderWorker::Download(const rational& time, QVariant texture, QString
|
||||
frame->set_video_params(video_params());
|
||||
frame->allocate();
|
||||
|
||||
TextureToBuffer(texture, frame->data());
|
||||
TextureToBuffer(texture, frame->data(), frame->linesize_pixels());
|
||||
|
||||
emit GeneratedFrame(time, frame);
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ protected:
|
||||
|
||||
virtual void ParametersChangedEvent(){}
|
||||
|
||||
virtual void TextureToBuffer(const QVariant& texture, void *buffer) = 0;
|
||||
virtual void TextureToBuffer(const QVariant& texture, void *buffer, int linesize) = 0;
|
||||
|
||||
virtual NodeValueTable RenderInternal(const NodeDependency& CurrentPath, const qint64& job_time) override;
|
||||
|
||||
|
||||
@@ -68,7 +68,13 @@ ColorProcessor::ColorProcessor(ColorManager *config,
|
||||
|
||||
void ColorProcessor::ConvertFrame(Frame *f)
|
||||
{
|
||||
OCIO::PackedImageDesc img(reinterpret_cast<float*>(f->data()), f->width(), f->height(), PixelFormat::ChannelCount(f->format()));
|
||||
OCIO::PackedImageDesc img(reinterpret_cast<float*>(f->data()),
|
||||
f->width(),
|
||||
f->height(),
|
||||
PixelFormat::ChannelCount(f->format()),
|
||||
OCIO::AutoStride,
|
||||
OCIO::AutoStride,
|
||||
f->linesize_bytes());
|
||||
|
||||
processor_->apply(img);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user