1 /* GStreamer
2  * Copyright (C) <2014> 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_SCALER_H__
21 #define __GST_VIDEO_SCALER_H__
22 
23 #include <gst/gst.h>
24 
25 #include <gst/video/video-format.h>
26 #include <gst/video/video-color.h>
27 #include <gst/video/video-resampler.h>
28 
29 G_BEGIN_DECLS
30 
31 /**
32  * GST_VIDEO_SCALER_OPT_DITHER_METHOD:
33  *
34  * #GST_TYPE_VIDEO_DITHER_METHOD, The dither method to use for propagating
35  * quatization errors.
36  */
37 #define GST_VIDEO_SCALER_OPT_DITHER_METHOD   "GstVideoScaler.dither-method"
38 
39 /**
40  * GstVideoScalerFlags:
41  * @GST_VIDEO_SCALER_FLAG_NONE: no flags
42  * @GST_VIDEO_SCALER_FLAG_INTERLACED: Set up a scaler for interlaced content
43  *
44  * Different scale flags.
45  */
46 typedef enum {
47   GST_VIDEO_SCALER_FLAG_NONE                 = (0),
48   GST_VIDEO_SCALER_FLAG_INTERLACED           = (1 << 0),
49 } GstVideoScalerFlags;
50 
51 typedef struct _GstVideoScaler GstVideoScaler;
52 
53 GST_VIDEO_API
54 GstVideoScaler *      gst_video_scaler_new            (GstVideoResamplerMethod method,
55                                                        GstVideoScalerFlags flags,
56                                                        guint n_taps,
57                                                        guint in_size, guint out_size,
58                                                        GstStructure * options);
59 
60 GST_VIDEO_API
61 void                  gst_video_scaler_free           (GstVideoScaler *scale);
62 
63 GST_VIDEO_API
64 guint                 gst_video_scaler_get_max_taps   (GstVideoScaler *scale);
65 
66 GST_VIDEO_API
67 const gdouble *       gst_video_scaler_get_coeff      (GstVideoScaler *scale,
68                                                        guint out_offset,
69                                                        guint *in_offset,
70                                                        guint *n_taps);
71 
72 GST_VIDEO_API
73 void                  gst_video_scaler_horizontal     (GstVideoScaler *scale,
74                                                        GstVideoFormat format,
75                                                        gpointer src, gpointer dest,
76                                                        guint dest_offset, guint width);
77 
78 GST_VIDEO_API
79 void                  gst_video_scaler_vertical       (GstVideoScaler *scale,
80                                                        GstVideoFormat format,
81                                                        gpointer src_lines[], gpointer dest,
82                                                        guint dest_offset, guint width);
83 
84 GST_VIDEO_API
85 GstVideoScaler *      gst_video_scaler_combine_packed_YUV (GstVideoScaler * y_scale,
86                                                            GstVideoScaler *uv_scale,
87                                                            GstVideoFormat in_format,
88                                                            GstVideoFormat out_format);
89 
90 GST_VIDEO_API
91 void                  gst_video_scaler_2d             (GstVideoScaler *hscale,
92                                                        GstVideoScaler *vscale,
93                                                        GstVideoFormat format,
94                                                        gpointer src, gint src_stride,
95                                                        gpointer dest, gint dest_stride,
96                                                        guint x, guint y,
97                                                        guint width, guint height);
98 
99 G_END_DECLS
100 
101 #endif /* __GST_VIDEO_SCALER_H__ */
102