00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VISIR_CPL_COMPAT_H
00029 #define VISIR_CPL_COMPAT_H
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include "config.h"
00033 #endif
00034
00035
00036
00037
00038
00039 #include <cpl.h>
00040
00041
00042
00043
00044
00045 #if !defined CPL_VERSION_CODE || CPL_VERSION_CODE < CPL_VERSION(6, 0, 0)
00046
00047 #error CPL too old, at least cpl 6 required
00048 #endif
00049
00050 #if CPL_VERSION_CODE < CPL_VERSION(6, 1, 0)
00051 #define CPL_FFT_FIND_MEASURE 0
00052 #endif
00053
00054 #if CPL_VERSION_CODE < CPL_VERSION(6, 1, 0)
00055 #define CPL_FITS_START_CACHING
00056 #define CPL_FITS_RESTART_CACHING
00057 #define CPL_FITS_STOP_CACHING
00058 #define cpl_fits_set_mode(x)
00059 #endif
00060
00061 #if CPL_VERSION_CODE < CPL_VERSION(6, 3, 0)
00062 #define CPL_IO_COMPRESS_RICE 0
00063 #endif
00064
00065
00066
00067
00068
00069
00070
00079
00080 static inline cpl_frame *
00081 visir_frameset_get_frame(cpl_frameset *self, cpl_size position)
00082 {
00083 #if CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0)
00084 return cpl_frameset_get_position(self, position);
00085 #else
00086 return cpl_frameset_get_frame(self, position);
00087 #endif
00088 }
00089
00090
00091
00097
00098 static inline double
00099 visir_vector_sum(const cpl_vector * vs)
00100 {
00101 #if CPL_VERSION_CODE >= CPL_VERSION(6, 3, 0)
00102 double sum = cpl_vector_get_sum(vs);
00103 #else
00104 const size_t n = cpl_vector_get_size(vs);
00105 const double * data = cpl_vector_get_data_const(vs);
00106 double sum = 0;
00107 for (size_t j = 0; j < n; j++)
00108 sum += data[j];
00109 #endif
00110 return sum;
00111 }
00112
00113
00114
00120
00121 static inline void
00122 visir_imagelist_unwrap(cpl_imagelist * list)
00123 {
00124 #if CPL_VERSION_CODE >= CPL_VERSION(6, 1, 0)
00125 cpl_imagelist_unwrap(list);
00126 #else
00127 for (cpl_size i = cpl_imagelist_get_size(list); i-- > 0;)
00128 cpl_imagelist_unset(list, i);
00129 cpl_imagelist_delete(list);
00130 #endif
00131 }
00132
00133 #endif