summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-02 08:49:09 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-02 08:49:09 +0100
commit57f2f8976b37ba6f6ec188c77e38cd854d594233 (patch)
tree4fed2b8e73132f4f5d00f1565675c75380af6b97 /src
parentcb3a933340614866f7b6a3dd0977956450a161dd (diff)
downloadlibufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.gz
libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.bz2
libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.tar.xz
libufodecode-57f2f8976b37ba6f6ec188c77e38cd854d594233.zip
Rename to `ufodecode`
Diffstat (limited to 'src')
-rw-r--r--src/libipe.h27
-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.h27
4 files changed, 54 insertions, 52 deletions
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
+