Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
dsview
Commits
f6245e2e
Commit
f6245e2e
authored
May 16, 2016
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve memory alloc and free for capture session
parent
1b6f16bf
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
284 additions
and
246 deletions
+284
-246
DSView/darkstyle/style.qss
DSView/darkstyle/style.qss
+2
-2
DSView/pv/data/analog.cpp
DSView/pv/data/analog.cpp
+5
-1
DSView/pv/data/analogsnapshot.cpp
DSView/pv/data/analogsnapshot.cpp
+23
-8
DSView/pv/data/analogsnapshot.h
DSView/pv/data/analogsnapshot.h
+5
-1
DSView/pv/data/decoderstack.cpp
DSView/pv/data/decoderstack.cpp
+20
-15
DSView/pv/data/dso.cpp
DSView/pv/data/dso.cpp
+5
-1
DSView/pv/data/dsosnapshot.cpp
DSView/pv/data/dsosnapshot.cpp
+28
-13
DSView/pv/data/dsosnapshot.h
DSView/pv/data/dsosnapshot.h
+5
-1
DSView/pv/data/groupsnapshot.h
DSView/pv/data/groupsnapshot.h
+1
-1
DSView/pv/data/logic.cpp
DSView/pv/data/logic.cpp
+5
-1
DSView/pv/data/logicsnapshot.cpp
DSView/pv/data/logicsnapshot.cpp
+29
-13
DSView/pv/data/logicsnapshot.h
DSView/pv/data/logicsnapshot.h
+5
-1
DSView/pv/data/mathstack.cpp
DSView/pv/data/mathstack.cpp
+4
-2
DSView/pv/data/snapshot.cpp
DSView/pv/data/snapshot.cpp
+47
-22
DSView/pv/data/snapshot.h
DSView/pv/data/snapshot.h
+9
-3
DSView/pv/dock/protocoldock.cpp
DSView/pv/dock/protocoldock.cpp
+2
-9
DSView/pv/dock/protocoldock.h
DSView/pv/dock/protocoldock.h
+0
-2
DSView/pv/sigsession.cpp
DSView/pv/sigsession.cpp
+60
-77
DSView/pv/sigsession.h
DSView/pv/sigsession.h
+1
-3
DSView/pv/toolbars/filebar.cpp
DSView/pv/toolbars/filebar.cpp
+2
-2
DSView/pv/view/analogsignal.cpp
DSView/pv/view/analogsignal.cpp
+2
-0
DSView/pv/view/decodetrace.cpp
DSView/pv/view/decodetrace.cpp
+9
-47
DSView/pv/view/decodetrace.h
DSView/pv/view/decodetrace.h
+0
-3
DSView/pv/view/dsosignal.cpp
DSView/pv/view/dsosignal.cpp
+9
-7
DSView/pv/view/logicsignal.cpp
DSView/pv/view/logicsignal.cpp
+6
-11
No files found.
DSView/darkstyle/style.qss
View file @
f6245e2e
...
...
@@ -369,7 +369,7 @@ QScrollBar:horizontal
QScrollBar::handle:horizontal
{
background-color: #605F5F;
min-width: 5px;
min-width:
1
5px;
border-radius: 4px;
}
...
...
@@ -435,7 +435,7 @@ QScrollBar:vertical
QScrollBar::handle:vertical
{
background-color: #605F5F;
min-height: 5px;
min-height:
1
5px;
border-radius: 4px;
}
...
...
DSView/pv/data/analog.cpp
View file @
f6245e2e
...
...
@@ -24,6 +24,8 @@
#include "analog.h"
#include "analogsnapshot.h"
#include <boost/foreach.hpp>
using
namespace
boost
;
using
namespace
std
;
...
...
@@ -47,7 +49,9 @@ deque< boost::shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
void
Analog
::
clear
()
{
_snapshots
.
clear
();
//_snapshots.clear();
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
AnalogSnapshot
>
s
,
_snapshots
)
s
->
clear
();
}
}
// namespace data
...
...
DSView/pv/data/analogsnapshot.cpp
View file @
f6245e2e
...
...
@@ -46,13 +46,10 @@ const float AnalogSnapshot::LogEnvelopeScaleFactor =
logf
(
EnvelopeScaleFactor
);
const
uint64_t
AnalogSnapshot
::
EnvelopeDataUnit
=
64
*
1024
;
// bytes
AnalogSnapshot
::
AnalogSnapshot
(
const
sr_datafeed_analog
&
analog
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
)
:
Snapshot
(
sizeof
(
uint16_t
)
*
channel_num
,
_total_sample_len
,
channel_num
)
AnalogSnapshot
::
AnalogSnapshot
()
:
Snapshot
(
sizeof
(
uint16_t
)
,
1
,
1
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
memset
(
_envelope_levels
,
0
,
sizeof
(
_envelope_levels
));
init
(
_total_sample_len
*
channel_num
);
append_payload
(
analog
);
}
AnalogSnapshot
::~
AnalogSnapshot
()
...
...
@@ -62,6 +59,24 @@ AnalogSnapshot::~AnalogSnapshot()
free
(
e
.
samples
);
}
void
AnalogSnapshot
::
clear
()
{
_sample_count
=
0
;
_ring_sample_count
=
0
;
}
void
AnalogSnapshot
::
first_payload
(
const
sr_datafeed_analog
&
analog
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
)
{
_total_sample_count
=
total_sample_count
;
_channel_num
=
channel_num
;
_unit_size
=
sizeof
(
uint16_t
)
*
channel_num
;
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
if
(
init
(
_total_sample_count
*
_channel_num
)
==
SR_OK
)
{
append_payload
(
analog
);
_last_ended
=
false
;
}
}
void
AnalogSnapshot
::
append_payload
(
const
sr_datafeed_analog
&
analog
)
{
...
...
@@ -89,7 +104,7 @@ const uint16_t* AnalogSnapshot::get_samples(
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
// (end_sample - start_sample));
// return data;
return
(
uint16_t
*
)
_data
+
start_sample
*
_channel_num
;
return
(
uint16_t
*
)
_data
.
data
()
+
start_sample
*
_channel_num
;
}
void
AnalogSnapshot
::
get_envelope_section
(
EnvelopeSection
&
s
,
...
...
@@ -154,7 +169,7 @@ void AnalogSnapshot::append_payload_to_envelope_levels()
dest_ptr
=
e0
.
samples
+
prev_length
;
// Iterate through the samples to populate the first level mipmap
const
uint16_t
*
const
stop_src_ptr
=
(
uint16_t
*
)
_data
+
const
uint16_t
*
const
stop_src_ptr
=
(
uint16_t
*
)
_data
.
data
()
+
e0
.
length
*
EnvelopeScaleFactor
*
_channel_num
;
// for (const uint16_t *src_ptr = (uint16_t*)_data +
// prev_length * EnvelopeScaleFactor;
...
...
@@ -167,7 +182,7 @@ void AnalogSnapshot::append_payload_to_envelope_levels()
// *dest_ptr++ = sub_sample;
// }
for
(
const
uint16_t
*
src_ptr
=
(
uint16_t
*
)
_data
+
for
(
const
uint16_t
*
src_ptr
=
(
uint16_t
*
)
_data
.
data
()
+
prev_length
*
EnvelopeScaleFactor
*
_channel_num
+
i
;
src_ptr
<
stop_src_ptr
;
src_ptr
+=
EnvelopeScaleFactor
*
_channel_num
)
{
...
...
DSView/pv/data/analogsnapshot.h
View file @
f6245e2e
...
...
@@ -69,10 +69,14 @@ private:
static
const
uint64_t
EnvelopeDataUnit
;
public:
AnalogSnapshot
(
const
sr_datafeed_analog
&
analog
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
);
AnalogSnapshot
();
virtual
~
AnalogSnapshot
();
void
clear
();
void
first_payload
(
const
sr_datafeed_analog
&
analog
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
);
void
append_payload
(
const
sr_datafeed_analog
&
analog
);
const
uint16_t
*
get_samples
(
int64_t
start_sample
,
...
...
DSView/pv/data/decoderstack.cpp
View file @
f6245e2e
...
...
@@ -56,8 +56,8 @@ namespace data {
const
double
DecoderStack
::
DecodeMargin
=
1.0
;
const
double
DecoderStack
::
DecodeThreshold
=
0.2
;
const
int64_t
DecoderStack
::
DecodeChunkLength
=
102
4
*
1024
;
const
unsigned
int
DecoderStack
::
DecodeNotifyPeriod
=
1
;
const
int64_t
DecoderStack
::
DecodeChunkLength
=
4
*
1024
;
const
unsigned
int
DecoderStack
::
DecodeNotifyPeriod
=
1
024
;
mutex
DecoderStack
::
_global_decode_mutex
;
...
...
@@ -332,7 +332,7 @@ void DecoderStack::clear()
_sample_count
=
0
;
_frame_complete
=
false
;
_samples_decoded
=
0
;
//
new_decode_data();
new_decode_data
();
_error_message
=
QString
();
for
(
map
<
const
Row
,
RowData
>::
const_iterator
i
=
_rows
.
begin
();
i
!=
_rows
.
end
();
i
++
)
...
...
@@ -342,7 +342,7 @@ void DecoderStack::clear()
void
DecoderStack
::
stop_decode
()
{
_snapshot
.
reset
();
//
_snapshot.reset();
if
(
_decode_state
==
Stopped
)
{
clear
();
...
...
@@ -397,12 +397,14 @@ void DecoderStack::begin_decode()
if
(
snapshots
.
empty
())
return
;
_snapshot
=
snapshots
.
front
();
if
(
_snapshot
->
empty
())
return
;
// Get the samplerate and start time
_start_time
=
data
->
get_start_time
();
_samplerate
=
data
->
samplerate
();
if
(
_samplerate
==
0.0
)
_samplerate
=
1.0
;
if
(
_samplerate
==
0.0
)
return
;
//_decode_thread = boost::thread(&DecoderStack::decode_proc, this);
_decode_thread
.
reset
(
new
boost
::
thread
(
&
DecoderStack
::
decode_proc
,
this
));
...
...
@@ -437,7 +439,8 @@ void DecoderStack::decode_data(
const
unsigned
int
unit_size
,
srd_session
*
const
session
)
{
uint8_t
*
chunk
=
NULL
;
uint64_t
last_cnt
=
0
;
uint64_t
notify_cnt
=
(
decode_end
-
decode_start
+
1
)
/
100
;
const
uint64_t
chunk_sample_count
=
DecodeChunkLength
/
_snapshot
->
unit_size
();
...
...
@@ -463,8 +466,10 @@ void DecoderStack::decode_data(
_samples_decoded
=
chunk_end
-
decode_start
+
1
;
}
if
(
i
%
DecodeNotifyPeriod
==
0
)
if
((
i
-
last_cnt
)
>
notify_cnt
)
{
last_cnt
=
i
;
new_decode_data
();
}
}
_options_changed
=
false
;
...
...
@@ -492,6 +497,12 @@ void DecoderStack::decode_proc()
// Create the decoders
const
unsigned
int
unit_size
=
_snapshot
->
unit_size
();
// Get the intial sample count
{
unique_lock
<
mutex
>
input_lock
(
_input_mutex
);
sample_count
=
_sample_count
=
_snapshot
->
get_sample_count
();
}
BOOST_FOREACH
(
const
shared_ptr
<
decode
::
Decoder
>
&
dec
,
_stack
)
{
srd_decoder_inst
*
const
di
=
dec
->
create_decoder_inst
(
session
,
unit_size
);
...
...
@@ -508,13 +519,7 @@ void DecoderStack::decode_proc()
prev_di
=
di
;
decode_start
=
dec
->
decode_start
();
decode_end
=
min
(
dec
->
decode_end
(),
_snapshot
->
get_sample_count
());
}
// Get the intial sample count
{
unique_lock
<
mutex
>
input_lock
(
_input_mutex
);
sample_count
=
_sample_count
=
_snapshot
->
get_sample_count
();
decode_end
=
min
(
dec
->
decode_end
(),
_sample_count
-
1
);
}
// Start the session
...
...
DSView/pv/data/dso.cpp
View file @
f6245e2e
...
...
@@ -23,6 +23,8 @@
#include "dso.h"
#include "dsosnapshot.h"
#include <boost/foreach.hpp>
using
namespace
boost
;
using
namespace
std
;
...
...
@@ -46,7 +48,9 @@ deque< boost::shared_ptr<DsoSnapshot> >& Dso::get_snapshots()
void
Dso
::
clear
()
{
_snapshots
.
clear
();
//_snapshots.clear();
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
DsoSnapshot
>
s
,
_snapshots
)
s
->
clear
();
}
}
// namespace data
...
...
DSView/pv/data/dsosnapshot.cpp
View file @
f6245e2e
...
...
@@ -47,16 +47,13 @@ const uint64_t DsoSnapshot::EnvelopeDataUnit = 4*1024; // bytes
const
int
DsoSnapshot
::
VrmsScaleFactor
=
1
<<
8
;
DsoSnapshot
::
DsoSnapshot
(
const
sr_datafeed_dso
&
dso
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
,
bool
instant
)
:
Snapshot
(
sizeof
(
uint16_t
),
_total_sample_len
,
channel_num
),
DsoSnapshot
::
DsoSnapshot
()
:
Snapshot
(
sizeof
(
uint16_t
),
1
,
1
),
_envelope_en
(
false
),
_envelope_done
(
false
),
_instant
(
instant
)
_instant
(
false
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
memset
(
_envelope_levels
,
0
,
sizeof
(
_envelope_levels
));
init
(
_total_sample_len
);
append_payload
(
dso
);
}
DsoSnapshot
::~
DsoSnapshot
()
...
...
@@ -66,6 +63,24 @@ DsoSnapshot::~DsoSnapshot()
free
(
e
.
samples
);
}
void
DsoSnapshot
::
clear
()
{
_sample_count
=
0
;
_ring_sample_count
=
0
;
}
void
DsoSnapshot
::
first_payload
(
const
sr_datafeed_dso
&
dso
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
,
bool
instant
)
{
_total_sample_count
=
total_sample_count
;
_channel_num
=
channel_num
;
_instant
=
instant
;
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
if
(
init
(
_total_sample_count
)
==
SR_OK
)
{
append_payload
(
dso
);
_last_ended
=
false
;
}
}
void
DsoSnapshot
::
append_payload
(
const
sr_datafeed_dso
&
dso
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
...
...
@@ -103,7 +118,7 @@ const uint8_t *DsoSnapshot::get_samples(
// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) *
// (end_sample - start_sample));
// return data;
return
(
uint8_t
*
)
_data
+
start_sample
*
_channel_num
+
index
*
(
_channel_num
!=
1
);
return
(
uint8_t
*
)
_data
.
data
()
+
start_sample
*
_channel_num
+
index
*
(
_channel_num
!=
1
);
}
void
DsoSnapshot
::
get_envelope_section
(
EnvelopeSection
&
s
,
...
...
@@ -170,9 +185,9 @@ void DsoSnapshot::append_payload_to_envelope_levels(bool header)
dest_ptr
=
e0
.
samples
+
prev_length
;
// Iterate through the samples to populate the first level mipmap
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
+
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
e0
.
length
*
EnvelopeScaleFactor
*
_channel_num
;
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
+
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
prev_length
*
EnvelopeScaleFactor
*
_channel_num
+
i
;
src_ptr
<
stop_src_ptr
;
src_ptr
+=
EnvelopeScaleFactor
*
_channel_num
)
{
...
...
@@ -248,9 +263,9 @@ double DsoSnapshot::cal_vrms(double zero_off, int index) const
double
tmp
;
// Iterate through the samples to populate the first level mipmap
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
+
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
_sample_count
*
_channel_num
;
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
+
index
;
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
index
;
src_ptr
<
stop_src_ptr
;
src_ptr
+=
VrmsScaleFactor
*
_channel_num
)
{
const
uint8_t
*
begin_src_ptr
=
...
...
@@ -282,9 +297,9 @@ double DsoSnapshot::cal_vmean(int index) const
double
vmean
=
0
;
// Iterate through the samples to populate the first level mipmap
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
+
const
uint8_t
*
const
stop_src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
_sample_count
*
_channel_num
;
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
+
index
;
for
(
const
uint8_t
*
src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
index
;
src_ptr
<
stop_src_ptr
;
src_ptr
+=
VrmsScaleFactor
*
_channel_num
)
{
const
uint8_t
*
begin_src_ptr
=
...
...
DSView/pv/data/dsosnapshot.h
View file @
f6245e2e
...
...
@@ -70,10 +70,14 @@ private:
static
const
int
VrmsScaleFactor
;
public:
DsoSnapshot
(
const
sr_datafeed_dso
&
dso
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
,
bool
instant
);
DsoSnapshot
();
virtual
~
DsoSnapshot
();
void
clear
();
void
first_payload
(
const
sr_datafeed_dso
&
dso
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
,
bool
instant
);
void
append_payload
(
const
sr_datafeed_dso
&
dso
);
const
uint8_t
*
get_samples
(
int64_t
start_sample
,
...
...
DSView/pv/data/groupsnapshot.h
View file @
f6245e2e
...
...
@@ -98,7 +98,7 @@ private:
private:
struct
Envelope
_envelope_levels
[
ScaleStepCount
];
mutable
boost
::
recursive_mutex
_mutex
;
void
*
_data
;
const
void
*
_data
;
uint64_t
_sample_count
;
int
_unit_size
;
boost
::
shared_ptr
<
view
::
Signal
>
_signal
;
...
...
DSView/pv/data/logic.cpp
View file @
f6245e2e
...
...
@@ -24,6 +24,8 @@
#include "logic.h"
#include "logicsnapshot.h"
#include <boost/foreach.hpp>
using
namespace
boost
;
using
namespace
std
;
...
...
@@ -48,7 +50,9 @@ deque< boost::shared_ptr<LogicSnapshot> >& Logic::get_snapshots()
void
Logic
::
clear
()
{
_snapshots
.
clear
();
//_snapshots.clear();
BOOST_FOREACH
(
const
boost
::
shared_ptr
<
LogicSnapshot
>
s
,
_snapshots
)
s
->
clear
();
}
}
// namespace data
...
...
DSView/pv/data/logicsnapshot.cpp
View file @
f6245e2e
...
...
@@ -43,21 +43,37 @@ const int LogicSnapshot::MipMapScaleFactor = 1 << MipMapScalePower;
const
float
LogicSnapshot
::
LogMipMapScaleFactor
=
logf
(
MipMapScaleFactor
);
const
uint64_t
LogicSnapshot
::
MipMapDataUnit
=
64
*
1024
;
// bytes
LogicSnapshot
::
LogicSnapshot
(
const
sr_datafeed_logic
&
logic
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
)
:
Snapshot
(
logic
.
unitsize
,
_total_sample_len
,
channel_num
),
_last_append_sample
(
0
)
LogicSnapshot
::
LogicSnapshot
()
:
Snapshot
(
1
,
1
,
1
),
_last_append_sample
(
0
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
memset
(
_mip_map
,
0
,
sizeof
(
_mip_map
));
if
(
init
(
_total_sample_len
*
channel_num
)
==
SR_OK
)
append_payload
(
logic
);
memset
(
_mip_map
,
0
,
sizeof
(
_mip_map
));
}
LogicSnapshot
::~
LogicSnapshot
()
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
BOOST_FOREACH
(
MipMapLevel
&
l
,
_mip_map
)
free
(
l
.
data
);
BOOST_FOREACH
(
MipMapLevel
&
l
,
_mip_map
)
free
(
l
.
data
);
}
void
LogicSnapshot
::
clear
()
{
_sample_count
=
0
;
_ring_sample_count
=
0
;
memset
(
_mip_map
,
0
,
sizeof
(
_mip_map
));
}
void
LogicSnapshot
::
first_payload
(
const
sr_datafeed_logic
&
logic
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
)
{
_total_sample_count
=
total_sample_count
;
_channel_num
=
channel_num
;
_unit_size
=
logic
.
unitsize
;
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
if
(
init
(
_total_sample_count
*
_channel_num
)
==
SR_OK
)
{
append_payload
(
logic
);
_last_ended
=
false
;
}
}
void
LogicSnapshot
::
append_payload
(
...
...
@@ -88,7 +104,7 @@ uint8_t * LogicSnapshot::get_samples(int64_t start_sample, int64_t end_sample) c
//const size_t size = (end_sample - start_sample) * _unit_size;
//memcpy(data, (const uint8_t*)_data + start_sample * _unit_size, size);
return
(
uint8_t
*
)
_data
+
start_sample
*
_unit_size
;
return
(
uint8_t
*
)
_data
.
data
()
+
start_sample
*
_unit_size
;
}
void
LogicSnapshot
::
reallocate_mipmap_level
(
MipMapLevel
&
m
)
...
...
@@ -127,9 +143,9 @@ void LogicSnapshot::append_payload_to_mipmap()
dest_ptr
=
(
uint8_t
*
)
m0
.
data
+
prev_length
*
_unit_size
;
// Iterate through the samples to populate the first level mipmap
const
uint8_t
*
const
end_src_ptr
=
(
uint8_t
*
)
_data
+
const
uint8_t
*
const
end_src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
m0
.
length
*
_unit_size
*
MipMapScaleFactor
;
for
(
src_ptr
=
(
uint8_t
*
)
_data
+
for
(
src_ptr
=
(
uint8_t
*
)
_data
.
data
()
+
prev_length
*
_unit_size
*
MipMapScaleFactor
;
src_ptr
<
end_src_ptr
;)
{
...
...
@@ -201,7 +217,7 @@ void LogicSnapshot::get_subsampled_edges(
assert
(
sig_index
>=
0
);
assert
(
sig_index
<
64
);
if
(
!
_data
)
if
(
_data
.
size
()
==
0
)
return
;
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
...
...
DSView/pv/data/logicsnapshot.h
View file @
f6245e2e
...
...
@@ -61,10 +61,14 @@ public:
typedef
std
::
pair
<
uint64_t
,
bool
>
EdgePair
;
public:
LogicSnapshot
(
const
sr_datafeed_logic
&
logic
,
uint64_t
_total_sample_len
,
unsigned
int
channel_num
);
LogicSnapshot
();
virtual
~
LogicSnapshot
();
void
clear
();
void
first_payload
(
const
sr_datafeed_logic
&
logic
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
);
void
append_payload
(
const
sr_datafeed_logic
&
logic
);
uint8_t
*
get_samples
(
int64_t
start_sample
,
int64_t
end_sample
)
const
;
...
...
DSView/pv/data/mathstack.cpp
View file @
f6245e2e
...
...
@@ -56,7 +56,8 @@ MathStack::MathStack(pv::SigSession &session, int index) :
_index
(
index
),
_dc_ignore
(
true
),
_sample_interval
(
1
),
_math_state
(
Init
)
_math_state
(
Init
),
_fft_plan
(
NULL
)
{
}
...
...
@@ -65,7 +66,8 @@ MathStack::~MathStack()
_xn
.
clear
();
_xk
.
clear
();
_power_spectrum
.
clear
();
fftw_destroy_plan
(
_fft_plan
);
if
(
_fft_plan
)
fftw_destroy_plan
(
_fft_plan
);
}
void
MathStack
::
clear
()
...
...
DSView/pv/data/snapshot.cpp
View file @
f6245e2e
...
...
@@ -33,12 +33,13 @@ namespace pv {
namespace
data
{
Snapshot
::
Snapshot
(
int
unit_size
,
uint64_t
total_sample_count
,
unsigned
int
channel_num
)
:
_data
(
NULL
),
_channel_num
(
channel_num
),
_sample_count
(
0
),
_total_sample_count
(
total_sample_count
),
_ring_sample_count
(
0
),
_unit_size
(
unit_size
)
_unit_size
(
unit_size
),
_memory_failed
(
true
),
_last_ended
(
true
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
assert
(
_unit_size
>
0
);
...
...
@@ -47,41 +48,65 @@ Snapshot::Snapshot(int unit_size, uint64_t total_sample_count, unsigned int chan
Snapshot
::~
Snapshot
()
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
if
(
_data
!=
NULL
)
free
(
_data
);
_data
=
NULL
;
_data
.
clear
();
}
int
Snapshot
::
init
(
uint64_t
_total_sample_len
)
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
_data
=
malloc
(
_total_sample_len
*
_unit_size
+
sizeof
(
uint64_t
));
// boost::lock_guard<boost::recursive_mutex> lock(_mutex);
// _data = malloc(_total_sample_len * _unit_size +
// sizeof(uint64_t));
// if (_data == NULL)
// return SR_ERR_MALLOC;
// else
// return SR_OK;
if
(
_data
==
NULL
)
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
uint64_t
size
=
_total_sample_len
*
_unit_size
+
sizeof
(
uint64_t
);
try
{
_data
.
resize
(
size
);
}
catch
(...)
{
_memory_failed
=
true
;
return
SR_ERR_MALLOC
;
else
return
SR_OK
;
}
_memory_failed
=
false
;
return
SR_OK
;
}
bool
Snapshot
::
memory_failed
()
const
{
return
_memory_failed
;
}
bool
Snapshot
::
buf_null
()
const
bool
Snapshot
::
empty
()
const
{
if
(
_
data
==
NULL
)
if
(
_
sample_count
==
0
||
_memory_failed
)
return
true
;
else
return
false
;
}
bool
Snapshot
::
last_ended
()
const
{
return
_last_ended
;
}
void
Snapshot
::
set_last_ended
(
bool
ended
)
{
_last_ended
=
ended
;
}
uint64_t
Snapshot
::
get_sample_count
()
const
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
return
_sample_count
;
}
void
*
Snapshot
::
get_data
()
const
const
void
*
Snapshot
::
get_data
()
const
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
return
_data
;
return
_data
.
data
()
;
}
int
Snapshot
::
unit_size
()
const
...
...
@@ -100,10 +125,10 @@ uint64_t Snapshot::get_sample(uint64_t index) const
{
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
assert
(
_data
);
assert
(
_data
.
data
()
);
assert
(
index
<
_sample_count
);
return
*
(
uint64_t
*
)((
uint8_t
*
)
_data
+
index
*
_unit_size
);
return
*
(
uint64_t
*
)((
uint8_t
*
)
_data
.
data
()
+
index
*
_unit_size
);
}
void
Snapshot
::
append_data
(
void
*
data
,
uint64_t
samples
)
...
...
@@ -117,13 +142,13 @@ void Snapshot::append_data(void *data, uint64_t samples)
_sample_count
=
_total_sample_count
;
if
(
_ring_sample_count
+
samples
>
_total_sample_count
)
{
memcpy
((
uint8_t
*
)
_data
+
_ring_sample_count
*
_unit_size
,
memcpy
((
uint8_t
*
)
_data
.
data
()
+
_ring_sample_count
*
_unit_size
,
data
,
(
_total_sample_count
-
_ring_sample_count
)
*
_unit_size
);
_ring_sample_count
=
(
samples
+
_ring_sample_count
-
_total_sample_count
)
%
_total_sample_count
;
memcpy
((
uint8_t
*
)
_data
,
memcpy
((
uint8_t
*
)
_data
.
data
()
,
data
,
_ring_sample_count
*
_unit_size
);
}
else
{
memcpy
((
uint8_t
*
)
_data
+
_ring_sample_count
*
_unit_size
,
memcpy
((
uint8_t
*
)
_data
.
data
()
+
_ring_sample_count
*
_unit_size
,
data
,
samples
*
_unit_size
);
_ring_sample_count
+=
samples
;
}
...
...
@@ -134,10 +159,10 @@ void Snapshot::refill_data(void *data, uint64_t samples, bool instant)
boost
::
lock_guard
<
boost
::
recursive_mutex
>
lock
(
_mutex
);
if
(
instant
)
{
memcpy
((
uint8_t
*
)
_data
+
_sample_count
*
_channel_num
,
data
,
samples
*
_channel_num
);
memcpy
((
uint8_t
*
)
_data
.
data
()
+
_sample_count
*
_channel_num
,
data
,
samples
*
_channel_num
);
_sample_count
=
(
_sample_count
+
samples
)
%
(
_total_sample_count
+
1
);
}
else
{
memcpy
((
uint8_t
*
)
_data
,
data
,
samples
*
_channel_num
);
memcpy
((
uint8_t
*
)
_data
.
data
()
,
data
,
samples
*
_channel_num
);
_sample_count
=
samples
;
}
...
...
DSView/pv/data/snapshot.h
View file @
f6245e2e
...
...
@@ -42,11 +42,15 @@ public:
uint64_t
get_sample_count
()
const
;
void
*
get_data
()
const
;
const
void
*
get_data
()
const
;
int
unit_size
()
const
;
bool
buf_null
()
const
;
bool
memory_failed
()
const
;
bool
empty
()
const
;
bool
last_ended
()
const
;
void
set_last_ended
(
bool
ended
);
unsigned
int
get_channel_num
()
const
;
...
...
@@ -58,12 +62,14 @@ protected:
protected:
mutable
boost
::
recursive_mutex
_mutex
;
void
*
_data
;
std
::
vector
<
uint8_t
>
_data
;
unsigned
int
_channel_num
;
uint64_t
_sample_count
;
uint64_t
_total_sample_count
;
uint64_t
_ring_sample_count
;
int
_unit_size
;
bool
_memory_failed
;
bool
_last_ended
;
};
}
// namespace data
...
...
DSView/pv/dock/protocoldock.cpp
View file @
f6245e2e
...
...
@@ -166,14 +166,6 @@ int ProtocolDock::decoder_name_cmp(const void *a, const void *b)
((
const
srd_decoder
*
)
b
)
->
name
);
}
void
ProtocolDock
::
paintEvent
(
QPaintEvent
*
)
{
//QStyleOption opt;
//opt.init(this);
//QPainter p(this);
//style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void
ProtocolDock
::
add_protocol
()
{
if
(
_session
.
get_device
()
->
dev_inst
()
->
mode
!=
LOGIC
)
{
...
...
@@ -228,7 +220,7 @@ void ProtocolDock::add_protocol()
// progress connection
const
std
::
vector
<
boost
::
shared_ptr
<
pv
::
view
::
DecodeTrace
>
>
decode_sigs
(
_session
.
get_decode_signals
());
//
connect(decode_sigs.back().get(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progess(int)));
connect
(
decode_sigs
.
back
().
get
(),
SIGNAL
(
decoded_progress
(
int
)),
this
,
SLOT
(
decoded_progess
(
int
)));
protocol_updated
();
}
...
...
@@ -363,6 +355,7 @@ void ProtocolDock::decoded_progess(int progress)
_progress_label_list
.
at
(
index
)
->
setText
(
progress_str
);
index
++
;
}
update_model
();
}
void
ProtocolDock
::
set_model
()
...
...
DSView/pv/dock/protocoldock.h
View file @
f6245e2e
...
...
@@ -61,8 +61,6 @@ public:
ProtocolDock
(
QWidget
*
parent
,
SigSession
&
session
);
~
ProtocolDock
();
void
paintEvent
(
QPaintEvent
*
);
void
del_all_protocol
();
signals:
...
...
DSView/pv/sigsession.cpp
View file @
f6245e2e
This diff is collapsed.
Click to expand it.
DSView/pv/sigsession.h
View file @
f6245e2e
...
...
@@ -173,7 +173,7 @@ public:
void
del_group
();
void
*
get_buf
(
int
&
unit_size
,
uint64_t
&
length
);
const
void
*
get_buf
(
int
&
unit_size
,
uint64_t
&
length
);
void
start_hotplug_proc
(
boost
::
function
<
void
(
const
QString
)
>
error_handler
);
void
stop_hotplug_proc
();
...
...
@@ -191,8 +191,6 @@ public:
private:
void
set_capture_state
(
capture_state
state
);
void
update_data_header
(
const
sr_dev_inst
*
const
sdi
);
private: