/* SPDX-License-Identifier: GPL-2.0 */ /* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef __IA_CSS_FRAME_PUBLIC_H #define __IA_CSS_FRAME_PUBLIC_H /* @file * This file contains structs to describe various frame-formats supported by the ISP. */ #include <media/videobuf2-v4l2.h> #include <type_support.h> #include "ia_css_err.h" #include "ia_css_types.h" #include "ia_css_frame_format.h" #include "ia_css_buffer.h" /* For RAW input, the bayer order needs to be specified separately. There * are 4 possible orders. The name is constructed by taking the first two * colors on the first line and the first two colors from the second line. */ enum ia_css_bayer_order { … }; #define IA_CSS_BAYER_ORDER_NUM … /* Frame plane structure. This describes one plane in an image * frame buffer. */ struct ia_css_frame_plane { … }; /* Binary "plane". This is used to story binary streams such as jpeg * images. This is not actually a real plane. */ struct ia_css_frame_binary_plane { … }; /* Container for planar YUV frames. This contains 3 planes. */ struct ia_css_frame_yuv_planes { … }; /* Container for semi-planar YUV frames. */ struct ia_css_frame_nv_planes { … }; /* Container for planar RGB frames. Each color has its own plane. */ struct ia_css_frame_rgb_planes { … }; /* Container for 6-plane frames. These frames are used internally * in the advanced ISP only. */ struct ia_css_frame_plane6_planes { … }; /* Crop info struct - stores the lines to be cropped in isp */ struct ia_css_crop_info { … }; /* Frame info struct. This describes the contents of an image frame buffer. */ struct ia_css_frame_info { … }; #define IA_CSS_BINARY_DEFAULT_FRAME_INFO … /** * Specifies the DVS loop delay in "frame periods" */ enum ia_css_frame_delay { … }; /* Frame structure. This structure describes an image buffer or frame. * This is the main structure used for all input and output images. */ struct ia_css_frame { … }; #define vb_to_frame(vb2) … #define DEFAULT_FRAME … /* @brief Allocate a CSS frame structure * * @param frame The allocated frame. * @param width The width (in pixels) of the frame. * @param height The height (in lines) of the frame. * @param format The frame format. * @param stride The padded stride, in pixels. * @param raw_bit_depth The raw bit depth, in bits. * @return The error code. * * Allocate a CSS frame structure. The memory for the frame data will be * allocated in the CSS address space. */ int ia_css_frame_allocate(struct ia_css_frame **frame, unsigned int width, unsigned int height, enum ia_css_frame_format format, unsigned int stride, unsigned int raw_bit_depth); /* @brief Initialize a CSS frame structure using a frame info structure. * * @param frame The allocated frame. * @param[in] info The frame info structure. * @return The error code. * * Initialize a frame using the resolution and format from a frame info struct. */ int ia_css_frame_init_from_info(struct ia_css_frame *frame, const struct ia_css_frame_info *info); /* @brief Allocate a CSS frame structure using a frame info structure. * * @param frame The allocated frame. * @param[in] info The frame info structure. * @return The error code. * * Allocate a frame using the resolution and format from a frame info struct. * This is a convenience function, implemented on top of * ia_css_frame_allocate(). */ int ia_css_frame_allocate_from_info(struct ia_css_frame **frame, const struct ia_css_frame_info *info); /* @brief Free a CSS frame structure. * * @param[in] frame Pointer to the frame. * @return None * * Free a CSS frame structure. This will free both the frame structure * and the pixel data pointer contained within the frame structure. */ void ia_css_frame_free(struct ia_css_frame *frame); static inline const struct ia_css_frame_info * ia_css_frame_get_info(const struct ia_css_frame *frame) { … } #endif /* __IA_CSS_FRAME_PUBLIC_H */