Skip to content

Commit 3fd07ff

Browse files
authored
Merge pull request #159 from sz3/cleanup-time3
cleanup: cimbar_send cli improvement/fix, new emsdk version for wasm build, +++
2 parents fbf90c4 + 4bf2f65 commit 3fd07ff

File tree

29 files changed

+5721
-5309
lines changed

29 files changed

+5721
-5309
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616

1717
- name: Get openCV
1818
run: |
19-
git clone --recurse-submodules --depth 1 --branch 4.11.0 https://github.com/opencv/opencv.git opencv4
19+
git clone --recurse-submodules --depth 1 --branch 4.12.0 https://github.com/opencv/opencv.git opencv4
2020
2121
- name: Run the build process with Docker
2222
uses: addnab/docker-run-action@v3
2323
with:
24-
image: emscripten/emsdk:3.1.69
24+
image: emscripten/emsdk:5.0.0
2525
options: -v ${{ github.workspace }}:/usr/src/app
2626
shell: bash
2727
run: |

package-wasm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:3.1.69 bash
2+
#docker run --mount type=bind,source="$(pwd)",target="/usr/src/app" -it emscripten/emsdk:5.0.0 bash
33

44
SKIP_JS=${SKIP_JS:-}
55
CIMBAR_ROOT=${CIMBAR_ROOT:-/usr/src/app}

src/exe/cimbar_send/send.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ int main(int argc, char** argv)
3333
{
3434
cxxopts::Options options("cimbar video encoder", "Draw a bunch of weird static on the screen!");
3535

36-
unsigned colorBits = cimbar::Config::color_bits();
3736
unsigned compressionLevel = cimbar::Config::compression_level();
38-
unsigned ecc = cimbar::Config::ecc_bytes();
3937
unsigned defaultFps = 15;
38+
unsigned defaultPadding = 32;
4039
options.add_options()
4140
("i,in", "Source file", cxxopts::value<vector<string>>())
42-
("c,colorbits", "Color bits. [0-3]", cxxopts::value<int>()->default_value(turbo::str::str(colorBits)))
43-
("e,ecc", "ECC level", cxxopts::value<unsigned>()->default_value(turbo::str::str(ecc)))
4441
("f,fps", "Target FPS", cxxopts::value<unsigned>()->default_value(turbo::str::str(defaultFps)))
45-
("m,mode", "Select a cimbar mode. B is new to 0.6.x. 4C is the 0.5.x config. [B,Bm,Bu,4C]", cxxopts::value<string>()->default_value("4C"))
42+
("m,mode", "Select a cimbar mode. B modes are new to 0.6.x. 4C is the 0.5.x config. [B,Bm,Bu,4C]", cxxopts::value<string>()->default_value("B"))
43+
("p,padding", "Black padding around image in pixels.", cxxopts::value<unsigned>()->default_value(turbo::str::str(defaultPadding)))
4644
("z,compression", "Compression level. 0 == no compression.", cxxopts::value<int>()->default_value(turbo::str::str(compressionLevel)))
4745
("h,help", "Print usage")
4846
;
@@ -58,10 +56,7 @@ int main(int argc, char** argv)
5856
}
5957

6058
vector<string> infiles = result["in"].as<vector<string>>();
61-
62-
colorBits = std::min(3, result["colorbits"].as<int>());
6359
compressionLevel = result["compression"].as<int>();
64-
ecc = result["ecc"].as<unsigned>();
6560

6661
unsigned config_mode = 68;
6762
if (result.count("mode"))
@@ -74,20 +69,25 @@ int main(int argc, char** argv)
7469
else if (mode == "Bm" or mode == "BM")
7570
config_mode = 67;
7671
}
72+
cimbar::Config::update(config_mode);
73+
74+
unsigned padding = result["padding"].as<unsigned>();
75+
if (padding == 0)
76+
padding = defaultPadding;
7777

7878
unsigned fps = result["fps"].as<unsigned>();
7979
if (fps == 0)
8080
fps = defaultFps;
8181
unsigned delay = 1000 / fps;
8282

