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_YCbCr-4:4:4:  standard YCbCr color space; no subsampling.
38  * @GST_JPEG2000_SAMPLING_YCbCr-4:2:2:  standard YCbCr color space; Cb and Cr are subsampled horizontally by 1/2.
39  * @GST_JPEG2000_SAMPLING_YCbCr-4:2:0:  standard YCbCr color space; Cb and Cr are subsampled horizontally and vertically by 1/2.
40  * @GST_JPEG2000_SAMPLING_YCbCr-4:1:1:  standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4.
41  * @GST_JPEG2000_SAMPLING_GRAYSCALE:  basically, a single component image of just multilevels of grey.
42  * @GST_JPEG2000_SAMPLING_YBRA4444_EXT: standard YCbCr color space, alpha channel, no subsampling,
43  */
44 typedef enum
45 {
46   GST_JPEG2000_SAMPLING_NONE,
47   GST_JPEG2000_SAMPLING_RGB,
48   GST_JPEG2000_SAMPLING_BGR,
49   GST_JPEG2000_SAMPLING_RGBA,
50   GST_JPEG2000_SAMPLING_BGRA,
51   GST_JPEG2000_SAMPLING_YBR444,
52   GST_JPEG2000_SAMPLING_YBR422,
53   GST_JPEG2000_SAMPLING_YBR420,
54   GST_JPEG2000_SAMPLING_YBR410,
55   GST_JPEG2000_SAMPLING_GRAYSCALE,
56   GST_JPEG2000_SAMPLING_YBRA4444_EXT
57 } GstJPEG2000Sampling;
58 
59 /* GST_JPEG2000_SAMPLING_LIST: sampling strings in list form, for use in caps */
60 #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\", \"GRAYSCALE\" , \"YCbCrA-4:4:4:4\"}"
61 
62 GST_CODEC_PARSERS_API
63 const gchar *gst_jpeg2000_sampling_to_string (GstJPEG2000Sampling sampling);
64 
65 GST_CODEC_PARSERS_API
66 GstJPEG2000Sampling gst_jpeg2000_sampling_from_string (const gchar *
67     sampling_string);
68 
69 GST_CODEC_PARSERS_API
70 gboolean gst_jpeg2000_sampling_is_rgb (GstJPEG2000Sampling sampling);
71 
72 GST_CODEC_PARSERS_API
73 gboolean gst_jpeg2000_sampling_is_yuv (GstJPEG2000Sampling sampling);
74 
75 GST_CODEC_PARSERS_API
76 gboolean gst_jpeg2000_sampling_is_mono (GstJPEG2000Sampling sampling);
77 
78 
79 /**
80  * GstJPEG2000Colorspace:
81  * @GST_JPEG2000_COLORSPACE_NONE: no color space
82  * @GST_JPEG2000_COLORSPACE_RGB: standard RGB color space
83  * @GST_JPEG2000_COLORSPACE_YUV: standard YUV color space
84  * @GST_JPEG2000_COLORSPACE_GRAY: monochrome color space
85  */
86 typedef enum
87 {
88   GST_JPEG2000_COLORSPACE_NONE,
89   GST_JPEG2000_COLORSPACE_RGB,
90   GST_JPEG2000_COLORSPACE_YUV,
91   GST_JPEG2000_COLORSPACE_GRAY
92 } GstJPEG2000Colorspace;
93 
94 GST_CODEC_PARSERS_API
95 const gchar *gst_jpeg2000_colorspace_to_string (GstJPEG2000Colorspace
96     colorspace);
97 
98 GST_CODEC_PARSERS_API
99 GstJPEG2000Colorspace gst_jpeg2000_colorspace_from_string (const gchar *
100     colorspace_string);
101 
102 /* GST_JPEG2000_COLORSPACE_LIST: color space strings in list form, for use in caps */
103 #define GST_JPEG2000_COLORSPACE_LIST "colorspace = (string) { \"sRGB\", \"sYUV\", \"GRAY\" }"
104 
105 #endif
106