mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-21 11:48:54 -04:00
SDRdaemonFEC plugin: migrate to new cm256cc library
This commit is contained in:
parent
a0729ce6f5
commit
bda1d8997b
35
cmake/Modules/FindCM256cc.cmake
Normal file
35
cmake/Modules/FindCM256cc.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(PC_CM256cc "libcm256cc")
|
||||
|
||||
FIND_PATH(CM256CC_INCLUDE_DIR
|
||||
NAMES cm256.h
|
||||
HINTS ${PC_CM256CC_INCLUDE_DIR}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${LIBCM256CC_INSTALL_PREFIX}/include
|
||||
PATHS
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(CM256CC_LIBRARIES
|
||||
NAMES cm256cc libcm256cc
|
||||
HINTS ${PC_CM256CC_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
PATHS
|
||||
${CM256CC_INCLUDE_DIR}/../lib
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
if(CM256CC_INCLUDE_DIR AND CM256CC_LIBRARIES)
|
||||
set(CM256CC_FOUND TRUE CACHE INTERNAL "CM256CC found")
|
||||
message(STATUS "Found CM256cc: ${CM256CC_INCLUDE_DIR}, ${CM256CC_LIBRARIES}")
|
||||
else(CM256CC_INCLUDE_DIR AND CM256CC_LIBRARIES)
|
||||
set(CM256CC_FOUND FALSE CACHE INTERNAL "CM256CC found")
|
||||
message(STATUS "CM256cc not found")
|
||||
endif(CM256CC_INCLUDE_DIR AND CM256CC_LIBRARIES)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CM256CC DEFAULT_MSG CM256CC_LIBRARIES CM256CC_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(CM256CC_LIBRARIES CM256CC_INCLUDE_DIR)
|
@ -47,10 +47,10 @@ endif(LIBUSB_FOUND AND LIBHACKRF_FOUND)
|
||||
# add_subdirectory(sdrdaemon)
|
||||
#endif(LIBNANOMSG_FOUND)
|
||||
|
||||
find_package(CM256)
|
||||
if(CM256_FOUND)
|
||||
find_package(CM256cc)
|
||||
if(CM256CC_FOUND)
|
||||
add_subdirectory(sdrdaemonfec)
|
||||
endif(CM256_FOUND)
|
||||
endif(CM256CC_FOUND)
|
||||
|
||||
add_subdirectory(filesource)
|
||||
add_subdirectory(sdrdaemon)
|
||||
|
@ -42,13 +42,13 @@ add_library(inputsdrdaemonfec SHARED
|
||||
)
|
||||
|
||||
target_include_directories(inputsdrdaemonfec PUBLIC
|
||||
${CM256_INCLUDE_DIR}
|
||||
${CM256CC_INCLUDE_DIR}
|
||||
${LIBNANOMSG_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(inputsdrdaemonfec
|
||||
${QT_LIBRARIES}
|
||||
${CM256_LIBRARIES}
|
||||
${CM256CC_LIBRARIES}
|
||||
${LIBNANOMSG_LIBRARIES}
|
||||
sdrbase
|
||||
)
|
||||
|
@ -50,9 +50,9 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) :
|
||||
m_paramsCM256.BlockBytes = sizeof(ProtectedBlock); // never changes
|
||||
m_paramsCM256.OriginalCount = m_nbOriginalBlocks; // never changes
|
||||
|
||||
if (cm256_init()) {
|
||||
if (!m_cm256.isInitialized()) {
|
||||
m_cm256_OK = false;
|
||||
qDebug() << "SDRdaemonFECBuffer::SDRdaemonFECBuffer: cannot initialize CM256 library";
|
||||
qDebug() << "SDRdaemonFECBuffer::SDRdaemonFECBuffer: cannot initialize CM256 library";
|
||||
} else {
|
||||
m_cm256_OK = true;
|
||||
}
|
||||
@ -249,7 +249,7 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
||||
m_paramsCM256.RecoveryCount = m_decoderSlots[decoderIndex].m_recoveryCount;
|
||||
}
|
||||
|
||||
if (cm256_decode(m_paramsCM256, m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks)) // CM256 decode
|
||||
if (m_cm256.cm256_decode(m_paramsCM256, m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks)) // CM256 decode
|
||||
{
|
||||
qDebug() << "SDRdaemonFECBuffer::writeData: decode CM256 error:"
|
||||
<< " m_originalCount: " << m_decoderSlots[decoderIndex].m_originalCount
|
||||
|
@ -163,7 +163,7 @@ private:
|
||||
{
|
||||
ProtectedBlock m_originalBlocks[m_nbOriginalBlocks]; //!< Original blocks retrieved directly or by later FEC
|
||||
ProtectedBlock m_recoveryBlocks[m_nbOriginalBlocks]; //!< Recovery blocks (FEC blocks) with max size
|
||||
cm256_block m_cm256DescriptorBlocks[m_nbOriginalBlocks]; //!< CM256 decoder descriptors (block addresses and block indexes)
|
||||
CM256::cm256_block m_cm256DescriptorBlocks[m_nbOriginalBlocks]; //!< CM256 decoder descriptors (block addresses and block indexes)
|
||||
int m_blockCount; //!< number of blocks received for this frame
|
||||
int m_originalCount; //!< number of original blocks received
|
||||
int m_recoveryCount; //!< number of recovery blocks received
|
||||
@ -172,7 +172,7 @@ private:
|
||||
};
|
||||
|
||||
MetaDataFEC m_currentMeta; //!< Stored current meta data
|
||||
cm256_encoder_params m_paramsCM256; //!< CM256 decoder parameters block
|
||||
CM256::cm256_encoder_params m_paramsCM256; //!< CM256 decoder parameters block
|
||||
DecoderSlot m_decoderSlots[nbDecoderSlots]; //!< CM256 decoding control/buffer slots
|
||||
BufferFrame m_frames[nbDecoderSlots]; //!< Samples buffer
|
||||
int m_framesNbBytes; //!< Number of bytes in samples buffer
|
||||
@ -199,6 +199,7 @@ private:
|
||||
int m_nbWrites; //!< Number of buffer writes since start of auto R/W balance correction period
|
||||
int m_balCorrection; //!< R/W balance correction in number of samples
|
||||
int m_balCorrLimit; //!< Correction absolute value limit in number of samples
|
||||
CM256 m_cm256; //!< CM256 library
|
||||
bool m_cm256_OK; //!< CM256 library initialized OK
|
||||
|
||||
void initDecodeAllSlots();
|
||||
|
@ -56,6 +56,4 @@ class MovingAverage
|
||||
Total m_total;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* GR_SDRDAEMONFEC_LIB_MOVINGAVERAGE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user