83-
int window_size_x = cimbar::Config::image_size_x() + 32;
84-
int window_size_y = cimbar::Config::image_size_y() + 32;
83+
int window_size_x = cimbar::Config::image_size_x();
84+
int window_size_y = cimbar::Config::image_size_y();
8585
if (cimbare_init_window(window_size_x, window_size_y) < 0)
8686
{
8787
std::cerr << "failed to create window :(" << std::endl;
8888
return 70;
8989
}
90-
cimbare_auto_scale_window();
90+
cimbare_auto_scale_window(padding);
9191
cimbare_configure(config_mode, compressionLevel);
9292

9393
std::chrono::time_point start = std::chrono::high_resolution_clock::now();

src/lib/cimb_translator/Config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ namespace cimbar
149149
return active_conf().total_cells();
150150
}
151151

152-
// leave bitspercell here
153152
static unsigned capacity(unsigned bitspercell=0)
154153
{
155154
return active_conf().capacity(bitspercell);

src/lib/cimb_translator/GridConf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace cimbar
4444
return cells_per_col_x*cells_per_col_y - (corner_padding_x()*corner_padding_y() * 4);
4545
}
4646

47-
unsigned capacity(unsigned bitspercell) const
47+
unsigned capacity(unsigned bitspercell=0) const
4848
{
4949
if (!bitspercell)
5050
bitspercell = bits_per_cell();

src/lib/cimbar_js/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ set (LINK_WASM_LIST
9090
-s FILESYSTEM=0
9191
-s TOTAL_MEMORY=134217728
9292
-s EXPORTED_FUNCTIONS='[${LINK_WASM_EXPORTED_FUNCTIONS}]'
93+
-s EXPORTED_RUNTIME_METHODS=['HEAPU8']
9394
)
9495
string(REPLACE ";" " " LINK_WASM_FLAGS "${LINK_WASM_LIST}")
9596

src/lib/cimbar_js/cimbar_js.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
#include "encoder/Encoder.h"
77
#include "gui/window_glfw.h"
88
#include "util/byte_istream.h"
9-
10-
#include <iostream>
119
#include <sstream>
1210

13-
1411
namespace {
1512
std::shared_ptr<cimbar::window_glfw> _window;
1613
std::shared_ptr<fountain_encoder_stream> _fes;
@@ -64,12 +61,12 @@ int cimbare_rotate_window(bool rotate)
6461
return 0;
6562
}
6663

67-
bool cimbare_auto_scale_window()
64+
bool cimbare_auto_scale_window(unsigned padding)
6865
{
6966
if (!_window or !_window->is_good())
7067
return false;
7168

72-
_window->auto_scale_to_window();
69+
_window->auto_scale_to_window(padding);
7370
return true;
7471
}
7572

src/lib/cimbar_js/cimbar_js.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int cimbare_configure(int mode_val, int compression);
1717
float cimbare_get_aspect_ratio();
1818

1919
// internal usage
20-
bool cimbare_auto_scale_window();
20+
bool cimbare_auto_scale_window(unsigned padding);
2121
int cimbare_get_frame_buff(unsigned char** buff);
2222

2323
#ifdef __cplusplus

src/lib/compression/zstd_compressor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#pragma once
33

44
#include "zstd/zstd.h"
5+
6+
#include "serialize/format.h"
57
#include <array>
6-
#include <fstream>
7-
#include <iostream>
88
#include <sstream>
99
#include <vector>
1010

@@ -36,7 +36,7 @@ class zstd_compressor : public STREAM
3636
size_t compressedBytes = ZSTD_compressCCtx(_cctx, _compBuff.data(), _compBuff.size(), data, writeLen, _compressionLevel);
3737
if (ZSTD_isError(compressedBytes))
3838
{
39-
std::cerr << "error? " << ZSTD_getErrorName(compressedBytes) << std::endl;
39+
fmt::print("error? {}\n", ZSTD_getErrorName(compressedBytes));
4040
return false;
4141
}
4242
STREAM::write(_compBuff.data(), compressedBytes);

src/lib/compression/zstd_decompressor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "zstd/zstd.h"
77
#include <array>
8-
#include <iostream>
98
#include <sstream>
109
#include <vector>
1110

0 commit comments

Comments
 (0)