Lines Matching full:plane
25 pub enum Plane { enum
32 impl From<usize> for Plane { implementation
33 fn from(plane: usize) -> Self { in from()
34 match plane { in from()
35 1 => Plane::U, in from()
36 2 => Plane::V, in from()
37 3 => Plane::A, in from()
38 _ => Plane::Y, in from()
43 impl Plane { implementation
46 Plane::Y => 0, in to_usize()
47 Plane::U => 1, in to_usize()
48 Plane::V => 2, in to_usize()
49 Plane::A => 3, in to_usize()
56 pub const YUV_PLANES: [Plane; 3] = [Plane::Y, Plane::U, Plane::V];
57 pub const A_PLANE: [Plane; 1] = [Plane::A];
58 pub const ALL_PLANES: [Plane; MAX_PLANE_COUNT] = [Plane::Y, Plane::U, Plane::V, Plane::A];
135 pub fn has_plane(&self, plane: Plane) -> bool { in has_plane()
136 let plane_index = plane.to_usize(); in has_plane()
144 self.has_plane(Plane::A) in has_alpha()
151 pub fn width(&self, plane: Plane) -> usize { in width()
152 match plane { in width()
153 Plane::Y | Plane::A => self.width as usize, in width()
154 Plane::U => match self.yuv_format { in width()
162 Plane::V => match self.yuv_format { in width()
174 pub fn height(&self, plane: Plane) -> usize { in height()
175 match plane { in height()
176 Plane::Y | Plane::A => self.height as usize, in height()
177 Plane::U => match self.yuv_format { in height()
185 Plane::V => match self.yuv_format { in height()
197 pub fn plane_data(&self, plane: Plane) -> Option<PlaneData> { in plane_data()
198 if !self.has_plane(plane) { in plane_data()
202 width: self.width(plane) as u32, in plane_data()
203 height: self.height(plane) as u32, in plane_data()
204 row_bytes: self.row_bytes[plane.to_usize()], in plane_data()
209 pub fn row(&self, plane: Plane, row: u32) -> AvifResult<&[u8]> { in row() argument
210 let plane_data = self.plane_data(plane).ok_or(AvifError::NoContent)?; in row()
212 self.planes[plane.to_usize()] in row()
217 pub fn row_mut(&mut self, plane: Plane, row: u32) -> AvifResult<&mut [u8]> { in row_mut() argument
218 let plane_data = self.plane_data(plane).ok_or(AvifError::NoContent)?; in row_mut()
221 self.planes[plane.to_usize()] in row_mut()
226 pub fn row16(&self, plane: Plane, row: u32) -> AvifResult<&[u16]> { in row16() argument
227 let plane_data = self.plane_data(plane).ok_or(AvifError::NoContent)?; in row16()
230 self.planes[plane.to_usize()] in row16()
235 pub fn row16_mut(&mut self, plane: Plane, row: u32) -> AvifResult<&mut [u16]> { in row16_mut() argument
236 let plane_data = self.plane_data(plane).ok_or(AvifError::NoContent)?; in row16_mut()
239 self.planes[plane.to_usize()] in row16_mut()
244 pub fn row_generic(&self, plane: Plane, row: u32) -> AvifResult<PlaneRow> { in row_generic() argument
246 PlaneRow::Depth8(self.row(plane, row)?) in row_generic()
248 PlaneRow::Depth16(self.row16(plane, row)?) in row_generic()
253 for plane in [Plane::U, Plane::V] { in clear_chroma_planes()
254 let plane = plane.to_usize(); in clear_chroma_planes() localVariable
255 self.planes[plane] = None; in clear_chroma_planes()
256 self.row_bytes[plane] = 0; in clear_chroma_planes()
257 self.image_owns_planes[plane] = false; in clear_chroma_planes()
263 for plane in category.planes() { in allocate_planes()
264 let plane = *plane; in allocate_planes() localVariable
265 let plane_index = plane.to_usize(); in allocate_planes()
266 let width = self.width(plane); in allocate_planes()
267 let plane_size = checked_mul!(width, self.height(plane))?; in allocate_planes()
268 let default_value = if plane == Plane::A { self.max_channel() } else { 0 }; in allocate_planes()
293 for plane in category.planes() { in steal_or_copy_from()
294 let plane = plane.to_usize(); in steal_or_copy_from() localVariable
295 (self.planes[plane], self.row_bytes[plane]) = match &src.planes[plane] { in steal_or_copy_from()
296 Some(src_plane) => (Some(src_plane.clone()), src.row_bytes[plane]), in steal_or_copy_from()
313 for plane in category.planes() { in copy_from_tile()
314 let plane = *plane; in copy_from_tile() localVariable
315 let src_plane = tile.plane_data(plane); in copy_from_tile()
323 checked_sub!(self.width(plane), usize_from_u32(width_so_far)?)? in copy_from_tile()
331 checked_sub!(u32_from_usize(self.height(plane))?, height_so_far)? in copy_from_tile()
341 let src_row = tile.row(plane, y)?; in copy_from_tile()
343 let dst_row = self.row_mut(plane, checked_add!(dst_y_start, y)?)?; in copy_from_tile()
349 let src_row = tile.row16(plane, y)?; in copy_from_tile()
351 let dst_row = self.row16_mut(plane, checked_add!(dst_y_start, y)?)?; in copy_from_tile()