rawpyのauto_bright_thrに相当する値はdcraw(Decoding raw digital photos in Linux)では0.01に固定されている。これをオプションで変更できるようにしてみた。
-l 数値
--- dcraw.c +++ dcraw-kai.c @@ -125,6 +125,7 @@ ushort white[8][8], curve[0x10000], cr2_slice[3], sraw_mul[4]; double pixel_aspect, aber[4]={1,1,1,1}, gamm[6]={ 0.45,4.5,0,0,0,0 }; float bright=1, user_mul[4]={0,0,0,0}, threshold=0; +float white_ratio=0.01; int mask[8][4]; int half_size=0, four_color_rgb=0, document_mode=0, highlight=0; int verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=1; @@ -10039,7 +10040,7 @@ int c, row, col, soff, rstep, cstep; int perc, val, total, white=0x2000; - perc = width * height * 0.01; /* 99th percentile white level */ + perc = width * height * white_ratio; /* 99th percentile white level */ if (fuji_width) perc /= 2; if (!((highlight & ~2) || no_auto_bright)) for (white=c=0; c < colors; c++) { @@ -10159,6 +10160,7 @@ return 1; } switch (opt) { + case 'l': white_ratio = atof(argv[arg++]); break; case 'n': threshold = atof(argv[arg++]); break; case 'b': bright = atof(argv[arg++]); break; case 'r':
$ gcc -o dcraw-kai -O4 dcraw-kai.c -lm -DNODEPS
素材はRAWSAMPLES.CH - Sonyから - RX10。