int calculate_bogus_daylight_wb(dt_iop_module_t *module, float bwb[3]) { // color matrix char makermodel[1024]; dt_colorspaces_get_makermodel(makermodel, sizeof(makermodel), module->dev->image_storage.exif_maker, module->dev->image_storage.exif_model); float cam_xyz[4][3]; cam_xyz[0][0] = NAN; dt_dcraw_adobe_coeff(makermodel, (float(*)[12])cam_xyz); if(!isnan(cam_xyz[0][0])) { float mat[3][3]; dt_colorspaces_create_cmatrix(cam_xyz, mat); for(int c = 0; c < 3; c++) { float num = 0.0f; for(int j = 0; j < 3; j++) { num += mat[c][j]; } bwb[c] = 1.0f / num; } return 0; } return 1; }
void dt_colorspaces_get_makermodel_split(char *makermodel, const int size, char **modelo, const char *const maker, const char *const model) { dt_colorspaces_get_makermodel(makermodel, size, maker, model); *modelo = makermodel; for(; **modelo != ' ' && *modelo < makermodel + strlen(makermodel); (*modelo)++); **modelo = '\0'; (*modelo)++; }