• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  ******************************************************************************
18  * @file    M4VPP_API.h
19  * @brief    Video preprocessing API public functions prototypes.
20  * @note
21  ******************************************************************************
22 */
23 
24 #ifndef M4VPP_API_H
25 #define M4VPP_API_H
26 
27 #include "M4OSA_Types.h"            /**< Include for common OSAL types */
28 #include "M4OSA_Error.h"            /**< Include for common OSAL errors */
29 
30 /**
31  *    Include Video filters interface definition (for the M4VIFI_ImagePlane type) */
32 #include "M4VIFI_FiltersAPI.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37 
38 
39 /**
40  ******************************************************************************
41  * Public type of the Video Preprocessing execution context
42  ******************************************************************************
43 */
44 typedef M4OSA_Void*    M4VPP_Context;
45 
46 typedef enum
47 {
48     M4VPP_kIYUV420=0,    /**< YUV 4:2:0 planar (standard input for mpeg-4 video) */
49     M4VPP_kIYUV422,        /**< YUV422 planar */
50     M4VPP_kIYUYV,        /**< YUV422 interlaced, luma first */
51     M4VPP_kIUYVY,        /**< YUV422 interlaced, chroma first */
52     M4VPP_kIJPEG,        /**< JPEG compressed frames */
53     M4VPP_kIRGB444,        /**< RGB 12 bits 4:4:4 */
54     M4VPP_kIRGB555,        /**< RGB 15 bits 5:5:5 */
55     M4VPP_kIRGB565,        /**< RGB 16 bits 5:6:5 */
56     M4VPP_kIRGB24,        /**< RGB 24 bits 8:8:8 */
57     M4VPP_kIRGB32,        /**< RGB 32 bits  */
58     M4VPP_kIBGR444,        /**< BGR 12 bits 4:4:4 */
59     M4VPP_kIBGR555,        /**< BGR 15 bits 5:5:5 */
60     M4VPP_kIBGR565,        /**< BGR 16 bits 5:6:5 */
61     M4VPP_kIBGR24,        /**< BGR 24 bits 8:8:8 */
62     M4VPP_kIBGR32        /**< BGR 32 bits  */
63 } M4VPP_InputVideoFormat;
64 
65 
66 /**
67  ******************************************************************************
68  * @brief    Prototype of the main video preprocessing function
69  * @note    Preprocess one frame
70  * @param    pContext:    (IN) Execution context of the VPP.
71  * @param    pPlaneIn:    (INOUT)    Input Image
72  * @param    pPlaneOut:    (INOUT)    Output Image
73  ******************************************************************************
74 */
75 typedef M4OSA_ERR (M4VPP_apply_fct) (M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn,
76                                      M4VIFI_ImagePlane* pPlaneOut);
77 
78 
79 
80 /**
81  ******************************************************************************
82  * M4OSA_ERR M4VPP_initVideoPreprocessing(M4VPP_Context* pContext)
83  * @brief    This function allocates a new execution context for the Video Preprocessing component.
84  * @note
85  * @param    pContext:    (OUT) Execution context allocated by the function.
86  * @return    M4NO_ERROR: there is no error.
87  * @return    M4ERR_ALLOC: there is no more available memory.
88  * @return    M4ERR_PARAMETER: pContext is NULL (debug only).
89  ******************************************************************************
90 */
91 M4OSA_ERR M4VPP_initVideoPreprocessing(M4VPP_Context* pContext);
92 
93 /**
94  ******************************************************************************
95  * M4OSA_ERR M4VPP_applyVideoPreprocessing(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn,
96  *                                           M4VIFI_ImagePlane* pPlaneOut)
97  * @brief    Preprocess one frame.
98  * @note
99  * @param    pContext:    (IN) Execution context.
100  * @param    pPlaneIn:    (INOUT)    Input Image
101  * @param    pPlaneOut:    (INOUT)    Output Image
102  * @return    M4NO_ERROR: there is no error.
103  * @return    M4ERR_PARAMETER: pContext or pPlaneIn or pPlaneOut is NULL (debug only).
104  * @return    M4ERR_STATE: Video Preprocessing is not in an appropriate state for this function
105  *                           to be called
106  ******************************************************************************
107 */
108 M4OSA_ERR M4VPP_applyVideoPreprocessing(M4VPP_Context pContext, M4VIFI_ImagePlane* pPlaneIn,
109                                          M4VIFI_ImagePlane* pPlaneOut);
110 
111 /**
112  ******************************************************************************
113  * M4OSA_ERR M4VPP_cleanUpVideoPreprocessing(M4VPP_Context pContext)
114  * @brief    This method frees the execution context for the Video Preprocessing component.
115  *            Any further usage of the context will lead to unpredictable result.
116  * @note
117  * @param    pContext:    (IN) Execution context.
118  * @return    M4NO_ERROR: there is no error.
119  * @return    M4ERR_PARAMETER: pContext is NULL (debug only).
120  ******************************************************************************
121 */
122 M4OSA_ERR M4VPP_cleanUpVideoPreprocessing(M4VPP_Context pContext);
123 
124 /**
125  ******************************************************************************
126  * M4OSA_ERR M4VPP_setVideoPreprocessingMode(M4VPP_Context pContext, M4VES_InputVideoFormat format)
127  * @brief    This method apply the video preprocessing to the input plane. Result is put into the
128  *           output plan.
129  * @param    pContext:    (IN) Execution context.
130  * @param    format  :    (IN) Format of input plane (rgb, yuv, ...)
131  * @return    M4NO_ERROR: there is no error
132  ******************************************************************************
133 */
134 M4OSA_ERR M4VPP_setVideoPreprocessingMode(M4VPP_Context pContext, M4VPP_InputVideoFormat format);
135 
136 /**
137  ******************************************************************************
138  * @brief    Definition of the errors specific to this module.
139  ******************************************************************************
140 */
141 
142 /**< Input and output planes have incompatible properties */
143 #define M4VPP_ERR_IMCOMPATIBLE_IN_AND_OUT_PLANES    M4OSA_ERR_CREATE( M4_ERR,\
144      M4PREPROCESS_VIDEO, 0x000001);
145 
146 #ifdef __cplusplus
147 }
148 #endif /* __cplusplus */
149 
150 #endif /* M4VPP_API_H */
151 
152