95a2f48dcaacee6f81a896bfcb31c705669589e7
[platform/upstream/gstreamer.git] / gst-libs / gst / video / video-chroma.h
1 /* GStreamer
2  * Copyright (C) <2013> 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 #ifndef __GST_VIDEO_CHROMA_H__
21 #define __GST_VIDEO_CHROMA_H__
22
23 #include <gst/gst.h>
24
25 G_BEGIN_DECLS
26
27 /**
28  * GstVideoChromaSite:
29  * @GST_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
30  * @GST_VIDEO_CHROMA_SITE_NONE: no cositing
31  * @GST_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
32  * @GST_VIDEO_CHROMA_SITE_V_COSITED: chroma is vertically cosited
33  * @GST_VIDEO_CHROMA_SITE_ALT_LINE: choma samples are sited on alternate lines
34  * @GST_VIDEO_CHROMA_SITE_COSITED: chroma samples cosited with luma samples
35  * @GST_VIDEO_CHROMA_SITE_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
36  * @GST_VIDEO_CHROMA_SITE_MPEG2: mpeg2 style cositing
37  * @GST_VIDEO_CHROMA_SITE_DV: DV style cositing
38  *
39  * Various Chroma sitings.
40  */
41 typedef enum {
42   GST_VIDEO_CHROMA_SITE_UNKNOWN   =  0,
43   GST_VIDEO_CHROMA_SITE_NONE      = (1 << 0),
44   GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
45   GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
46   GST_VIDEO_CHROMA_SITE_ALT_LINE  = (1 << 3),
47   /* some common chroma cositing */
48   GST_VIDEO_CHROMA_SITE_COSITED   = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
49   GST_VIDEO_CHROMA_SITE_JPEG      = (GST_VIDEO_CHROMA_SITE_NONE),
50   GST_VIDEO_CHROMA_SITE_MPEG2     = (GST_VIDEO_CHROMA_SITE_H_COSITED),
51   GST_VIDEO_CHROMA_SITE_DV        = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
52 } GstVideoChromaSite;
53
54 GST_EXPORT
55 GstVideoChromaSite    gst_video_chroma_from_string   (const gchar * s);
56
57 GST_EXPORT
58 const gchar *         gst_video_chroma_to_string     (GstVideoChromaSite site);
59
60 /**
61  * GstVideoChromaMethod:
62  * @GST_VIDEO_CHROMA_METHOD_NEAREST: Duplicates the chroma samples when
63  *    upsampling and drops when subsampling
64  * @GST_VIDEO_CHROMA_METHOD_LINEAR: Uses linear interpolation to reconstruct
65  *    missing chroma and averaging to subsample
66  *
67  * Different subsampling and upsampling methods
68  */
69 typedef enum {
70   GST_VIDEO_CHROMA_METHOD_NEAREST,
71   GST_VIDEO_CHROMA_METHOD_LINEAR
72 } GstVideoChromaMethod;
73
74 /**
75  * GstVideoChromaFlags:
76  * @GST_VIDEO_CHROMA_FLAG_NONE: no flags
77  * @GST_VIDEO_CHROMA_FLAG_INTERLACED: the input is interlaced
78  *
79  * Extra flags that influence the result from gst_video_chroma_resample_new().
80  */
81 typedef enum {
82   GST_VIDEO_CHROMA_FLAG_NONE       = 0,
83   GST_VIDEO_CHROMA_FLAG_INTERLACED = (1 << 0),
84 } GstVideoChromaFlags;
85
86 typedef struct _GstVideoChromaResample GstVideoChromaResample;
87
88 /* circular dependency, need to include this after defining the enums */
89 #include <gst/video/video-format.h>
90
91 GST_EXPORT
92 GstVideoChromaResample * gst_video_chroma_resample_new   (GstVideoChromaMethod method,
93                                                           GstVideoChromaSite site,
94                                                           GstVideoChromaFlags flags,
95                                                           GstVideoFormat format,
96                                                           gint h_factor, gint v_factor);
97
98 GST_EXPORT
99 void                     gst_video_chroma_resample_free  (GstVideoChromaResample *resample);
100
101 GST_EXPORT
102 void                     gst_video_chroma_resample_get_info (GstVideoChromaResample *resample,
103                                                              guint * n_lines, gint *offset);
104
105 GST_EXPORT
106 void                     gst_video_chroma_resample       (GstVideoChromaResample *resample,
107                                                           gpointer lines[], gint width);
108
109 G_END_DECLS
110
111 #endif /* __GST_VIDEO_CHROMA_H__ */