MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__convert_8_to_16

Function stbi__convert_8_to_16

include/stb/stb_image.h:1206–1220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204}
1205
1206static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels)
1207{
1208 int i;
1209 int img_len = w * h * channels;
1210 stbi__uint16 *enlarged;
1211
1212 enlarged = (stbi__uint16 *) stbi__malloc(img_len*2);
1213 if (enlarged == NULL) return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory");
1214
1215 for (i = 0; i < img_len; ++i)
1216 enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff
1217
1218 STBI_FREE(orig);
1219 return enlarged;
1220}
1221
1222static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel)
1223{

Callers 1

Calls 1

stbi__mallocFunction · 0.85

Tested by

no test coverage detected