Warning: session_start(): open(/var/lib/php/sessions/sess_okj3r1uveqssefnlkl650t5osa, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
srecord noeq G22_RegionToSSIs_v2(IImageRegion region) {
RGB color;
L ssis;
new L growingSSIs;
settable bool withDiagonals;
class GrowingSSI {
settable int y1;
new ShortBuffer data;
int y2() { ret y1+l(data)/2; }
SSI finish() {
ret new SSI(y1, y2()).data(data.toArray())
.color(color);
}
}
L get() {
if (region == null) null;
color = region.color();
ssis = new L;
Rect r = region.bounds();
int x1 = r.x1(), y1 = r.y1(), y2 = r.y2(), h = y2-y1, w = r.w;
for (int y = y1; y < y2; y++) {
reMutable y;
L streaks = genericStreaks(w, x -> region.contains(x1+x, y));
// process growingSSIs & streaks simultaneously (from L to R)
int iStreak = 0, iSSI = 0;
bool moreStreaks, moreSSIs;
while ((moreStreaks = iStreak < l(streaks))
| (moreSSIs = iSSI < l(growingSSIs))) {
if (moreStreaks)
if (moreSSIs)
// compare positions
}
// finish SSIs
while (longerThan(growingSSIs, streaks))
ssis.add(popLast(growingSSIs).finish());
// now we know that l(growingSSIs) <= l(streaks)
// start new SSIs
for (int i = l(growingSSIs); i < l(streaks); i++)
growingSSIs.add(new GrowingSSI().y1(y));
// continue SSIs
for (ssi, range : unpair zipTwoLists(growingSSIs, streaks)) {
ssi.data.add(toShort_enforce(x1+range.start));
ssi.data.add(toShort_enforce(x1+range.end));
}
}
for (ssi : cloneAndClear(growingSSIs))
ssis.add(ssi.finish());
ret ssis;
}
swappable IntRange selectHorizontalPart(L parts) {
ret first(parts);
}
}