Add new comment

Yes, I totally understand its

Yes, I totally understand its not supported in the current release, but it would nonetheless be very helpful to me if you could provide some understanding of how your code works in this area.

You are correct CM2 means nothing to me at all.

   \libraw\libraw.h(104):  DllDef float libraw_get_pre_mul(libraw_data_t *lr, int index);
  \libraw\libraw_types.h(481):    float pre_mul[4];
  \internal\var_defines.h(61):#define pre_mul         (imgdata.color.pre_mul)
  \internal\dcraw_common.cpp(413):    pre_mul[i - 1] = 1 / (frac * mul[hi][i] + (1 - frac) * mul[lo][i]);
  \internal\dcraw_common.cpp(510):      pre_mul[i] = 1.0 / (total[st][i] + total[st][i + 4]);
  \internal\dcraw_common.cpp(525):  mc = pre_mul[1] / pre_mul[2];
  \internal\dcraw_common.cpp(526):  yc = pre_mul[3] / pre_mul[2];
  \internal\dcraw_common.cpp(4847):      pre_mul[i] = 1 / num;
  \internal\dcraw_common.cpp(4853):      pre_mul[i] = 1.0;
  \internal\dcraw_common.cpp(4925):    FORCC balance[geshifilter-c] = pre_mul[c] * gmb_cam[20][c];
  \internal\dcraw_common.cpp(5016):      mul[row] = 0.125 * pre_mul[FC(row + 1, 0) | 1] / pre_mul[FC(row, 0) | 1];
  \internal\dcraw_common.cpp(5131):      mul[row] = 0.125 * pre_mul[FC(row + 1, 0) | 1] / pre_mul[FC(row, 0) | 1];
  \internal\dcraw_common.cpp(5236):    memcpy(pre_mul, user_mul, sizeof pre_mul);
  \internal\dcraw_common.cpp(5269):    FORC4 if (dsum[c]) pre_mul[c] = dsum[c + 4] / dsum[c];
  \internal\dcraw_common.cpp(5286):      pre_mul[0] = pre_mul[1] = pre_mul[2] = pre_mul[3] = 1.0;
  \internal\dcraw_common.cpp(5291):      FORC4 pre_mul[c] = (float)sum[c + 4] / sum[c];
  \internal\dcraw_common.cpp(5293):      memcpy(pre_mul, cam_mul, sizeof pre_mul);
  \internal\dcraw_common.cpp(5310):      pre_mul[c] /= cam_mul[c];
  \internal\dcraw_common.cpp(5313):  if (pre_mul[1] == 0)
  \internal\dcraw_common.cpp(5314):    pre_mul[1] = 1;
  \internal\dcraw_common.cpp(5315):  if (pre_mul[3] == 0)
  \internal\dcraw_common.cpp(5316):    pre_mul[3] = colors < 4 ? pre_mul[1] : 1;
  \internal\dcraw_common.cpp(5324):    if (dmin > pre_mul[c])
  \internal\dcraw_common.cpp(5325):      dmin = pre_mul[c];
  \internal\dcraw_common.cpp(5326):    if (dmax < pre_mul[c])
  \internal\dcraw_common.cpp(5327):      dmax = pre_mul[c];
  \internal\dcraw_common.cpp(5331):  FORC4 scale_mul[c] = (pre_mul[c] /= dmax) * 65535.0 / maximum;
  \internal\dcraw_common.cpp(5336):    FORC4 fprintf(stderr, " %f", pre_mul[c]);
  \internal\dcraw_common.cpp(6601):  FORCC if (clip > (i = 65535 * pre_mul[c])) clip = i;
  \internal\dcraw_common.cpp(6645):  FORCC hsat[c] = 32000 * pre_mul[c];
  \internal\dcraw_common.cpp(6647):    if (pre_mul[kc] < pre_mul[c])
  \internal\dcraw_common.cpp(14075):    FORCC if(fabs(cc[c][c])>0.0001) pre_mul[c] /= cc[c][c];
  \internal\dcraw_common.cpp(17758):    pre_mul[i] = i < 3;
  \internal\dcraw_common.cpp(18601):    pre_mul[0] = 1.2085;
  \internal\dcraw_common.cpp(18602):    pre_mul[1] = 1.0943;
  \internal\dcraw_common.cpp(18603):    pre_mul[3] = 1.1103;
  \internal\dcraw_common.cpp(18618):      pre_mul[0] = 1.196;
  \internal\dcraw_common.cpp(18619):      pre_mul[1] = 1.246;
  \internal\dcraw_common.cpp(18620):      pre_mul[2] = 1.018;
  \internal\dcraw_common.cpp(19341):      pre_mul[1] = 1.179;
  \internal\dcraw_common.cpp(19342):      pre_mul[2] = 1.209;
  \internal\dcraw_common.cpp(19343):      pre_mul[3] = 1.036;
  \src\libraw_c_api.cpp(387):  DllDef float libraw_get_pre_mul(libraw_data_t *lr, int index)
  \src\libraw_c_api.cpp(391):    return lr->color.pre_mul[LIM(index, 0, 3)];
  \src\libraw_cxx.cpp(1222):    imgdata.color.pre_mul[i] = 1.0;
  \src\libraw_cxx.cpp(2110):          imgdata.color.pre_mul[c] /= (delta[c] / maxdelta);
  \src\libraw_cxx.cpp(2148):      imgdata.color.pre_mul[0] = 1.f / 0.3984f;
  \src\libraw_cxx.cpp(2149):      imgdata.color.pre_mul[2] = 1.f / 0.7666f;
  \src\libraw_cxx.cpp(2150):      imgdata.color.pre_mul[1] = imgdata.color.pre_mul[3] = 1.0;
  \src\libraw_cxx.cpp(4048):      if (dmax > C.pre_mul[c])
  \src\libraw_cxx.cpp(4049):        dmax = C.pre_mul[c];
  \src\libraw_cxx.cpp(4052):      scale_mul[c] = (C.pre_mul[c] / dmax) * 65535.0 / C.maximum;
  Matching lines: 52    Matching files: 6    Total files searched: 16


in none of those places does there appear to be any derivation of the pre_mul value from the WB Coefficients, even though it is clear that such a derivation must take place.[/geshifilter-c]

David Partridge