Lines Matching +full:reserved +full:- +full:channels

2 ** Copyright (c) 2002-2021, Erik de Castro Lopo <erikd@mega-nerd.com>
3 ** All rights reserved.
5 ** This code is released under 2-clause BSD license. Please see the
48 /*----------------------------------------------------------------------------------------
57 if (data->input_frames <= 0) in zoh_vari_process()
60 if (state->private_data == NULL) in zoh_vari_process()
63 priv = (ZOH_DATA*) state->private_data ; in zoh_vari_process()
65 if (!priv->dirty) in zoh_vari_process()
67 for (ch = 0 ; ch < state->channels ; ch++) in zoh_vari_process()
68 priv->last_value [ch] = data->data_in [ch] ; in zoh_vari_process()
69 priv->dirty = true ; in zoh_vari_process()
72 priv->in_count = data->input_frames * state->channels ; in zoh_vari_process()
73 priv->out_count = data->output_frames * state->channels ; in zoh_vari_process()
74 priv->in_used = priv->out_gen = 0 ; in zoh_vari_process()
76 src_ratio = state->last_ratio ; in zoh_vari_process()
81 input_index = state->last_position ; in zoh_vari_process()
84 while (input_index < 1.0 && priv->out_gen < priv->out_count) in zoh_vari_process()
86 if (priv->in_used + state->channels * input_index >= priv->in_count) in zoh_vari_process()
89 if (priv->out_count > 0 && fabs (state->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) in zoh_vari_process()
90 …src_ratio = state->last_ratio + priv->out_gen * (data->src_ratio - state->last_ratio) / priv->out_… in zoh_vari_process()
92 for (ch = 0 ; ch < state->channels ; ch++) in zoh_vari_process()
93 { data->data_out [priv->out_gen] = priv->last_value [ch] ; in zoh_vari_process()
94 priv->out_gen ++ ; in zoh_vari_process()
102 priv->in_used += state->channels * lrint (input_index - rem) ; in zoh_vari_process()
106 …while (priv->out_gen < priv->out_count && priv->in_used + state->channels * input_index <= priv->i… in zoh_vari_process()
108 if (priv->out_count > 0 && fabs (state->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) in zoh_vari_process()
109 …src_ratio = state->last_ratio + priv->out_gen * (data->src_ratio - state->last_ratio) / priv->out_… in zoh_vari_process()
111 for (ch = 0 ; ch < state->channels ; ch++) in zoh_vari_process()
112 { data->data_out [priv->out_gen] = data->data_in [priv->in_used - state->channels + ch] ; in zoh_vari_process()
113 priv->out_gen ++ ; in zoh_vari_process()
120 priv->in_used += state->channels * lrint (input_index - rem) ; in zoh_vari_process()
124 if (priv->in_used > priv->in_count) in zoh_vari_process()
125 { input_index += (priv->in_used - priv->in_count) / state->channels ; in zoh_vari_process()
126 priv->in_used = priv->in_count ; in zoh_vari_process()
129 state->last_position = input_index ; in zoh_vari_process()
131 if (priv->in_used > 0) in zoh_vari_process()
132 for (ch = 0 ; ch < state->channels ; ch++) in zoh_vari_process()
133 priv->last_value [ch] = data->data_in [priv->in_used - state->channels + ch] ; in zoh_vari_process()
136 state->last_ratio = src_ratio ; in zoh_vari_process()
138 data->input_frames_used = priv->in_used / state->channels ; in zoh_vari_process()
139 data->output_frames_gen = priv->out_gen / state->channels ; in zoh_vari_process()
144 /*------------------------------------------------------------------------------
168 zoh_data_new (int channels) in zoh_data_new() argument
170 assert (channels > 0) ; in zoh_data_new()
175 priv->zoh_magic_marker = ZOH_MAGIC_MARKER ; in zoh_data_new()
176 priv->last_value = (float *) calloc (channels, sizeof (float)) ; in zoh_data_new()
177 if (!priv->last_value) in zoh_data_new()
188 zoh_state_new (int channels, SRC_ERROR *error) in zoh_state_new() argument
190 assert (channels > 0) ; in zoh_state_new()
200 state->channels = channels ; in zoh_state_new()
201 state->mode = SRC_MODE_PROCESS ; in zoh_state_new()
203 state->private_data = zoh_data_new (state->channels) ; in zoh_state_new()
204 if (!state->private_data) in zoh_state_new()
211 state->vt = &zoh_state_vt ; in zoh_state_new()
227 priv = (ZOH_DATA*) state->private_data ; in zoh_reset()
231 priv->dirty = false ; in zoh_reset()
232 memset (priv->last_value, 0, sizeof (float) * state->channels) ; in zoh_reset()
242 if (state->private_data == NULL) in zoh_copy()
250 ZOH_DATA* from_priv = (ZOH_DATA*) state->private_data ; in zoh_copy()
259 to_priv->last_value = (float *) malloc (sizeof (float) * state->channels) ; in zoh_copy()
260 if (!to_priv->last_value) in zoh_copy()
266 memcpy (to_priv->last_value, from_priv->last_value, sizeof (float) * state->channels) ; in zoh_copy()
268 to->private_data = to_priv ; in zoh_copy()
278 ZOH_DATA *zoh = (ZOH_DATA *) state->private_data ; in zoh_close()
281 if (zoh->last_value) in zoh_close()
283 free (zoh->last_value) ; in zoh_close()
284 zoh->last_value = NULL ; in zoh_close()