N64 QOI Encoder Demo
1.0.1
Encoder for N64 that saves it to SD card
Toggle main menu visibility
Loading...
Searching...
No Matches
colorconv.h
Go to the documentation of this file.
1
34
35
#ifndef COLORCONV_H
36
#define COLORCONV_H
37
38
#if __cplusplus
39
extern
"C"
{
40
#endif
41
42
#include <stdint.h>
43
47
uint16_t
read_be_u16
(uint16_t val)
48
{
49
uint8_t* val_ptr = (uint8_t*)&val;
50
return
(uint16_t)((val_ptr[1] << 0) | (val_ptr[0] << 8));
51
}
52
56
inline
uint32_t
n64_color16_to_rgba32
(uint16_t px16)
57
{
58
int
r = (px16 >> 11) & 0x1F;
59
int
g = (px16 >> 6) & 0x1F;
60
int
b = (px16 >> 1) & 0x1F;
61
int
a = (px16 >> 0) & 0x01;
62
63
// expand to 8 bit
64
r = (r << 3) | (r >> 2);
65
g = (g << 3) | (g >> 2);
66
b = (b << 3) | (b >> 2);
67
a = a * 255;
68
69
return
(r << 24) | (g << 16) | (b << 8) | a;
70
}
71
72
#if __cplusplus
73
}
74
#endif
75
76
#endif
// COLORCONV_H
n64_color16_to_rgba32
uint32_t n64_color16_to_rgba32(uint16_t px16)
Convert N64 16-bit (5R-5G-5B-1A) to 0xRRGGBBAA (32-bit).
Definition
colorconv.h:56
read_be_u16
uint16_t read_be_u16(uint16_t val)
Reads an 16-bit unsigned big endian integer number.
Definition
colorconv.h:47
src
colorconv.h
Generated by
1.17.0