Skip to content

Commit

Permalink
Cleanup some includes/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sz3 committed Feb 18, 2024
1 parent 55299de commit 196a893
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
10 changes: 4 additions & 6 deletions src/lib/chromatic_adaptation/color_correction.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <opencv2/opencv.hpp>

#include <iostream>

// transforms are in adaptation_transform.h
// http://brucelindbloom.com/Eqn_ChromAdapt.html

Expand All @@ -27,10 +25,10 @@ class color_correction

static inline cv::Matx<float, 3, 3> get_moore_penrose_lsm(const cv::Mat& actual, const cv::Mat& desired)
{
// 1. TODO: make sure actual and desired dims match?
// 2. the calculation is MoorePenrose least squares mapping:
// in numpy, it's dot(transpose(x), pinv(transpose(y)))

// inspired by the python colour-science package. It's not complicated,
// but I didn't know that going in.
// See also:
// https://en.wikipedia.org/wiki/Moore-Penrose_inverse
cv::Mat x, y, z;
cv::transpose(desired, x);
cv::transpose(actual, y);
Expand Down
3 changes: 0 additions & 3 deletions src/lib/cimb_translator/CimbReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
#include "bit_file/bitmatrix.h"
#include "chromatic_adaptation/adaptation_transform.h"
#include "chromatic_adaptation/color_correction.h"
#include "serialize/format.h"

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cimbar;

Expand Down
4 changes: 2 additions & 2 deletions src/lib/cimbar_js/cimbar_js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ int next_frame()
return 0;

// we generate 5x the amount of required symbol blocks -- unless everything fits in a single frame.
// color blocks will contribute to this total, but only symbols used for the initial calculation.
// ... this way, if the color decode is failing, we don't get "stuck" rendering a single frame.
// color blocks will contribute to this total, but only symbols are used for the initial calculation.
// ... this way, if the color decode is failing, it won't get "stuck" failing to read a single frame.
unsigned required = _fes->blocks_required();
if (required > cimbar::Config::fountain_chunks_per_frame(cimbar::Config::symbol_bits(), _legacyMode))
required = required*5;
Expand Down
15 changes: 0 additions & 15 deletions src/lib/encoder/Decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,6 @@ inline unsigned Decoder::do_decode_coupled(CimbReader& reader, STREAM& ostream)
return bb.flush(rss);
}


// seems like we want to take a file or img, and have an output sink
// output sync could be template param?
// we'd decode the full message (via bit_writer) to a temp buffer -- probably a stringstream
// then we'd direct the stringstream to our sink
// which would either be a filestream, or a multi-channel fountain sink

template <typename MAT, typename STREAM>
inline unsigned Decoder::decode(const MAT& img, STREAM& ostream, bool should_preprocess, int color_correction)
{
Expand All @@ -177,15 +170,7 @@ inline unsigned Decoder::decode(const MAT& img, STREAM& ostream, bool should_pre
template <typename MAT, typename FOUNTAINSTREAM>
inline unsigned Decoder::decode_fountain(const MAT& img, FOUNTAINSTREAM& ostream, bool should_preprocess, int color_correction)
{
// reader takes cimbar::Config::color_mode() ?
CimbReader reader(img, _decoder, should_preprocess, color_correction);

// maybe give aligned_stream a callback function that can poke the CimbReader on flush()?
// and then in do_decode(), after the first flush, call CimbReader::try_to_make_new_ccm(),
// ... maybe a replacement for the existing updateColorCorrection()? (called in constructor, would now happen later)...
// which reads the values from the image (using what the aligned_stream gave it -- if anything, and maybe the cellpositions from FloodFillDecode?)
// iff we got enough data from aligned_stream to sample enough colors, try_to_make_new_ccm() pushes the updated ccm to CimbDecoder's threadlocal
// if not, we use whatever we previously had in CimbDecoder's threadlocal...?
aligned_stream aligner(ostream, ostream.chunk_size(), 0, std::bind(&CimbReader::update_metadata, &reader, std::placeholders::_1, std::placeholders::_2));
return do_decode(reader, aligner);
}
Expand Down
2 changes: 0 additions & 2 deletions src/lib/encoder/SimpleEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <optional>
#include <string>

#include <iostream>

class SimpleEncoder
{
public:
Expand Down

0 comments on commit 196a893

Please sign in to comment.