Lines Matching refs:state
44 struct MS_ADPCM_decodestate state[2]; member
83 static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state, in MS_ADPCM_nibble() argument
94 new_sample = ((state->iSamp1 * coeff[0]) + in MS_ADPCM_nibble()
95 (state->iSamp2 * coeff[1]))/256; in MS_ADPCM_nibble()
97 new_sample += state->iDelta * (nybble-0x10); in MS_ADPCM_nibble()
99 new_sample += state->iDelta * nybble; in MS_ADPCM_nibble()
107 delta = ((Sint32)state->iDelta * adaptive[nybble])/256; in MS_ADPCM_nibble()
111 state->iDelta = (Uint16)delta; in MS_ADPCM_nibble()
112 state->iSamp2 = state->iSamp1; in MS_ADPCM_nibble()
113 state->iSamp1 = (Sint16)new_sample; in MS_ADPCM_nibble()
119 struct MS_ADPCM_decodestate *state[2]; in MS_ADPCM_decode() local
142 state[0] = &MS_ADPCM_state.state[0]; in MS_ADPCM_decode()
143 state[1] = &MS_ADPCM_state.state[stereo]; in MS_ADPCM_decode()
146 state[0]->hPredictor = *encoded++; in MS_ADPCM_decode()
148 state[1]->hPredictor = *encoded++; in MS_ADPCM_decode()
150 state[0]->iDelta = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
153 state[1]->iDelta = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
156 state[0]->iSamp1 = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
159 state[1]->iSamp1 = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
162 state[0]->iSamp2 = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
165 state[1]->iSamp2 = ((encoded[1]<<8)|encoded[0]); in MS_ADPCM_decode()
168 coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor]; in MS_ADPCM_decode()
169 coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor]; in MS_ADPCM_decode()
172 decoded[0] = state[0]->iSamp2&0xFF; in MS_ADPCM_decode()
173 decoded[1] = state[0]->iSamp2>>8; in MS_ADPCM_decode()
176 decoded[0] = state[1]->iSamp2&0xFF; in MS_ADPCM_decode()
177 decoded[1] = state[1]->iSamp2>>8; in MS_ADPCM_decode()
180 decoded[0] = state[0]->iSamp1&0xFF; in MS_ADPCM_decode()
181 decoded[1] = state[0]->iSamp1>>8; in MS_ADPCM_decode()
184 decoded[0] = state[1]->iSamp1&0xFF; in MS_ADPCM_decode()
185 decoded[1] = state[1]->iSamp1>>8; in MS_ADPCM_decode()
194 new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]); in MS_ADPCM_decode()
201 new_sample = MS_ADPCM_nibble(state[1],nybble,coeff[1]); in MS_ADPCM_decode()
224 struct IMA_ADPCM_decodestate state[2]; member
249 static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble) in IMA_ADPCM_nibble() argument
272 step = step_table[state->index]; in IMA_ADPCM_nibble()
278 state->sample += delta; in IMA_ADPCM_nibble()
281 state->index += index_table[nybble]; in IMA_ADPCM_nibble()
282 if ( state->index > 88 ) { in IMA_ADPCM_nibble()
283 state->index = 88; in IMA_ADPCM_nibble()
285 if ( state->index < 0 ) { in IMA_ADPCM_nibble()
286 state->index = 0; in IMA_ADPCM_nibble()
290 if ( state->sample > max_audioval ) { in IMA_ADPCM_nibble()
291 state->sample = max_audioval; in IMA_ADPCM_nibble()
293 if ( state->sample < min_audioval ) { in IMA_ADPCM_nibble()
294 state->sample = min_audioval; in IMA_ADPCM_nibble()
296 return(state->sample); in IMA_ADPCM_nibble()
301 int channel, int numchannels, struct IMA_ADPCM_decodestate *state) in Fill_IMA_ADPCM_block() argument
310 new_sample = IMA_ADPCM_nibble(state, nybble); in Fill_IMA_ADPCM_block()
317 new_sample = IMA_ADPCM_nibble(state, nybble); in Fill_IMA_ADPCM_block()
329 struct IMA_ADPCM_decodestate *state; in IMA_ADPCM_decode() local
336 if ( channels > SDL_arraysize(IMA_ADPCM_state.state) ) { in IMA_ADPCM_decode()
338 SDL_arraysize(IMA_ADPCM_state.state)); in IMA_ADPCM_decode()
341 state = IMA_ADPCM_state.state; in IMA_ADPCM_decode()
362 state[c].sample = ((encoded[1]<<8)|encoded[0]); in IMA_ADPCM_decode()
364 if ( state[c].sample & 0x8000 ) { in IMA_ADPCM_decode()
365 state[c].sample -= 0x10000; in IMA_ADPCM_decode()
367 state[c].index = *encoded++; in IMA_ADPCM_decode()
374 decoded[0] = (Uint8)(state[c].sample&0xFF); in IMA_ADPCM_decode()
375 decoded[1] = (Uint8)(state[c].sample>>8); in IMA_ADPCM_decode()
384 c, channels, &state[c]); in IMA_ADPCM_decode()