-
Notifications
You must be signed in to change notification settings - Fork 309
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
Misc bugfixes + dependency upgrades #59
Changes from all commits
c5f7676
7c545bb
52547ae
b0091d1
178e02a
28559cb
82ed9e9
39b37d9
cc6abee
0f2665a
fec665f
e698786
c05e3b5
9e0dae0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <cstddef> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make modern g++ happy(er) |
||
#include <utility> | ||
#include <vector> | ||
|
||
class CellPositions | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ class FountainMetadata | |
} | ||
|
||
public: | ||
FountainMetadata(uint64_t id) | ||
FountainMetadata(uint32_t id) | ||
: _data(id) | ||
{ | ||
} | ||
|
@@ -33,7 +33,7 @@ class FountainMetadata | |
to_uint8_arr(encode_id, size, d); | ||
} | ||
|
||
unsigned id() const | ||
uint32_t id() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This unsigned was doing a lot of work -- the type here should've been 32bit all along. |
||
{ | ||
return _data; | ||
} | ||
|
@@ -65,5 +65,5 @@ class FountainMetadata | |
} | ||
|
||
protected: | ||
uint64_t _data; // might invert this and only generate the uint64_t when we need it | ||
uint32_t _data; // might invert this and only generate the uint32_t when we need it | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,10 +39,10 @@ class fountain_decoder_sink | |
return true; | ||
} | ||
|
||
void mark_done(uint64_t id) | ||
void mark_done(const FountainMetadata& md) | ||
{ | ||
_done.insert(id); | ||
auto it = _streams.find(id); | ||
_done.insert(md.id()); | ||
auto it = _streams.find(stream_slot(md)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we were searching by Luckily: this code is currently only used by the android app, and the whole sink gets thrown away whenever the app is stopped or paused. |
||
if (it != _streams.end()) | ||
_streams.erase(it); | ||
} | ||
|
@@ -60,7 +60,7 @@ class fountain_decoder_sink | |
std::vector<std::string> get_done() const | ||
{ | ||
std::vector<std::string> done; | ||
for (uint64_t id : _done) | ||
for (uint32_t id : _done) | ||
done.push_back( get_filename(FountainMetadata(id)) ); | ||
return done; | ||
} | ||
|
@@ -77,7 +77,7 @@ class fountain_decoder_sink | |
return progress; | ||
} | ||
|
||
bool is_done(uint64_t id) const | ||
bool is_done(uint32_t id) const | ||
{ | ||
return _done.find(id) != _done.end(); | ||
} | ||
|
@@ -106,7 +106,7 @@ class fountain_decoder_sink | |
return false; | ||
|
||
if (store(md, *finished)) | ||
mark_done(md.id()); | ||
mark_done(md); | ||
return true; | ||
} | ||
|
||
|
@@ -122,7 +122,7 @@ class fountain_decoder_sink | |
} | ||
|
||
protected: | ||
// streams is limited to at most 8 decoders at a time. Current, we just use the lower bits of the encode_id. | ||
// streams is limited to at most 8 decoders at a time. Currently, we just use the lower bits of the encode_id. | ||
uint8_t stream_slot(const FountainMetadata& md) const | ||
{ | ||
return md.encode_id() & 0x7; | ||
|
@@ -137,7 +137,10 @@ class fountain_decoder_sink | |
std::string _dataDir; | ||
unsigned _chunkSize; | ||
|
||
// maybe instead of unordered_map+set, something where we can "age out" old streams? | ||
// e.g. most recent 16/8, or something? | ||
// question is what happens to _done/_streams when we wrap for continuous data streaming... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's more work to be done here. |
||
std::unordered_map<uint8_t, fountain_decoder_stream> _streams; | ||
// track the uint64_t combo of (encode_id,size) to avoid redundant work | ||
std::set<uint64_t> _done; | ||
// track the uint32_t combo of (encode_id,size) to avoid redundant work | ||
std::set<uint32_t> _done; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ordering is helpful for static builds. calib3d is needed for opencv4 and the
undistort
functionality.undistort
isn't currently used anywhere, but I didn't see a good reason to axe it yet.