MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / convertRGBModel

Function convertRGBModel

external/lodepng/lodepng_util.cpp:1418–1437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1416}
1417
1418unsigned convertRGBModel(unsigned char* out, const unsigned char* in,
1419 unsigned w, unsigned h,
1420 const LodePNGState* state_out,
1421 const LodePNGState* state_in,
1422 unsigned rendering_intent) {
1423 if(modelsEqual(state_in, state_out)) {
1424 return lodepng_convert(out, in, &state_out->info_raw, &state_in->info_raw, w, h);
1425 } else {
1426 unsigned error = 0;
1427 size_t n, bytes;
1428 if(lodepng_mulofl((size_t)w, (size_t)h, &n)) return 92;
1429 if(lodepng_mulofl(n, 4 * sizeof(float), &bytes)) return 92;
1430 float* xyz = (float*)lodepng_malloc(bytes);
1431 float whitepoint[3];
1432 error = convertToXYZ(xyz, whitepoint, in, w, h, state_in);
1433 if (!error) error = convertFromXYZ(out, xyz, w, h, state_out, whitepoint, rendering_intent);
1434 lodepng_free(xyz);
1435 return error;
1436 }
1437}
1438
1439unsigned convertToSrgb(unsigned char* out, const unsigned char* in,
1440 unsigned w, unsigned h,

Callers 4

convertToSrgbFunction · 0.85
convertFromSrgbFunction · 0.85
testICCFunction · 0.85
testICCGrayFunction · 0.85

Calls 7

modelsEqualFunction · 0.85
lodepng_convertFunction · 0.85
convertToXYZFunction · 0.85
convertFromXYZFunction · 0.85
lodepng_muloflFunction · 0.70
lodepng_mallocFunction · 0.70
lodepng_freeFunction · 0.70

Tested by 2

testICCFunction · 0.68
testICCGrayFunction · 0.68