From 94051a28c0cd484e47b115f4251fa42d0edba7e5 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 24 Jul 2012 23:15:47 +0200 Subject: Support 12-bit modes --- ipecamera/reader.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ipecamera/reader.c') 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; } -- cgit v1.2.3