Use local var for channels to speed up encoding
This commit is contained in:
parent
80356a5aaa
commit
9dd60534e4
6
qoi.h
6
qoi.h
@ -385,8 +385,10 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
|
|||||||
|
|
||||||
int px_len = desc->width * desc->height * desc->channels;
|
int px_len = desc->width * desc->height * desc->channels;
|
||||||
int px_end = px_len - desc->channels;
|
int px_end = px_len - desc->channels;
|
||||||
for (int px_pos = 0; px_pos < px_len; px_pos += desc->channels) {
|
int channels = desc->channels;
|
||||||
if (desc->channels == 4) {
|
|
||||||
|
for (int px_pos = 0; px_pos < px_len; px_pos += channels) {
|
||||||
|
if (channels == 4) {
|
||||||
px = *(qoi_rgba_t *)(pixels + px_pos);
|
px = *(qoi_rgba_t *)(pixels + px_pos);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user