1 /* GStreamer
2 * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19 
20 
21 #ifndef __GST_RTP_J2K_COMMON_H__
22 #define __GST_RTP_J2K_COMMON_H__
23 
24 
25 
26 /* Sampling values from RFC 5371 for JPEG 2000 over RTP : https://datatracker.ietf.org/doc/rfc5371/C
27 
28 RGB:  standard Red, Green, Blue color space.
29 
30 BGR:  standard Blue, Green, Red color space.
31 
32 RGBA:  standard Red, Green, Blue, Alpha color space.
33 
34 BGRA:  standard Blue, Green, Red, Alpha color space.
35 
36 YCbCr-4:4:4:  standard YCbCr color space; no subsampling.
37 
38 YCbCr-4:2:2:  standard YCbCr color space; Cb and Cr are subsampled horizontally by 1/2.
39 
40 YCbCr-4:2:0:  standard YCbCr color space; Cb and Cr are subsampled horizontally and vertically by 1/2.
41 
42 YCbCr-4:1:1:  standard YCbCr color space; Cb and Cr are subsampled vertically by 1/4.
43 
44 GRAYSCALE:  basically, a single component image of just multilevels of grey.
45 */
46 
47 
48 #define GST_RTP_J2K_RGB       "RGB"
49 #define GST_RTP_J2K_BGR       "BGR"
50 #define GST_RTP_J2K_RGBA      "RGBA"
51 #define GST_RTP_J2K_BGRA      "BGRA"
52 #define GST_RTP_J2K_YBRA   	  "YCbCrA"
53 #define GST_RTP_J2K_YBR444    "YCbCr-4:4:4"
54 #define GST_RTP_J2K_YBR422    "YCbCr-4:2:2"
55 #define GST_RTP_J2K_YBR420    "YCbCr-4:2:0"
56 #define GST_RTP_J2K_YBR410    "YCbCr-4:1:0"
57 #define GST_RTP_J2K_GRAYSCALE "GRAYSCALE"
58 
59 #define GST_RTP_J2K_SAMPLING_LIST "sampling = (string) {\"RGB\", \"BGR\", \"RGBA\", \"BGRA\", \"YCbCrA\", \"YCbCr-4:4:4\", \"YCbCr-4:2:2\", \"YCbCr-4:2:0\", \"YCbCr-4:1:1\", \"GRAYSCALE\"}"
60 
61 typedef enum
62 {
63 
64   GST_RTP_SAMPLING_NONE,
65   GST_RTP_SAMPLING_RGB,
66   GST_RTP_SAMPLING_BGR,
67   GST_RTP_SAMPLING_RGBA,
68   GST_RTP_SAMPLING_BGRA,
69   GST_RTP_SAMPLING_YBRA,
70   GST_RTP_SAMPLING_YBR444,
71   GST_RTP_SAMPLING_YBR422,
72   GST_RTP_SAMPLING_YBR420,
73   GST_RTP_SAMPLING_YBR410,
74   GST_RTP_SAMPLING_GRAYSCALE
75 } GstRtpSampling;
76 
77 
78 /*
79 * GstRtpJ2KMarker:
80 * @GST_J2K_MARKER: Prefix for JPEG 2000 marker
81 * @GST_J2K_MARKER_SOC: Start of Codestream
82 * @GST_J2K_MARKER_SOT: Start of tile
83 * @GST_J2K_MARKER_EOC: End of Codestream
84 *
85 * Identifiers for markers in JPEG 2000 code streams
86 */
87 typedef enum
88 {
89   GST_J2K_MARKER = 0xFF,
90   GST_J2K_MARKER_SOC = 0x4F,
91   GST_J2K_MARKER_SOT = 0x90,
92   GST_J2K_MARKER_SOP = 0x91,
93   GST_J2K_MARKER_EPH = 0x92,
94   GST_J2K_MARKER_SOD = 0x93,
95   GST_J2K_MARKER_EOC = 0xD9
96 } GstRtpJ2KMarker;
97 
98 
99 #define GST_RTP_J2K_HEADER_SIZE 8
100 
101 
102 #endif /* __GST_RTP_J2K_COMMON_H__ */
103