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 24 #include <gst/gst.h> 25 26 #include <gst/audio/audio.h> 27 28 29 #ifndef __GST_AUDIO_QUANTIZE_H__ 30 #define __GST_AUDIO_QUANTIZE_H__ 31 32 /** 33 * GstAudioDitherMethod: 34 * @GST_AUDIO_DITHER_NONE: No dithering 35 * @GST_AUDIO_DITHER_RPDF: Rectangular dithering 36 * @GST_AUDIO_DITHER_TPDF: Triangular dithering (default) 37 * @GST_AUDIO_DITHER_TPDF_HF: High frequency triangular dithering 38 * 39 * Set of available dithering methods. 40 */ 41 typedef enum 42 { 43 GST_AUDIO_DITHER_NONE = 0, 44 GST_AUDIO_DITHER_RPDF, 45 GST_AUDIO_DITHER_TPDF, 46 GST_AUDIO_DITHER_TPDF_HF 47 } GstAudioDitherMethod; 48 49 /** 50 * GstAudioNoiseShapingMethod: 51 * @GST_AUDIO_NOISE_SHAPING_NONE: No noise shaping (default) 52 * @GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK: Error feedback 53 * @GST_AUDIO_NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping 54 * @GST_AUDIO_NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping 55 * @GST_AUDIO_NOISE_SHAPING_HIGH: High 8-pole noise shaping 56 * 57 * Set of available noise shaping methods 58 */ 59 typedef enum 60 { 61 GST_AUDIO_NOISE_SHAPING_NONE = 0, 62 GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK, 63 GST_AUDIO_NOISE_SHAPING_SIMPLE, 64 GST_AUDIO_NOISE_SHAPING_MEDIUM, 65 GST_AUDIO_NOISE_SHAPING_HIGH 66 } GstAudioNoiseShapingMethod; 67 68 /** 69 * GstAudioQuantizeFlags: 70 * @GST_AUDIO_QUANTIZE_FLAG_NONE: no flags 71 * @GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED: samples are non-interleaved 72 * 73 * Extra flags that can be passed to gst_audio_quantize_new() 74 */ 75 typedef enum 76 { 77 GST_AUDIO_QUANTIZE_FLAG_NONE = 0, 78 GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED = (1 << 0) 79 } GstAudioQuantizeFlags; 80 81 82 typedef struct _GstAudioQuantize GstAudioQuantize; 83 84 GST_AUDIO_API 85 GstAudioQuantize * gst_audio_quantize_new (GstAudioDitherMethod dither, 86 GstAudioNoiseShapingMethod ns, 87 GstAudioQuantizeFlags flags, 88 GstAudioFormat format, 89 guint channels, 90 guint quantizer); 91 92 GST_AUDIO_API 93 void gst_audio_quantize_free (GstAudioQuantize * quant); 94 95 GST_AUDIO_API 96 void gst_audio_quantize_reset (GstAudioQuantize * quant); 97 98 GST_AUDIO_API 99 void gst_audio_quantize_samples (GstAudioQuantize * quant, 100 const gpointer in[], 101 gpointer out[], guint samples); 102 103 #endif /* __GST_AUDIO_QUANTIZE_H__ */ 104