2
0
forked from Ivasoft/DSView

Decode the data while collection the data

This commit is contained in:
dreamsourcelabTAI
2022-12-22 17:38:21 +08:00
parent bf05fdf055
commit 44e120ee2b
4 changed files with 33 additions and 17 deletions

View File

@@ -452,14 +452,17 @@ void DecoderStack::do_decode_work()
if (data == NULL)
return;
// Check we have a snapshot of data
const auto &snapshots = data->get_snapshots();
if (snapshots.empty())
return;
if (_session->is_realtime_mode() == false)
{
// Check we have a snapshot of data
const auto &snapshots = data->get_snapshots();
if (snapshots.empty())
return;
_snapshot = snapshots.front();
if (_snapshot->empty())
return;
_snapshot = snapshots.front();
if (_snapshot->empty())
return;
}
// Get the samplerate
_samplerate = data->samplerate();
@@ -512,13 +515,24 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
if( i >= decode_end){
dsv_info("%s", "decode data index have been end");
}
std::vector<const uint8_t *> chunk;
std::vector<uint8_t> chunk_const;
while(i < decode_end && !_no_memory && !status->_bStop)
{
std::vector<const uint8_t *> chunk;
std::vector<uint8_t> chunk_const;
chunk.clear();
chunk_const.clear();
uint64_t chunk_end = decode_end;
// Wait the data is ready.
if (!_is_capture_end && i == _snapshot->get_ring_sample_count())
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
continue;
}
for (int j =0 ; j < logic_di->dec_num_channels; j++) {
int sig_index = logic_di->dec_channelmap[j];
@@ -609,7 +623,7 @@ void DecoderStack::execute_decode_stack()
assert(session);
// Get the intial sample count
_sample_count = _snapshot->get_sample_count();
_sample_count = _snapshot->get_ring_sample_count();
// Create the decoders
for(auto dec : _stack)

View File

@@ -477,12 +477,14 @@ void LogicSnapshot::calc_mipmap(unsigned int order, uint8_t index0, uint8_t inde
}
const uint8_t *LogicSnapshot::get_samples(uint64_t start_sample, uint64_t &end_sample, int sig_index)
{
uint64_t sample_count = _sample_count;
assert(start_sample < sample_count);
assert(end_sample <= sample_count);
{
assert(start_sample < _ring_sample_count);
assert(start_sample <= end_sample);
if (end_sample >= _ring_sample_count){
end_sample = _ring_sample_count - 1;
}
int order = get_ch_order(sig_index);
uint64_t index0 = start_sample >> (LeafBlockPower + RootScalePower);
uint64_t index1 = (start_sample & RootMask) >> LeafBlockPower;
@@ -492,7 +494,7 @@ const uint8_t *LogicSnapshot::get_samples(uint64_t start_sample, uint64_t &end_s
(index1 << LeafBlockPower) +
~(~0ULL << LeafBlockPower);
end_sample = min(end_sample + 1, sample_count);
end_sample = min(end_sample + 1, _ring_sample_count);
if (order == -1 || _ch_data[order][index0].lbp[index1] == NULL)
return NULL;

View File

@@ -487,7 +487,6 @@ namespace pv
// On real-time mode, create the decode task when capture started.
if (is_realtime_mode())
{
de->decoder()->frame_ended();
de->frame_ended();
add_decode_task(de);
}
@@ -1998,7 +1997,6 @@ namespace pv
// If is not the real-time mode, try to create all decode tasks.
if (is_realtime_mode() == false){
de->decoder()->frame_ended();
de->frame_ended();
add_decode_task(de);
}

View File

@@ -663,6 +663,8 @@ void DecodeTrace::frame_ended()
_decode_cursor2 = 0;
}
decoder()->frame_ended();
for(auto dec : _decoder_stack->stack()) {
dec->set_decode_region(_decode_start, _decode_end);
dec->commit();