video-chroma.h 4.1 KB

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