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::decoder::Category; 30 use crate::reformat::*; 31 use crate::*; 32 yuv_to_rgb(_image: &image::Image, _rgb: &mut rgb::Image) -> AvifResult<bool>33 pub fn yuv_to_rgb(_image: &image::Image, _rgb: &mut rgb::Image) -> AvifResult<bool> { 34 Err(AvifError::NotImplemented) 35 } 36 convert_to_half_float(_rgb: &mut rgb::Image, _scale: f32) -> AvifResult<()>37 pub fn convert_to_half_float(_rgb: &mut rgb::Image, _scale: f32) -> AvifResult<()> { 38 Err(AvifError::NotImplemented) 39 } 40 41 impl image::Image { scale(&mut self, width: u32, height: u32, _category: Category) -> AvifResult<()>42 pub fn scale(&mut self, width: u32, height: u32, _category: Category) -> AvifResult<()> { 43 if self.width == width && self.height == height { 44 return Ok(()); 45 } 46 Err(AvifError::NotImplemented) 47 } 48 } 49 } 50