video-dither.h 2.7 KB

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