- int64_t fragment_size = input_len[current_buffer];
-
-// printf("IndexThread::run %d index_state->channels=%d index_file->source_channels=%d index_state->index_buffer=%p buffer_in=%p\n",
-// __LINE__,
-// index_state->channels,
-// index_file->source_channels,
-// index_state->index_buffer,
-// buffer_in);
- for(int channel = 0; channel < index_file->source_channels; channel++)
- {
-SET_TRACE
- int64_t *highpoint_channel = &highpoint[channel];
- int64_t *lowpoint_channel = &lowpoint[channel];
- int64_t *frame_position_channel = &frame_position[channel];
- double *buffer_source = buffer_in[current_buffer][channel]->get_data();
-
-SET_TRACE
- for(int64_t i = 0; i < fragment_size; i++)
- {
- if(*frame_position_channel == zoomx)
- {
- *highpoint_channel += 2;
- *lowpoint_channel += 2;
- *frame_position_channel = 0;
-// store and reset output values
- index_buffer[*highpoint_channel] =
- index_buffer[*lowpoint_channel] =
- buffer_source[i];
- index_sizes[channel] =
- *lowpoint_channel -
- index_offsets[channel] +
- 1;
- }
- else
- {
-// get high and low points
- if(first_point)
- {
- index_buffer[*highpoint_channel] =
- index_buffer[*lowpoint_channel] = buffer_source[i];
- first_point = 0;
- }
- else
- {
- if(buffer_source[i] > index_buffer[*highpoint_channel])
- index_buffer[*highpoint_channel] = buffer_source[i];
- else
- if(buffer_source[i] < index_buffer[*lowpoint_channel])
- index_buffer[*lowpoint_channel] = buffer_source[i];
- }
- }
- (*frame_position_channel)++;
- } // end index one buffer
-SET_TRACE
+ int64_t len = input_len[current_buffer];
+ for( int ch=0; ch<index_channels; ++ch ) {
+ double *samples = buffer_in[current_buffer][ch]->get_data();
+ index_state->put_data(ch,samples,len);