Mercurial > hg > forks > libbpg
diff bpgenc.c @ 33:33594243ce31
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Mar 2020 19:14:25 +0200 |
parents | 38ae4a231581 |
children | 5d51fff843eb |
line wrap: on
line diff
--- a/bpgenc.c Tue May 16 17:25:59 2017 +0300 +++ b/bpgenc.c Sun Mar 08 19:14:25 2020 +0200 @@ -38,6 +38,8 @@ #include "bpgenc.h" + + typedef uint16_t PIXEL; static void put_ue(uint8_t **pp, uint32_t v); @@ -709,10 +711,13 @@ c_count = 1; else c_count = 3; + if (has_alpha) c_count++; + for(i = 0; i < c_count; i++) { get_plane_res(img, &w1, &h1, i); + /* multiple of 16 pixels to add borders */ w1 = (w1 + (W_PAD - 1)) & ~(W_PAD - 1); h1 = (h1 + (W_PAD - 1)) & ~(W_PAD - 1); @@ -2004,11 +2009,11 @@ uint8_t *p = *pp; int i, j; - for(i = 1; i < 5; i++) { + for (i = 1; i < 5; i++) { if (v < (1U << (7 * i))) break; } - for(j = i - 1; j >= 1; j--) + for (j = i - 1; j >= 1; j--) *p++ = ((v >> (7 * j)) & 0x7f) | 0x80; *p++ = v & 0x7f; *pp = p;