about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* clarify a corner case in 2's complement integersKartik K. Agaram2021-07-141-0/+31
| | | | https://merveilles.town/@akkartik/106577885001702701
* dithering ppm files using all 256 colorsKartik K. Agaram2021-07-131-2/+205
| | | | | Not quite working yet, but yields an interesting 'sketching-like' effect.
* scaling the palette working on third attemptKartik K. Agaram2021-07-131-2/+16
| | | | | See commits b4e997adb8 and 2777479a94. This seems like a good sign that dithering is now extremely precise.
* get rid of our ugly rounding codeKartik K. Agaram2021-07-131-8/+1
| | | | | | | | | | | | | | | It turns out "truncating" the last 4 bits is actually more accurate, because it divides up the palette evenly. Before: 0-7 -> 0 8-0x17 -> 1 0x18-0x27 -> 2 ... 0xd8-0xe7 -> 0xe 0xe8-0xff -> 0xf The first interval is just 8 shades, and the final interval is 24 shades.
* clean up some unseemly specklesKartik K. Agaram2021-07-131-3/+2
| | | | | | | Turns out they were a bug after all, and scaling the palette was just making them more obvious. The bug: I was carefully clamping to 0xf0 to avoid rounding later, but I forgot to do so for values between 0xf0 and 0xff. As a result, some values could round up past 0xff and turn black.
* cleanupKartik K. Agaram2021-07-131-65/+5
|
* give up on .pgm files with color depths != 255Kartik K. Agaram2021-07-131-9/+5
| | | | | | Things kinda seem to work for color depths close to 255, but it isn't really the goal here, and I don't have the skills of numerical analysis to track this down.
* undoKartik K. Agaram2021-07-131-19/+7
|
* experimentKartik K. Agaram2021-07-131-7/+19
| | | | | Now scaling pixels to 255 levels looks a lot better. Still worse, though. On both t.pgm and barbara.pgm.
* now t.pgm looks rightKartik K. Agaram2021-07-131-7/+7
|
* clamp the upper bound of nearest-color as wellKartik K. Agaram2021-07-131-30/+53
| | | | | I'd kinda convinced myself it would never happen, but observations say otherwise. Unless there's a bug elsewhere..
* .Kartik K. Agaram2021-07-131-6/+11
|
* .Kartik K. Agaram2021-07-131-14/+10
|
* finally a clue: error is going over 255Kartik K. Agaram2021-07-131-9/+75
| | | | Exactly in the places to the right of the line.
* undoKartik K. Agaram2021-07-131-14/+2
|
* experiment: scaling pixels to 255 levelsKartik K. Agaram2021-07-131-2/+14
| | | | | This is strictly worse than before, both with barbara.pgm and more subtly with t.pgm.
* .Kartik K. Agaram2021-07-123-43/+1331
| | | | | | | | | Undo commit 70a03be0d0 and reinline the helper extracted there. I have a better sense now of the primitives to reuse between greyscale and color dithering. https://merveilles.town/@akkartik/106571585137582228
* more precise error-diffusionKartik K. Agaram2021-07-122-34/+22222
| | | | | | | | | The Barbara test image has been looking right since commit 430dd67cb2. However, t.pgm has not. This doesn't fix it, but does seem like an improvement. The remaining error seems to be unrelated to rounding. Adding 8 more bits of precision has no effect.
* .Kartik K. Agaram2021-07-121-28/+28
|
* .Kartik K. Agaram2021-07-111-2/+2
|
* .Kartik K. Agaram2021-07-111-5/+2
|
* forget HSL conversion for now, stick to RGBKartik K. Agaram2021-07-112-13/+50
| | | | | It looks like seeking the nearest neighbor in HSL space leads to more saturated colors.
* .Kartik K. Agaram2021-07-111-42/+42
| | | | Inline a helper.
* .Kartik K. Agaram2021-07-111-33/+39
| | | | Extract a helper.
* .Kartik K. Agaram2021-07-111-32/+30
| | | | Inline an unnecessary block.
* .Kartik K. Agaram2021-07-111-20/+20
|
* .Kartik K. Agaram2021-07-111-1/+11
|
* dither 256-level greyscale to 8-level greyscaleKartik K. Agaram2021-07-112-2/+212
|
* .Kartik K. Agaram2021-07-101-24/+24
|
* .Kartik K. Agaram2021-07-101-3/+3
|
* .Kartik K. Agaram2021-07-104-23/+3
|
* .Kartik K. Agaram2021-07-101-88/+47
|
* increase precision for dithering computationsKartik K. Agaram2021-07-101-3/+8
| | | | Now we get a perfect checkerboard pattern.
* .Kartik K. Agaram2021-07-102-34/+106
| | | | https://merveilles.town/@akkartik/106559551043772522
* .Kartik K. Agaram2021-07-101-4/+4
| | | | https://merveilles.town/@akkartik/106557664535993377
* dithering greyscale using black/whiteKartik K. Agaram2021-07-105-24/+293
| | | | Starting to look right.
* reorder a few functionsKartik K. Agaram2021-07-081-126/+128
|
* .Kartik K. Agaram2021-07-081-0/+12
|
* scaling ppm imagesKartik K. Agaram2021-07-081-26/+76
|
* scaling pgm imagesKartik K. Agaram2021-07-081-21/+65
|
* .Kartik K. Agaram2021-07-081-3/+2
|
* .Kartik K. Agaram2021-07-081-3/+3
|
* .Kartik K. Agaram2021-07-081-4/+4
|
* .Kartik K. Agaram2021-07-081-1/+1
|
* scaling pbm imagesKartik K. Agaram2021-07-081-30/+67
|
* .Kartik K. Agaram2021-07-081-18/+18
|
* better ppm colorsKartik K. Agaram2021-07-081-7/+31
| | | | I had some logic to make hue distance cylindrical, but it wasn't right.
* better greyscaleKartik K. Agaram2021-07-081-2/+8
|
* .Kartik K. Agaram2021-07-081-14/+14
|
* .Kartik K. Agaram2021-07-081-1/+0
|