summaryrefslogtreecommitdiffstats
path: root/src/libipe.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-01 11:01:51 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-12-01 11:01:51 +0100
commit845a638d4c7183ed91b223fbd5047a9cc27b47c8 (patch)
treea485127fbe01f0b407c96670565a1546a7e8a5c3 /src/libipe.c
parentff3390720f5f3d37995986665e38f189a49d514e (diff)
downloadlibufodecode-845a638d4c7183ed91b223fbd5047a9cc27b47c8.tar.gz
libufodecode-845a638d4c7183ed91b223fbd5047a9cc27b47c8.tar.bz2
libufodecode-845a638d4c7183ed91b223fbd5047a9cc27b47c8.tar.xz
libufodecode-845a638d4c7183ed91b223fbd5047a9cc27b47c8.zip
Set frame number/timestamp and write results
Diffstat (limited to 'src/libipe.c')
-rw-r--r--src/libipe.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libipe.c b/src/libipe.c
index 7b919d5..b0db74d 100644
--- a/src/libipe.c
+++ b/src/libipe.c
@@ -73,7 +73,6 @@ void ipe_decoder_set_raw_data(ipe_decoder decoder, uint32_t *raw, size_t num_byt
decoder->current_pos = 0;
}
-
static int ipe_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 };
@@ -83,14 +82,14 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows,
int channel = 0;
int pos = 0;
uint32_t data;
+ const int bytes = 43;
do {
info = raw[0];
- channel = info & 0x0F;
row = (info >> 4) & 0x7FF;
int pixels = (info >> 20) & 0xFF;
- channel = channel_order[channel];
+ channel = channel_order[info & 0x0F];
int base = row * IPECAMERA_WIDTH + channel * IPECAMERA_PIXELS_PER_CHANNEL;
#ifdef DEBUG
@@ -112,12 +111,6 @@ static int ipe_decode_frame(uint16_t *pixel_buffer, uint32_t *raw, int num_rows,
CHECK_FLAG("number of pixels, %i is expected", pixels == IPECAMERA_PIXELS_PER_CHANNEL, pixels, IPECAMERA_PIXELS_PER_CHANNEL);
#endif
- int bytes = 43;
- /* bytes = pixels / 3; */
- /* int ppw = pixels - bytes * 3; */
- /* if (ppw) */
- /* ++bytes; */
-
for (int i = 1; i < bytes; i++) {
data = raw[i];
@@ -259,11 +252,13 @@ int ipe_decoder_get_next_frame(ipe_decoder decoder, uint16_t **pixels, uint32_t
if (err)
return EILSEQ;
#else
+ *frame_number = raw[pos + 6] & 0xF0000000;
+ *time_stamp = raw[pos + 7] & 0xF0000000;
pos += 8;
#endif
err = ipe_decode_frame(*pixels, raw + pos, decoder->height, &advance);
- if (err)
+ if (err)
return EILSEQ;
pos += advance;