1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /**
22 *******************************************************************************
23 * @file
24 *  ih264e_error.h
25 *
26 * @brief
27 *  Definitions related to error handling
28 *
29 * @author
30 *  ittiam
31 *
32 * @remarks
33 *  None
34 *
35 *******************************************************************************
36 */
37 
38 #ifndef IH264E_ERROR_H_
39 #define IH264E_ERROR_H_
40 
41 /**
42 ******************************************************************************
43 *  @brief   Error start codes for various classes of errors in H264 encoder
44 ******************************************************************************
45 */
46 #define SET_ERROR_ON_RETURN(error, severity, out_status, ret_code) \
47     if (error != IH264E_SUCCESS) \
48     {\
49         out_status = ((1 << severity) | error);\
50         return (ret_code);\
51     }
52 
53 
54 /**
55 ******************************************************************************
56  *  @brief   Extended error code for each error in  H264 encoder
57 ******************************************************************************
58  */
59 typedef enum
60 {
61     /* NOTE: the ive error codes ends at 0x80 */
62     IVE_ERR_CODEC_EXTENSIONS                                        = 0x80,
63 
64     /* bit stream error start */
65     IH264E_BITSTREAM_ERROR_START                                    = IVE_ERR_CODEC_EXTENSIONS,
66 
67     /* codec error start */
68     IH264E_CODEC_ERROR_START                                        = IH264E_BITSTREAM_ERROR_START + 0x10,
69 
70     /** no error */
71     IH264E_SUCCESS                                                  = 0,
72 
73     /** bitstream init failure, buffer ptr not aligned to WORD (32bits)     */
74     IH264E_BITSTREAM_BUFPTR_ALIGN_FAIL                              = IH264E_BITSTREAM_ERROR_START + 0x01,
75 
76     /** bitstream init failure, buf size not multiple of WORD size (32bits) */
77     IH264E_BITSTREAM_BUFSIZE_ALIGN_FAIL                             = IH264E_BITSTREAM_ERROR_START + 0x02,
78 
79     /** bitstream runtime failure, buf size limit exceeded during encode    */
80     IH264E_BITSTREAM_BUFFER_OVERFLOW                                = IH264E_BITSTREAM_ERROR_START + 0x03,
81 
82     /**width not set within supported limit */
83     IH264E_WIDTH_NOT_SUPPORTED                                      = IH264E_CODEC_ERROR_START + 0x01,
84 
85     /**height not set within supported limit */
86     IH264E_HEIGHT_NOT_SUPPORTED                                     = IH264E_CODEC_ERROR_START + 0x02,
87 
88     /**Unsupported number of reference pictures passed as an argument */
89     IH264E_NUM_REF_UNSUPPORTED                                      = IH264E_CODEC_ERROR_START + 0x03,
90 
91     /**Unsupported number of reference pictures passed as an argument */
92     IH264E_NUM_REORDER_UNSUPPORTED                                  = IH264E_CODEC_ERROR_START + 0x04,
93 
94     /**codec level not supported */
95     IH264E_CODEC_LEVEL_NOT_SUPPORTED                                = IH264E_CODEC_ERROR_START + 0x05,
96 
97     /**input chroma format not supported */
98     IH264E_INPUT_CHROMA_FORMAT_NOT_SUPPORTED                        = IH264E_CODEC_ERROR_START + 0x06,
99 
100     /**recon chroma format not supported */
101     IH264E_RECON_CHROMA_FORMAT_NOT_SUPPORTED                        = IH264E_CODEC_ERROR_START + 0x07,
102 
103     /**rate control option configured is not supported */
104     IH264E_RATE_CONTROL_MODE_NOT_SUPPORTED                          = IH264E_CODEC_ERROR_START + 0x08,
105 
106     /**frame rate configured is not supported */
107     IH264E_FRAME_RATE_NOT_SUPPORTED                                 = IH264E_CODEC_ERROR_START + 0x09,
108 
109     /**bit rate configured is not supported */
110     IH264E_BITRATE_NOT_SUPPORTED                                    = IH264E_CODEC_ERROR_START + 0x0A,
111 
112     /**frame rate not supported */
113     IH264E_BFRAMES_NOT_SUPPORTED                                    = IH264E_CODEC_ERROR_START + 0x0B,
114 
115     /**content type not supported */
116     IH264E_CONTENT_TYPE_NOT_SUPPORTED                               = IH264E_CODEC_ERROR_START + 0x0C,
117 
118     /**unsupported horizontal search range */
119     IH264E_HORIZONTAL_SEARCH_RANGE_NOT_SUPPORTED                    = IH264E_CODEC_ERROR_START + 0x0D,
120 
121     /**unsupported vertical search range */
122     IH264E_VERTICAL_SEARCH_RANGE_NOT_SUPPORTED                      = IH264E_CODEC_ERROR_START + 0x0E,
123 
124     /**Unsupported slice type input */
125     IH264E_SLICE_TYPE_INPUT_INVALID                                 = IH264E_CODEC_ERROR_START + 0x0F,
126 
127     /**unsupported architecture type */
128     IH264E_ARCH_TYPE_NOT_SUPPORTED                                  = IH264E_CODEC_ERROR_START + 0x10,
129 
130     /**unsupported soc type */
131     IH264E_SOC_TYPE_NOT_SUPPORTED                                   = IH264E_CODEC_ERROR_START + 0x11,
132 
133     /**target frame rate exceeds source frame rate */
134     IH264E_TGT_FRAME_RATE_EXCEEDS_SRC_FRAME_RATE                    = IH264E_CODEC_ERROR_START + 0x12,
135 
136     /**invalid force frame input */
137     IH264E_INVALID_FORCE_FRAME_INPUT                                = IH264E_CODEC_ERROR_START + 0x13,
138 
139     /**invalid me speed preset */
140     IH264E_INVALID_ME_SPEED_PRESET                                  = IH264E_CODEC_ERROR_START + 0x14,
141 
142     /**invalid encoder speed preset */
143     IH264E_INVALID_ENC_SPEED_PRESET                                 = IH264E_CODEC_ERROR_START + 0x15,
144 
145     /**invalid deblocking param */
146     IH264E_INVALID_DEBLOCKING_TYPE_INPUT                            = IH264E_CODEC_ERROR_START + 0x16,
147 
148     /**invalid max qp */
149     IH264E_INVALID_MAX_FRAME_QP                                     = IH264E_CODEC_ERROR_START + 0x17,
150 
151     /**invalid min qp */
152     IH264E_INVALID_MIN_FRAME_QP                                     = IH264E_CODEC_ERROR_START + 0x18,
153 
154     /**invalid init qp */
155     IH264E_INVALID_INIT_QP                                          = IH264E_CODEC_ERROR_START + 0x19,
156 
157     /**version buffer size is insufficient */
158     IH264E_CXA_VERS_BUF_INSUFFICIENT                                = IH264E_CODEC_ERROR_START + 0x1A,
159 
160     /**init not done */
161     IH264E_INIT_NOT_DONE                                            = IH264E_CODEC_ERROR_START + 0x1B,
162 
163     /**invalid refresh type input */
164     IH264E_INVALID_AIR_MODE                                         = IH264E_CODEC_ERROR_START + 0x1C,
165 
166     /** Unsupported air mode */
167     IH264E_INVALID_AIR_REFRESH_PERIOD                               = IH264E_CODEC_ERROR_START + 0x1D,
168 
169     /**In sufficient memory allocated for MV Bank */
170     IH264E_INSUFFICIENT_MEM_MVBANK                                  = IH264E_CODEC_ERROR_START + 0x1E,
171 
172     /**In sufficient memory allocated for MV Bank */
173     IH264E_INSUFFICIENT_MEM_PICBUF                                  = IH264E_CODEC_ERROR_START + 0x1F,
174 
175     /**Buffer manager error */
176     IH264E_BUF_MGR_ERROR                                            = IH264E_CODEC_ERROR_START + 0x20,
177 
178     /**No free MV Bank buffer available to store current pic */
179     IH264E_NO_FREE_MVBANK                                           = IH264E_CODEC_ERROR_START + 0x21,
180 
181     /**No free picture buffer available to store current pic */
182     IH264E_NO_FREE_PICBUF                                           = IH264E_CODEC_ERROR_START + 0x22,
183 
184     /**Invalid encoder operation mode */
185     IH264E_INVALID_ENC_OPERATION_MODE                               = IH264E_CODEC_ERROR_START + 0x23,
186 
187     /**Invalid half pel option */
188     IH264E_INVALID_HALFPEL_OPTION                                   = IH264E_CODEC_ERROR_START + 0x24,
189 
190     /**Invalid quarter pel option */
191     IH264E_INVALID_QPEL_OPTION                                      = IH264E_CODEC_ERROR_START + 0x25,
192 
193     /**Invalid fast sad option */
194     IH264E_INVALID_FAST_SAD_OPTION                                  = IH264E_CODEC_ERROR_START + 0x26,
195 
196     /**Invalid intra 4x4 option */
197     IH264E_INVALID_INTRA4x4_OPTION                                  = IH264E_CODEC_ERROR_START + 0x27,
198 
199     /**Invalid intra frame interval */
200     IH264E_INVALID_INTRA_FRAME_INTERVAL                             = IH264E_CODEC_ERROR_START + 0x28,
201 
202     /**Invalid idr frame interval */
203     IH264E_INVALID_IDR_FRAME_INTERVAL                               = IH264E_CODEC_ERROR_START + 0x29,
204 
205     /**Invalid buffer delay */
206     IH264E_INVALID_BUFFER_DELAY                                     = IH264E_CODEC_ERROR_START + 0x2A,
207 
208     /**Invalid num cores */
209     IH264E_INVALID_NUM_CORES                                        = IH264E_CODEC_ERROR_START + 0x2B,
210 
211     /**profile not supported */
212     IH264E_PROFILE_NOT_SUPPORTED                                    = IH264E_CODEC_ERROR_START + 0x2C,
213 
214     /**Unsupported slice type input */
215     IH264E_SLICE_PARAM_INPUT_INVALID                                = IH264E_CODEC_ERROR_START + 0x2D,
216 
217     /**Invalid alt ref option */
218     IH264E_INVALID_ALT_REF_OPTION                                   = IH264E_CODEC_ERROR_START + 0x2E,
219 
220     /**No free picture buffer available to store recon pic */
221     IH264E_NO_FREE_RECONBUF                                         = IH264E_CODEC_ERROR_START + 0x2F,
222 
223     /**Not enough memory allocated as output buffer */
224     IH264E_INSUFFICIENT_OUTPUT_BUFFER                               = IH264E_CODEC_ERROR_START + 0x30,
225 
226     /**Invalid entropy coding mode */
227     IH264E_INVALID_ENTROPY_CODING_MODE                              = IH264E_CODEC_ERROR_START + 0x31,
228 
229     /**Invalid Constrained Intra prediction mode */
230     IH264E_INVALID_CONSTRAINED_INTRA_PREDICTION_MODE                = IH264E_CODEC_ERROR_START + 0x32,
231 
232     /**Invalid mastering display color volume sei params */
233     IH264E_INVALID_SEI_MDCV_PARAMS                                  = IH264E_CODEC_ERROR_START + 0x33,
234 
235     /**Invalid content light level sei params */
236     IH264E_INVALID_SEI_CLL_PARAMS                                   = IH264E_CODEC_ERROR_START + 0x34,
237 
238     /**Invalid ambient viewing environment sei params */
239     IH264E_INVALID_SEI_AVE_PARAMS                                   = IH264E_CODEC_ERROR_START + 0x35,
240 
241     /**Invalid content color volume sei params */
242     IH264E_INVALID_SEI_CCV_PARAMS                                   = IH264E_CODEC_ERROR_START + 0x36,
243 
244     /**max failure error code to ensure enum is 32 bits wide */
245     IH264E_FAIL                                                     = -1,
246 
247 }IH264E_ERROR_T;
248 
249 
250 #endif /* IH264E_ERROR_H_ */
251