Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LimaGroup
Lima-camera-eiger
Commits
24a1e1c6
Commit
24a1e1c6
authored
Dec 16, 2019
by
Alejandro Homs Puron
Committed by
operator for beamline
Jan 27, 2020
Browse files
Add BSLZ4 support for Stream, allow free LZ4/BSLZ4 selection
parent
101e2148
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
24a1e1c6
...
...
@@ -118,6 +118,7 @@ target_link_libraries(eiger PUBLIC
${
ZMQ_LIBRARIES
}
JsonCpp::JsonCpp
limacore
h5bshuf_objects
)
if
(
WIN32
)
...
...
src/EigerDecompress.cpp
View file @
24a1e1c6
...
...
@@ -20,6 +20,7 @@
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#include
"lz4.h"
#include
"bitshuffle.h"
#include
"EigerDecompress.h"
#include
"EigerStream.h"
...
...
@@ -63,7 +64,8 @@ Data _DecompressTask::process(Data& src)
throw
ProcessException
(
"_DecompressTask: can't find compressed message"
);
void
*
dst
;
int
size
;
if
(
src
.
depth
()
==
4
&&
depth
==
2
)
bool
expand_16_to_32bit
=
((
src
.
depth
()
==
4
)
&&
(
depth
==
2
));
if
(
expand_16_to_32bit
)
{
if
(
posix_memalign
(
&
dst
,
16
,
src
.
size
()
/
2
))
throw
ProcessException
(
"Can't allocate temporary memory"
);
...
...
@@ -72,10 +74,18 @@ Data _DecompressTask::process(Data& src)
else
dst
=
src
.
data
(),
size
=
src
.
size
();
int
return_code
=
LZ4_decompress_fast
((
const
char
*
)
msg_data
,(
char
*
)
dst
,
size
);
Camera
::
CompressionType
type
;
m_stream
.
getCompressionType
(
type
);
int
return_code
;
if
(
type
==
Camera
::
LZ4
)
{
return_code
=
LZ4_decompress_fast
((
const
char
*
)
msg_data
,(
char
*
)
dst
,
size
);
}
else
{
size_t
nb_elements
=
size
/
depth
;
return_code
=
bshuf_decompress_lz4
(
msg_data
,
dst
,
nb_elements
,
depth
,
0
);
}
if
(
return_code
<
0
)
{
if
(
src
.
depth
()
==
4
&&
depth
==
2
)
free
(
dst
);
if
(
expand_16_to_32bit
)
free
(
dst
);
char
ErrorBuff
[
1024
];
snprintf
(
ErrorBuff
,
sizeof
(
ErrorBuff
),
...
...
@@ -83,7 +93,7 @@ Data _DecompressTask::process(Data& src)
return_code
,
src
.
size
());
throw
ProcessException
(
ErrorBuff
);
}
if
(
src
.
depth
()
==
4
&&
depth
==
2
)
if
(
expand_16_to_32bit
)
{
_expend
(
dst
,
src
);
free
(
dst
);
...
...
src/EigerInterface.cpp
View file @
24a1e1c6
...
...
@@ -99,9 +99,6 @@ void Interface::prepareAcq()
m_stream
->
setActive
(
!
use_filewriter
);
m_decompress
->
setActive
(
!
use_filewriter
);
Camera
::
CompressionType
c
=
use_filewriter
?
Camera
::
BSLZ4
:
Camera
::
LZ4
;
m_cam
.
setCompressionType
(
c
);
m_cam
.
prepareAcq
();
int
serie_id
;
m_cam
.
getSerieId
(
serie_id
);
m_saving
->
setSerieId
(
serie_id
);
...
...
src/EigerStream.cpp
View file @
24a1e1c6
...
...
@@ -214,6 +214,11 @@ bool Stream::isRunning() const
return
m_running
;
}
void
Stream
::
getCompressionType
(
Camera
::
CompressionType
&
type
)
const
{
m_cam
.
getCompressionType
(
type
);
}
void
Stream
::
getHeaderDetail
(
Stream
::
HeaderDetail
&
detail
)
const
{
AutoMutex
lock
(
m_cond
.
mutex
());
...
...
src/EigerStream.h
View file @
24a1e1c6
...
...
@@ -44,7 +44,9 @@ namespace lima
void
start
();
void
stop
();
bool
isRunning
()
const
;
void
getCompressionType
(
Camera
::
CompressionType
&
type
)
const
;
void
getHeaderDetail
(
HeaderDetail
&
)
const
;
void
setHeaderDetail
(
HeaderDetail
);
...
...
tango/Eiger.py
View file @
24a1e1c6
...
...
@@ -83,6 +83,8 @@ class Eiger(PyTango.Device_4Impl):
'OFF'
:
False
}
self
.
__PixelMask
=
{
'ON'
:
True
,
'OFF'
:
False
}
self
.
__CompressionType
=
{
'LZ4'
:
EigerAcq
.
Camera
.
LZ4
,
'BSLZ4'
:
EigerAcq
.
Camera
.
BSLZ4
}
#------------------------------------------------------------------
...
...
@@ -201,6 +203,10 @@ class EigerClass(PyTango.DeviceClass):
[[
PyTango
.
DevString
,
PyTango
.
SCALAR
,
PyTango
.
READ_WRITE
]],
'compression_type'
:
[[
PyTango
.
DevString
,
PyTango
.
SCALAR
,
PyTango
.
READ_WRITE
]],
'threshold_energy'
:
[[
PyTango
.
DevFloat
,
PyTango
.
SCALAR
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment