1extern crate byteorder;
4extern crate libc;
5
6#[cfg(feature = "rayon")]
7extern crate rayon;
8
9#[macro_use]
10extern crate quick_error;
11
12use std::io::Read;
13
14pub use bayer::BayerDepth;
15pub use bayer::CFA;
16pub use demosaic::Demosaic;
17pub use errcode::BayerError;
18pub use errcode::BayerResult;
19pub use raster::RasterDepth;
20
21pub struct RasterMut<'a> {
23 x: usize,
24 y: usize,
25 w: usize,
26 h: usize,
27 stride: usize,
28 depth: RasterDepth,
29 buf: &'a mut [u8],
30}
31
32pub mod demosaic;
33pub mod ffi;
34
35mod bayer;
36mod border_mirror;
37mod border_none;
38mod border_replicate;
39mod errcode;
40mod raster;
41
42pub fn run_demosaic(r: &mut Read,
64 depth: BayerDepth, cfa: CFA, alg: Demosaic,
65 dst: &mut RasterMut)
66 -> BayerResult<()> {
67 match alg {
68 Demosaic::None => demosaic::none::run(r, depth, cfa, dst),
69 Demosaic::NearestNeighbour => demosaic::nearestneighbour::run(r, depth, cfa, dst),
70 Demosaic::Linear => demosaic::linear::run(r, depth, cfa, dst),
71 Demosaic::Cubic => demosaic::cubic::run(r, depth, cfa, dst),
72 }
73}