Skip to content

Commit

Permalink
Improved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
user-simon committed Oct 19, 2021
1 parent 60af233 commit 1339af5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static struct
uint32_t bitmap_h;
} settings;

// calculates the average luma in the pixel block starting at x, y
static inline double block_luma(uint32_t x, uint32_t y)
{
static const float sample_frac = settings.block_size / settings.ss;
Expand Down Expand Up @@ -87,13 +88,13 @@ int main()
{
for (float x = 0; x < settings.bitmap_w - settings.block_size; x += settings.block_size)
{
// calculate the block luma
const double luma = block_luma(x, y);

// get character from block luminosity
const uint32_t char_index = luma * (pixel_chars.length() - 1);

// add two chars per "pixel" since chars typically have a 2:1 size ratio

output << std::string(2, pixel_chars[char_index]);
}
output << '\n';
Expand Down

0 comments on commit 1339af5

Please sign in to comment.