1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#[cfg(feature = "software-scaling")]
pub mod scaling;

#[cfg(feature = "software-scaling")]
#[inline]
pub fn scaler(
    format: ::format::Pixel,
    flags: scaling::Flags,
    (in_width, in_height): (u32, u32),
    (out_width, out_height): (u32, u32),
) -> Result<scaling::Context, ::Error> {
    scaling::Context::get(
        format, in_width, in_height, format, out_width, out_height, flags,
    )
}

#[cfg(feature = "software-scaling")]
#[inline]
pub fn converter(
    (width, height): (u32, u32),
    input: ::format::Pixel,
    output: ::format::Pixel,
) -> Result<scaling::Context, ::Error> {
    scaling::Context::get(
        input,
        width,
        height,
        output,
        width,
        height,
        scaling::flag::Flags::FAST_BILINEAR,
    )
}

#[cfg(feature = "software-resampling")]
pub mod resampling;

#[cfg(feature = "software-resampling")]
#[inline]
pub fn resampler(
    (in_format, in_layout, in_rate): (::format::Sample, ::ChannelLayout, u32),
    (out_format, out_layout, out_rate): (::format::Sample, ::ChannelLayout, u32),
) -> Result<resampling::Context, ::Error> {
    resampling::Context::get(
        in_format, in_layout, in_rate, out_format, out_layout, out_rate,
    )
}