changeset 31213:f1c1efd356c8

Tiff: added an error for reading and writing YCbCr images * libinterp/corefcn/__tiff__.cc: added error for reading and writing YCbCr images through the Tiff interface which is currently unsupported.
author magedrifaat <magedrifaat@gmail.com>
date Tue, 06 Sep 2022 21:50:48 +0200
parents 13132e7834f5
children ddbed40b811b
files libinterp/corefcn/__tiff__.cc
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__tiff__.cc	Tue Sep 06 21:38:51 2022 +0200
+++ b/libinterp/corefcn/__tiff__.cc	Tue Sep 06 21:50:48 2022 +0200
@@ -2592,8 +2592,8 @@
 
     TIFF *tif = tiff_handle->get_file ();
 
-    // FIXME: add support for reading in YCbCr mode
-    octave_unused_parameter (nargout);
+    if (nargout > 1)
+      error ("Tiff: Reading YCbCr image data is not supported");
 
     // Obtain all necessary tags
     // The main purpose of this struct is to hold all the necessary tags that
@@ -2646,8 +2646,8 @@
 
     TIFF *tif = tiff_handle->get_file ();
 
-    // FIXME: add support for reading in YCbCr mode
-    octave_unused_parameter (nargout);
+    if (nargout > 1)
+      error ("Tiff: Reading YCbCr image data is not supported");
 
     if (TIFFIsTiled (tif))
       error ("The image is tiled not stripped");
@@ -2687,8 +2687,8 @@
 
     TIFF *tif = tiff_handle->get_file ();
 
-    // FIXME: add support for reading in YCbCr mode
-    octave_unused_parameter (nargout);
+    if (nargout > 1)
+      error ("Tiff: Reading YCbCr image data is not supported");
 
     if (! TIFFIsTiled (tif))
       error ("The image is stripped not tiled");
@@ -3036,10 +3036,12 @@
 #if defined (HAVE_TIFF)
     int nargin = args.length ();
 
-    // FIXME: add support for writing in YCbCr mode
     if (nargin < 2)
       error ("Wrong number of arguments\n");
     
+    if (nargin > 2)
+      error ("Tiff: Writing YCbCr image data is not supported");
+    
     octave_tiff_handle *tiff_handle
       = octave_tiff_handle::get_tiff_handle (args(0));
     check_closed (tiff_handle);
@@ -3085,10 +3087,12 @@
 #if defined (HAVE_TIFF)
     int nargin = args.length ();
 
-    // FIXME: add support for writing in YCbCr mode
     if (nargin < 3)
       error ("Too few arguments provided\n");
     
+    if (nargin > 3)
+      error ("Tiff: Writing YCbCr image data is not supported");
+    
     octave_tiff_handle *tiff_handle
       = octave_tiff_handle::get_tiff_handle (args(0));
     check_closed (tiff_handle);
@@ -3123,10 +3127,12 @@
 #if defined (HAVE_TIFF)
     int nargin = args.length ();
 
-    // FIXME: add support for writing in YCbCr mode
     if (nargin < 3)
       error ("Too few arguments provided\n");
     
+    if (nargin > 3)
+      error ("Tiff: Writing YCbCr image data is not supported");
+    
     octave_tiff_handle *tiff_handle
       = octave_tiff_handle::get_tiff_handle (args(0));
     check_closed (tiff_handle);