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 /* Function Macros */ 43 /*****************************************************************************/ 44 45 /** 46 ****************************************************************************** 47 * @brief Error start codes for various classes of errors in H264 encoder 48 ****************************************************************************** 49 */ 50 #define SET_ERROR_ON_RETURN(error, severity, out_status, ret_code) \ 51 if (error != IH264E_SUCCESS) \ 52 {\ 53 out_status = ((1 << severity) | error);\ 54 ps_codec->i4_error_code = out_status;\ 55 if (severity == IVE_FATALERROR) return (ret_code);\ 56 } 57 58 /*****************************************************************************/ 59 /* Enums */ 60 /*****************************************************************************/ 61 62 /** 63 ****************************************************************************** 64 * @brief Extended error code for each error in H264 encoder 65 ****************************************************************************** 66 */ 67 typedef enum 68 { 69 /* NOTE: the ive error codes ends at 0x80 */ 70 IVE_ERR_CODEC_EXTENSIONS = 0x80, 71 72 /* bit stream error start */ 73 IH264E_BITSTREAM_ERROR_START = IVE_ERR_CODEC_EXTENSIONS, 74 75 /* codec error start */ 76 IH264E_CODEC_ERROR_START = IH264E_BITSTREAM_ERROR_START + 0x10, 77 78 /** no error */ 79 IH264E_SUCCESS = 0, 80 81 /** bitstream init failure, buffer ptr not aligned to WORD (32bits) */ 82 IH264E_BITSTREAM_BUFPTR_ALIGN_FAIL = IH264E_BITSTREAM_ERROR_START + 0x01, 83 84 /** bitstream init failure, buf size not multiple of WORD size (32bits) */ 85 IH264E_BITSTREAM_BUFSIZE_ALIGN_FAIL = IH264E_BITSTREAM_ERROR_START + 0x02, 86 87 /** bitstream runtime failure, buf size limit exceeded during encode */ 88 IH264E_BITSTREAM_BUFFER_OVERFLOW = IH264E_BITSTREAM_ERROR_START + 0x03, 89 90 /**width not set within supported limit */ 91 IH264E_WIDTH_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x01, 92 93 /**height not set within supported limit */ 94 IH264E_HEIGHT_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x02, 95 96 /**Unsupported number of reference pictures passed as an argument */ 97 IH264E_NUM_REF_UNSUPPORTED = IH264E_CODEC_ERROR_START + 0x03, 98 99 /**Unsupported number of reference pictures passed as an argument */ 100 IH264E_NUM_REORDER_UNSUPPORTED = IH264E_CODEC_ERROR_START + 0x04, 101 102 /**codec level not supported */ 103 IH264E_CODEC_LEVEL_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x05, 104 105 /**input chroma format not supported */ 106 IH264E_INPUT_CHROMA_FORMAT_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x06, 107 108 /**recon chroma format not supported */ 109 IH264E_RECON_CHROMA_FORMAT_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x07, 110 111 /**rate control option configured is not supported */ 112 IH264E_RATE_CONTROL_MODE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x08, 113 114 /**frame rate configured is not supported */ 115 IH264E_FRAME_RATE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x09, 116 117 /**bit rate configured is not supported */ 118 IH264E_BITRATE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x0A, 119 120 /**frame rate not supported */ 121 IH264E_BFRAMES_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x0B, 122 123 /**content type not supported */ 124 IH264E_CONTENT_TYPE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x0C, 125 126 /**unsupported horizontal search range */ 127 IH264E_HORIZONTAL_SEARCH_RANGE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x0D, 128 129 /**unsupported vertical search range */ 130 IH264E_VERTICAL_SEARCH_RANGE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x0E, 131 132 /**Unsupported slice type input */ 133 IH264E_SLICE_TYPE_INPUT_INVALID = IH264E_CODEC_ERROR_START + 0x0F, 134 135 /**unsupported architecture type */ 136 IH264E_ARCH_TYPE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x10, 137 138 /**unsupported soc type */ 139 IH264E_SOC_TYPE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x11, 140 141 /**target frame rate exceeds source frame rate */ 142 IH264E_TGT_FRAME_RATE_EXCEEDS_SRC_FRAME_RATE = IH264E_CODEC_ERROR_START + 0x12, 143 144 /**invalid force frame input */ 145 IH264E_INVALID_FORCE_FRAME_INPUT = IH264E_CODEC_ERROR_START + 0x13, 146 147 /**invalid me speed preset */ 148 IH264E_INVALID_ME_SPEED_PRESET = IH264E_CODEC_ERROR_START + 0x14, 149 150 /**invalid encoder speed preset */ 151 IH264E_INVALID_ENC_SPEED_PRESET = IH264E_CODEC_ERROR_START + 0x15, 152 153 /**invalid deblocking param */ 154 IH264E_INVALID_DEBLOCKING_TYPE_INPUT = IH264E_CODEC_ERROR_START + 0x16, 155 156 /**invalid max qp */ 157 IH264E_INVALID_MAX_FRAME_QP = IH264E_CODEC_ERROR_START + 0x17, 158 159 /**invalid min qp */ 160 IH264E_INVALID_MIN_FRAME_QP = IH264E_CODEC_ERROR_START + 0x18, 161 162 /**invalid init qp */ 163 IH264E_INVALID_INIT_QP = IH264E_CODEC_ERROR_START + 0x19, 164 165 /**version buffer size is insufficient */ 166 IH264E_CXA_VERS_BUF_INSUFFICIENT = IH264E_CODEC_ERROR_START + 0x1A, 167 168 /**init not done */ 169 IH264E_INIT_NOT_DONE = IH264E_CODEC_ERROR_START + 0x1B, 170 171 /**invalid refresh type input */ 172 IH264E_INVALID_AIR_MODE = IH264E_CODEC_ERROR_START + 0x1C, 173 174 /** Unsupported air mode */ 175 IH264E_INVALID_AIR_REFRESH_PERIOD = IH264E_CODEC_ERROR_START + 0x1D, 176 177 /**In sufficient memory allocated for MV Bank */ 178 IH264E_INSUFFICIENT_MEM_MVBANK = IH264E_CODEC_ERROR_START + 0x1E, 179 180 /**In sufficient memory allocated for MV Bank */ 181 IH264E_INSUFFICIENT_MEM_PICBUF = IH264E_CODEC_ERROR_START + 0x1F, 182 183 /**Buffer manager error */ 184 IH264E_BUF_MGR_ERROR = IH264E_CODEC_ERROR_START + 0x20, 185 186 /**No free MV Bank buffer available to store current pic */ 187 IH264E_NO_FREE_MVBANK = IH264E_CODEC_ERROR_START + 0x21, 188 189 /**No free picture buffer available to store current pic */ 190 IH264E_NO_FREE_PICBUF = IH264E_CODEC_ERROR_START + 0x22, 191 192 /**Invalid encoder operation mode */ 193 IH264E_INVALID_ENC_OPERATION_MODE = IH264E_CODEC_ERROR_START + 0x23, 194 195 /**Invalid half pel option */ 196 IH264E_INVALID_HALFPEL_OPTION = IH264E_CODEC_ERROR_START + 0x24, 197 198 /**Invalid quarter pel option */ 199 IH264E_INVALID_QPEL_OPTION = IH264E_CODEC_ERROR_START + 0x25, 200 201 /**Invalid fast sad option */ 202 IH264E_INVALID_FAST_SAD_OPTION = IH264E_CODEC_ERROR_START + 0x26, 203 204 /**Invalid intra 4x4 option */ 205 IH264E_INVALID_INTRA4x4_OPTION = IH264E_CODEC_ERROR_START + 0x27, 206 207 /**Invalid intra frame interval */ 208 IH264E_INVALID_INTRA_FRAME_INTERVAL = IH264E_CODEC_ERROR_START + 0x28, 209 210 /**Invalid idr frame interval */ 211 IH264E_INVALID_IDR_FRAME_INTERVAL = IH264E_CODEC_ERROR_START + 0x29, 212 213 /**Invalid buffer delay */ 214 IH264E_INVALID_BUFFER_DELAY = IH264E_CODEC_ERROR_START + 0x2A, 215 216 /**Invalid num cores */ 217 IH264E_INVALID_NUM_CORES = IH264E_CODEC_ERROR_START + 0x2B, 218 219 /**profile not supported */ 220 IH264E_PROFILE_NOT_SUPPORTED = IH264E_CODEC_ERROR_START + 0x2C, 221 222 /**Unsupported slice type input */ 223 IH264E_SLICE_PARAM_INPUT_INVALID = IH264E_CODEC_ERROR_START + 0x2D, 224 225 /**Invalid alt ref option */ 226 IH264E_INVALID_ALT_REF_OPTION = IH264E_CODEC_ERROR_START + 0x2E, 227 228 /**No free picture buffer available to store recon pic */ 229 IH264E_NO_FREE_RECONBUF = IH264E_CODEC_ERROR_START + 0x2F, 230 231 /**Not enough memory allocated as output buffer */ 232 IH264E_INSUFFICIENT_OUTPUT_BUFFER = IH264E_CODEC_ERROR_START + 0x30, 233 234 /**Invalid entropy coding mode */ 235 IH264E_INVALID_ENTROPY_CODING_MODE = IH264E_CODEC_ERROR_START + 0x31, 236 237 /**Invalid Constrained Intra prediction mode */ 238 IH264E_INVALID_CONSTRAINED_INTRA_PREDICTION_MODE = IH264E_CODEC_ERROR_START + 0x32, 239 240 /**Invalid mastering display color volume sei params */ 241 IH264E_INVALID_SEI_MDCV_PARAMS = IH264E_CODEC_ERROR_START + 0x33, 242 243 /**Invalid content light level sei params */ 244 IH264E_INVALID_SEI_CLL_PARAMS = IH264E_CODEC_ERROR_START + 0x34, 245 246 /**Invalid ambient viewing environment sei params */ 247 IH264E_INVALID_SEI_AVE_PARAMS = IH264E_CODEC_ERROR_START + 0x35, 248 249 /**Invalid content color volume sei params */ 250 IH264E_INVALID_SEI_CCV_PARAMS = IH264E_CODEC_ERROR_START + 0x36, 251 252 /**Invalid shutter interval info sei params */ 253 IH264E_INVALID_SEI_SII_PARAMS = IH264E_CODEC_ERROR_START + 0x37, 254 255 /**Invalid shutter interval info sei params. Does not match H264 sii spec requirements*/ 256 IH264E_SEI_SII_FAILED_TO_MATCH_SPEC_COND = IH264E_CODEC_ERROR_START + 0x38, 257 258 /**max failure error code to ensure enum is 32 bits wide */ 259 IH264E_FAIL = -1, 260 261 }IH264E_ERROR_T; 262 263 264 #endif /* _IH264E_ERROR_H_ */ 265