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