summaryrefslogtreecommitdiffstats
path: root/ipecamera/reader.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-24 23:15:47 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-24 23:15:47 +0200
commit94051a28c0cd484e47b115f4251fa42d0edba7e5 (patch)
tree318dcfac5f232058e3a019018301abbed23eeae7 /ipecamera/reader.c
parent587863fb5bc46f225c3b192ca4c2f63e0be8613b (diff)
downloadipecamera-94051a28c0cd484e47b115f4251fa42d0edba7e5.tar.gz
ipecamera-94051a28c0cd484e47b115f4251fa42d0edba7e5.tar.bz2
ipecamera-94051a28c0cd484e47b115f4251fa42d0edba7e5.tar.xz
ipecamera-94051a28c0cd484e47b115f4251fa42d0edba7e5.zip
Support 12-bit modes
Diffstat (limited to 'ipecamera/reader.c')
-rw-r--r--ipecamera/reader.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ipecamera/reader.c b/ipecamera/reader.c
index 645af48..cf5fc5c 100644
--- a/ipecamera/reader.c
+++ b/ipecamera/reader.c
@@ -25,8 +25,12 @@ 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 = 8 * sizeof(ipecamera_payload_t);
- size_t raw_size = header_size + lines * line_size - 32 + footer_size;
- size_t padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);
+ size_t raw_size, padded_blocks;
+
+ raw_size = header_size + lines * line_size - 32 + footer_size;
+ raw_size *= 16 / ctx->cmosis_outputs;
+
+ padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);
ctx->cur_raw_size = raw_size;
ctx->cur_full_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
@@ -37,7 +41,7 @@ int ipecamera_compute_buffer_size(ipecamera_t *ctx, size_t lines) {
#endif /* IPECAMERA_BUG_EXTRA_DATA */
ctx->cur_padded_size = padded_blocks * IPECAMERA_DMA_PACKET_LENGTH;
-
+
return 0;
}