From cddd07a1c50f7e86b1f47671b6a5a27762d685fc Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 28 Dec 2024 12:08:13 -0500 Subject: [PATCH] hires: drop duplicate egc sets from sex/oct. compute partition counts --- src/lib/blit.c | 617 +++++++++++++++++++++---------------------------- 1 file changed, 268 insertions(+), 349 deletions(-) diff --git a/src/lib/blit.c b/src/lib/blit.c index 9114c8200..fe042869d 100644 --- a/src/lib/blit.c +++ b/src/lib/blit.c @@ -516,8 +516,9 @@ quadrant_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, // resulting lerps. static const char* hires_solver(const uint32_t rgbas[6], uint64_t* channels, unsigned blendcolors, - unsigned nointerpolate, unsigned cellheight, const char** egcs, - const unsigned* partitions, unsigned parcount){ + unsigned nointerpolate, unsigned cellheight, + const char* const* transegcs, const unsigned* partitions){ + const unsigned parcount = 1u << (cellheight * 2 - 1); // we loop over the bitstrings, dividing the pixels into two sets, and then // taking a general lerp over each set. we then compute the sum of absolute // differences, and see if it's the new minimum. @@ -575,12 +576,13 @@ hires_solver(const uint32_t rgbas[6], uint64_t* channels, unsigned blendcolors, } } //fprintf(stderr, "solved for best: %d (%u)\n", best, mindiff); - assert(best >= 0 && best < (1u << (cellheight * 2) - 1)); if(blendcolors){ ncchannels_set_fg_alpha(channels, NCALPHA_BLEND); ncchannels_set_bg_alpha(channels, NCALPHA_BLEND); } - return egcs[best]; + best = parcount * 2 - 1 - partitions[best]; + assert(best >= 0 && best >= (1u << (cellheight * 2 - 1)) && best < (1u << (cellheight * 2))); + return transegcs[best]; } // FIXME replace both of these arrays of pointers with fixed-width matrices @@ -605,262 +607,262 @@ static const char* const sextrans[64] = { // 16: row 2 left 32: row 2 right // 64: row 3 left 128: row 3 right static const char* const octtrans[256] = { - "\U00002588", // โ–ˆ 255 all eight set (full) - "\U0001cde5", // ๐œทฅ 254 missing upper left (o2345678) - "\U0001cde4", // ๐œทค 253 missing upper right (o1345678) - "\U00002586", // โ–† 252 missing row 0 (lower three quarters) - "\U0001cde3", // ๐œทฃ 251 missing row 1 left (o1245678) - "\U0000259f", // โ–Ÿ 250 (q upper right and lower left and lower right) - "\U0001cde2", // ๐œทข 249 (o1245678) - "\U0001cde1", // ๐œทก 248 (o45678) - "\U0001cde0", // ๐œท  247 missing row 1 right (o1235678) - "\U0001cddf", // ๐œทŸ 246 missing 0 left 1 right (o235678) - "\U00002599", // โ–™ 245 missing 0/1 right (q upper left and lower left and lower right) - "\U0001cdde", // ๐œทž 244 - "\U0001cddd", // ๐œท 243 - "\U0001cddc", // ๐œทœ 242 - "\U0001cddb", // ๐œท› 241 (o15678) - "\U00002584", // โ–„ 240 2/3 full (lower half) - "\U0001cdda", // ๐œทš 239 (o1234678) - "\U0001cdd9", // ๐œท™ 238 (o234678) - "\U0001cdd8", // ๐œท˜ 237 (o134678) - "\U0001cdd7", // ๐œท— 236 (o34678) - "\U0001cdd6", // ๐œท– 235 (o124678) - "\U0001cdd5", // ๐œท• 234 (o24678) - "\U0001cdd4", // ๐œท” 233 (o14678) - "\U0001cdd3", // ๐œท“ 232 (o4678) - "\U0001cdd2", // ๐œท’ 231 - "\U0001cdd1", // ๐œท‘ 230 - "\U0001cdd0", // ๐œท 229 - "\U0001cdcf", // ๐œท 228 (o145678) - "\U0001cdce", // ๐œทŽ 227 - "\U0001cdcd", // ๐œท 226 - "\U0001cdcc", // ๐œทŒ 225 - "\U0001cdcb", // ๐œท‹ 224 (o678) - "\U0001cdca", - "\U0001cdc9", - "\U0001cdc8", - "\U0001cdc7", // ๐œท‡ 220 (o34578) - "\U0001cdc6", - "\U0001cdc5", - "\U0001cdc4", - "\U0001cdc3", // ๐œทƒ 216 (o4578) - "\U0001cdc2", - "\U0001cdc1", - "\U0001cdc0", - "\U0001cdbf", // ๐œถฟ 212 (o3578) - "\U0001cdbe", - "\U0001cdbd", - "\U0001cdbc", - "\U0001cdbb", // ๐œถป 208 (o578) - "\U0001cdba", - "\U0001cdb9", - "\U0001cdb8", - "\U0001cdb7", // ๐œถท 204 (o4578) - "\U0001cdb6", - "\U0001cdb5", - "\U0001cdb4", - "\U0001cdb3", // ๐œถณ 200 (o478) - "\U0001cdb2", - "\U0001cdb1", - "\U0001cdb0", - "\U0001cdaf", // ๐œถฏ 196 (o378) - "\U0001cdae", - "\U0001cdad", - "\U0001cdac", - "\U00002582", // โ–‚ 192 (lower one quarter) - "\U0001cdab", - "\U0001cdaa", - "\U0001cda9", - "\U0001cda8", // ๐œถจ 188 (o34568) - "\U0001cda7", - "\U0001cda6", - "\U0001cda5", - "\U0001cda4", - "\U0001cda3", - "\U0001cda2", - "\U0001cda1", - "\U0001cda0", - "\U0001cd9f", - "\U0001cd9e", - "\U0001cd9d", - "\U0001cd9c", - "\U0000259c", // โ–œ 175 (q upper left and upper right and lower right) - "\U0001cd9b", - "\U0001cd9a", - "\U0001cd99", - "\U0001cd98", - "\U00002590", // โ– 170 (right half) - "\U0001cd97", - "\U0001cd96", - "\U0001cd95", - "\U0001cd94", - "\U0000259a", // โ–š 165 (q upper left and lower right) - "\U0001cd93", - "\U0001cd92", - "\U0001cd91", - "\U0001cd90", - "\U00002597", // โ–— 160 (q lower right) - "\U0001cd8f", - "\U0001cd8e", - "\U0001cd8d", - "\U0001cd8c", // ๐œถŒ 156 (u3458) - "\U0001cd8b", - "\U0001cd8a", - "\U0001cd89", - "\U0001cd88", // ๐œถˆ 152 (u458) - "\U0001cd87", - "\U0001cd86", - "\U0001cd85", - "\U0001cd84", // ๐œถ„ 148 (u358) - "\U0001cd83", - "\U0001cd82", - "\U0001cd81", - "\U0001cd80", // ๐œถ€ 144 (u58) - "\U0001cd7f", - "\U0001cd7e", - "\U0001cd7d", - "\U0001cd7c", // ๐œตผ 140 (u348) - "\U0001cd7b", - "\U0001cd7a", - "\U0001cd79", - "\U0001cd78", // ๐œตธ 136 (u48) - "\U0001cd77", - "\U0001cd76", - "\U0001cd75", - "\U0001cd74", // ๐œตด 132 (u38) - "\U0001cd73", - "\U0001cd72", - "\U0001cd71", - "\U0001cea0", // ๐œบ  128 lower right only (right half lower one quarter) - "\U0001cd70", // ๐œตฐ 127 missing lower right (u1234567) - "\U0001cd6f", - "\U0001cd6e", - "\U0001cd6d", - "\U0001cd6c", - "\U0001cd6b", - "\U0001cd6a", - "\U0001cd69", - "\U0001cd68", - "\U0001cd67", - "\U0001cd66", - "\U0001cd65", - "\U0001cd64", - "\U0001cd63", - "\U0001cd62", - "\U0001cd61", - "\U0001cd60", - "\U0001cd5f", - "\U0001cd5e", - "\U0001cd5d", - "\U0001cd5c", - "\U0001cd5b", - "\U0001cd5a", - "\U0001cd59", - "\U0001cd58", - "\U0001cd57", - "\U0001cd56", - "\U0001cd55", - "\U0001cd54", - "\U0001cd53", - "\U0001cd52", - "\U0001cd51", - "\U0000259b", // โ–› 95 0/1 full 2/3 left (q upper left and upper right and lower left) - "\U0001cd50", - "\U0001cd4f", - "\U0001cd4e", - "\U0001cd4d", - "\U0000259e", // โ–ž 92 0/1 right 2/3 left (q upper right and lower left) - "\U0001cd4c", - "\U0001cd4b", - "\U0001cd4a", - "\U0001cd49", - "\U0000258c", // โ–Œ 85 0/1/2/3 left (left block) - "\U0001cd48", - "\U0001cd47", - "\U0001cd46", - "\U0001cd45", - "\U00002596", // โ–– 80 2/3 left (q lower left) - "\U0001cd44", - "\U0001cd43", - "\U0001cd42", - "\U0001cd41", - "\U0001cd40", - "\U0001cd3f", - "\U0001cd3e", - "\U0001cd3d", - "\U0001cd3c", - "\U0001cd3b", - "\U0001cd3a", - "\U0001cd39", - "\U0001cd38", - "\U0001cd37", // ๐œดท 66 0 right 3 left (o27) - "\U0001cd36", // ๐œดถ 65 0 left 3 left (o17) - "\U0001cea3", // ๐œบฃ 64 lower left only (left half lower one quarter) - "\U0001fb85", // ๐Ÿฎ… 63 row 0/1/2 full (upper three quarters) - "\U0001cd35", // ๐œดต 62 (o23456) - "\U0001cd34", // ๐œดด 61 (o13456) - "\U0001cd33", // ๐œดณ 60 (o3456) - "\U0001cd32", // ๐œดฒ 59 (o12456) - "\U0001cd31", // ๐œดฑ 58 (o2456) - "\U0001cd30", // ๐œดฐ 57 0 left 1 right 2 full (o1456) - "\U0001cd2f", // ๐œดฏ 56 (o456) - "\U0001cd2e", // ๐œดฎ 55 - "\U0001cd2d", // ๐œดญ 54 - "\U0001cd2c", // ๐œดฌ 53 - "\U0001cd2b", // ๐œดซ 52 - "\U0001cd2a", // ๐œดช 51 - "\U0001cd29", // ๐œดฉ 50 - "\U0001cd28", // ๐œดจ 49 - "\U0001cd27", // ๐œดง 48 - "\U0001cd26", // ๐œดฆ 47 (o12346) - "\U0001cd25", // ๐œดฅ 46 (o2346) - "\U0001cd24", // ๐œดค 45 (o1346) - "\U0001cd23", // ๐œดฃ 44 (o346) - "\U0001cd22", // ๐œดข 43 (o1246) - "\U0001cd21", // ๐œดก 42 (o246) - "\U0001cd20", // ๐œด  41 (o146) - "\U0001fbe7", // ๐Ÿฏง 40 (middle right one quarter) - "\U0001cd1f", // ๐œดŸ 39 (o1236) - "\U0001cd1e", // ๐œดž 38 (o236) - "\U0001cd1d", // ๐œด 37 (o136) - "\U0001cd1c", // ๐œดœ 36 (o36) - "\U0001cd1b", // ๐œด› 35 (o126) - "\U0001cd1a", // ๐œดš 34 (o26) - "\U0001cd19", // ๐œด™ 33 (o16) - "\U0001cd18", // ๐œด˜ 32 row 2 right only (o6) - "\U0001cd17", // ๐œด— 31 (o12345) - "\U0001cd16", // ๐œด– 30 (o2345) - "\U0001cd15", // ๐œด• 29 (o1345) - "\U0001cd14", // ๐œด” 28 (o345) - "\U0001cd13", // ๐œด“ 27 (o1245) - "\U0001cd12", // ๐œด’ 26 row 0/1 right row 2 l (o245) - "\U0001cd11", // ๐œด‘ 25 row 1/2 left row 1 r (o145) - "\U0001cd10", // ๐œด 24 row 1 right row 2 left (o45) - "\U0001cd0f", // ๐œด 23 row 0 full row 1/2 l (o1235) - "\U0001cd0e", // ๐œดŽ 22 row 1 right row 2/3 l (o235) - "\U0001cd0d", // ๐œด 21 row 0/1/2 left (o135) - "\U0001fbe6", // ๐Ÿฏฆ 20 row 1/2 left (middle left one quarter) - "\U0001cd0c", // ๐œดŒ 19 row 0 full row 2 left (o125) - "\U0001cd0b", // ๐œด‹ 18 row 0 right row 2 left (o25) - "\U0001cd0a", // ๐œดŠ 17 row 0 left row 2 left (o15) - "\U0001cd09", // ๐œด‰ 16 row 2 left only (o5) - "\U00002580", // โ–€ 15 row 0/1 full (upper half) - "\U0001cd08", // ๐œดˆ 14 row 0 right row 1 full (o234) - "\U0001cd07", // ๐œด‡ 13 row 0 left row 1 full (o134) - "\U0001cd06", // ๐œด† 12 row 1 full (o34) - "\U0001cd05", // ๐œด… 11 row 0 full row 1 right (o124) - "\U0000259d", // โ– 10 row 0/1 right only (upper right quadrant) - "\U0001cd04", // ๐œด„ 9 row 0 left row 1 right (o14) - "\U0001cd03", // ๐œดƒ 8 row 1 right only (o4) - "\U0001cd02", // ๐œด‚ 7 row 0 full row 1 left (o123) - "\U0001cd01", // ๐œด 6 row 0 right row 1 left (o23) - "\U00002598", // โ–˜ 5 row 0/1 left only (upper left quadrant) - "\U0001cd00", // ๐œด€ 4 row 1 left only (o3) - "\U0001fb82", // ๐Ÿฎ‚ 3 row 0 (upper one quarter) - "\U0001ceab", // ๐œบซ 2 upper right only (right half upper one quarter) - "\U0001cea8", // ๐œบจ 1 upper left only (left half upper one quarter) - " " // 0 none set (space) + u8"\U00002588", // โ–ˆ 255 all eight set (full) + u8"\U0001cde5", // ๐œทฅ 254 missing upper left (o2345678) + u8"\U0001cde4", // ๐œทค 253 missing upper right (o1345678) + u8"\U00002586", // โ–† 252 missing row 0 (lower three quarters) + u8"\U0001cde3", // ๐œทฃ 251 missing row 1 left (o1245678) + u8"\U0000259f", // โ–Ÿ 250 (q upper right and lower left and lower right) + u8"\U0001cde2", // ๐œทข 249 (o1245678) + u8"\U0001cde1", // ๐œทก 248 (o45678) + u8"\U0001cde0", // ๐œท  247 missing row 1 right (o1235678) + u8"\U0001cddf", // ๐œทŸ 246 missing 0 left 1 right (o235678) + u8"\U00002599", // โ–™ 245 missing 0/1 right (q upper left and lower left and lower right) + u8"\U0001cdde", // ๐œทž 244 + u8"\U0001cddd", // ๐œท 243 + u8"\U0001cddc", // ๐œทœ 242 + u8"\U0001cddb", // ๐œท› 241 (o15678) + u8"\U00002584", // โ–„ 240 2/3 full (lower half) + u8"\U0001cdda", // ๐œทš 239 (o1234678) + u8"\U0001cdd9", // ๐œท™ 238 (o234678) + u8"\U0001cdd8", // ๐œท˜ 237 (o134678) + u8"\U0001cdd7", // ๐œท— 236 (o34678) + u8"\U0001cdd6", // ๐œท– 235 (o124678) + u8"\U0001cdd5", // ๐œท• 234 (o24678) + u8"\U0001cdd4", // ๐œท” 233 (o14678) + u8"\U0001cdd3", // ๐œท“ 232 (o4678) + u8"\U0001cdd2", // ๐œท’ 231 + u8"\U0001cdd1", // ๐œท‘ 230 + u8"\U0001cdd0", // ๐œท 229 + u8"\U0001cdcf", // ๐œท 228 (o145678) + u8"\U0001cdce", // ๐œทŽ 227 + u8"\U0001cdcd", // ๐œท 226 + u8"\U0001cdcc", // ๐œทŒ 225 + u8"\U0001cdcb", // ๐œท‹ 224 (o678) + u8"\U0001cdca", + u8"\U0001cdc9", + u8"\U0001cdc8", + u8"\U0001cdc7", // ๐œท‡ 220 (o34578) + u8"\U0001cdc6", + u8"\U0001cdc5", + u8"\U0001cdc4", + u8"\U0001cdc3", // ๐œทƒ 216 (o4578) + u8"\U0001cdc2", + u8"\U0001cdc1", + u8"\U0001cdc0", + u8"\U0001cdbf", // ๐œถฟ 212 (o3578) + u8"\U0001cdbe", + u8"\U0001cdbd", + u8"\U0001cdbc", + u8"\U0001cdbb", // ๐œถป 208 (o578) + u8"\U0001cdba", + u8"\U0001cdb9", + u8"\U0001cdb8", + u8"\U0001cdb7", // ๐œถท 204 (o4578) + u8"\U0001cdb6", + u8"\U0001cdb5", + u8"\U0001cdb4", + u8"\U0001cdb3", // ๐œถณ 200 (o478) + u8"\U0001cdb2", + u8"\U0001cdb1", + u8"\U0001cdb0", + u8"\U0001cdaf", // ๐œถฏ 196 (o378) + u8"\U0001cdae", + u8"\U0001cdad", + u8"\U0001cdac", + u8"\U00002582", // โ–‚ 192 (lower one quarter) + u8"\U0001cdab", + u8"\U0001cdaa", + u8"\U0001cda9", + u8"\U0001cda8", // ๐œถจ 188 (o34568) + u8"\U0001cda7", + u8"\U0001cda6", + u8"\U0001cda5", + u8"\U0001cda4", + u8"\U0001cda3", + u8"\U0001cda2", + u8"\U0001cda1", + u8"\U0001cda0", + u8"\U0001cd9f", + u8"\U0001cd9e", + u8"\U0001cd9d", + u8"\U0001cd9c", + u8"\U0000259c", // โ–œ 175 (q upper left and upper right and lower right) + u8"\U0001cd9b", + u8"\U0001cd9a", + u8"\U0001cd99", + u8"\U0001cd98", + u8"\U00002590", // โ– 170 (right half) + u8"\U0001cd97", + u8"\U0001cd96", + u8"\U0001cd95", + u8"\U0001cd94", + u8"\U0000259a", // โ–š 165 (q upper left and lower right) + u8"\U0001cd93", + u8"\U0001cd92", + u8"\U0001cd91", + u8"\U0001cd90", + u8"\U00002597", // โ–— 160 (q lower right) + u8"\U0001cd8f", + u8"\U0001cd8e", + u8"\U0001cd8d", + u8"\U0001cd8c", // ๐œถŒ 156 (u3458) + u8"\U0001cd8b", + u8"\U0001cd8a", + u8"\U0001cd89", + u8"\U0001cd88", // ๐œถˆ 152 (u458) + u8"\U0001cd87", + u8"\U0001cd86", + u8"\U0001cd85", + u8"\U0001cd84", // ๐œถ„ 148 (u358) + u8"\U0001cd83", + u8"\U0001cd82", + u8"\U0001cd81", + u8"\U0001cd80", // ๐œถ€ 144 (u58) + u8"\U0001cd7f", + u8"\U0001cd7e", + u8"\U0001cd7d", + u8"\U0001cd7c", // ๐œตผ 140 (u348) + u8"\U0001cd7b", + u8"\U0001cd7a", + u8"\U0001cd79", + u8"\U0001cd78", // ๐œตธ 136 (u48) + u8"\U0001cd77", + u8"\U0001cd76", + u8"\U0001cd75", + u8"\U0001cd74", // ๐œตด 132 (u38) + u8"\U0001cd73", + u8"\U0001cd72", + u8"\U0001cd71", + u8"\U0001cea0", // ๐œบ  128 lower right only (right half lower one quarter) + u8"\U0001cd70", // ๐œตฐ 127 missing lower right (u1234567) + u8"\U0001cd6f", + u8"\U0001cd6e", + u8"\U0001cd6d", + u8"\U0001cd6c", + u8"\U0001cd6b", + u8"\U0001cd6a", + u8"\U0001cd69", + u8"\U0001cd68", + u8"\U0001cd67", + u8"\U0001cd66", + u8"\U0001cd65", + u8"\U0001cd64", + u8"\U0001cd63", + u8"\U0001cd62", + u8"\U0001cd61", + u8"\U0001cd60", + u8"\U0001cd5f", + u8"\U0001cd5e", + u8"\U0001cd5d", + u8"\U0001cd5c", + u8"\U0001cd5b", + u8"\U0001cd5a", + u8"\U0001cd59", + u8"\U0001cd58", + u8"\U0001cd57", + u8"\U0001cd56", + u8"\U0001cd55", + u8"\U0001cd54", + u8"\U0001cd53", + u8"\U0001cd52", + u8"\U0001cd51", + u8"\U0000259b", // โ–› 95 0/1 full 2/3 left (q upper left and upper right and lower left) + u8"\U0001cd50", + u8"\U0001cd4f", + u8"\U0001cd4e", + u8"\U0001cd4d", + u8"\U0000259e", // โ–ž 92 0/1 right 2/3 left (q upper right and lower left) + u8"\U0001cd4c", + u8"\U0001cd4b", + u8"\U0001cd4a", + u8"\U0001cd49", + u8"\U0000258c", // โ–Œ 85 0/1/2/3 left (left block) + u8"\U0001cd48", + u8"\U0001cd47", + u8"\U0001cd46", + u8"\U0001cd45", + u8"\U00002596", // โ–– 80 2/3 left (q lower left) + u8"\U0001cd44", + u8"\U0001cd43", + u8"\U0001cd42", + u8"\U0001cd41", + u8"\U0001cd40", + u8"\U0001cd3f", + u8"\U0001cd3e", + u8"\U0001cd3d", + u8"\U0001cd3c", + u8"\U0001cd3b", + u8"\U0001cd3a", + u8"\U0001cd39", + u8"\U0001cd38", + u8"\U0001cd37", // ๐œดท 66 0 right 3 left (o27) + u8"\U0001cd36", // ๐œดถ 65 0 left 3 left (o17) + u8"\U0001cea3", // ๐œบฃ 64 lower left only (left half lower one quarter) + u8"\U0001fb85", // ๐Ÿฎ… 63 row 0/1/2 full (upper three quarters) + u8"\U0001cd35", // ๐œดต 62 (o23456) + u8"\U0001cd34", // ๐œดด 61 (o13456) + u8"\U0001cd33", // ๐œดณ 60 (o3456) + u8"\U0001cd32", // ๐œดฒ 59 (o12456) + u8"\U0001cd31", // ๐œดฑ 58 (o2456) + u8"\U0001cd30", // ๐œดฐ 57 0 left 1 right 2 full (o1456) + u8"\U0001cd2f", // ๐œดฏ 56 (o456) + u8"\U0001cd2e", // ๐œดฎ 55 + u8"\U0001cd2d", // ๐œดญ 54 + u8"\U0001cd2c", // ๐œดฌ 53 + u8"\U0001cd2b", // ๐œดซ 52 + u8"\U0001cd2a", // ๐œดช 51 + u8"\U0001cd29", // ๐œดฉ 50 + u8"\U0001cd28", // ๐œดจ 49 + u8"\U0001cd27", // ๐œดง 48 + u8"\U0001cd26", // ๐œดฆ 47 (o12346) + u8"\U0001cd25", // ๐œดฅ 46 (o2346) + u8"\U0001cd24", // ๐œดค 45 (o1346) + u8"\U0001cd23", // ๐œดฃ 44 (o346) + u8"\U0001cd22", // ๐œดข 43 (o1246) + u8"\U0001cd21", // ๐œดก 42 (o246) + u8"\U0001cd20", // ๐œด  41 (o146) + u8"\U0001fbe7", // ๐Ÿฏง 40 (middle right one quarter) + u8"\U0001cd1f", // ๐œดŸ 39 (o1236) + u8"\U0001cd1e", // ๐œดž 38 (o236) + u8"\U0001cd1d", // ๐œด 37 (o136) + u8"\U0001cd1c", // ๐œดœ 36 (o36) + u8"\U0001cd1b", // ๐œด› 35 (o126) + u8"\U0001cd1a", // ๐œดš 34 (o26) + u8"\U0001cd19", // ๐œด™ 33 (o16) + u8"\U0001cd18", // ๐œด˜ 32 row 2 right only (o6) + u8"\U0001cd17", // ๐œด— 31 (o12345) + u8"\U0001cd16", // ๐œด– 30 (o2345) + u8"\U0001cd15", // ๐œด• 29 (o1345) + u8"\U0001cd14", // ๐œด” 28 (o345) + u8"\U0001cd13", // ๐œด“ 27 (o1245) + u8"\U0001cd12", // ๐œด’ 26 row 0/1 right row 2 l (o245) + u8"\U0001cd11", // ๐œด‘ 25 row 1/2 left row 1 r (o145) + u8"\U0001cd10", // ๐œด 24 row 1 right row 2 left (o45) + u8"\U0001cd0f", // ๐œด 23 row 0 full row 1/2 l (o1235) + u8"\U0001cd0e", // ๐œดŽ 22 row 1 right row 2/3 l (o235) + u8"\U0001cd0d", // ๐œด 21 row 0/1/2 left (o135) + u8"\U0001fbe6", // ๐Ÿฏฆ 20 row 1/2 left (middle left one quarter) + u8"\U0001cd0c", // ๐œดŒ 19 row 0 full row 2 left (o125) + u8"\U0001cd0b", // ๐œด‹ 18 row 0 right row 2 left (o25) + u8"\U0001cd0a", // ๐œดŠ 17 row 0 left row 2 left (o15) + u8"\U0001cd09", // ๐œด‰ 16 row 2 left only (o5) + u8"\U00002580", // โ–€ 15 row 0/1 full (upper half) + u8"\U0001cd08", // ๐œดˆ 14 row 0 right row 1 full (o234) + u8"\U0001cd07", // ๐œด‡ 13 row 0 left row 1 full (o134) + u8"\U0001cd06", // ๐œด† 12 row 1 full (o34) + u8"\U0001cd05", // ๐œด… 11 row 0 full row 1 right (o124) + u8"\U0000259d", // โ– 10 row 0/1 right only (upper right quadrant) + u8"\U0001cd04", // ๐œด„ 9 row 0 left row 1 right (o14) + u8"\U0001cd03", // ๐œดƒ 8 row 1 right only (o4) + u8"\U0001cd02", // ๐œด‚ 7 row 0 full row 1 left (o123) + u8"\U0001cd01", // ๐œด 6 row 0 right row 1 left (o23) + u8"\U00002598", // โ–˜ 5 row 0/1 left only (upper left quadrant) + u8"\U0001cd00", // ๐œด€ 4 row 1 left only (o3) + u8"\U0001fb82", // ๐Ÿฎ‚ 3 row 0 (upper one quarter) + u8"\U0001ceab", // ๐œบซ 2 upper right only (right half upper one quarter) + u8"\U0001cea8", // ๐œบจ 1 upper left only (left half upper one quarter) + u8" " // 0 none set (space) }; static const char* @@ -918,8 +920,7 @@ hires_trans_check(nccell* c, const uint32_t* rgbas, unsigned blendcolors, static inline int hires_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, const blitterargs* bargs, int cellheight, - const char* const* transegcs, const char **egcs, - const unsigned* partitions, unsigned parcount){ + const char* const* transegcs, const unsigned* partitions){ const unsigned nointerpolate = bargs->flags & NCVISUAL_OPTION_NOINTERPOLATE; const bool blendcolors = bargs->flags & NCVISUAL_OPTION_BLEND; unsigned dimy, dimx, x, y; @@ -959,7 +960,7 @@ hires_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, nointerpolate, cellheight, transegcs); if(egc == NULL){ // no transparency; run a full solver egc = hires_solver(rgbas, &c->channels, blendcolors, nointerpolate, - cellheight, egcs, partitions, parcount); + cellheight, transegcs, partitions); cell_set_blitquadrants(c, 1, 1, 1, 1); } //fprintf(stderr, "hires EGC: %s channels: %016lx\n", egc, c->channels); @@ -982,13 +983,7 @@ sextant_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, // each element within the set of 64 has an inverse element within the set, // for which we would calculate the same total differences, so just handle // the first 32. the sextition[] bit masks represent combinations of - // sextants, and their indices correspond to sex[]. - static const char* sex[32] = { - " ", "๐Ÿฌ€", "๐Ÿฌ", "๐Ÿฌƒ", "๐Ÿฌ‡", "๐Ÿฌ", "๐Ÿฌž", "๐Ÿฌ‚", // 0..7 - "๐Ÿฌ„", "๐Ÿฌˆ", "๐Ÿฌ", "๐ŸฌŸ", "๐Ÿฌ…", "๐Ÿฌ‰", "๐Ÿฌ‘", "๐Ÿฌ ", // 8..15 - "๐Ÿฌ‹", "๐Ÿฌ“", "๐Ÿฌข", "๐Ÿฌ–", "๐Ÿฌฆ", "๐Ÿฌญ", "๐Ÿฌ†", "๐ŸฌŠ", // 16..23 - "๐Ÿฌ’", "๐Ÿฌก", "๐ŸฌŒ", "โ–Œ", "๐Ÿฌฃ", "๐Ÿฌ—", "๐Ÿฌง", "๐Ÿฌฎ", // 24..31 - }; + // sextants, and their indices correspond to inverse sextrans[]. static const unsigned sextitions[32] = { 0, // 1 way to arrange 0 1, 2, 4, 8, 16, 32, // 6 ways to arrange 1 @@ -996,8 +991,7 @@ sextant_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, // 16 ways to arrange 3, *but* six of them are inverses, so 10 7, 11, 19, 35, 13, 21, 37, 25, 41, 49 // 10 + 15 + 6 + 1 == 32 }; - return hires_blit(nc, linesize, data, leny, lenx, bargs, 3, sextrans, - sex, sextitions, sizeof(sextitions) / sizeof(*sextitions)); + return hires_blit(nc, linesize, data, leny, lenx, bargs, 3, sextrans, sextitions); } static inline int @@ -1006,82 +1000,8 @@ octant_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, // each element within the set of 256 has an inverse element within the set, // for which we would calculate the same total differences, so just handle // the first 128. the octition[] bit masks represent combinations of - // octants, and their indices correspond to sex[]. -#define T(sum) (255 - (sum)) + // octants, and their indices correspond to inverse octtrans[]. #define E(bits) (1u << (bits)) - static const char* oct[128] = { - octtrans[T(0)], - // one set - octtrans[T(E(0))], - octtrans[T(E(1))], - octtrans[T(E(2))], - octtrans[T(E(3))], - octtrans[T(E(4))], - octtrans[T(E(5))], - octtrans[T(E(6))], - octtrans[T(E(7))], - // two set (7 + 6 + 5 + 4 + 3 + 2 + 1 = 28) - octtrans[T(E(0) + E(1))], octtrans[T(E(0) + E(2))], octtrans[T(E(0) + E(3))], - octtrans[T(E(0) + E(4))], octtrans[T(E(0) + E(5))], octtrans[T(E(0) + E(6))], - octtrans[T(E(0) + E(7))], // 0 + 1... - octtrans[T(E(1) + E(2))], octtrans[T(E(1) + E(3))], octtrans[T(E(1) + E(4))], - octtrans[T(E(1) + E(5))], octtrans[T(E(1) + E(6))], octtrans[T(E(1) + E(7))], // 1 + 2... - octtrans[T(E(2) + E(3))], octtrans[T(E(2) + E(4))], octtrans[T(E(2) + E(5))], - octtrans[T(E(2) + E(6))], octtrans[T(E(2) + E(7))], // 2 + 3... - octtrans[T(E(3) + E(4))], octtrans[T(E(3) + E(5))], octtrans[T(E(3) + E(6))], - octtrans[T(E(3) + E(7))], // 3 + 4... - octtrans[T(E(4) + E(5))], octtrans[T(E(4) + E(6))], octtrans[T(E(4) + E(7))], // 4 + 5... - octtrans[T(E(5) + E(6))], octtrans[T(E(5) + E(7))], // 5 + 6... - octtrans[T(E(6) + E(7))], // 6 + 7 - // three set (21 + 15 + 10 + 6 + 3 + 1 = 56) - octtrans[T(E(0) + E(1) + E(2))], octtrans[T(E(0) + E(1) + E(3))], octtrans[T(E(0) + E(1) + E(4))], - octtrans[T(E(0) + E(1) + E(5))], octtrans[T(E(0) + E(1) + E(6))], octtrans[T(E(0) + E(1) + E(7))], // 0 + 1 + 2... - octtrans[T(E(0) + E(2) + E(3))], octtrans[T(E(0) + E(2) + E(4))], octtrans[T(E(0) + E(2) + E(5))], - octtrans[T(E(0) + E(2) + E(6))], octtrans[T(E(0) + E(2) + E(7))], // 0 + 2 + 3... - octtrans[T(E(0) + E(3) + E(4))], octtrans[T(E(0) + E(3) + E(5))], octtrans[T(E(0) + E(3) + E(6))], - octtrans[T(E(0) + E(3) + E(7))], // 3 + 4... - octtrans[T(E(0) + E(4) + E(5))], octtrans[T(E(0) + E(4) + E(6))], octtrans[T(E(0) + E(4) + E(7))], // 0 + 4 + 5... - octtrans[T(E(0) + E(5) + E(6))], octtrans[T(E(0) + E(5) + E(7))], // 0 + 5 + 6... - octtrans[T(E(0) + E(6) + E(7))], // 0 + 6 + 7 - octtrans[T(E(1) + E(2) + E(3))], octtrans[T(E(1) + E(2) + E(4))], octtrans[T(E(1) + E(2) + E(5))], - octtrans[T(E(1) + E(2) + E(6))], octtrans[T(E(1) + E(2) + E(7))], - octtrans[T(E(1) + E(3) + E(4))], octtrans[T(E(1) + E(3) + E(5))], octtrans[T(E(1) + E(3) + E(6))], - octtrans[T(E(1) + E(3) + E(7))], - octtrans[T(E(1) + E(4) + E(5))], octtrans[T(E(1) + E(4) + E(6))], octtrans[T(E(1) + E(4) + E(7))], - octtrans[T(E(1) + E(5) + E(6))], octtrans[T(E(1) + E(5) + E(7))], - octtrans[T(E(1) + E(6) + E(7))], - octtrans[T(E(2) + E(3) + E(4))], octtrans[T(E(2) + E(3) + E(5))], octtrans[T(E(2) + E(3) + E(6))], - octtrans[T(E(2) + E(3) + E(7))], - octtrans[T(E(2) + E(4) + E(5))], octtrans[T(E(2) + E(4) + E(6))], octtrans[T(E(2) + E(4) + E(7))], - octtrans[T(E(2) + E(5) + E(6))], octtrans[T(E(2) + E(5) + E(7))], - octtrans[T(E(2) + E(6) + E(7))], - octtrans[T(E(3) + E(4) + E(5))], octtrans[T(E(3) + E(4) + E(6))], octtrans[T(E(3) + E(4) + E(7))], - octtrans[T(E(3) + E(5) + E(6))], octtrans[T(E(3) + E(5) + E(7))], - octtrans[T(E(3) + E(6) + E(7))], - octtrans[T(E(4) + E(5) + E(6))], octtrans[T(E(4) + E(5) + E(7))], - octtrans[T(E(4) + E(6) + E(7))], - octtrans[T(E(5) + E(6) + E(7))], // 5 + 6 + 7 - // four set (15 + 10 + 6 + 3 + 1 = 35) - octtrans[T(E(0) + E(1) + E(2) + E(3))], octtrans[T(E(0) + E(1) + E(2) + E(4))], octtrans[T(E(0) + E(1) + E(2) + E(5))], - octtrans[T(E(0) + E(1) + E(2) + E(6))], octtrans[T(E(0) + E(1) + E(2) + E(7))], - octtrans[T(E(0) + E(1) + E(3) + E(4))], octtrans[T(E(0) + E(1) + E(3) + E(5))], octtrans[T(E(0) + E(1) + E(3) + E(6))], - octtrans[T(E(0) + E(1) + E(3) + E(7))], - octtrans[T(E(0) + E(1) + E(4) + E(5))], octtrans[T(E(0) + E(1) + E(4) + E(6))], octtrans[T(E(0) + E(1) + E(4) + E(7))], - octtrans[T(E(0) + E(1) + E(5) + E(6))], octtrans[T(E(0) + E(1) + E(5) + E(7))], - octtrans[T(E(0) + E(1) + E(6) + E(7))], - octtrans[T(E(0) + E(2) + E(3) + E(4))], octtrans[T(E(0) + E(2) + E(3) + E(5))], octtrans[T(E(0) + E(2) + E(3) + E(6))], - octtrans[T(E(0) + E(2) + E(3) + E(7))], - octtrans[T(E(0) + E(2) + E(4) + E(5))], octtrans[T(E(0) + E(2) + E(4) + E(6))], octtrans[T(E(0) + E(2) + E(4) + E(7))], - octtrans[T(E(0) + E(2) + E(5) + E(6))], octtrans[T(E(0) + E(2) + E(5) + E(7))], - octtrans[T(E(0) + E(2) + E(6) + E(7))], - octtrans[T(E(0) + E(3) + E(4) + E(5))], octtrans[T(E(0) + E(3) + E(4) + E(6))], octtrans[T(E(0) + E(3) + E(4) + E(7))], - octtrans[T(E(0) + E(3) + E(5) + E(6))], octtrans[T(E(0) + E(3) + E(5) + E(7))], - octtrans[T(E(0) + E(3) + E(6) + E(7))], - octtrans[T(E(0) + E(4) + E(5) + E(6))], octtrans[T(E(0) + E(4) + E(5) + E(7))], - octtrans[T(E(0) + E(4) + E(6) + E(7))], - octtrans[T(E(0) + E(5) + E(6) + E(7))], // 0 + 5 + 6 + 7 -#undef T - }; static const unsigned octitions[128] = { 0, // one set @@ -1155,8 +1075,7 @@ octant_blit(ncplane* nc, int linesize, const void* data, int leny, int lenx, E(0) + E(5) + E(6) + E(7), // 0 + 5 + 6 + 7 #undef E }; - return hires_blit(nc, linesize, data, leny, lenx, bargs, 4, octtrans, - oct, octitions, sizeof(octitions) / sizeof(*octitions)); + return hires_blit(nc, linesize, data, leny, lenx, bargs, 4, octtrans, octitions); } // Bit is set where Braille dot is present: