/usr/include/pjmedia/wsola.h is in libpjproject-dev 2.1.0.0.ast20130823-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | /* $Id: wsola.h 3553 2011-05-05 06:14:19Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJMEDIA_WSOLA_H__
#define __PJMEDIA_WSOLA_H__
/**
* @file wsola.h
* @brief Waveform Similarity Based Overlap-Add (WSOLA)
*/
#include <pjmedia/types.h>
/**
* @defgroup PJMED_WSOLA Waveform Similarity Based Overlap-Add (WSOLA)
* @ingroup PJMEDIA_FRAME_OP
* @brief Time-scale modification to audio without affecting the pitch
* @{
*
* This section describes Waveform Similarity Based Overlap-Add (WSOLA)
* implementation in PJMEDIA. The WSOLA API here can be used both to
* compress (speed-up) and stretch (expand, slow down) audio playback
* without altering the pitch, or as a mean for performing packet loss
* concealment (WSOLA).
*
* The WSOLA implementation is used by \ref PJMED_DELAYBUF and \ref PJMED_PLC.
*/
PJ_BEGIN_DECL
/**
* Opaque declaration for WSOLA structure.
*/
typedef struct pjmedia_wsola pjmedia_wsola;
/**
* WSOLA options, can be combined with bitmask operation.
*/
enum pjmedia_wsola_option
{
/**
* Disable Hanning window to conserve memory.
*/
PJMEDIA_WSOLA_NO_HANNING = 1,
/**
* Specify that the WSOLA will not be used for PLC.
*/
PJMEDIA_WSOLA_NO_PLC = 2,
/**
* Specify that the WSOLA will not be used to discard frames in
* non-contiguous buffer.
*/
PJMEDIA_WSOLA_NO_DISCARD = 4,
/**
* Disable fade-in and fade-out feature in the transition between
* actual and synthetic frames in WSOLA. With fade feature enabled,
* WSOLA will only generate a limited number of synthetic frames
* (configurable with #pjmedia_wsola_set_max_expand()), fading out
* the volume on every more samples it generates, and when it reaches
* the limit it will only generate silence.
*/
PJMEDIA_WSOLA_NO_FADING = 8
};
/**
* Create and initialize WSOLA.
*
* @param pool Pool to allocate memory for WSOLA.
* @param clock_rate Sampling rate of audio playback.
* @param samples_per_frame Number of samples per frame.
* @param channel_count Number of channels.
* @param options Option flags, bitmask combination of
* #pjmedia_wsola_option.
* @param p_wsola Pointer to receive WSOLA structure.
*
* @return PJ_SUCCESS or the appropriate error code.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_create(pj_pool_t *pool,
unsigned clock_rate,
unsigned samples_per_frame,
unsigned channel_count,
unsigned options,
pjmedia_wsola **p_wsola);
/**
* Specify maximum number of continuous synthetic frames that can be
* generated by WSOLA, in milliseconds. This option will only take
* effect if fading is not disabled via the option when the WSOLA
* session was created. Default value is PJMEDIA_WSOLA_MAX_EXPAND_MSEC
* (see also the documentation of PJMEDIA_WSOLA_MAX_EXPAND_MSEC for
* more information).
*
* @param wsola The WSOLA session
* @param msec The duration.
*
* @return PJ_SUCCESS normally.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_set_max_expand(pjmedia_wsola *wsola,
unsigned msec);
/**
* Destroy WSOLA.
*
* @param wsola WSOLA session.
*
* @return PJ_SUCCESS normally.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_destroy(pjmedia_wsola *wsola);
/**
* Reset the buffer contents of WSOLA.
*
* @param wsola WSOLA session.
* @param options Reset options, must be zero for now.
*
* @return PJ_SUCCESS normally.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_reset(pjmedia_wsola *wsola,
unsigned options);
/**
* Give one good frame to WSOLA to be kept as reference. Application
* must continuously give WSOLA good frames to keep its session up to
* date with current playback. Depending on the WSOLA implementation,
* this function may modify the content of the frame.
*
* @param wsola WSOLA session.
* @param frm The frame, which length must match the samples per
* frame setting of the WSOLA session.
* @param prev_lost If application previously generated a synthetic
* frame with #pjmedia_wsola_generate() before calling
* this function, specify whether that was because of
* packet lost. If so, set this parameter to PJ_TRUE
* to make WSOLA interpolate this frame with its buffer.
* Otherwise if this value is PJ_FALSE, WSOLA will
* just append this frame to the end of its buffer.
*
* @return PJ_SUCCESS normally.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_save(pjmedia_wsola *wsola,
pj_int16_t frm[],
pj_bool_t prev_lost);
/**
* Generate one synthetic frame from WSOLA.
*
* @param wsola WSOLA session.
* @param frm Buffer to receive the frame.
*
* @return PJ_SUCCESS normally.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_generate(pjmedia_wsola *wsola,
pj_int16_t frm[]);
/**
* Compress or compact the specified buffer by removing some audio samples
* from the buffer, without altering the pitch. For this function to work,
* total length of the buffer must be more than twice \a erase_cnt.
*
* @param wsola WSOLA session.
* @param buf1 Pointer to buffer.
* @param buf1_cnt Number of samples in the buffer.
* @param buf2 Pointer to second buffer, if the buffer is not
* contiguous. Otherwise this parameter must be NULL.
* @param buf2_cnt Number of samples in the second buffer, if the buffer
* is not contiguous. Otherwise this parameter should be
* zero.
* @param erase_cnt On input, specify the number of samples to be erased.
* This function may erase more or less than the requested
* number, and the actual number of samples erased will be
* given on this argument upon returning from the function.
*
* @return PJ_SUCCESS if some samples have been erased, PJ_ETOOSMALL
* if buffer is too small to be reduced, PJ_EINVAL if any
* of the parameters are not valid.
*/
PJ_DECL(pj_status_t) pjmedia_wsola_discard(pjmedia_wsola *wsola,
pj_int16_t buf1[],
unsigned buf1_cnt,
pj_int16_t buf2[],
unsigned buf2_cnt,
unsigned *erase_cnt);
PJ_END_DECL
/**
* @}
*/
#endif /* __PJMEDIA_WSOLA_H__ */
|