mirror of
https://github.com/steve-m/hsdaoh.git
synced 2026-03-14 21:09:44 +01:00
Revert "lib: optionally use crc-fast-rust library"
This reverts commit a71d50969d.
This commit is contained in:
parent
cd217c889c
commit
97a8e5224b
4 changed files with 7 additions and 86 deletions
|
|
@ -113,8 +113,6 @@ else()
|
|||
set(LIBFLAC_INCLUDE_DIRS "" CACHE STRING "manual FLAC includepath")
|
||||
endif()
|
||||
|
||||
find_package(CRCFAST)
|
||||
|
||||
if(PKG_CONFIG_FOUND AND NOT LIBUSB_FOUND)
|
||||
message(FATAL_ERROR "LibUSB 1.0 required to compile hsdaoh")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
find_path(CRCFAST_INCLUDE_DIR
|
||||
NAMES libcrc_fast.h
|
||||
)
|
||||
|
||||
find_library(CRCFAST_LIBRARY
|
||||
NAMES crc_fast
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CRCFAST
|
||||
REQUIRED_VARS CRCFAST_LIBRARY CRCFAST_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(CRCFAST_FOUND)
|
||||
add_library(CRCFAST::CRCFAST UNKNOWN IMPORTED)
|
||||
set_target_properties(CRCFAST::CRCFAST PROPERTIES
|
||||
IMPORTED_LOCATION "${CRCFAST_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CRCFAST_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
|
@ -15,38 +15,11 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(HSDAOH_COMMON_SOURCES
|
||||
libhsdaoh.c
|
||||
format_convert.c
|
||||
iqconverter_float.c
|
||||
)
|
||||
|
||||
if(NOT CRCFAST_FOUND)
|
||||
list(APPEND HSDAOH_COMMON_SOURCES
|
||||
crcspeed.c
|
||||
crc16speed.c
|
||||
crc_simd.c
|
||||
)
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
# Setup shared library variant
|
||||
########################################################################
|
||||
add_library(hsdaoh SHARED ${HSDAOH_COMMON_SOURCES})
|
||||
|
||||
target_link_libraries(hsdaoh
|
||||
${LIBUSB_LIBRARIES}
|
||||
${LIBUVC_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
if(CRCFAST_FOUND)
|
||||
target_link_libraries(hsdaoh CRCFAST::CRCFAST)
|
||||
target_compile_definitions(hsdaoh PRIVATE HAVE_CRCFAST=1)
|
||||
else()
|
||||
target_compile_definitions(hsdaoh PRIVATE HAVE_CRCFAST=0)
|
||||
endif()
|
||||
|
||||
add_library(hsdaoh SHARED libhsdaoh.c format_convert.c iqconverter_float.c crcspeed.c crc16speed.c crc_simd.c)
|
||||
target_link_libraries(hsdaoh ${LIBUSB_LIBRARIES} ${LIBUVC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_include_directories(hsdaoh PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||
|
|
@ -62,22 +35,8 @@ generate_export_header(hsdaoh)
|
|||
########################################################################
|
||||
# Setup static library variant
|
||||
########################################################################
|
||||
add_library(hsdaoh_static STATIC ${HSDAOH_COMMON_SOURCES})
|
||||
|
||||
target_link_libraries(hsdaoh_static
|
||||
m
|
||||
${LIBUSB_LIBRARIES}
|
||||
${LIBUVC_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
if(CRCFAST_FOUND)
|
||||
target_link_libraries(hsdaoh_static CRCFAST::CRCFAST)
|
||||
target_compile_definitions(hsdaoh_static PRIVATE HAVE_CRCFAST=1)
|
||||
else()
|
||||
target_compile_definitions(hsdaoh_static PRIVATE HAVE_CRCFAST=0)
|
||||
endif()
|
||||
|
||||
add_library(hsdaoh_static STATIC libhsdaoh.c format_convert.c iqconverter_float.c crcspeed.c crc16speed.c crc_simd.c)
|
||||
target_link_libraries(hsdaoh m ${LIBUSB_LIBRARIES} ${LIBUVC_LIBRARIES} ${THREADS_PTHREADS_LIBRARY})
|
||||
target_include_directories(hsdaoh_static PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||
|
|
|
|||
|
|
@ -41,19 +41,14 @@
|
|||
#include <libusb.h>
|
||||
#include <libuvc/libuvc.h>
|
||||
|
||||
#if HAVE_CRCFAST
|
||||
#include <libcrc_fast.h>
|
||||
#else
|
||||
#include <crc16speed.h>
|
||||
#include <crc_simd.h>
|
||||
#endif
|
||||
|
||||
#include <iqconverter_float.h>
|
||||
#include <filters.h>
|
||||
|
||||
#include <hsdaoh.h>
|
||||
#include <hsdaoh_private.h>
|
||||
#include <format_convert.h>
|
||||
#include <crc16speed.h>
|
||||
#include <crc_simd.h>
|
||||
|
||||
#define DEFAULT_BUFFERS 96
|
||||
|
||||
|
|
@ -556,10 +551,8 @@ int hsdaoh_open(hsdaoh_dev_t **out_dev, uint32_t index)
|
|||
dev->cnv_f1 = iqconverter_float_create(HB_KERNEL_FLOAT, HB_KERNEL_FLOAT_LEN);
|
||||
dev->cnv_f2 = iqconverter_float_create(HB_KERNEL_FLOAT, HB_KERNEL_FLOAT_LEN);
|
||||
|
||||
#if HAVE_CRCFAST == 0
|
||||
crc16speed_init();
|
||||
crc16_simd_init();
|
||||
#endif
|
||||
|
||||
found:
|
||||
*out_dev = dev;
|
||||
|
|
@ -756,15 +749,6 @@ inline int hsdaoh_check_idle_cnt(hsdaoh_dev_t *dev, uint16_t *buf, size_t length
|
|||
return idle_counter_errors;
|
||||
}
|
||||
|
||||
static inline uint16_t hsdaoh_crc16(uint8_t *buf, unsigned int len)
|
||||
{
|
||||
#if HAVE_CRCFAST
|
||||
return (uint16_t)crc_fast_checksum(Crc16Ibm3740, (const char *)buf, len);
|
||||
#else
|
||||
return crc16_simd(0xffff, buf, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Extract the metadata stored in the upper 4 bits of the last word of each line */
|
||||
inline void hsdaoh_extract_metadata(uint8_t *data, metadata_t *metadata, unsigned int width)
|
||||
{
|
||||
|
|
@ -848,7 +832,7 @@ static void hsdaoh_process_frame(hsdaoh_dev_t *dev, uint8_t *data, int size)
|
|||
frame_errors++;
|
||||
|
||||
dev->last_crc[1] = dev->last_crc[0];
|
||||
dev->last_crc[0] = hsdaoh_crc16(line_dat, dev->width * sizeof(uint16_t));
|
||||
dev->last_crc[0] = crc16_simd(0xffff, line_dat, dev->width * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
if ((payload_len > 0) && dev->stream_synced) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue