summaryrefslogtreecommitdiffstats
path: root/ipecamera/reader.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-03-29 18:05:58 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-03-29 18:05:58 +0200
commitadb36212be886985dbaf397d7d2dd875b3d4aab8 (patch)
tree292b252b22f823eb4eb8753c7d437b723e23a85b /ipecamera/reader.c
parentb222af943c405df509eb9df084d203da4fbd324e (diff)
downloadipecamera-adb36212be886985dbaf397d7d2dd875b3d4aab8.tar.gz
ipecamera-adb36212be886985dbaf397d7d2dd875b3d4aab8.tar.bz2
ipecamera-adb36212be886985dbaf397d7d2dd875b3d4aab8.tar.xz
ipecamera-adb36212be886985dbaf397d7d2dd875b3d4aab8.zip
Fix frame size computation in ipecamera and few debuging options
Diffstat (limited to 'ipecamera/reader.c')
-rw-r--r--ipecamera/reader.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ipecamera/reader.c b/ipecamera/reader.c
index 1f054ae..cad5da8 100644
--- a/ipecamera/reader.c
+++ b/ipecamera/reader.c
@@ -24,11 +24,10 @@
int ipecamera_compute_buffer_size(ipecamera_t *ctx, size_t lines) {
const size_t header_size = 8 * sizeof(ipecamera_payload_t);
- const size_t footer_size = 16 * sizeof(ipecamera_payload_t);
+ const size_t footer_size = 8 * sizeof(ipecamera_payload_t);
size_t line_size, raw_size, padded_blocks;
-
switch (ctx->firmware) {
case 4:
line_size = IPECAMERA_MAX_CHANNELS * (2 + IPECAMERA_PIXELS_PER_CHANNEL / 3) * sizeof(ipecamera_payload_t);
@@ -36,8 +35,9 @@ int ipecamera_compute_buffer_size(ipecamera_t *ctx, size_t lines) {
break;
default:
line_size = (1 + IPECAMERA_PIXELS_PER_CHANNEL) * 32;
- raw_size = header_size + lines * line_size - 32 + footer_size;
+ raw_size = lines * line_size;
raw_size *= 16 / ctx->cmosis_outputs;
+ raw_size += header_size + footer_size;
}
padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);
@@ -93,7 +93,7 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
size_t real_size;
size_t extra_data = 0;
#endif /* IPECAMERA_BUG_MULTIFRAME_PACKETS */
-
+
ipecamera_t *ctx = (ipecamera_t*)user;
#if defined(IPECAMERA_BUG_INCOMPLETE_PACKETS)||defined(IPECAMERA_BUG_MULTIFRAME_PACKETS)
@@ -185,6 +185,8 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
//bufsize = need;
eof = 1;
}
+
+// printf("%lu %lu %lu - %u\n", ctx->event_id, ctx->cur_size, ctx->cur_raw_size, eof);
// just rip of padding
bufsize = ctx->cur_raw_size - ctx->cur_size;