diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-06-18 16:50:25 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2015-06-18 16:50:25 +0200 |
commit | f2ca02d18e037c42c278a24c68e9bdf216d9bf6b (patch) | |
tree | dea80449147998e1a07883252d769401ea51b79b /src/ufodecode.c | |
parent | 1964f8ecb4c10368c6b8f9af4503e73beaa4c552 (diff) | |
download | libufodecode-f2ca02d18e037c42c278a24c68e9bdf216d9bf6b.tar.gz libufodecode-f2ca02d18e037c42c278a24c68e9bdf216d9bf6b.tar.bz2 libufodecode-f2ca02d18e037c42c278a24c68e9bdf216d9bf6b.tar.xz libufodecode-f2ca02d18e037c42c278a24c68e9bdf216d9bf6b.zip |
Start using the common pre-header
Diffstat (limited to 'src/ufodecode.c')
-rw-r--r-- | src/ufodecode.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ufodecode.c b/src/ufodecode.c index 25ed02c..aecb554 100644 --- a/src/ufodecode.c +++ b/src/ufodecode.c @@ -25,6 +25,13 @@ #define IPECAMERA_MODE_10_BIT_ADC 0 typedef struct { + unsigned no_ext_header : 1; + unsigned version: 3; + unsigned ones : 24; + unsigned five: 4; +} pre_header_t; + +typedef struct { unsigned int pixel_number : 8; unsigned int row_number : 12; unsigned int pixel_size : 4; @@ -260,12 +267,18 @@ ufo_decoder_decode_frame(UfoDecoder *decoder, uint32_t *raw, size_t num_bytes, u size_t pos = 0; size_t advance = 0; const size_t num_words = num_bytes / 4; + const pre_header_t *pre_header; if ((pixels == NULL) || (num_words < 16)) return 0; + pre_header = (pre_header_t *) raw; + + CHECK_VALUE(pre_header->five, 0x5); + CHECK_VALUE(pre_header->ones, 0x111111); + size_t rows_per_frame = decoder->height; - const int version = (raw[pos+6] >> 24) & 0xF; + const int version = pre_header->version + 5; /* it starts with 0 */ #ifdef DEBUG CHECK_VALUE(raw[pos++], 0x51111111); |