changeset 31106:f5a88c0a61ab

Support for GrayResponseCurve and GrayResponseUnit tags * __tiff__.cc: Handled GrayResponseCurve and GrayResponseUnit tags according to the format specification.
author magedrifaat <magedrifaat@gmail.com>
date Tue, 05 Jul 2022 03:55:10 +0200
parents 7c5b8a294f60
children fae39152ddcf
files libinterp/dldfcn/__tiff__.cc
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__tiff__.cc	Tue Jul 05 03:44:41 2022 +0200
+++ b/libinterp/dldfcn/__tiff__.cc	Tue Jul 05 03:55:10 2022 +0200
@@ -117,7 +117,6 @@
   octave_value_list
   interpret_data (void *data, uint32_t count, TIFFDataType tag_datatype)
   {
-    // TODO(maged): Find the correct way fo returning multivalues
     octave_value_list ovl_data;
     // Apparently matlab converts scalar numerical values into double
     // but doesn't do the same for arrays
@@ -328,6 +327,15 @@
       case TIFFTAG_REFERENCEBLACKWHITE:
         tag_data_ovl = get_array_field_data (tif, fip, 6);
         break;
+      case TIFFTAG_GRAYRESPONSECURVE:
+        {
+          uint16_t bits_per_sample;
+          if (! TIFFGetField (tif, TIFFTAG_BITSPERSAMPLE, &bits_per_sample))
+            error ("Failed to obtain the bit depth");
+          
+          tag_data_ovl = get_array_field_data (tif, fip, 1<<bits_per_sample);
+          break;
+        }
       case TIFFTAG_COLORMAP:
         {
           uint16_t bits_per_sample;
@@ -430,10 +438,11 @@
           error ("Complex Tags not implemented");
           break;
         }
-      // Those two tags are not mentioned in the LibTIFF documentation
+      // These tags are not mentioned in the LibTIFF documentation
       // but are handled correctly by the library
       case TIFFTAG_ZIPQUALITY:
       case TIFFTAG_SGILOGDATAFMT:
+      case TIFFTAG_GRAYRESPONSEUNIT:
         {
           tag_data_ovl = get_scalar_field_data (tif, fip);
           break;