Skip to main content

ffmpeg_the_third/software/scaling/
extensions.rs

1use super::{Context, Flags};
2use crate::util::format;
3use crate::{decoder, frame, Error};
4
5impl frame::Video {
6    #[inline]
7    pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
8        Context::get(
9            self.format(),
10            self.width(),
11            self.height(),
12            self.format(),
13            width,
14            height,
15            flags,
16        )
17    }
18
19    #[inline]
20    pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
21        Context::get(
22            self.format(),
23            self.width(),
24            self.height(),
25            format,
26            self.width(),
27            self.height(),
28            Flags::FAST_BILINEAR,
29        )
30    }
31}
32
33impl decoder::Video {
34    #[inline]
35    pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
36        Context::get(
37            self.format(),
38            self.width(),
39            self.height(),
40            self.format(),
41            width,
42            height,
43            flags,
44        )
45    }
46
47    #[inline]
48    pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
49        Context::get(
50            self.format(),
51            self.width(),
52            self.height(),
53            format,
54            self.width(),
55            self.height(),
56            Flags::FAST_BILINEAR,
57        )
58    }
59}