Skip to content
Snippets Groups Projects
Commit 82a789a7 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix lossless encoder bug

parent 6d8b75c8
No related branches found
No related tags found
1 merge request!311Resolves #296 removal of NvPipe
Pipeline #27149 failed
......@@ -184,7 +184,7 @@ bool NvidiaDecoder::decode(const ftl::codecs::Packet &pkt, cv::cuda::GpuMat &out
// OpenCV GpuMat for YCbCr 4:2:0
cv::cuda::GpuMat surface;
if (is_float_frame && !islossless) surface = cv::cuda::GpuMat(height_+height_/2, width_, CV_16U, decodedPtr, width_*2);
else if (is_float_frame && islossless) surface = cv::cuda::GpuMat(height_+height_/2, width_*2, CV_8U, decodedPtr, width_*2);
else if (is_float_frame && islossless) surface = cv::cuda::GpuMat(height_+height_/2, width_, CV_8U, decodedPtr, width_);
else surface = cv::cuda::GpuMat(height_+height_/2, width_, CV_8U, decodedPtr, width_);
auto cvstream = cv::cuda::StreamAccessor::wrapStream(stream_);
......@@ -196,7 +196,7 @@ bool NvidiaDecoder::decode(const ftl::codecs::Packet &pkt, cv::cuda::GpuMat &out
ftl::cuda::vuya_to_depth(out, sroi, csroi, 16.0f, cvstream);
} else {
ftl::cuda::nv12_to_float(decodedPtr, width_*2, (float*)out.data, out.step1(), width_, height_, stream_);
ftl::cuda::nv12_to_float(decodedPtr, width_, (float*)out.data, out.step1(), width_/2, height_, stream_);
}
} else {
// Flag 0x1 means frame is in RGB so needs conversion to BGR
......
......@@ -203,7 +203,7 @@ bool NvidiaEncoder::encode(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt)
} else if (params_.isLossy()) {
ftl::cuda::depth_to_nv12_10(in, (ushort*)f->inputPtr, (ushort*)(((uchar*)f->inputPtr)+(nvenc_->GetEncodeHeight()*f->pitch)), f->pitch/2, 16.0f, stream_);
} else {
ftl::cuda::float_to_nv12_16bit((float*)in.data, in.step1(), (uchar*)f->inputPtr, f->pitch, nvenc_->GetEncodeWidth(), nvenc_->GetEncodeHeight(), cv::cuda::StreamAccessor::getStream(stream_));
ftl::cuda::float_to_nv12_16bit((float*)in.data, in.step1(), (uchar*)f->inputPtr, f->pitch, nvenc_->GetEncodeWidth()/2, nvenc_->GetEncodeHeight(), cv::cuda::StreamAccessor::getStream(stream_));
}
// TODO: Use page locked memory?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment