audio-quantize.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* GStreamer
  2. * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
  3. * (C) 2015 Wim Taymans <wim.taymans@gmail.com>
  4. *
  5. * gstaudioquantize.h: quantizes audio to the target format and optionally
  6. * applies dithering and noise shaping.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Library General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Library General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  21. * Boston, MA 02110-1301, USA.
  22. */
  23. #include <gst/gst.h>
  24. #include <gst/audio/audio.h>
  25. #ifndef __GST_AUDIO_QUANTIZE_H__
  26. #define __GST_AUDIO_QUANTIZE_H__
  27. /**
  28. * GstAudioDitherMethod:
  29. * @GST_AUDIO_DITHER_NONE: No dithering
  30. * @GST_AUDIO_DITHER_RPDF: Rectangular dithering
  31. * @GST_AUDIO_DITHER_TPDF: Triangular dithering (default)
  32. * @GST_AUDIO_DITHER_TPDF_HF: High frequency triangular dithering
  33. *
  34. * Set of available dithering methods.
  35. */
  36. typedef enum
  37. {
  38. GST_AUDIO_DITHER_NONE = 0,
  39. GST_AUDIO_DITHER_RPDF,
  40. GST_AUDIO_DITHER_TPDF,
  41. GST_AUDIO_DITHER_TPDF_HF
  42. } GstAudioDitherMethod;
  43. /**
  44. * GstAudioNoiseShapingMethod:
  45. * @GST_AUDIO_NOISE_SHAPING_NONE: No noise shaping (default)
  46. * @GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK: Error feedback
  47. * @GST_AUDIO_NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping
  48. * @GST_AUDIO_NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping
  49. * @GST_AUDIO_NOISE_SHAPING_HIGH: High 8-pole noise shaping
  50. *
  51. * Set of available noise shaping methods
  52. */
  53. typedef enum
  54. {
  55. GST_AUDIO_NOISE_SHAPING_NONE = 0,
  56. GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK,
  57. GST_AUDIO_NOISE_SHAPING_SIMPLE,
  58. GST_AUDIO_NOISE_SHAPING_MEDIUM,
  59. GST_AUDIO_NOISE_SHAPING_HIGH
  60. } GstAudioNoiseShapingMethod;
  61. /**
  62. * GstAudioQuantizeFlags:
  63. * @GST_AUDIO_QUANTIZE_FLAG_NONE: no flags
  64. * @GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED: samples are non-interleaved
  65. *
  66. * Extra flags that can be passed to gst_audio_quantize_new()
  67. */
  68. typedef enum
  69. {
  70. GST_AUDIO_QUANTIZE_FLAG_NONE = 0,
  71. GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED = (1 << 0)
  72. } GstAudioQuantizeFlags;
  73. typedef struct _GstAudioQuantize GstAudioQuantize;
  74. GstAudioQuantize * gst_audio_quantize_new (GstAudioDitherMethod dither,
  75. GstAudioNoiseShapingMethod ns,
  76. GstAudioQuantizeFlags flags,
  77. GstAudioFormat format,
  78. guint channels,
  79. guint quantizer);
  80. void gst_audio_quantize_free (GstAudioQuantize * quant);
  81. void gst_audio_quantize_reset (GstAudioQuantize * quant);
  82. void gst_audio_quantize_samples (GstAudioQuantize * quant,
  83. const gpointer in[],
  84. gpointer out[], guint samples);
  85. #endif /* __GST_AUDIO_QUANTIZE_H__ */