Whitespace, cosmetics
This commit is contained in:
parent
296f0ef840
commit
0112e3d555
4
qoi.h
4
qoi.h
@ -325,7 +325,7 @@ Implementation */
|
|||||||
#define QOI_FREE(p) free(p)
|
#define QOI_FREE(p) free(p)
|
||||||
#endif
|
#endif
|
||||||
#ifndef QOI_ZEROARR
|
#ifndef QOI_ZEROARR
|
||||||
#define QOI_ZEROARR(_arr) memset((_arr),0,sizeof(_arr))
|
#define QOI_ZEROARR(a) memset((a),0,sizeof(a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define QOI_OP_INDEX 0x00 /* 00xxxxxx */
|
#define QOI_OP_INDEX 0x00 /* 00xxxxxx */
|
||||||
@ -361,7 +361,7 @@ unsigned int qoi_read_32(const unsigned char *bytes, int *p) {
|
|||||||
unsigned int b = bytes[(*p)++];
|
unsigned int b = bytes[(*p)++];
|
||||||
unsigned int c = bytes[(*p)++];
|
unsigned int c = bytes[(*p)++];
|
||||||
unsigned int d = bytes[(*p)++];
|
unsigned int d = bytes[(*p)++];
|
||||||
return (a << 24) | (b << 16) | (c << 8) | d;
|
return a << 24 | b << 16 | c << 8 | d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
|
void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
|
||||||
|
@ -152,7 +152,7 @@ void *libpng_encode(void *pixels, int w, int h, int channels, int *out_len) {
|
|||||||
info,
|
info,
|
||||||
w, h,
|
w, h,
|
||||||
8,
|
8,
|
||||||
(channels==3)?PNG_COLOR_TYPE_RGB:PNG_COLOR_TYPE_RGBA,
|
channels == 3 ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGBA,
|
||||||
PNG_INTERLACE_NONE,
|
PNG_INTERLACE_NONE,
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT,
|
PNG_COMPRESSION_TYPE_DEFAULT,
|
||||||
PNG_FILTER_TYPE_DEFAULT
|
PNG_FILTER_TYPE_DEFAULT
|
||||||
@ -417,7 +417,9 @@ benchmark_result_t benchmark_image(const char *path) {
|
|||||||
ERROR("Error decoding header %s", path);
|
ERROR("Error decoding header %s", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
channels = (channels == 3) ? 3 : 4;
|
if (channels != 3) {
|
||||||
|
channels = 4;
|
||||||
|
}
|
||||||
|
|
||||||
void *pixels = (void *)stbi_load(path, &w, &h, NULL, channels);
|
void *pixels = (void *)stbi_load(path, &w, &h, NULL, channels);
|
||||||
void *encoded_png = fload(path, &encoded_png_size);
|
void *encoded_png = fload(path, &encoded_png_size);
|
||||||
|
10
qoiconv.c
10
qoiconv.c
@ -62,13 +62,13 @@ int main(int argc, char **argv) {
|
|||||||
printf("Couldn't read header %s\n", argv[1]);
|
printf("Couldn't read header %s\n", argv[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(channels < 3) {// Force all odd encodings to be RGBA
|
|
||||||
|
// Force all odd encodings to be RGBA
|
||||||
|
if(channels != 3) {
|
||||||
channels = 4;
|
channels = 4;
|
||||||
pixels = (void *)stbi_load(argv[1], &w, &h, NULL, 4);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pixels = (void *)stbi_load(argv[1], &w, &h, &channels, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pixels = (void *)stbi_load(argv[1], &w, &h, NULL, channels);
|
||||||
}
|
}
|
||||||
else if (STR_ENDS_WITH(argv[1], ".qoi")) {
|
else if (STR_ENDS_WITH(argv[1], ".qoi")) {
|
||||||
qoi_desc desc;
|
qoi_desc desc;
|
||||||
|
Loading…
Reference in New Issue
Block a user