• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #[cfg(feature = "libyuv")]
16 pub mod libyuv;
17 #[cfg(feature = "libyuv")]
18 pub mod scale;
19 
20 pub mod alpha;
21 pub mod coeffs;
22 pub mod rgb;
23 pub mod rgb_impl;
24 
25 // If libyuv is not present, add placeholder functions so that the library will build successfully
26 // without it.
27 #[cfg(not(feature = "libyuv"))]
28 pub mod libyuv {
29     use crate::reformat::*;
30     use crate::*;
31 
yuv_to_rgb(_image: &image::Image, _rgb: &mut rgb::Image) -> AvifResult<bool>32     pub(crate) fn yuv_to_rgb(_image: &image::Image, _rgb: &mut rgb::Image) -> AvifResult<bool> {
33         Err(AvifError::NotImplemented)
34     }
35 
convert_to_half_float(_rgb: &mut rgb::Image, _scale: f32) -> AvifResult<()>36     pub(crate) fn convert_to_half_float(_rgb: &mut rgb::Image, _scale: f32) -> AvifResult<()> {
37         Err(AvifError::NotImplemented)
38     }
39 
40     impl image::Image {
scale( &mut self, width: u32, height: u32, _category: Category, ) -> AvifResult<()>41         pub(crate) fn scale(
42             &mut self,
43             width: u32,
44             height: u32,
45             _category: Category,
46         ) -> AvifResult<()> {
47             if self.width == width && self.height == height {
48                 return Ok(());
49             }
50             Err(AvifError::NotImplemented)
51         }
52     }
53 }
54