Browse Source

Add linearizationtable parsing

Martijn Braam 7 months ago
parent
commit
a5b5df8350
2 changed files with 9 additions and 0 deletions
  1. 8 0
      src/dcp.c
  2. 1 0
      src/dng.h

+ 8 - 0
src/dcp.c

@@ -124,6 +124,14 @@ libdng_load_calibration_file(libdng_info *dng, const char *path)
 						get_float(buffer, offset + (j * 4));
 				}
 				break;
+			case DNGTAG_LINEARIZATIONTABLE:
+				dng->tone_curve = malloc(count * sizeof(float));
+				dng->tone_curve_length = count;
+				for (int j = 0; j < count; j++) {
+					dng->tone_curve[j] =
+						get_float(buffer, offset + (j * 4));
+				}
+				break;
 			case DNGTAG_PROFILE_HUE_SAT_MAP_DIMS:
 				dng->hue_sat_map_dims[0] = get_int32(buffer, offset);
 				dng->hue_sat_map_dims[1] = get_int32(buffer, offset + 4);

+ 1 - 0
src/dng.h

@@ -146,4 +146,5 @@ static const TIFFFieldInfo custom_dng_fields[] = {
 	{DNGTAG_PROFILE_HUE_SAT_MAP_DATA_2, -1, -1, TIFF_FLOAT,     FIELD_CUSTOM, 1, 1, "ProfileHueSatMapData2"},
 	{DNGTAG_CFAREPEATPATTERNDIM,        -1, -1, TIFF_SHORT,     FIELD_CUSTOM, 1, 1, "CFARepeatPatternDim"},
 	{DNGTAG_CFAPATTERN,                 -1, -1, TIFF_BYTE,      FIELD_CUSTOM, 1, 1, "CFAPattern"},
+	{DNGTAG_LINEARIZATIONTABLE,         -1, -1, TIFF_SHORT,     FIELD_CUSTOM, 1, 1, "LinearizationTable"},
 };