diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-12-02 08:49:09 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-12-02 08:49:09 +0100 |
commit | 57f2f8976b37ba6f6ec188c77e38cd854d594233 (patch) | |
tree | 4fed2b8e73132f4f5d00f1565675c75380af6b97 | |
parent | cb3a933340614866f7b6a3dd0977956450a161dd (diff) | |
download | libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.gz libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.bz2 libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.xz libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.zip |
Rename to `ufodecode`
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | src/libipe.h | 27 | ||||
-rw-r--r-- | src/ufodecode-private.h (renamed from src/libipe-private.h) | 6 | ||||
-rw-r--r-- | src/ufodecode.c (renamed from src/libipe.c) | 46 | ||||
-rw-r--r-- | src/ufodecode.h | 27 | ||||
-rw-r--r-- | test/ipedec.c | 8 | ||||
-rw-r--r-- | ufodecode.pc.in (renamed from ipe.pc.in) | 4 |
7 files changed, 73 insertions, 71 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f541898..6c7c2fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 2.8) -set(TARNAME "libipe") +set(TARNAME "libufodecode") -set(LIBIPE_API_VERSION "0.1.0") -set(LIBIPE_ABI_VERSION "0.1.0") -set(LIBIPE_ABI_MAJOR_VERSION "0") +set(LIBUFODECODE_API_VERSION "0.1.0") +set(LIBUFODECODE_ABI_VERSION "0.1.0") +set(LIBUFODECODE_ABI_MAJOR_VERSION "0") set(PACKAGE_VERSION "0.1.0") set(PACKAGE_NAME "${TARNAME}") @@ -63,23 +63,23 @@ include_directories( add_definitions("--std=c99 -Wall -O2 ${SSE_FLAGS}") -add_library(ipe SHARED src/libipe.c) +add_library(ufodecode SHARED src/ufodecode.c) -set_target_properties(ipe PROPERTIES - VERSION ${LIBIPE_ABI_VERSION} - SOVERSION ${LIBIPE_ABI_MAJOR_VERSION} +set_target_properties(ufodecode PROPERTIES + VERSION ${LIBUFODECODE_ABI_VERSION} + SOVERSION ${LIBUFODECODE_ABI_MAJOR_VERSION} ) -install(TARGETS ipe +install(TARGETS ufodecode LIBRARY DESTINATION lib${LIB_SUFFIX} ) install(FILES - src/libipe.h + src/ufodecode.h DESTINATION include ) -configure_file(ipe.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ipe.pc) +configure_file(ufodecode.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ufodecode.pc) if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug") set(DEBUG "1") @@ -87,12 +87,12 @@ endif() configure_file(src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/ipe.pc + ${CMAKE_CURRENT_BINARY_DIR}/ufodecode.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) # --- Build test executable ------------------------------------------------- add_executable(ipedec test/ipedec.c) -target_link_libraries(ipedec ipe) +target_link_libraries(ipedec ufodecode) install(TARGETS ipedec DESTINATION ${BIN_INSTALL_DIR}) diff --git a/src/libipe.h b/src/libipe.h deleted file mode 100644 index 5abc6e4..0000000 --- a/src/libipe.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef LIB_IPE_H -#define LIB_IPE_H - -#include <inttypes.h> - -typedef struct ipe_decoder_t *ipe_decoder; - -#ifdef __cplusplus -extern "C" { -#endif - - -ipe_decoder ipe_decoder_new(uint32_t height, uint32_t *raw, size_t num_bytes); -void ipe_decoder_free(ipe_decoder decoder); -void ipe_decoder_set_raw_data(ipe_decoder decoder, uint32_t *raw, size_t num_bytes); -int ipe_decoder_get_next_frame(ipe_decoder decoder, uint16_t **pixels, uint32_t *frame_number, uint32_t *time_stamp); - -void ipe_deinterlace_interpolate(const uint16_t *frame_in, uint16_t *frame_out, int width, int height); -void ipe_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *out, int width, int height); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/libipe-private.h b/src/ufodecode-private.h index 8d7de1c..4dce6bc 100644 --- a/src/libipe-private.h +++ b/src/ufodecode-private.h @@ -1,9 +1,9 @@ -#ifndef LIB_IPE_PRIVATE_H -#define LIB_IPE_PRIVATE_H +#ifndef LIB_UFODECODE_PRIVATE_H +#define LIB_UFODECODE_PRIVATE_H #include <stdbool.h> -struct ipe_decoder_t { +struct ufo_decoder_t { uint32_t height; uint32_t *raw; size_t num_bytes; diff --git a/src/libipe.c b/src/ufodecode.c index 466056a..b2c496a 100644 --- a/src/libipe.c +++ b/src/ufodecode.c @@ -3,10 +3,13 @@ #include <stdlib.h> #include <string.h> #include <errno.h> -#include "libipe.h" -#include "libipe-private.h" +#include "ufodecode.h" +#include "ufodecode-private.h" #include "config.h" + +#ifdef HAVE_SSE #include <xmmintrin.h> +#endif #define IPECAMERA_NUM_CHANNELS 16 #define IPECAMERA_PIXELS_PER_CHANNEL 128 @@ -31,20 +34,20 @@ * * \param height Number of rows that are expected in the data stream * \param raw The data stream from the camera or NULL if set later with - * ipe_decoder_set_raw_data. + * ufo_decoder_set_raw_data. * \param num_bytes Size of the data stream buffer in bytes * * \return A new decoder instance that can be used to iterate over the frames - * using ipe_decoder_get_next_frame. + * using ufo_decoder_get_next_frame. */ -ipe_decoder ipe_decoder_new(uint32_t height, uint32_t *raw, size_t num_bytes) +ufo_decoder ufo_decoder_new(uint32_t height, uint32_t *raw, size_t num_bytes) { - ipe_decoder decoder = malloc(sizeof(struct ipe_decoder_t)); + ufo_decoder decoder = malloc(sizeof(struct ufo_decoder_t)); if (decoder == NULL) return NULL; decoder->height = height; - ipe_decoder_set_raw_data(decoder, raw, num_bytes); + ufo_decoder_set_raw_data(decoder, raw, num_bytes); return decoder; } @@ -52,9 +55,9 @@ ipe_decoder ipe_decoder_new(uint32_t height, uint32_t *raw, size_t num_bytes) /** * \brief Release decoder instance * - * \param decoder An ipe_decoder instance + * \param decoder An ufo_decoder instance */ -void ipe_decoder_free(ipe_decoder decoder) +void ufo_decoder_free(ufo_decoder decoder) { free(decoder); } @@ -63,18 +66,18 @@ void ipe_decoder_free(ipe_decoder decoder) /** * \brief Set raw data stream * - * \param decoder An ipe_decoder instance + * \param decoder An ufo_decoder instance * \param raw Raw data stream * \param num_bytes Size of data stream buffer in bytes */ -void ipe_decoder_set_raw_data(ipe_decoder decoder, uint32_t *raw, size_t num_bytes) +void ufo_decoder_set_raw_data(ufo_decoder decoder, uint32_t *raw, size_t num_bytes) { decoder->raw = raw; decoder->num_bytes = num_bytes; decoder->current_pos = 0; } -static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, int *offset) +static int ufo_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, int *offset) { static int channel_order[IPECAMERA_NUM_CHANNELS] = { 15, 13, 14, 12, 10, 8, 11, 7, 9, 6, 5, 2, 4, 3, 0, 1 }; @@ -86,8 +89,7 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, const int bytes = 43; #ifdef HAVE_SSE - const uint32_t mask = 0x3FF; - __m128i mmask = _mm_set_epi32(mask, mask, mask, mask); + __m128i mask = _mm_set_epi32(0x3FF, 0x3FF, 0x3FF, 0x3FF); __m128i packed; __m128i tmp1, tmp2; uint32_t result[4] __attribute__ ((aligned (16))) = {0}; @@ -125,7 +127,7 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, packed = _mm_set_epi32(raw[i], raw[i+1], raw[i+2], raw[i+3]); tmp1 = _mm_srli_epi32(packed, 20); - tmp2 = _mm_and_si128(tmp1, mmask); + tmp2 = _mm_and_si128(tmp1, mask); _mm_storeu_si128((__m128i*) result, tmp2); pixel_buffer[base] = result[0]; pixel_buffer[base+3] = result[1]; @@ -133,14 +135,14 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, pixel_buffer[base+9] = result[3]; tmp1 = _mm_srli_epi32(packed, 10); - tmp2 = _mm_and_si128(tmp1, mmask); + tmp2 = _mm_and_si128(tmp1, mask); _mm_storeu_si128((__m128i*) result, tmp2); pixel_buffer[base+1] = result[0]; pixel_buffer[base+4] = result[1]; pixel_buffer[base+7] = result[2]; pixel_buffer[base+10] = result[3]; - tmp1 = _mm_and_si128(packed, mmask); + tmp1 = _mm_and_si128(packed, mask); _mm_storeu_si128((__m128i*) result, tmp1); pixel_buffer[base+2] = result[0]; pixel_buffer[base+5] = result[1]; @@ -200,7 +202,7 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows, * \param width Width of frame in pixels * \param heigh Height of frame in pixels */ -void ipe_deinterlace_interpolate(const uint16_t *in, uint16_t *out, int width, int height) +void ufo_deinterlace_interpolate(const uint16_t *in, uint16_t *out, int width, int height) { const size_t row_size_bytes = width * sizeof(uint16_t); @@ -230,7 +232,7 @@ void ipe_deinterlace_interpolate(const uint16_t *in, uint16_t *out, int width, i * \param width Width of frame in pixels * \param heigh Height of frame in pixels */ -void ipe_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *out, int width, int height) +void ufo_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *out, int width, int height) { const size_t row_size_bytes = width * sizeof(uint16_t); for (int row = 0; row < height; row++) { @@ -248,7 +250,7 @@ void ipe_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *o * This function tries to decode the next frame in the currently set raw data * stream. * - * \param decoder An ipe_decoder instance + * \param decoder An ufo_decoder instance * \param pixels If pointer with NULL content is passed, a new buffer is * allocated otherwise, this user-supplied buffer is used. * \param frame_number Frame number as reported in the header @@ -258,7 +260,7 @@ void ipe_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *o * NULL was passed but no memory could be allocated, EILSEQ if data stream is * corrupt and EFAULT if pixels is a NULL-pointer. */ -int ipe_decoder_get_next_frame(ipe_decoder decoder, uint16_t **pixels, uint32_t *frame_number, uint32_t *time_stamp) +int ufo_decoder_get_next_frame(ufo_decoder decoder, uint16_t **pixels, uint32_t *frame_number, uint32_t *time_stamp) { uint32_t *raw = decoder->raw; @@ -301,7 +303,7 @@ int ipe_decoder_get_next_frame(ipe_decoder decoder, uint16_t **pixels, uint32_t pos += 8; #endif - err = ipe_decode_frame(*pixels, raw + pos, decoder->height, &advance); + err = ufo_decode_frame(*pixels, raw + pos, decoder->height, &advance); if (err) return EILSEQ; diff --git a/src/ufodecode.h b/src/ufodecode.h new file mode 100644 index 0000000..6d9bdce --- /dev/null +++ b/src/ufodecode.h @@ -0,0 +1,27 @@ +#ifndef LIB_UFODECODE_H +#define LIB_UFODECODE_H + +#include <inttypes.h> + +typedef struct ufo_decoder_t *ufo_decoder; + +#ifdef __cplusplus +extern "C" { +#endif + + +ufo_decoder ufo_decoder_new(uint32_t height, uint32_t *raw, size_t num_bytes); +void ufo_decoder_free(ufo_decoder decoder); +void ufo_decoder_set_raw_data(ufo_decoder decoder, uint32_t *raw, size_t num_bytes); +int ufo_decoder_get_next_frame(ufo_decoder decoder, uint16_t **pixels, uint32_t *frame_number, uint32_t *time_stamp); + +void ufo_deinterlace_interpolate(const uint16_t *frame_in, uint16_t *frame_out, int width, int height); +void ufo_deinterlace_weave(const uint16_t *in1, const uint16_t *in2, uint16_t *out, int width, int height); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/test/ipedec.c b/test/ipedec.c index 2b44ddd..94c8d59 100644 --- a/test/ipedec.c +++ b/test/ipedec.c @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/time.h> #include <errno.h> -#include <libipe.h> +#include <ufodecode.h> int read_raw_file(const char *filename, char **buffer, size_t *length) @@ -47,7 +47,7 @@ int main(int argc, char const* argv[]) const int rows = atoi(argv[2]); - ipe_decoder decoder = ipe_decoder_new(rows, (uint32_t *) buffer, num_bytes); + ufo_decoder decoder = ufo_decoder_new(rows, (uint32_t *) buffer, num_bytes); int err = 0; uint16_t *pixels = (uint16_t *) malloc(2048 * rows * sizeof(uint16_t)); uint32_t frame_number, time_stamp; @@ -59,7 +59,7 @@ int main(int argc, char const* argv[]) while (!err) { gettimeofday(&start, NULL); - err = ipe_decoder_get_next_frame(decoder, &pixels, &frame_number, &time_stamp); + err = ufo_decoder_get_next_frame(decoder, &pixels, &frame_number, &time_stamp); gettimeofday(&end, NULL); if (!err) { @@ -75,7 +75,7 @@ int main(int argc, char const* argv[]) printf("Decoded %i frames in %.5fms\n", num_frames, mtime); free(pixels); - ipe_decoder_free(decoder); + ufo_decoder_free(decoder); free(buffer); return 0; diff --git a/ipe.pc.in b/ufodecode.pc.in index bbd9311..f9b007a 100644 --- a/ipe.pc.in +++ b/ufodecode.pc.in @@ -3,8 +3,8 @@ exec_prefix=${BIN_INSTALL_DIR} libdir=${LIB_INSTALL_DIR} includedir=${INCLUDE_INSTALL_DIR} -Name: libipe +Name: ${TARNAME} Description: Decoding routines for the UFO camera Version: ${PACKAGE_VERSION} -Libs: -L${LIB_INSTALL_DIR} -lipe +Libs: -L${LIB_INSTALL_DIR} -lufodecode Cflags: -I${INCLUDE_INSTALL_DIR} |