mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
sixel: special case parsing of images with an aspect ratio of 1:1
Images with an aspect ratio of 1:1 are by far the most common (though not the default). It makes a lot of sense, performance wise, to special case them. Specifically, the sixel_add() function benefits greatly from this, as it is the inner most, most heavily executed function when parsing a sixel image. sixel_add_many() also benefits, since allows us to drop a multiplication. Since sixel_add_many() always called first (no other call sites call sixel_add() directly), this has a noticeable effect on performance. Another thing that helps (though not as much), and not specifically with AR 1:1 images, is special casing DECGRI a bit. Up until now, it simply updated the current sixel parameter value. The problem is that the default parameter value is 0. But, a value of 0 should be treated as 1. By adding a special ‘repeat_count’ variable to the sixel struct, we can initialize it to ‘1’ when we see DECGRI, and then simply overwrite it as the parameter value gets updated. This allows us to drop an if..else when emitting the sixel.
This commit is contained in:
parent
a44a0b4ebe
commit
3555e81fee
4 changed files with 153 additions and 27 deletions
3
dcs.c
3
dcs.c
|
|
@ -427,8 +427,7 @@ dcs_hook(struct terminal *term, uint8_t final)
|
|||
int p2 = vt_param_get(term, 1,0);
|
||||
int p3 = vt_param_get(term, 2, 0);
|
||||
|
||||
sixel_init(term, p1, p2, p3);
|
||||
term->vt.dcs.put_handler = &sixel_put;
|
||||
term->vt.dcs.put_handler = sixel_init(term, p1, p2, p3);
|
||||
term->vt.dcs.unhook_handler = &sixel_unhook;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue