renderer: reinstated new and improved texture cache
This commit is contained in:
@@ -61,9 +61,6 @@ FFmpegDecoder::FFmpegDecoder() :
|
||||
input_fmt_(AV_PIX_FMT_NONE),
|
||||
native_internal_pix_fmt_(VideoParams::kFormatInvalid),
|
||||
native_output_pix_fmt_(VideoParams::kFormatInvalid),
|
||||
y_tex_(nullptr),
|
||||
u_tex_(nullptr),
|
||||
v_tex_(nullptr),
|
||||
working_frame_(nullptr),
|
||||
working_packet_(nullptr),
|
||||
cache_at_zero_(false),
|
||||
@@ -219,12 +216,7 @@ TexturePtr FFmpegDecoder::RetrieveVideoInternal(Renderer *renderer, const ration
|
||||
plane_params.set_channel_count(1);
|
||||
plane_params.set_divider(1);
|
||||
plane_params.set_format(native_internal_pix_fmt_);
|
||||
|
||||
if (!y_tex_) {
|
||||
y_tex_ = renderer->CreateTexture(plane_params, f->data[0], f->linesize[0] / px_size);
|
||||
} else {
|
||||
y_tex_->Upload(f->data[0], f->linesize[0] / px_size);
|
||||
}
|
||||
TexturePtr y_plane = renderer->CreateTexture(plane_params, f->data[0], f->linesize[0] / px_size);
|
||||
|
||||
if (src_fmt == AV_PIX_FMT_YUV420P
|
||||
|| src_fmt == AV_PIX_FMT_YUV422P
|
||||
@@ -244,22 +236,13 @@ TexturePtr FFmpegDecoder::RetrieveVideoInternal(Renderer *renderer, const ration
|
||||
plane_params.set_height(plane_params.height()/2);
|
||||
}
|
||||
|
||||
if (!u_tex_) {
|
||||
u_tex_ = renderer->CreateTexture(plane_params, f->data[1], f->linesize[1] / px_size);
|
||||
} else {
|
||||
u_tex_->Upload(f->data[1], f->linesize[1] / px_size);
|
||||
}
|
||||
|
||||
if (!v_tex_) {
|
||||
v_tex_ = renderer->CreateTexture(plane_params, f->data[2], f->linesize[2] / px_size);
|
||||
} else {
|
||||
v_tex_->Upload(f->data[2], f->linesize[2] / px_size);
|
||||
}
|
||||
TexturePtr u_plane = renderer->CreateTexture(plane_params, f->data[1], f->linesize[1] / px_size);
|
||||
TexturePtr v_plane = renderer->CreateTexture(plane_params, f->data[2], f->linesize[2] / px_size);
|
||||
|
||||
ShaderJob job;
|
||||
job.Insert(QStringLiteral("y_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(y_tex_)));
|
||||
job.Insert(QStringLiteral("u_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(u_tex_)));
|
||||
job.Insert(QStringLiteral("v_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(v_tex_)));
|
||||
job.Insert(QStringLiteral("y_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(y_plane)));
|
||||
job.Insert(QStringLiteral("u_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(u_plane)));
|
||||
job.Insert(QStringLiteral("v_channel"), NodeValue(NodeValue::kTexture, QVariant::fromValue(v_plane)));
|
||||
job.Insert(QStringLiteral("bits_per_pixel"), NodeValue(NodeValue::kInt, bits_per_pixel));
|
||||
job.Insert(QStringLiteral("jpeg_range"), NodeValue(NodeValue::kBoolean, jpeg_range));
|
||||
|
||||
@@ -313,10 +296,6 @@ void FFmpegDecoder::CloseInternal()
|
||||
input_fmt_ = AV_PIX_FMT_NONE;
|
||||
native_internal_pix_fmt_ = VideoParams::kFormatInvalid;
|
||||
native_output_pix_fmt_ = VideoParams::kFormatInvalid;
|
||||
|
||||
y_tex_ = nullptr;
|
||||
u_tex_ = nullptr;
|
||||
v_tex_ = nullptr;
|
||||
}
|
||||
|
||||
QString FFmpegDecoder::id() const
|
||||
|
||||
Reference in New Issue
Block a user