1 /* GStreamer JPEG 2000 Sampling 2 * Copyright (C) <2016> Grok Image Compression Inc. 3 * @author Aaron Boxer <boxerab@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GST_JPEG2000_SAMPLING_H__ 22 #define __GST_JPEG2000_SAMPLING_H__ 23 24 #include <gst/gst.h> 25 #include <gst/codecparsers/codecparsers-prelude.h> 26 27 /** 28 * GstJPEG2000Sampling: 29 * Sampling values from RF 5371 for JPEG 2000 over RTP : https://datatracker.ietf.org/doc/rfc5371/C 30 * Note: sampling extensions that are not listed in the RFC are signified by an _EXT at the end of the enum 31 * 32 * @GST_JPEG2000_SAMPLING_NONE: no sampling 33 * @GST_JPEG2000_SAMPLING_RGB: standard Red, Green, Blue color space. 34 * @GST_JPEG2000_SAMPLING_BGR: standard Blue, Green, Red color space. 35 * @GST_JPEG2000_SAMPLING_RGBA: standard Red, Green, Blue, Alpha color space. 36 * @GST_JPEG2000_SAMPLING_BGRA: standard Blue, Green, Red, Alpha color space. 37 * @GST_JPEG2000_SAMPLING_YBR444: standard YCbCr color space; no subsampling. 38 * @GST_JPEG2000_SAMPLING_YBR422: standard YCbCr color space; Cb and Cr are subsampled horizontally by 1/2. 39 * @GST_JPEG2000_SAMPLING_YBR420: standard YCbCr color space; Cb and Cr are subsampled horizontally and vertically by 1/2. 40 * @GST_JPEG2000_SAMPLING_YBR411: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 (Since: 1.20). 41 * @GST_JPEG2000_SAMPLING_YBR410: standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 alternating the Cb and Cr component. 42 * @GST_JPEG2000_SAMPLING_GRAYSCALE: basically, a single component image of just multilevels of grey. 43 * @GST_JPEG2000_SAMPLING_YBRA4444_EXT: standard YCbCr color space, alpha channel, no subsampling, 44 */ 45 46 /** 47 * GST_JPEG2000_SAMPLING_YBR411: 48 * 49 * standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4 50 * 51 * Since: 1.20 52 */ 53 typedef enum 54 { 55 GST_JPEG2000_SAMPLING_NONE, 56 GST_JPEG2000_SAMPLING_RGB, 57 GST_JPEG2000_SAMPLING_BGR, 58 GST_JPEG2000_SAMPLING_RGBA, 59 GST_JPEG2000_SAMPLING_BGRA, 60 GST_JPEG2000_SAMPLING_YBR444, 61 GST_JPEG2000_SAMPLING_YBR422, 62 GST_JPEG2000_SAMPLING_YBR420, 63 GST_JPEG2000_SAMPLING_YBR410, 64 GST_JPEG2000_SAMPLING_GRAYSCALE, 65 GST_JPEG2000_SAMPLING_YBRA4444_EXT, 66 GST_JPEG2000_SAMPLING_YBR411 67 } GstJPEG2000Sampling; 68 69 /* GST_JPEG2000_SAMPLING_LIST: sampling strings in list form, for use in caps */ 70 #define GST_JPEG2000_SAMPLING_LIST "sampling = (string) {\"RGB\", \"BGR\", \"RGBA\", \"BGRA\", \"YCbCr-4:4:4\", \"YCbCr-4:2:2\", \"YCbCr-4:2:0\", \"YCbCr-4:1:1\", \"YCbCr-4:1:0\", \"GRAYSCALE\" , \"YCbCrA-4:4:4:4\"}" 71 72 GST_CODEC_PARSERS_API 73 const gchar *gst_jpeg2000_sampling_to_string (GstJPEG2000Sampling sampling); 74 75 GST_CODEC_PARSERS_API 76 GstJPEG2000Sampling gst_jpeg2000_sampling_from_string (const gchar * 77 sampling_string); 78 79 GST_CODEC_PARSERS_API 80 gboolean gst_jpeg2000_sampling_is_rgb (GstJPEG2000Sampling sampling); 81 82 GST_CODEC_PARSERS_API 83 gboolean gst_jpeg2000_sampling_is_yuv (GstJPEG2000Sampling sampling); 84 85 GST_CODEC_PARSERS_API 86 gboolean gst_jpeg2000_sampling_is_mono (GstJPEG2000Sampling sampling); 87 88 89 /** 90 * GstJPEG2000Colorspace: 91 * @GST_JPEG2000_COLORSPACE_NONE: no color space 92 * @GST_JPEG2000_COLORSPACE_RGB: standard RGB color space 93 * @GST_JPEG2000_COLORSPACE_YUV: standard YUV color space 94 * @GST_JPEG2000_COLORSPACE_GRAY: monochrome color space 95 */ 96 typedef enum 97 { 98 GST_JPEG2000_COLORSPACE_NONE, 99 GST_JPEG2000_COLORSPACE_RGB, 100 GST_JPEG2000_COLORSPACE_YUV, 101 GST_JPEG2000_COLORSPACE_GRAY 102 } GstJPEG2000Colorspace; 103 104 GST_CODEC_PARSERS_API 105 const gchar *gst_jpeg2000_colorspace_to_string (GstJPEG2000Colorspace 106 colorspace); 107 108 GST_CODEC_PARSERS_API 109 GstJPEG2000Colorspace gst_jpeg2000_colorspace_from_string (const gchar * 110 colorspace_string); 111 112 /* GST_JPEG2000_COLORSPACE_LIST: color space strings in list form, for use in caps */ 113 #define GST_JPEG2000_COLORSPACE_LIST "colorspace = (string) { \"sRGB\", \"sYUV\", \"GRAY\" }" 114 115 #endif 116