Skip to content

Commit

Permalink
More const, and add more seed positions for the decode?
Browse files Browse the repository at this point in the history
  • Loading branch information
sz3 committed Jun 1, 2023
1 parent 6849234 commit f3cdabe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/lib/cimb_translator/AdjacentCellFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include "AdjacentCellFinder.h"

AdjacentCellFinder::AdjacentCellFinder(const CellPositions::positions_list& positions, int dimensions, int marker_size)
: _positions(positions)
, _dimensions(dimensions)
, _markerSize(marker_size)
: _positions(positions)
, _dimensions(dimensions)
, _markerSize(marker_size)
{
int midDimensions = dimensions - marker_size - marker_size;
int midCells = dimensions * midDimensions;
Expand All @@ -13,10 +13,10 @@ AdjacentCellFinder::AdjacentCellFinder(const CellPositions::positions_list& posi
_firstBottom = edgeCells + midCells;
}

std::array<int, 4> AdjacentCellFinder::find(int index)
std::array<int, 4> AdjacentCellFinder::find(int index) const
{
std::array<int,4> adj = {
right(index), left(index), bottom(index), top(index)
right(index), left(index), bottom(index), top(index)
};
return adj;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cimb_translator/AdjacentCellFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AdjacentCellFinder
public:
AdjacentCellFinder(const CellPositions::positions_list& positions, int dimensions, int marker_size);

std::array<int, 4> find(int index);
std::array<int, 4> find(int index) const;

int dimensions() const;
int marker_size() const;
Expand Down
19 changes: 13 additions & 6 deletions src/lib/cimb_translator/FloodDecodePositions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include "FloodDecodePositions.h"

FloodDecodePositions::FloodDecodePositions(int spacing, int dimensions, int offset, int marker_size)
: _positions(CellPositions::compute(spacing, dimensions, offset, marker_size, 0))
, _cellFinder(_positions, dimensions, marker_size)
: _positions(CellPositions::compute(spacing, dimensions, offset, marker_size, 0))
, _cellFinder(_positions, dimensions, marker_size)
{
reset();
}
Expand All @@ -25,12 +25,19 @@ void FloodDecodePositions::reset()
}

// seed
uint16_t smallRowLen = _cellFinder.dimensions() - (2*_cellFinder.marker_size()) - 1;
uint16_t smallRowLen = _cellFinder.dimensions() - (2*_cellFinder.marker_size());
uint16_t lastElem = _positions.size()-1;
_heap.push({0, 0});
_heap.push({smallRowLen, 0});
_heap.push({smallRowLen-1, 0});
_heap.push({lastElem, 0});
_heap.push({lastElem-smallRowLen, 0});
_heap.push({lastElem-(smallRowLen-1), 0});

// add more seed corners?
uint16_t betweenMarkerBlock = smallRowLen * _cellFinder.marker_size();
_heap.push({betweenMarkerBlock, 1});
_heap.push({betweenMarkerBlock+_cellFinder.dimensions()-1, 1});
_heap.push({lastElem-betweenMarkerBlock, 1});
_heap.push({lastElem-(betweenMarkerBlock+_cellFinder.dimensions()-1), 1});
}

bool FloodDecodePositions::done() const
Expand All @@ -47,7 +54,7 @@ FloodDecodePositions::iter FloodDecodePositions::next()

std::vector<bool>::reference needsDecode = _remaining[i];
if (!needsDecode)
continue;
continue;

needsDecode = false;
++_count;
Expand Down

0 comments on commit f3cdabe

Please sign in to comment.