Skip to content

Commit

Permalink
Merge pull request #26 from sz3/dependency-upgrades-and-bugfixes
Browse files Browse the repository at this point in the history
v0.5.14 -- Dependency upgrades and bugfixes
  • Loading branch information
sz3 authored Dec 2, 2023
2 parents 4368143 + bd6a980 commit f9badfa
Show file tree
Hide file tree
Showing 91 changed files with 27,512 additions and 11,574 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.cimbar.camerafilecopy"
minSdkVersion 21
targetSdkVersion 30
versionCode 9
versionName "0.5.13"
versionCode 10
versionName "0.5.14"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
Expand Down
2 changes: 1 addition & 1 deletion app/src/cpp/cfc-cpp/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace {
{
std::stringstream sstop;
sstop << "cfc using " << proc.num_threads() << " thread(s). " << proc.color_bits() << "..." << proc.backlog() << "? ";
sstop << (MultiThreadedDecoder::bytes / std::max<double>(1, MultiThreadedDecoder::decoded)) << "b v0.5.13";
sstop << (MultiThreadedDecoder::bytes / std::max<double>(1, MultiThreadedDecoder::decoded)) << "b v0.5.14";
std::stringstream ssmid;
ssmid << "#: " << MultiThreadedDecoder::perfect << " / " << MultiThreadedDecoder::decoded << " / " << MultiThreadedDecoder::scanned << " / " << _calls;
std::stringstream ssperf;
Expand Down
9 changes: 6 additions & 3 deletions app/src/cpp/libcimbar/src/lib/cimb_translator/CimbReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ namespace {
template <typename MAT>
bitbuffer preprocessSymbolGrid(const MAT& img, bool needs_sharpen)
{
int blockSize = 3; // default: no preprocessing
int blockSize = 5; // default: no preprocessing

cv::Mat symbols;
cv::cvtColor(img, symbols, cv::COLOR_RGB2GRAY);
if (needs_sharpen)
sharpenSymbolGrid(symbols, symbols); // we used to change blockSize for this case -- may one day be a useful trick again?
cv::adaptiveThreshold(symbols, symbols, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, blockSize, -5);
{
blockSize = 7;
sharpenSymbolGrid(symbols, symbols);
}
cv::adaptiveThreshold(symbols, symbols, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, blockSize, 0);

bitbuffer bb(std::pow(Config::image_size(), 2) / 8);
bitmatrix::mat_to_bitbuffer(symbols, bb.get_writer());
Expand Down
2 changes: 1 addition & 1 deletion app/src/cpp/libcimbar/src/lib/cimb_translator/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace cimbar

static constexpr unsigned compression_level()
{
return 6;
return 16;
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ TEST_CASE( "CimbReaderTest/testSample", "[unit]" )
++count;
}

string expected = "0=0 99=8 600=33 710=28 711=30 821=8 822=22 823=19 934=55 11688=55 11799=25 "
"11900=28 12000=23 12100=0 12200=5 12201=0 12298=32 12299=34 12300=30 12301=32 "
"12398=10 12399=15";
string expected = "0=0 99=8 11680=3 11681=32 11900=28 11901=25 11904=12 11995=2 11996=8 11998=6 "
"11999=54 12001=29 12004=6 12099=2 12195=57 12196=1 12200=5 12201=0 12298=32 "
"12299=34 12300=30 12399=15";
assertEquals( expected, turbo::str::join(res) );

PositionData pos;
Expand Down Expand Up @@ -109,8 +109,9 @@ TEST_CASE( "CimbReaderTest/testSampleMessy", "[unit]" )
++count;
}

string expected = "0=0 99=8 600=33 711=30 11462=2 11573=33 11574=0 11685=52 11686=17 11687=41 "
"11688=55 11797=30 11798=15 11799=25 12200=5 12298=46 12299=34 12300=30 12301=32 12397=38 12398=10 12399=15";
string expected = "0=0 1=28 99=8 100=28 600=33 601=38 711=30 712=57 11464=53 11576=32 11577=44 "
"11687=41 11688=55 11689=32 11690=48 11798=15 11799=25 12297=46 12298=32 "
"12299=34 12300=30 12399=15";
assertEquals( expected, turbo::str::join(res) );

PositionData pos;
Expand Down Expand Up @@ -200,7 +201,7 @@ TEST_CASE( "CimbReaderTest/testCCM.VeryNecessary", "[unit]" )
" 0.023812667, 0.98703396, -0.0048082001;\n"
" 0, 0, 1.0017186]", ss.str());

std::array<unsigned, 6> expectedColors = {0, 0, 0, 0, 0, 3}; // it's wrong, but it's consistent!
std::array<unsigned, 6> expectedColors = {0, 0, 0, 0, 0, 0}; // it's wrong, but it's consistent!
for (unsigned i = 0; i < expectedColors.size(); ++i)
{
PositionData pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class zstd_compressor : public STREAM

protected:
static const size_t CHUNK_SIZE = 0x4000;
int _compressionLevel = 6;
int _compressionLevel = 16;
ZSTD_CCtx* _cctx = ZSTD_createCCtx();
std::vector<char> _compBuff = std::vector<char>(ZSTD_compressBound(CHUNK_SIZE));
};
Expand Down
2 changes: 1 addition & 1 deletion app/src/cpp/libcimbar/src/lib/encoder/test/DecoderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ TEST_CASE( "DecoderTest/testDecode.Sample", "[unit]" )
assertEquals( 9300, bytesDecoded );

if (CV_VERSION_MAJOR == 4)
assertEquals( "0f74a76cb1f59df7a42449a3527d464d913d12a03bffa51d6f53828724c3feb1", get_hash(decodedFile) );
assertEquals( "2040c157884c476def842f7854621a7655182e5f11a34ade563616d93cb93455", get_hash(decodedFile) );
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TEST_CASE( "EncoderRoundTripTest/testStreaming", "[unit]" )

// done
assertEquals( 1, fds.num_done() );
std::string decodedContents = File(tempdir.path() / "0.5387").read_all();
std::string decodedContents = File(tempdir.path() / "0.5256").read_all();
assertEquals( 16727, decodedContents.size() );
assertStringContains( "Mozilla Public License Version 2.0", decodedContents );
}
6 changes: 3 additions & 3 deletions app/src/cpp/libcimbar/src/lib/encoder/test/EncoderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TEST_CASE( "EncoderTest/testFountain.Compress", "[unit]" )
Encoder enc(30, 4, 2);
assertEquals( 1, enc.encode_fountain(inputFile, outPrefix) );

uint64_t hash = 0x4fd34f01ee80a28d;
uint64_t hash = 0x664598a460acad14;
std::string path = fmt::format("{}_0.png", outPrefix);
cv::Mat img = cv::imread(path);
assertEquals( hash, image_hash::average_hash(img) );
Expand All @@ -96,7 +96,7 @@ TEST_CASE( "EncoderTest/testPiecemealFountainEncoder", "[unit]" )
std::optional<cv::Mat> frame = enc.encode_next(*fes);
assertTrue( frame );

uint64_t hash = 0xf8cde200e90582e4;
uint64_t hash = 0x423de068e4894a7f;
assertEquals( hash, image_hash::average_hash(*frame) );
}

Expand All @@ -110,7 +110,7 @@ TEST_CASE( "EncoderTest/testFountain.Size", "[unit]" )
Encoder enc(30, 4, 2);
assertEquals( 1, enc.encode_fountain(inputFile, outPrefix, 10, 2.0, 1080) );

uint64_t hash = 0x8985b70d93675786;
uint64_t hash = 0xeb28da8af88de8d0;
std::string path = fmt::format("{}_0.png", outPrefix);
cv::Mat img = cv::imread(path);
assertEquals( 1080, img.rows );
Expand Down
Loading

0 comments on commit f9badfa

Please sign in to comment.