public static void stbi__hdr_convert(float *output, byte *input, int req_comp) { if (input[3] != 0) { float f1 = 0; f1 = (float)CRuntime.ldexp((double)1.0f, input[3] - (128 + 8)); if (req_comp <= 2) { output[0] = (input[0] + input[1] + input[2]) * f1 / 3; } else { output[0] = input[0] * f1; output[1] = input[1] * f1; output[2] = input[2] * f1; } if (req_comp == 2) { output[1] = 1; } if (req_comp == 4) { output[3] = 1; } } else { switch (req_comp) { case 4: case 3: output[3] = 1; if (req_comp == 3) { output[0] = output[1] = output[2] = 0; } break; case 2: case 1: output[1] = 1; if (req_comp == 1) { output[0] = 0; } break; } } }