Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ndk + libcimbar #19

Merged
merged 4 commits into from
Jun 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 33
buildToolsVersion "29.0.3"
ndkVersion "22.1.7171670"
ndkVersion "25.2.9519653"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ndk 25.x, sdk version 33

defaultConfig {
applicationId "org.cimbar.camerafilecopy"
minSdkVersion 21
targetSdkVersion 30
versionCode 8
versionName "0.5.12"
targetSdkVersion 33
versionCode 9
versionName "0.5.13"
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.12";
sstop << (MultiThreadedDecoder::bytes / std::max<double>(1, MultiThreadedDecoder::decoded)) << "b v0.5.13";
std::stringstream ssmid;
ssmid << "#: " << MultiThreadedDecoder::perfect << " / " << MultiThreadedDecoder::decoded << " / " << MultiThreadedDecoder::scanned << " / " << _calls;
std::stringstream ssperf;
Expand Down
20 changes: 12 additions & 8 deletions app/src/cpp/libcimbar/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ jobs:
fail-fast: false
matrix:
config:
- name: "linux gcc7"
os: ubuntu-18.04
env: CXX="g++-7" CC="gcc-7"

- name: "linux gcc9"
os: ubuntu-20.04
env: CXX="g++-9" CC="gcc-9"

- name: "linux gcc-latest"
os: ubuntu-latest

- name: "linux clang"
os: ubuntu-18.04
os: ubuntu-20.04
env: CXX="clang++" CC="clang"
extra-packages: "clang"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: 'recursive'

Expand All @@ -45,11 +45,15 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: make test CTEST_OUTPUT_ON_FAILURE=TRUE

- name: Usage test
working-directory: ${{runner.workspace}}/libcimbar/test/py
run: python3 -m unittest

cppcheck:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install cppcheck
Expand Down
5 changes: 3 additions & 2 deletions app/src/cpp/libcimbar/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Get the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: 'recursive'

Expand All @@ -23,7 +23,7 @@ jobs:
- name: Run the build process with Docker
uses: addnab/docker-run-action@v3
with:
image: emscripten/emsdk:latest
image: emscripten/emsdk:3.1.39
options: -v ${{ github.workspace }}:/usr/src/app
shell: bash
run: |
Expand All @@ -39,4 +39,5 @@ jobs:
files: |
web/cimbar.asmjs.zip
web/cimbar.wasm.tar.gz
web/cimbar_js.html

2 changes: 1 addition & 1 deletion app/src/cpp/libcimbar/DETAILS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The above is a 4x4(x4) cimbar grid -- encoding 64 bits of data. A real cimbar im

![an example cimbar code](https://github.com/sz3/cimbar-samples/blob/v0.5/6bit/4color_ecc30_fountain_0.png)

... and contains 1550 tiles for data. For 6-bit cimbar (4 symbol bits, 2 color bits), this means 9300 bytes per image.
... and contains 12400 tiles for data. For 6-bit cimbar (4 symbol bits, 2 color bits), this means 9300 bytes per image.

### Error Correction

Expand Down
9 changes: 7 additions & 2 deletions app/src/cpp/libcimbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ Encode:
* large input files may fill up your disk with pngs!

```
./cimbar --encode -i inputfile.txt -o outputprefix -f
./cimbar --encode -i inputfile.txt -o outputprefix
```

Decode (extracts file into output directory):
```
./cimbar outputprefix*.png -o /tmp -f
./cimbar outputprefix*.png -o /tmp
```

Decode a series of encoded images from stdin:
```
echo outputprefix*.png | ./cimbar -o /tmp
```

Encode and animate to window:
Expand Down
Binary file added app/src/cpp/libcimbar/bitmap/2/00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/cpp/libcimbar/bitmap/2/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/cpp/libcimbar/bitmap/2/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/cpp/libcimbar/bitmap/2/03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions app/src/cpp/libcimbar/package-cimbar-html.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

def get_path(name):
fns = {
'index': 'web/index.html',
'cimbar_js': 'web/cimbar_js.js',
'main_js': 'web/main.js',
'output': 'web/cimbar_js.html',
}
return fns[name]


def read_file(name):
with open(get_path(name), 'rt') as f:
return f.read()


def read_script(name):
script = read_file(name)
return '<script type="text/javascript">\n' + script + '\n'


def main():
contents = read_file('index')
main_js = read_script('main_js')
cimbar_js = read_script('cimbar_js')

contents = contents.replace('<script src="main.js">', main_js)
contents = contents.replace('<script src="cimbar_js.js">', cimbar_js)

with open(get_path('output'), 'wt') as f:
f.write(contents)



if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion app/src/cpp/libcimbar/package-portable-linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
## targeting old glibc
# docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it ubuntu:16.04

Expand Down
11 changes: 7 additions & 4 deletions app/src/cpp/libcimbar/package-wasm.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/sh
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:latest
#!/bin/bash
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:3.1.39

cd /usr/src/app

apt update
apt install python -y
apt install python3 -y

cd opencv4/
mkdir opencv-build-wasm && cd opencv-build-wasm
python ../platforms/js/build_js.py build_wasm --build_wasm --emscripten_dir=/emsdk/upstream/emscripten
python3 ../platforms/js/build_js.py build_wasm --build_wasm --emscripten_dir=/emsdk/upstream/emscripten

cd /usr/src/app
mkdir build-wasm && cd build-wasm
Expand All @@ -21,3 +21,6 @@ mkdir build-asmjs && cd build-asmjs
emcmake cmake .. -DUSE_WASM=2 -DOPENCV_DIR=/usr/src/app/opencv4
make -j5 install
(cd ../web/ && zip cimbar.asmjs.zip cimbar_js.js index.html main.js)

(cd ../ && python3 package-cimbar-html.py)

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ map<string, string> getFileBlobs(string dir_path)
blobs[file_path] = base91::encode(contents);
}

for (int i = 0; i < 4; ++i)
{
string file_path = fmt::format("{}/2/{:02x}.png", dir_path, i);
string contents = File(file_path).read_all();
blobs[file_path] = base91::encode(contents);
}
for (int i = 0; i < 16; ++i)
{
string file_path = fmt::format("{}/4/{:02x}.png", dir_path, i);
Expand All @@ -43,8 +49,8 @@ int main(int argc, char** argv)
cxxopts::Options options("build_image_assets", "Build a C++ class file (header-only) that contains base91 png asset data.");

options.add_options()
("b,bitmap", "Bitmap directory", cxxopts::value<std::string>())
("h,help", "Print usage")
("b,bitmap", "Bitmap directory", cxxopts::value<std::string>())
("h,help", "Print usage")
;

auto result = options.parse(argc, argv);
Expand Down
1 change: 1 addition & 0 deletions app/src/cpp/libcimbar/src/exe/cimbar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target_link_libraries(cimbar
wirehair
zstd
${OPENCV_LIBS}
${CPPFILESYSTEM}
)

add_custom_command(
Expand Down
Loading