1 /* WEED is free software; you can redistribute it and/or 2 modify it under the terms of the GNU Lesser General Public 3 License as published by the Free Software Foundation; either 4 version 3 of the License, or (at your option) any later version. 5 6 Weed is distributed in the hope that it will be useful, 7 but WITHOUT ANY WARRANTY; without even the implied warranty of 8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9 Lesser General Public License for more details. 10 11 You should have received a copy of the GNU Lesser General Public 12 License along with this source code; if not, write to the Free Software 13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 14 15 Weed is developed by: 16 Gabriel "Salsaman" Finch - http://lives-video.com 17 18 partly based on LiViDO, which is developed by: 19 Niels Elburg - http://veejay.sf.net 20 Denis "Jaromil" Rojo - http://freej.dyne.org 21 Tom Schouten - http://zwizwa.fartit.com 22 Andraz Tori - http://cvs.cinelerra.org 23 24 reviewed with suggestions and contributions from: 25 Silvano "Kysucix" Galliani - http://freej.dyne.org 26 Kentaro Fukuchi - http://megaui.net/fukuchi 27 Jun Iio - http://www.malib.net 28 Carlo Prelz - http://www2.fluido.as:8080/ 29 */ 30 31 /* (C) G. Finch, 2005 - 2019 */ 32 33 #ifndef __WEED_PALETTES_H__ 34 #define __WEED_PALETTES_H__ 35 36 #define WEED_PALETTES_VERSION 200 37 38 /* Palette types */ 39 /* RGB palettes */ 40 #define WEED_PALETTE_NONE 0 41 #define WEED_PALETTE_END WEED_PALETTE_NONE 42 #define WEED_PALETTE_RGB24 1 43 #define WEED_PALETTE_RGB888 WEED_PALETTE_RGB24 44 #define WEED_PALETTE_BGR24 2 45 #define WEED_PALETTE_BGR888 WEED_PALETTE_BGR24 46 #define WEED_PALETTE_RGBA32 3 47 #define WEED_PALETTE_RGBA8888 WEED_PALETTE_RGBA32 48 #define WEED_PALETTE_BGRA32 4 49 #define WEED_PALETTE_BGRA8888 WEED_PALETTE_BGRA32 50 #define WEED_PALETTE_ARGB32 5 51 #define WEED_PALETTE_ARGB8888 WEED_PALETTE_ARGB32 52 53 #define WEED_PALETTE_RGBFLOAT 64 54 #define WEED_PALETTE_RGBAFLOAT 65 55 56 /* YUV palettes */ 57 // planar 58 #define WEED_PALETTE_YUV420P 512 59 #define WEED_PALETTE_I420 WEED_PALETTE_YUV420P 60 #define WEED_PALETTE_IYUV WEED_PALETTE_YUV420P 61 62 #define WEED_PALETTE_YVU420P 513 63 #define WEED_PALETTE_YV12 WEED_PALETTE_YVU420P 64 65 #define WEED_PALETTE_YUV422P 522 66 #define WEED_PALETTE_P422 WEED_PALETTE_YUV422P 67 68 #define WEED_PALETTE_YUV444P 544 69 70 #define WEED_PALETTE_YUVA4444P 545 71 72 // packed 73 #define WEED_PALETTE_UYVY 564 74 #define WEED_PALETTE_UYVY8888 WEED_PALETTE_UYVY 75 #define WEED_PALETTE_UYVY422 WEED_PALETTE_UYVY 76 #define WEED_PALETTE_Y422 WEED_PALETTE_UYVY 77 #define WEED_PALETTE_HDYC WEED_PALETTE_UYVY /// UYVY with bt,709 subspace 78 79 #define WEED_PALETTE_YUYV 565 80 #define WEED_PALETTE_YUYV8888 WEED_PALETTE_YUYV 81 #define WEED_PALETTE_YUYV422 WEED_PALETTE_YUYV 82 #define WEED_PALETTE_YUY2 WEED_PALETTE_YUYV 83 84 #define WEED_PALETTE_YUV888 588 85 #define WEED_PALETTE_IYU2 WEED_PALETTE_YUV888 86 87 #define WEED_PALETTE_YUVA8888 589 88 89 #define WEED_PALETTE_YUV411 595 90 #define WEED_PALETTE_IYU1 WEED_PALETTE_YUV411 91 92 /* Alpha palettes */ 93 #define WEED_PALETTE_A8 1024 94 #define WEED_PALETTE_A1 1025 95 #define WEED_PALETTE_AFLOAT 1064 96 97 #define WEED_PALETTE_FIRST_CUSTOM 8192 98 99 /* YUV sampling types */ 100 // see http://www.mir.com/DMG/chroma.html 101 #define WEED_YUV_SAMPLING_DEFAULT 0 102 #define WEED_YUV_SAMPLING_JPEG 0 ///< jpeg/mpeg1 - samples centered horizontally: 0.5, 2.5 etc. 103 #define WEED_YUV_SAMPLING_MPEG 1 ///< mpeg2 - samples aligned horizontally: left 0,2,4 etc; 104 #define WEED_YUV_SAMPLING_DVPAL 2 ///< separated Cb and Cr 105 #define WEED_YUV_SAMPLING_DVNTSC 3 ///< not used - only for 411 planar 106 107 #define WEED_YUV_SAMPLING_FIRST_CUSTOM 512 108 109 /* YUV clamping types */ 110 #define WEED_YUV_CLAMPING_CLAMPED 0 111 #define WEED_YUV_CLAMPING_MPEG WEED_YUV_CLAMPING_CLAMPED 112 #define WEED_YUV_CLAMPING_UNCLAMPED 1 113 #define WEED_YUV_CLAMPING_JPEG WEED_YUV_CLAMPING_UNCLAMPED 114 115 #define WEED_YUV_CLAMPING_FIRST_CUSTOM 512 116 117 /* YUV subspace types */ 118 #define WEED_YUV_SUBSPACE_YUV 0 119 #define WEED_YUV_SUBSPACE_YCBCR 1 120 #define WEED_YUV_SUBSPACE_BT709 2 121 #define WEED_YUV_SUBSPACE_ITU709 WEED_YUV_SUBSPACE_BT709 122 123 #define WEED_YUV_SUBSPACE_FIRST_CUSTOM 512 124 125 /* GAMMA Values */ 126 /* API version 200 */ 127 #define WEED_GAMMA_UNKNOWN 0 128 #define WEED_GAMMA_LINEAR -1 129 #define WEED_GAMMA_SRGB 1 130 #define WEED_GAMMA_BT709 2 131 132 #define WEED_GAMMA_FIRST_CUSTOM 512 133 134 /// advanced palettes extension (experimental) 135 136 #ifdef WEED_ADVANCED_PALETTES 137 #define WEED_ADVANCED_PALETTES_VERSION 100 138 139 // if desired, the "palette_list" for a filter or channel_template may include WEED_PALETTE_ADVANCED. 140 // In this case, an additional filter_class leaf "adv_pal_list", 141 // an array of type WEED_SEED_VOIDPTR should be set for the filter_class or channel_template 142 // the values should point to statically allocated weed_macropixel_t structs. 143 // the usual rules about channel_templates overriding filter_class, and palette matching / conversion 144 // still apply. 145 // 146 // in response, the host may set the "current_palette" for a channel to WEED_PALETTE_ADVANCED, 147 // and set the additional leaf "adv_palette" with type WEED_SEED_VOIDPTR to point to the 148 // weed_macropixel_t struct selected. 149 150 #define WEED_PALETTE_ADVANCED 8191 151 152 #define WEED_LEAF_ADVANCED_PALETTE_LIST "adv_pal_list" 153 #define WEED_LEAF_ADVANCED_PALETTE "adv_palette" 154 155 #ifndef MAXPPLANES 156 #define MAXPPLANES 8 157 #endif 158 159 #define WEED_VCHAN_end 0 160 161 #define WEED_VCHAN_red 1 162 #define WEED_VCHAN_green 2 163 #define WEED_VCHAN_blue 3 164 165 #define WEED_VCHAN_Y 512 166 #define WEED_VCHAN_U 513 167 #define WEED_VCHAN_V 514 168 169 #define WEED_VCHAN_alpha 1024 170 171 #define WEED_VCHAN_FIRST_CUSTOM 8192 172 173 #define WEED_VCHAN_DESC_PLANAR (1 << 0) ///< planar type 174 #define WEED_VCHAN_DESC_FP (1 << 1) ///< floating point type 175 #define WEED_VCHAN_DESC_BE (1 << 1) ///< pixel data is big endian (within each component) 176 177 #define WEED_VCHAN_DESC_FIRST_CUSTOM (1 << 16) ///< floating point type 178 179 typedef struct { 180 uint16_t ext_ref; ///< link to an enumerated type 181 uint16_t chantype[MAXPPLANES]; /// e.g. {WEED_VCHAN_U, WEED_VCHAN_Y, WEED_VCHAN_V, WEED_VCHAN_Y) 182 uint32_t flags; /// bitmap of flags, eg. WEED_VCHAN_DESC_FP | WEED_VCHAN_DESC_PLANAR 183 uint8_t hsub[MAXPPLANES]; /// horiz. subsampling, 0 or 1 means no subsampling, 2 means halved etc. (planar only) 184 uint8_t vsub[MAXPPLANES]; /// vert subsampling 185 uint8_t npixels; ///< npixels per macropixel: {0, 1} == 1 186 uint8_t bitsize[MAXPPLANES]; 187 void *extended; ///< pointer to app defined data 188 } weed_macropixel_t; 189 #endif 190 191 #endif 192