Mercurial > libavcodec.hg
annotate tiff.h @ 12391:4be72e19ab0e libavcodec
imc: fix undefined float to int conversion
Conversion of an out of range float to int is undefined. Clipping to
the final range first avoids such problems. This fixes decoding on
MIPS, which handles these conversions differently from many other CPUs.
author | mru |
---|---|
date | Thu, 19 Aug 2010 16:51:26 +0000 |
parents | 7dd2a45249a9 |
children |
rev | line source |
---|---|
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
1 /* |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
2 * TIFF tables |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
3 * Copyright (c) 2006 Konstantin Shishkov |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
4 * |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
6 * |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
11 * |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
16 * |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
20 */ |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
21 |
4782
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
22 /** |
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
23 * TIFF tables |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
10264
diff
changeset
|
24 * @file |
4782
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
25 * @author Konstantin Shishkov |
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
26 */ |
7760 | 27 #ifndef AVCODEC_TIFF_H |
28 #define AVCODEC_TIFF_H | |
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
29 |
5162 | 30 #include <stdint.h> |
31 | |
4782
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
32 /** abridged list of TIFF tags */ |
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
33 enum TiffTags{ |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
34 TIFF_SUBFILE = 0xfe, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
35 TIFF_WIDTH = 0x100, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
36 TIFF_HEIGHT, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
37 TIFF_BPP, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
38 TIFF_COMPR, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
39 TIFF_INVERT = 0x106, |
10264
f9efc2bd005d
Support both LSB and MSB orders for TIFF CCITT G.x compressed data.
kostya
parents:
8718
diff
changeset
|
40 TIFF_FILL_ORDER = 0x10A, |
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
41 TIFF_STRIP_OFFS = 0x111, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
42 TIFF_SAMPLES_PER_PIXEL = 0x115, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
43 TIFF_ROWSPERSTRIP = 0x116, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
44 TIFF_STRIP_SIZE, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
45 TIFF_XRES = 0x11A, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
46 TIFF_YRES = 0x11B, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
47 TIFF_PLANAR = 0x11C, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
48 TIFF_XPOS = 0x11E, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
49 TIFF_YPOS = 0x11F, |
8425
b8d72c9851c7
Register TIFF tags for CCITT Group 3 and 4 compression options
kostya
parents:
7760
diff
changeset
|
50 TIFF_T4OPTIONS = 0x124, |
b8d72c9851c7
Register TIFF tags for CCITT Group 3 and 4 compression options
kostya
parents:
7760
diff
changeset
|
51 TIFF_T6OPTIONS, |
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
52 TIFF_RES_UNIT = 0x128, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
53 TIFF_SOFTWARE_NAME = 0x131, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
54 TIFF_PREDICTOR = 0x13D, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
55 TIFF_PAL = 0x140, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
56 TIFF_YCBCR_COEFFICIENTS = 0x211, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
57 TIFF_YCBCR_SUBSAMPLING = 0x212, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
58 TIFF_YCBCR_POSITIONING = 0x213, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
59 TIFF_REFERENCE_BW = 0x214, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
60 }; |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
61 |
4782
bca8924ed36c
Add some Doxygen comments, by Kamil Nowosad, k.nowosad students.mimuw.edu pl.
diego
parents:
4774
diff
changeset
|
62 /** list of TIFF compression types */ |
4774
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
63 enum TiffCompr{ |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
64 TIFF_RAW = 1, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
65 TIFF_CCITT_RLE, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
66 TIFF_G3, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
67 TIFF_G4, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
68 TIFF_LZW, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
69 TIFF_JPEG, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
70 TIFF_NEWJPEG, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
71 TIFF_ADOBE_DEFLATE, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
72 TIFF_PACKBITS = 0x8005, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
73 TIFF_DEFLATE = 0x80B2 |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
74 }; |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
75 |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
76 enum TiffTypes{ |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
77 TIFF_BYTE = 1, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
78 TIFF_STRING, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
79 TIFF_SHORT, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
80 TIFF_LONG, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
81 TIFF_RATIONAL, |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
82 }; |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
83 |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
84 /** sizes of various TIFF field types (string size = 100)*/ |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
85 static const uint8_t type_sizes[6] = { |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
86 0, 1, 100, 2, 4, 8 |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
87 }; |
0860efc2f02b
tiff encoder by (Bartlomiej Wolowiec b.wolowiec students mimuw edu pl)
michael
parents:
diff
changeset
|
88 |
7760 | 89 #endif /* AVCODEC_TIFF_H */ |