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_DITHER_H__ |
21 | #define __GST_VIDEO_DITHER_H__ |
22 | |
23 | #include <gst/gst.h> |
24 | #include <gst/video/video-prelude.h> |
25 | |
26 | G_BEGIN_DECLS |
27 | |
28 | /** |
29 | * GstVideoDitherMethod: |
30 | * @GST_VIDEO_DITHER_NONE: no dithering |
31 | * @GST_VIDEO_DITHER_VERTERR: propagate rounding errors downwards |
32 | * @GST_VIDEO_DITHER_FLOYD_STEINBERG: Dither with floyd-steinberg error diffusion |
33 | * @GST_VIDEO_DITHER_SIERRA_LITE: Dither with Sierra Lite error diffusion |
34 | * @GST_VIDEO_DITHER_BAYER: ordered dither using a bayer pattern |
35 | * |
36 | * Different dithering methods to use. |
37 | */ |
38 | typedef enum { |
39 | GST_VIDEO_DITHER_NONE, |
40 | GST_VIDEO_DITHER_VERTERR, |
41 | GST_VIDEO_DITHER_FLOYD_STEINBERG, |
42 | GST_VIDEO_DITHER_SIERRA_LITE, |
43 | GST_VIDEO_DITHER_BAYER, |
44 | } GstVideoDitherMethod; |
45 | |
46 | /** |
47 | * GstVideoDitherFlags: |
48 | * @GST_VIDEO_DITHER_FLAG_NONE: no flags |
49 | * @GST_VIDEO_DITHER_FLAG_INTERLACED: the input is interlaced |
50 | * @GST_VIDEO_DITHER_FLAG_QUANTIZE: quantize values in addition to adding dither. |
51 | * |
52 | * Extra flags that influence the result from gst_video_chroma_resample_new(). |
53 | */ |
54 | typedef enum { |
55 | GST_VIDEO_DITHER_FLAG_NONE = 0, |
56 | GST_VIDEO_DITHER_FLAG_INTERLACED = (1 << 0), |
57 | GST_VIDEO_DITHER_FLAG_QUANTIZE = (1 << 1), |
58 | } GstVideoDitherFlags; |
59 | |
60 | typedef struct _GstVideoDither GstVideoDither; |
61 | |
62 | /* circular dependency, need to include this after defining the enums */ |
63 | #include <gst/video/video-format.h> |
64 | |
65 | GST_VIDEO_API |
66 | GstVideoDither * gst_video_dither_new (GstVideoDitherMethod method, |
67 | GstVideoDitherFlags flags, |
68 | GstVideoFormat format, |
69 | guint quantizer[GST_VIDEO_MAX_COMPONENTS], |
70 | guint width); |
71 | |
72 | GST_VIDEO_API |
73 | void gst_video_dither_free (GstVideoDither *dither); |
74 | |
75 | GST_VIDEO_API |
76 | void gst_video_dither_line (GstVideoDither *dither, |
77 | gpointer line, guint x, guint y, guint width); |
78 | |
79 | G_END_DECLS |
80 | |
81 | #endif /* __GST_VIDEO_DITHER_H__ */ |
82 | |