Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More case tweaks.

  • Loading branch information...
commit 4669eb4e7e6d30345062abc5bf1292d54aff9929 1 parent 3bf6fb8
mon-key authored
8 tiff4cl-floats.lisp
@@ -95,11 +95,11 @@
95 95 significand-length)))))))
96 96
97 97
98   -(make-encoder encode-IEEE-float 8 23)
99   -(make-decoder decode-IEEE-float 8 23)
  98 +(make-encoder encode-ieee-float 8 23)
  99 +(make-decoder decode-ieee-float 8 23)
100 100
101   -(make-encoder encode-IEEE-double 11 52)
102   -(make-decoder decode-IEEE-double 11 52)
  101 +(make-encoder encode-ieee-double 11 52)
  102 +(make-decoder decode-ieee-double 11 52)
103 103
104 104 (make-encoder encode-IEEE-quad 15 112)
105 105 (make-decoder decode-IEEE-quad 15 112)
46 tiff4cl-specials.lisp
@@ -62,7 +62,7 @@ of: a numeric id, a keyword id, and a length in bytes.")
62 62
63 63 (259 :compression ;; data compression technique
64 64 ((1 nil) ;; no compression
65   - (2 :CCITT-1d) ;; CCITT modified Huffman RLE
  65 + (2 :ccitt-1d) ;; CCITT modified Huffman RLE
66 66 (3 :fax-group3) ;; CCITT Group 3 fax encoding / CCITT T.4 (TIFF 6 name)
67 67 (4 :fax-group4) ;; CCITT Group 4 fax encoding / CCITT T.6 (TIFF 6 name)
68 68 (5 :lzw) ;; Lempel-Ziv & Welch
@@ -75,20 +75,20 @@ of: a numeric id, a keyword id, and a length in bytes.")
75 75 (32809 :thunderscan) ;; ThunderScan RLE
76 76 (32773 :pack-bits) ;; Macintosh RLE
77 77 ;;
78   - (32895 :it8ctpad) ;; IT8 CT w/padding
79   - (32896 :it8lw) ;; IT8 Linework RLE
80   - (32897 :it8mp) ;; IT8 Monochrome picture
81   - (32898 :it8bl) ;; IT8 Binary line art
  78 + (32895 :it8-ct-pad) ;; IT8 CT w/padding
  79 + (32896 :it8-linework-rle) ;; IT8 Linework RLE
  80 + (32897 :it8-monochrome) ;; IT8 Monochrome picture
  81 + (32898 :it8-binary-line-art) ;; IT8 Binary line art
82 82 ;;
83 83 (32908 :PIXARFILM) ;; Pixar companded 10bit LZW
84 84 (32909 :PIXARLOG) ;; Pixar companded 11bit ZIP
85 85 (32946 :DEFLATE) ;; Deflate compression
86 86
87   - (32947 :DCS) ;; Kodak DCS encoding
88   - (34661 :JBIG) ;; ISO JBIG
89   - (34676 :SGI-LOG) ;; SGI Log Luminance RLE
90   - (34677 :SGI-LOG24) ;; SGI Log 24-bit packed
91   - (34712 :JP2000))) ;; Leadtools JPEG2000
  87 + (32947 :dcs) ;; Kodak DCS encoding
  88 + (34661 :jbig) ;; ISO JBIG
  89 + (34676 :sgi-log) ;; SGI Log Luminance RLE
  90 + (34677 :sgi-log24) ;; SGI Log 24-bit packed
  91 + (34712 :jp2000))) ;; Leadtools JPEG2000
92 92
93 93 (262 :photometric-interpretation
94 94 ((0 :white-is-zero)
@@ -175,7 +175,7 @@ of: a numeric id, a keyword id, and a length in bytes.")
175 175
176 176 (297 :page-number) ;; page numbers of multi-page :NOTE this is returned as an array.
177 177
178   - (300 :COLOR-RESPONSE-UNIT ;; color curve accuracy per unit
  178 + (300 :color-response-unit ;; color curve accuracy per unit
179 179 ((1 :tenths)
180 180 (2 :hundredths)
181 181 (3 :thousandths)
@@ -248,14 +248,14 @@ of: a numeric id, a keyword id, and a length in bytes.")
248 248 ((1 :baseline) ;; !baseline sequential
249 249 (14 :lossless))) ;; !Huffman coded lossless
250 250
251   - (513 :JPEG-interchange-format)
252   - (514 :JPEG-interchange-format-length)
253   - (515 :JPEG-restart-interval)
254   - (517 :JPEG-lossless-predictors)
255   - (518 :JPEG-point-transforms)
256   - (519 :JPEG-q-tables)
257   - (520 :JPEG-dc-tables)
258   - (521 :JPEG-ac-tables)
  251 + (513 :jpeg-interchange-format)
  252 + (514 :jpeg-interchange-format-length)
  253 + (515 :jpeg-restart-interval)
  254 + (517 :jpeg-lossless-predictors)
  255 + (518 :jpeg-point-transforms)
  256 + (519 :jpeg-q-tables)
  257 + (520 :jpeg-dc-tables)
  258 + (521 :jpeg-ac-tables)
259 259 (529 :y-cb-cr-coefficients)
260 260 (530 :y-cb-cr-sub-sampling)
261 261 (531 :y-cb-cr-positioning
@@ -336,7 +336,7 @@ of: a numeric id, a keyword id, and a length in bytes.")
336 336 (34929 :fedex-edr) ;; tag 34929 is a private tag registered to FedEx with unknown use
337 337 (37724 :image-source-data) ;; Photoshop extension
338 338
339   - (50341 :print-IM) ;; Exif extension
  339 + (50341 :print-im) ;; Exif extension
340 340
341 341 ;; Adobe Digital Negative (DNG) format tags
342 342 (50706 :dng-version) ;; dNG version number
@@ -392,7 +392,7 @@ of: a numeric id, a keyword id, and a length in bytes.")
392 392 ;; tags 34665, 34853 and 40965 are documented in EXIF specification
393 393 (34665 :exif-ifd) ;; `interpret-tag-value' Exif extension
394 394 (33434 :exposure-time)
395   - (33437 :F-number)
  395 + (33437 :f-number)
396 396 (34850 :exposure-program
397 397 ((0 nil)
398 398 (1 :manual)
@@ -407,8 +407,8 @@ of: a numeric id, a keyword id, and a length in bytes.")
407 407
408 408 (34853 :gps-ifd) ;; `interpret-tag-value' Exif extension
409 409
410   - (34855 :ISO-speed-ratings)
411   - (34856 :OECF) ;; Optoelectric conversion factor
  410 + (34855 :iso-speed-ratings)
  411 + (34856 :oecf) ;; Optoelectric conversion factor
412 412 (36864 :exif-version)
413 413 (36867 :date-time-original) ;; Date and time of original data generation
414 414 (36868 :date-time-digitized) ;; Date and time of digital data generation
60 tiff4cl-tiff.lisp
@@ -42,11 +42,11 @@
42 42
43 43 (defgeneric decode-integer (tiff buffer &key start end))
44 44
45   -(defmethod decode-integer ((tiff TIFF-little-endian-stream) buffer &key (start 0) end)
  45 +(defmethod decode-integer ((tiff tiff-little-endian-stream) buffer &key (start 0) end)
46 46 (decode-integer-le buffer
47 47 :start start
48 48 :end end))
49   -(defmethod decode-integer ((tiff TIFF-big-endian-stream) buffer &key (start 0) end)
  49 +(defmethod decode-integer ((tiff tiff-big-endian-stream) buffer &key (start 0) end)
50 50 (decode-integer-be buffer
51 51 :start start
52 52 :end end))
@@ -182,12 +182,12 @@
182 182 (+ (* pos item-size) (/ item-size 2))
183 183 (* (1+ pos) item-size)))))
184 184 (:float
185   - (ieee-754:decode-ieee-float
  185 + (decode-ieee-float ;; ieee-754:decode-ieee-float
186 186 (parse-int buffer
187 187 (* pos item-size)
188 188 (* (1+ pos) item-size))))
189 189 (:double
190   - (ieee-754:decode-ieee-double
  190 + (decode-ieee-double ;; ieee-754:decode-ieee-double
191 191 (parse-int buffer
192 192 (* pos item-size)
193 193 (* (1+ pos) item-size))))))
@@ -263,7 +263,7 @@
263 263 (read-32bit tiff))
264 264
265 265 (defun read-tag-data (tiff)
266   - (read-bytes (TIFF-stream tiff) 4))
  266 + (read-bytes (tiff-stream tiff) 4))
267 267
268 268 (defun parse-tag (tiff)
269 269 (let* ((id (read-tag-id tiff))
@@ -272,73 +272,73 @@
272 272 (data (read-tag-data tiff)))
273 273 (list id type n data)))
274 274
275   -(defun parse-IFD (tiff &optional position)
  275 +(defun parse-ifd (tiff &optional position)
276 276 (when position
277   - (TIFF-position tiff position))
  277 + (tiff-position tiff position))
278 278 ;; First read the tags data and then create the objects, because
279 279 ;; get-tag-value can seek through the file to fetch the data values,
280 280 ;; thus disrupting the sequential read we do here.
281 281 (let* ((tags (loop
282   - for i from 0 below (read-IFD-tags-number tiff)
  282 + for i from 0 below (read-ifd-tags-number tiff)
283 283 collect (parse-tag tiff)))
284   - (next-ifd (read-IFD-pointer tiff))
  284 + (next-ifd (read-ifd-pointer tiff))
285 285 (tag-objects (mapcar #'(lambda (tag)
286 286 (destructuring-bind (id type count data) tag
287 287 (let ((value (get-tag-value tiff type count data)))
288   - (make-instance 'TIFF-tag
  288 + (make-instance 'tiff-tag
289 289 :id id
290 290 :type type
291 291 :value (interpret-tag-value tiff id value)))))
292 292 tags)))
293 293 (make-instance 'TIFF-IFD :tags tag-objects :next next-ifd)))
294 294
295   -(defun parse-TIFF-stream (stream &optional end)
  295 +(defun parse-tiff-stream (stream &optional end)
296 296 (let* ((start (file-position stream))
297 297 (endianness (parse-endianness stream))
298 298 (tiff (make-instance (if (eq endianness :little-endian)
299   - 'TIFF-little-endian-stream
300   - 'TIFF-big-endian-stream)
  299 + 'tiff-little-endian-stream
  300 + 'tiff-big-endian-stream)
301 301 :start start
302 302 :end end
303 303 :stream stream))
304 304 (version (parse-file-format-version tiff)))
305   - (unless (= version +TIFF-version+)
  305 + (unless (= version +tiff-version+)
306 306 (error 'wrong-version :version version))
307 307 (let ((ifds '())
308   - (address (read-IFD-pointer tiff)))
  308 + (address (read-ifd-pointer tiff)))
309 309 (loop
310 310 (when (zerop address)
311 311 (return))
312   - (let ((ifd (parse-IFD tiff address)))
  312 + (let ((ifd (parse-ifd tiff address)))
313 313 (push ifd ifds)
314 314 (setf address (ifd-next ifd))))
315 315 ifds)))
316 316
317   -(defun parse-TIFF (file &key start end)
  317 +(defun parse-tiff (file &key start end)
318 318 (if (streamp file)
319 319 (progn
320 320 (when start
321 321 (file-position file start))
322   - (parse-TIFF-stream file end))
  322 + (parse-tiff-stream file end))
323 323 (with-open-file (stream file)
324 324 (when start
325 325 (file-position stream start))
326   - (parse-TIFF-stream stream end))))
  326 + (parse-tiff-stream stream end))))
327 327
328   -(defun map-IFD-tags (function ifd)
  328 +(defun map-ifd-tags (function ifd)
329 329 (dolist (tag (ifd-tags ifd))
330 330 (let ((value (tag-value tag)))
331 331 (if (typep value 'tiff-ifd)
332   - (map-IFD-tags function value)
  332 + (map-ifd-tags function value)
333 333 (funcall function tag)))))
334 334
335   -(defun map-TIFF-tags (function ifds)
  335 +(defun map-tiff-tags (function ifds)
336 336 (dolist (ifd ifds)
337   - (map-IFD-tags function ifd)))
  337 + (map-ifd-tags function ifd)))
338 338
339   -(defun TIFF-extract-tags (ifds tag-ids)
  339 +(defun tiff-extract-tags (ifds tag-ids)
340 340 (let ((result '()))
341   - (map-TIFF-tags #'(lambda (tag)
  341 + (map-tiff-tags #'(lambda (tag)
342 342 (when (or (eq tag-ids t)
343 343 (find (tag-id tag) tag-ids))
344 344 (push (cons (tag-id tag) (tag-value tag))
@@ -346,17 +346,17 @@
346 346 ifds)
347 347 result))
348 348
349   -(defun print-TIFF-tags (ifds &optional stream)
  349 +(defun print-tiff-tags (ifds &optional stream)
350 350 (unless stream
351 351 (setf stream *standard-output*))
352   - (labels ((print-IFD (ifd indent)
  352 + (labels ((print-ifd (ifd indent)
353 353 (loop
354 354 for tag in (ifd-tags ifd)
355 355 for value = (tag-value tag)
356   - if (typep value 'TIFF-IFD)
  356 + if (typep value 'tiff-ifd)
357 357 do
358 358 (format stream "~vT~A:~%" indent (tag-id tag))
359   - (print-IFD value (+ 2 indent))
  359 + (print-ifd value (+ 2 indent))
360 360 else do
361 361 (format stream "~vT~A = ~S~%" indent (tag-id tag) value))))
362 362 (loop
@@ -364,7 +364,7 @@
364 364 for i from 0
365 365 do
366 366 (format stream "~&IFD ~A:~%" i)
367   - (print-IFD ifd 2))))
  367 + (print-ifd ifd 2))))
368 368
369 369 ;;; ==============================
370 370 ;;; EOF
2  tiff4cl-util.lisp
@@ -43,7 +43,7 @@
43 43 (defun read-16bit-be (stream)
44 44 (decode-integer-be (read-bytes stream 2)))
45 45
46   -(defun read-16bit-LE (stream)
  46 +(defun read-16bit-le (stream)
47 47 (decode-integer-le (read-bytes stream 2)))
48 48
49 49 (defun read-32bit-be (stream)

0 comments on commit 4669eb4

Please sign in to comment.
Something went wrong with that request. Please try again.