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

Disable chunked encoding

parent cb2b9219
No related branches found
No related tags found
1 merge request!196High resolution colour
Pipeline #17097 passed
This commit is part of merge request !196. Comments created here will be created in the context of that merge request.
...@@ -30,7 +30,9 @@ bool OpenCVEncoder::supports(ftl::codecs::codec_t codec) { ...@@ -30,7 +30,9 @@ bool OpenCVEncoder::supports(ftl::codecs::codec_t codec) {
bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, definition_t definition, bitrate_t bitrate, const std::function<void(const ftl::codecs::Packet&)> &cb) { bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, definition_t definition, bitrate_t bitrate, const std::function<void(const ftl::codecs::Packet&)> &cb) {
bool is_colour = in.type() != CV_32F; bool is_colour = in.type() != CV_32F;
current_definition_ = definition;
// Ensure definition does not exceed max
current_definition_ = ((int)definition < (int)max_definition) ? max_definition : definition;
in.download(tmp_); in.download(tmp_);
//CHECK(cv::Size(ftl::codecs::getWidth(definition), ftl::codecs::getHeight(definition)) == in.size()); //CHECK(cv::Size(ftl::codecs::getWidth(definition), ftl::codecs::getHeight(definition)) == in.size());
...@@ -47,7 +49,8 @@ bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, definition_t definition, ...@@ -47,7 +49,8 @@ bool OpenCVEncoder::encode(const cv::cuda::GpuMat &in, definition_t definition,
tmp_.convertTo(tmp_, CV_16UC1, 1000); tmp_.convertTo(tmp_, CV_16UC1, 1000);
} }
chunk_dim_ = (definition == definition_t::LD360) ? 1 : 4; // FIXME: Chunking is broken so forced to single chunk
chunk_dim_ = 1; //(definition == definition_t::LD360) ? 1 : 4;
chunk_count_ = chunk_dim_ * chunk_dim_; chunk_count_ = chunk_dim_ * chunk_dim_;
jobs_ = chunk_count_; jobs_ = chunk_count_;
...@@ -95,6 +98,7 @@ bool OpenCVEncoder::_encodeBlock(const cv::Mat &in, ftl::codecs::Packet &pkt, bi ...@@ -95,6 +98,7 @@ bool OpenCVEncoder::_encodeBlock(const cv::Mat &in, ftl::codecs::Packet &pkt, bi
int cx = (pkt.block_number % chunk_dim_) * chunk_width; int cx = (pkt.block_number % chunk_dim_) * chunk_width;
int cy = (pkt.block_number / chunk_dim_) * chunk_height; int cy = (pkt.block_number / chunk_dim_) * chunk_height;
cv::Rect roi(cx,cy,chunk_width,chunk_height); cv::Rect roi(cx,cy,chunk_width,chunk_height);
cv::Mat chunkHead = in(roi); cv::Mat chunkHead = in(roi);
if (pkt.codec == codec_t::PNG) { if (pkt.codec == codec_t::PNG) {
......
...@@ -52,8 +52,8 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int ...@@ -52,8 +52,8 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int
f.chunk_total[1] = 0; f.chunk_total[1] = 0;
f.channel_count = 0; f.channel_count = 0;
f.tx_size = 0; f.tx_size = 0;
f.channel[0].create(s, c1type); //f.channel[0].create(s, c1type);
f.channel[1].create(s, c2type); //f.channel[1].create(s, c2type);
return f; return f;
} }
oldest = (f.timestamp < oldest) ? f.timestamp : oldest; oldest = (f.timestamp < oldest) ? f.timestamp : oldest;
...@@ -72,8 +72,8 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int ...@@ -72,8 +72,8 @@ NetFrame &NetFrameQueue::getFrame(int64_t ts, const cv::Size &s, int c1type, int
f.chunk_total[1] = 0; f.chunk_total[1] = 0;
f.channel_count = 0; f.channel_count = 0;
f.tx_size = 0; f.tx_size = 0;
f.channel[0].create(s, c1type); //f.channel[0].create(s, c1type);
f.channel[1].create(s, c2type); //f.channel[1].create(s, c2type);
return f; return f;
} }
} }
...@@ -283,6 +283,8 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk ...@@ -283,6 +283,8 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk
// Update frame statistics // Update frame statistics
frame.tx_size += pkt.data.size(); frame.tx_size += pkt.data.size();
frame.channel[channum].create(size, (isFloatChannel(rchan) ? CV_32FC1 : CV_8UC3));
// Only decode if this channel is wanted. // Only decode if this channel is wanted.
if (rchan == Channel::Colour || rchan == chan) { if (rchan == Channel::Colour || rchan == chan) {
_createDecoder(channum, pkt); _createDecoder(channum, pkt);
...@@ -291,8 +293,7 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk ...@@ -291,8 +293,7 @@ void NetSource::_recvPacket(short ttimeoff, const ftl::codecs::StreamPacket &spk
LOG(ERROR) << "No frame decoder available"; LOG(ERROR) << "No frame decoder available";
return; return;
} }
frame.channel[channum].create(size, frame.channel[channum].type()); // TODO!!! queue_.getFrame() assumes same size
decoder->decode(pkt, frame.channel[channum]); decoder->decode(pkt, frame.channel[channum]);
} else if (chan != Channel::None && rchan != Channel::Colour) { } else if (chan != Channel::None && rchan != Channel::Colour) {
// Didn't receive correct second channel so just clear the images // Didn't receive correct second channel so just clear the images
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment