2 * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
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.
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.
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.
20 #ifndef __GST_VIDEO_DITHER_H__
21 #define __GST_VIDEO_DITHER_H__
24 #include <gst/video/video-prelude.h>
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
36 * Different dithering methods to use.
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;
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.
52 * Extra flags that influence the result from gst_video_chroma_resample_new().
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;
60 typedef struct _GstVideoDither GstVideoDither;
62 /* circular dependency, need to include this after defining the enums */
63 #include <gst/video/video-format.h>
66 GstVideoDither * gst_video_dither_new (GstVideoDitherMethod method,
67 GstVideoDitherFlags flags,
68 GstVideoFormat format,
69 guint quantizer[GST_VIDEO_MAX_COMPONENTS],
73 void gst_video_dither_free (GstVideoDither *dither);
76 void gst_video_dither_line (GstVideoDither *dither,
77 gpointer line, guint x, guint y, guint width);
81 #endif /* __GST_VIDEO_DITHER_H__ */