OLD | NEW |
1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
7 // | 7 // |
8 // Internal header for constants related to WebP file format. | 8 // Internal header for constants related to WebP file format. |
9 // | 9 // |
10 // Author: Urvang (urvang@google.com) | 10 // Author: Urvang (urvang@google.com) |
11 | 11 |
12 #ifndef WEBP_WEBP_FORMAT_CONSTANTS_H_ | 12 #ifndef WEBP_WEBP_FORMAT_CONSTANTS_H_ |
13 #define WEBP_WEBP_FORMAT_CONSTANTS_H_ | 13 #define WEBP_WEBP_FORMAT_CONSTANTS_H_ |
14 | 14 |
| 15 // Create fourcc of the chunk from the chunk tag characters. |
| 16 #define MKFOURCC(a, b, c, d) ((uint32_t)(a) | (b) << 8 | (c) << 16 | (d) << 24) |
| 17 |
15 // VP8 related constants. | 18 // VP8 related constants. |
16 #define VP8_SIGNATURE 0x9d012a // Signature in VP8 data. | 19 #define VP8_SIGNATURE 0x9d012a // Signature in VP8 data. |
17 #define VP8_MAX_PARTITION0_SIZE (1 << 19) // max size of mode partition | 20 #define VP8_MAX_PARTITION0_SIZE (1 << 19) // max size of mode partition |
18 #define VP8_MAX_PARTITION_SIZE (1 << 24) // max size for token partition | 21 #define VP8_MAX_PARTITION_SIZE (1 << 24) // max size for token partition |
19 #define VP8_FRAME_HEADER_SIZE 10 // Size of the frame header within VP8 data. | 22 #define VP8_FRAME_HEADER_SIZE 10 // Size of the frame header within VP8 data. |
20 | 23 |
21 // VP8L related constants. | 24 // VP8L related constants. |
22 #define VP8L_SIGNATURE_SIZE 1 // VP8L signature size. | 25 #define VP8L_SIGNATURE_SIZE 1 // VP8L signature size. |
23 #define VP8L_MAGIC_BYTE 0x2f // VP8L signature byte. | 26 #define VP8L_MAGIC_BYTE 0x2f // VP8L signature byte. |
24 #define VP8L_IMAGE_SIZE_BITS 14 // Number of bits used to store | 27 #define VP8L_IMAGE_SIZE_BITS 14 // Number of bits used to store |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #define ALPHA_HEADER_LEN 1 | 61 #define ALPHA_HEADER_LEN 1 |
59 #define ALPHA_NO_COMPRESSION 0 | 62 #define ALPHA_NO_COMPRESSION 0 |
60 #define ALPHA_LOSSLESS_COMPRESSION 1 | 63 #define ALPHA_LOSSLESS_COMPRESSION 1 |
61 #define ALPHA_PREPROCESSED_LEVELS 1 | 64 #define ALPHA_PREPROCESSED_LEVELS 1 |
62 | 65 |
63 // Mux related constants. | 66 // Mux related constants. |
64 #define TAG_SIZE 4 // Size of a chunk tag (e.g. "VP8L"). | 67 #define TAG_SIZE 4 // Size of a chunk tag (e.g. "VP8L"). |
65 #define CHUNK_SIZE_BYTES 4 // Size needed to store chunk's size. | 68 #define CHUNK_SIZE_BYTES 4 // Size needed to store chunk's size. |
66 #define CHUNK_HEADER_SIZE 8 // Size of a chunk header. | 69 #define CHUNK_HEADER_SIZE 8 // Size of a chunk header. |
67 #define RIFF_HEADER_SIZE 12 // Size of the RIFF header ("RIFFnnnnWEBP"). | 70 #define RIFF_HEADER_SIZE 12 // Size of the RIFF header ("RIFFnnnnWEBP"). |
68 #define FRAME_CHUNK_SIZE 15 // Size of a FRM chunk. | 71 #define ANMF_CHUNK_SIZE 16 // Size of an ANMF chunk. |
69 #define LOOP_CHUNK_SIZE 2 // Size of a LOOP chunk. | 72 #define ANIM_CHUNK_SIZE 6 // Size of an ANIM chunk. |
70 #define TILE_CHUNK_SIZE 6 // Size of a TILE chunk. | 73 #define FRGM_CHUNK_SIZE 6 // Size of a FRGM chunk. |
71 #define VP8X_CHUNK_SIZE 10 // Size of a VP8X chunk. | 74 #define VP8X_CHUNK_SIZE 10 // Size of a VP8X chunk. |
72 | 75 |
73 #define TILING_FLAG_BIT 0x01 // Set if tiles are possibly used. | |
74 #define ANIMATION_FLAG_BIT 0x02 // Set if some animation is expected | |
75 #define ICC_FLAG_BIT 0x04 // Whether ICC is present or not. | |
76 #define METADATA_FLAG_BIT 0x08 // Set if some META chunk is possibly present. | |
77 #define ALPHA_FLAG_BIT 0x10 // Should be same as the ALPHA_FLAG in mux.h | |
78 #define ROTATION_FLAG_BITS 0xe0 // all 3 bits for rotation + symmetry | |
79 | |
80 #define MAX_CANVAS_SIZE (1 << 24) // 24-bit max for VP8X width/height. | 76 #define MAX_CANVAS_SIZE (1 << 24) // 24-bit max for VP8X width/height. |
81 #define MAX_IMAGE_AREA (1ULL << 32) // 32-bit max for width x height. | 77 #define MAX_IMAGE_AREA (1ULL << 32) // 32-bit max for width x height. |
82 #define MAX_LOOP_COUNT (1 << 16) // maximum value for loop-count | 78 #define MAX_LOOP_COUNT (1 << 16) // maximum value for loop-count |
83 #define MAX_DURATION (1 << 24) // maximum duration | 79 #define MAX_DURATION (1 << 24) // maximum duration |
84 #define MAX_POSITION_OFFSET (1 << 24) // maximum frame/tile x/y offset | 80 #define MAX_POSITION_OFFSET (1 << 24) // maximum frame/fragment x/y offset |
85 | 81 |
86 // Maximum chunk payload is such that adding the header and padding won't | 82 // Maximum chunk payload is such that adding the header and padding won't |
87 // overflow a uint32_t. | 83 // overflow a uint32_t. |
88 #define MAX_CHUNK_PAYLOAD (~0U - CHUNK_HEADER_SIZE - 1) | 84 #define MAX_CHUNK_PAYLOAD (~0U - CHUNK_HEADER_SIZE - 1) |
89 | 85 |
90 #endif /* WEBP_WEBP_FORMAT_CONSTANTS_H_ */ | 86 #endif /* WEBP_WEBP_FORMAT_CONSTANTS_H_ */ |
OLD | NEW |