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

Fix for missing RGB flip in opencv decoder

parent 30ae9ccf
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28565 failed
......@@ -30,14 +30,12 @@ bool OpenCVDecoder::decode(const ftl::codecs::Packet &pkt, cv::cuda::GpuMat &out
cv::Rect roi(cx,cy,chunk_width,chunk_height);
cv::cuda::GpuMat chunkHead = out(roi);
//LOG(INFO) << "DECODE JPEG " << (int)pkt.block_number << "/" << chunk_dim;
cv::Mat tmp2_, tmp_;
// Decode in temporary buffers to prevent long locks
cv::imdecode(pkt.data, cv::IMREAD_UNCHANGED, &tmp2_);
if (tmp2_.type() == CV_8UC3) {
cv::cvtColor(tmp2_, tmp_, cv::COLOR_BGR2BGRA);
cv::cvtColor(tmp2_, tmp_, cv::COLOR_RGB2BGRA);
} else {
tmp_ = tmp2_;
}
......
......@@ -55,6 +55,8 @@ bool File::_checkFile() {
int min_ts_diff = 1000;
first_ts_ = 10000000000000ll;
std::unordered_set<ftl::codecs::codec_t> codecs_found;
while (count > 0) {
std::tuple<ftl::codecs::StreamPacket,ftl::codecs::Packet> data;
if (!readPacket(data)) {
......@@ -62,7 +64,9 @@ bool File::_checkFile() {
}
auto &spkt = std::get<0>(data);
//auto &pkt = std::get<1>(data);
auto &pkt = std::get<1>(data);
codecs_found.emplace(pkt.codec);
if (spkt.timestamp < first_ts_) first_ts_ = spkt.timestamp;
......@@ -89,6 +93,13 @@ bool File::_checkFile() {
LOG(INFO) << " -- Frame rate = " << (1000 / min_ts_diff);
if (!is_video_) LOG(INFO) << " -- Static image";
std::string codec_str = "";
for (auto c : codecs_found) {
codec_str += std::string(" ") + std::to_string(int(c));
}
LOG(INFO) << " -- Codecs:" << codec_str;
interval_ = min_ts_diff;
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment