vpx_codec_internal.h 17.4 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
John Koleszar's avatar
John Koleszar committed
3
 *
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
John Koleszar's avatar
John Koleszar committed
10 11
 */

James Zern's avatar
James Zern committed
12
/*!\file
John Koleszar's avatar
John Koleszar committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
 * \brief Describes the decoder algorithm interface for algorithm
 *        implementations.
 *
 * This file defines the private structures and data types that are only
 * relevant to implementing an algorithm, as opposed to using it.
 *
 * To create a decoder algorithm class, an interface structure is put
 * into the global namespace:
 *     <pre>
 *     my_codec.c:
 *       vpx_codec_iface_t my_codec = {
 *           "My Codec v1.0",
 *           VPX_CODEC_ALG_ABI_VERSION,
 *           ...
 *       };
 *     </pre>
 *
 * An application instantiates a specific decoder instance by using
 * vpx_codec_init() and a pointer to the algorithm's interface structure:
 *     <pre>
 *     my_app.c:
 *       extern vpx_codec_iface_t my_codec;
 *       {
 *           vpx_codec_ctx_t algo;
 *           res = vpx_codec_init(&algo, &my_codec);
 *       }
 *     </pre>
 *
 * Once initialized, the instance is manged using other functions from
 * the vpx_codec_* family.
 */
James Zern's avatar
James Zern committed
44 45
#ifndef VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
#define VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
John Koleszar's avatar
John Koleszar committed
46 47 48 49
#include "../vpx_decoder.h"
#include "../vpx_encoder.h"
#include <stdarg.h>

James Zern's avatar
James Zern committed
50 51 52
#ifdef __cplusplus
extern "C" {
#endif
John Koleszar's avatar
John Koleszar committed
53 54 55 56 57 58 59 60 61

/*!\brief Current ABI version number
 *
 * \internal
 * If this file is altered in any way that changes the ABI, this value
 * must be bumped.  Examples include, but are not limited to, changing
 * types, removing or reassigning enums, adding/removing/rearranging
 * fields to structures
 */
62
#define VPX_CODEC_INTERNAL_ABI_VERSION (5) /**<\hideinitializer*/
John Koleszar's avatar
John Koleszar committed
63

clang-format's avatar
clang-format committed
64
typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
John Koleszar's avatar
John Koleszar committed
65
typedef struct vpx_codec_priv_enc_mr_cfg vpx_codec_priv_enc_mr_cfg_t;
John Koleszar's avatar
John Koleszar committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79

/*!\brief init function pointer prototype
 *
 * Performs algorithm-specific initialization of the decoder context. This
 * function is called by the generic vpx_codec_init() wrapper function, so
 * plugins implementing this interface may trust the input parameters to be
 * properly initialized.
 *
 * \param[in] ctx   Pointer to this instance's context
 * \retval #VPX_CODEC_OK
 *     The input stream was recognized and decoder initialized.
 * \retval #VPX_CODEC_MEM_ERROR
 *     Memory operation failed.
 */
clang-format's avatar
clang-format committed
80 81
typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(
    vpx_codec_ctx_t *ctx, vpx_codec_priv_enc_mr_cfg_t *data);
John Koleszar's avatar
John Koleszar committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

/*!\brief destroy function pointer prototype
 *
 * Performs algorithm-specific destruction of the decoder context. This
 * function is called by the generic vpx_codec_destroy() wrapper function,
 * so plugins implementing this interface may trust the input parameters
 * to be properly initialized.
 *
 * \param[in] ctx   Pointer to this instance's context
 * \retval #VPX_CODEC_OK
 *     The input stream was recognized and decoder initialized.
 * \retval #VPX_CODEC_MEM_ERROR
 *     Memory operation failed.
 */
typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);

/*!\brief parse stream info function pointer prototype
 *
100 101 102 103
 * Performs high level parsing of the bitstream. This function is called by the
 * generic vpx_codec_peek_stream_info() wrapper function, so plugins
 * implementing this interface may trust the input parameters to be properly
 * initialized.
John Koleszar's avatar
John Koleszar committed
104 105 106 107 108 109 110 111 112 113 114
 *
 * \param[in]      data    Pointer to a block of data to parse
 * \param[in]      data_sz Size of the data buffer
 * \param[in,out]  si      Pointer to stream info to update. The size member
 *                         \ref MUST be properly initialized, but \ref MAY be
 *                         clobbered by the algorithm. This parameter \ref MAY
 *                         be NULL.
 *
 * \retval #VPX_CODEC_OK
 *     Bitstream is parsable and stream information updated
 */
clang-format's avatar
clang-format committed
115 116
typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
                                                  unsigned int data_sz,
John Koleszar's avatar
John Koleszar committed
117
                                                  vpx_codec_stream_info_t *si);
John Koleszar's avatar
John Koleszar committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131

/*!\brief Return information about the current stream.
 *
 * Returns information about the stream that has been parsed during decoding.
 *
 * \param[in]      ctx     Pointer to this instance's context
 * \param[in,out]  si      Pointer to stream info to update. The size member
 *                         \ref MUST be properly initialized, but \ref MAY be
 *                         clobbered by the algorithm. This parameter \ref MAY
 *                         be NULL.
 *
 * \retval #VPX_CODEC_OK
 *     Bitstream is parsable and stream information updated
 */
clang-format's avatar
clang-format committed
132
typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
John Koleszar's avatar
John Koleszar committed
133
                                                 vpx_codec_stream_info_t *si);
John Koleszar's avatar
John Koleszar committed
134 135 136 137 138 139 140 141 142 143 144 145 146

/*!\brief control function pointer prototype
 *
 * This function is used to exchange algorithm specific data with the decoder
 * instance. This can be used to implement features specific to a particular
 * algorithm.
 *
 * This function is called by the generic vpx_codec_control() wrapper
 * function, so plugins implementing this interface may trust the input
 * parameters to be properly initialized. However,  this interface does not
 * provide type safety for the exchanged data or assign meanings to the
 * control codes. Those details should be specified in the algorithm's
 * header file. In particular, the ctrl_id parameter is guaranteed to exist
147
 * in the algorithm's control mapping table, and the data parameter may be NULL.
John Koleszar's avatar
John Koleszar committed
148 149 150 151 152 153 154 155 156
 *
 *
 * \param[in]     ctx              Pointer to this instance's context
 * \param[in]     ctrl_id          Algorithm specific control identifier
 * \param[in,out] data             Data to exchange with algorithm instance.
 *
 * \retval #VPX_CODEC_OK
 *     The internal state data was deserialized.
 */
157 158
typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
                                                  va_list ap);
John Koleszar's avatar
John Koleszar committed
159 160 161 162 163 164 165 166 167 168 169 170

/*!\brief control function pointer mapping
 *
 * This structure stores the mapping between control identifiers and
 * implementing functions. Each algorithm provides a list of these
 * mappings. This list is searched by the vpx_codec_control() wrapper
 * function to determine which function to invoke. The special
 * value {0, NULL} is used to indicate end-of-list, and must be
 * present. The special value {0, <non-null>} can be used as a catch-all
 * mapping. This implies that ctrl_id values chosen by the algorithm
 * \ref MUST be non-zero.
 */
John Koleszar's avatar
John Koleszar committed
171
typedef const struct vpx_codec_ctrl_fn_map {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
172 173
  int ctrl_id;
  vpx_codec_control_fn_t fn;
John Koleszar's avatar
John Koleszar committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
} vpx_codec_ctrl_fn_map_t;

/*!\brief decode data function pointer prototype
 *
 * Processes a buffer of coded data. If the processing results in a new
 * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
 * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
 * function is called by the generic vpx_codec_decode() wrapper function,
 * so plugins implementing this interface may trust the input parameters
 * to be properly initialized.
 *
 * \param[in] ctx          Pointer to this instance's context
 * \param[in] data         Pointer to this block of new coded data. If
 *                         NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
 *                         for the previously decoded frame.
 * \param[in] data_sz      Size of the coded data, in bytes.
 *
 * \return Returns #VPX_CODEC_OK if the coded data was processed completely
 *         and future pictures can be decoded without error. Otherwise,
 *         see the descriptions of the other error codes in ::vpx_codec_err_t
 *         for recoverability capabilities.
 */
clang-format's avatar
clang-format committed
196 197 198 199 200
typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
                                                 const uint8_t *data,
                                                 unsigned int data_sz,
                                                 void *user_priv,
                                                 long deadline);
John Koleszar's avatar
John Koleszar committed
201 202 203 204 205 206 207 208

/*!\brief Decoded frames iterator
 *
 * Iterates over a list of the frames available for display. The iterator
 * storage should be initialized to NULL to start the iteration. Iteration is
 * complete when this function returns NULL.
 *
 * The list of available frames becomes valid upon completion of the
clang-format's avatar
clang-format committed
209 210
 * vpx_codec_decode call, and remains valid until the next call to
 * vpx_codec_decode.
John Koleszar's avatar
John Koleszar committed
211 212 213 214 215 216 217
 *
 * \param[in]     ctx      Pointer to this instance's context
 * \param[in out] iter     Iterator storage, initialized to NULL
 *
 * \return Returns a pointer to an image, if one is ready for display. Frames
 *         produced will always be in PTS (presentation time stamp) order.
 */
John Koleszar's avatar
John Koleszar committed
218
typedef vpx_image_t *(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
clang-format's avatar
clang-format committed
219
                                                 vpx_codec_iter_t *iter);
John Koleszar's avatar
John Koleszar committed
220

221 222
/*!\brief Pass in external frame buffers for the decoder to use.
 *
Yaowu Xu's avatar
Yaowu Xu committed
223 224
 * Registers functions to be called when libaom needs a frame buffer
 * to decode the current frame and a function to be called when libaom does
225
 * not internally reference the frame buffer. This set function must
Yaowu Xu's avatar
Yaowu Xu committed
226
 * be called before the first call to decode or libaom will assume the
227 228 229 230 231 232 233 234
 * default behavior of allocating frame buffers internally.
 *
 * \param[in] ctx          Pointer to this instance's context
 * \param[in] cb_get       Pointer to the get callback function
 * \param[in] cb_release   Pointer to the release callback function
 * \param[in] cb_priv      Callback's private data
 *
 * \retval #VPX_CODEC_OK
Yaowu Xu's avatar
Yaowu Xu committed
235
 *     External frame buffers will be used by libaom.
236 237 238 239 240 241 242 243
 * \retval #VPX_CODEC_INVALID_PARAM
 *     One or more of the callbacks were NULL.
 * \retval #VPX_CODEC_ERROR
 *     Decoder context not initialized, or algorithm not capable of
 *     using external frame buffers.
 *
 * \note
 * When decoding VP9, the application may be required to pass in at least
Jim Bankoski's avatar
Jim Bankoski committed
244
 * #VPX_MAXIMUM_WORK_BUFFERS external frame
245 246 247
 * buffers.
 */
typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
clang-format's avatar
clang-format committed
248
    vpx_codec_alg_priv_t *ctx, vpx_get_frame_buffer_cb_fn_t cb_get,
249
    vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
John Koleszar's avatar
John Koleszar committed
250

clang-format's avatar
clang-format committed
251 252 253 254 255 256 257 258
typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
                                                 const vpx_image_t *img,
                                                 vpx_codec_pts_t pts,
                                                 unsigned long duration,
                                                 vpx_enc_frame_flags_t flags,
                                                 unsigned long deadline);
typedef const vpx_codec_cx_pkt_t *(*vpx_codec_get_cx_data_fn_t)(
    vpx_codec_alg_priv_t *ctx, vpx_codec_iter_t *iter);
John Koleszar's avatar
John Koleszar committed
259

clang-format's avatar
clang-format committed
260 261 262 263
typedef vpx_codec_err_t (*vpx_codec_enc_config_set_fn_t)(
    vpx_codec_alg_priv_t *ctx, const vpx_codec_enc_cfg_t *cfg);
typedef vpx_fixed_buf_t *(*vpx_codec_get_global_headers_fn_t)(
    vpx_codec_alg_priv_t *ctx);
John Koleszar's avatar
John Koleszar committed
264

clang-format's avatar
clang-format committed
265 266
typedef vpx_image_t *(*vpx_codec_get_preview_frame_fn_t)(
    vpx_codec_alg_priv_t *ctx);
John Koleszar's avatar
John Koleszar committed
267

clang-format's avatar
clang-format committed
268 269
typedef vpx_codec_err_t (*vpx_codec_enc_mr_get_mem_loc_fn_t)(
    const vpx_codec_enc_cfg_t *cfg, void **mem_loc);
John Koleszar's avatar
John Koleszar committed
270

John Koleszar's avatar
John Koleszar committed
271 272 273 274 275 276 277 278 279 280
/*!\brief usage configuration mapping
 *
 * This structure stores the mapping between usage identifiers and
 * configuration structures. Each algorithm provides a list of these
 * mappings. This list is searched by the vpx_codec_enc_config_default()
 * wrapper function to determine which config to return. The special value
 * {-1, {0}} is used to indicate end-of-list, and must be present. At least
 * one mapping must be present, in addition to the end-of-list.
 *
 */
John Koleszar's avatar
John Koleszar committed
281
typedef const struct vpx_codec_enc_cfg_map {
clang-format's avatar
clang-format committed
282
  int usage;
John Koleszar's avatar
John Koleszar committed
283
  vpx_codec_enc_cfg_t cfg;
John Koleszar's avatar
John Koleszar committed
284 285 286 287 288 289
} vpx_codec_enc_cfg_map_t;

/*!\brief Decoder algorithm interface interface
 *
 * All decoders \ref MUST expose a variable of this type.
 */
John Koleszar's avatar
John Koleszar committed
290
struct vpx_codec_iface {
clang-format's avatar
clang-format committed
291 292 293 294 295 296
  const char *name;                   /**< Identification String  */
  int abi_version;                    /**< Implemented ABI version */
  vpx_codec_caps_t caps;              /**< Decoder capabilities */
  vpx_codec_init_fn_t init;           /**< \copydoc ::vpx_codec_init_fn_t */
  vpx_codec_destroy_fn_t destroy;     /**< \copydoc ::vpx_codec_destroy_fn_t */
  vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
John Koleszar's avatar
John Koleszar committed
297
  struct vpx_codec_dec_iface {
clang-format's avatar
clang-format committed
298 299 300 301 302 303
    vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
    vpx_codec_get_si_fn_t get_si;   /**< \copydoc ::vpx_codec_get_si_fn_t */
    vpx_codec_decode_fn_t decode;   /**< \copydoc ::vpx_codec_decode_fn_t */
    vpx_codec_get_frame_fn_t
        get_frame;                   /**< \copydoc ::vpx_codec_get_frame_fn_t */
    vpx_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::vpx_codec_set_fb_fn_t */
John Koleszar's avatar
John Koleszar committed
304
  } dec;
John Koleszar's avatar
John Koleszar committed
305
  struct vpx_codec_enc_iface {
clang-format's avatar
clang-format committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319
    int cfg_map_count;
    vpx_codec_enc_cfg_map_t
        *cfg_maps;                /**< \copydoc ::vpx_codec_enc_cfg_map_t */
    vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
    vpx_codec_get_cx_data_fn_t
        get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
    vpx_codec_enc_config_set_fn_t
        cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
    vpx_codec_get_global_headers_fn_t
        get_glob_hdrs; /**< \copydoc ::vpx_codec_get_global_headers_fn_t */
    vpx_codec_get_preview_frame_fn_t
        get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
    vpx_codec_enc_mr_get_mem_loc_fn_t
        mr_get_mem_loc; /**< \copydoc ::vpx_codec_enc_mr_get_mem_loc_fn_t */
John Koleszar's avatar
John Koleszar committed
320
  } enc;
John Koleszar's avatar
John Koleszar committed
321 322 323
};

/*!\brief Callback function pointer / user data pair storage */
John Koleszar's avatar
John Koleszar committed
324 325
typedef struct vpx_codec_priv_cb_pair {
  union {
clang-format's avatar
clang-format committed
326 327
    vpx_codec_put_frame_cb_fn_t put_frame;
    vpx_codec_put_slice_cb_fn_t put_slice;
John Koleszar's avatar
John Koleszar committed
328
  } u;
clang-format's avatar
clang-format committed
329
  void *user_priv;
John Koleszar's avatar
John Koleszar committed
330 331 332 333 334 335 336 337
} vpx_codec_priv_cb_pair_t;

/*!\brief Instance private storage
 *
 * This structure is allocated by the algorithm's init function. It can be
 * extended in one of two ways. First, a second, algorithm specific structure
 * can be allocated and the priv member pointed to it. Alternatively, this
 * structure can be made the first member of the algorithm specific structure,
Ralph Giles's avatar
Ralph Giles committed
338
 * and the pointer cast to the proper type.
John Koleszar's avatar
John Koleszar committed
339
 */
John Koleszar's avatar
John Koleszar committed
340
struct vpx_codec_priv {
clang-format's avatar
clang-format committed
341 342
  const char *err_detail;
  vpx_codec_flags_t init_flags;
John Koleszar's avatar
John Koleszar committed
343
  struct {
clang-format's avatar
clang-format committed
344 345
    vpx_codec_priv_cb_pair_t put_frame_cb;
    vpx_codec_priv_cb_pair_t put_slice_cb;
John Koleszar's avatar
John Koleszar committed
346 347
  } dec;
  struct {
clang-format's avatar
clang-format committed
348 349 350 351 352
    vpx_fixed_buf_t cx_data_dst_buf;
    unsigned int cx_data_pad_before;
    unsigned int cx_data_pad_after;
    vpx_codec_cx_pkt_t cx_data_pkt;
    unsigned int total_encoders;
John Koleszar's avatar
John Koleszar committed
353
  } enc;
John Koleszar's avatar
John Koleszar committed
354 355
};

John Koleszar's avatar
John Koleszar committed
356 357 358
/*
 * Multi-resolution encoding internal configuration
 */
clang-format's avatar
clang-format committed
359 360 361 362 363
struct vpx_codec_priv_enc_mr_cfg {
  unsigned int mr_total_resolutions;
  unsigned int mr_encoder_id;
  struct vpx_rational mr_down_sampling_factor;
  void *mr_low_res_mode_info;
John Koleszar's avatar
John Koleszar committed
364 365
};

John Koleszar's avatar
John Koleszar committed
366 367
#undef VPX_CTRL_USE_TYPE
#define VPX_CTRL_USE_TYPE(id, typ) \
clang-format's avatar
clang-format committed
368
  static VPX_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
John Koleszar's avatar
John Koleszar committed
369 370 371

#undef VPX_CTRL_USE_TYPE_DEPRECATED
#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
clang-format's avatar
clang-format committed
372
  static VPX_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
John Koleszar's avatar
John Koleszar committed
373 374 375

#define CAST(id, arg) id##__value(arg)

376 377 378 379 380 381 382 383 384
/* CODEC_INTERFACE convenience macro
 *
 * By convention, each codec interface is a struct with extern linkage, where
 * the symbol is suffixed with _algo. A getter function is also defined to
 * return a pointer to the struct, since in some cases it's easier to work
 * with text symbols than data symbols (see issue #169). This function has
 * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE
 * macro is provided to define this getter function automatically.
 */
clang-format's avatar
clang-format committed
385 386 387
#define CODEC_INTERFACE(id)                          \
  vpx_codec_iface_t *id(void) { return &id##_algo; } \
  vpx_codec_iface_t id##_algo
388

John Koleszar's avatar
John Koleszar committed
389 390
/* Internal Utility Functions
 *
James Zern's avatar
James Zern committed
391
 * The following functions are intended to be used inside algorithms as
John Koleszar's avatar
John Koleszar committed
392 393
 * utilities for manipulating vpx_codec_* data structures.
 */
John Koleszar's avatar
John Koleszar committed
394
struct vpx_codec_pkt_list {
clang-format's avatar
clang-format committed
395 396
  unsigned int cnt;
  unsigned int max;
John Koleszar's avatar
John Koleszar committed
397
  struct vpx_codec_cx_pkt pkts[1];
John Koleszar's avatar
John Koleszar committed
398 399
};

clang-format's avatar
clang-format committed
400 401 402 403 404 405 406 407
#define vpx_codec_pkt_list_decl(n)     \
  union {                              \
    struct vpx_codec_pkt_list head;    \
    struct {                           \
      struct vpx_codec_pkt_list head;  \
      struct vpx_codec_cx_pkt pkts[n]; \
    } alloc;                           \
  }
John Koleszar's avatar
John Koleszar committed
408

clang-format's avatar
clang-format committed
409 410 411
#define vpx_codec_pkt_list_init(m) \
  (m)->alloc.head.cnt = 0,         \
  (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
John Koleszar's avatar
John Koleszar committed
412

clang-format's avatar
clang-format committed
413 414
int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
                           const struct vpx_codec_cx_pkt *);
John Koleszar's avatar
John Koleszar committed
415

clang-format's avatar
clang-format committed
416 417
const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(
    struct vpx_codec_pkt_list *list, vpx_codec_iter_t *iter);
John Koleszar's avatar
John Koleszar committed
418 419 420

#include <stdio.h>
#include <setjmp.h>
James Zern's avatar
James Zern committed
421

John Koleszar's avatar
John Koleszar committed
422
struct vpx_internal_error_info {
clang-format's avatar
clang-format committed
423 424 425 426 427
  vpx_codec_err_t error_code;
  int has_detail;
  char detail[80];
  int setjmp;
  jmp_buf jmp;
John Koleszar's avatar
John Koleszar committed
428 429
};

430 431 432 433 434 435 436 437
#define CLANG_ANALYZER_NORETURN
#if defined(__has_feature)
#if __has_feature(attribute_analyzer_noreturn)
#undef CLANG_ANALYZER_NORETURN
#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
#endif
#endif

438
void vpx_internal_error(struct vpx_internal_error_info *info,
clang-format's avatar
clang-format committed
439
                        vpx_codec_err_t error, const char *fmt,
440
                        ...) CLANG_ANALYZER_NORETURN;
441

James Zern's avatar
James Zern committed
442 443 444 445
#ifdef __cplusplus
}  // extern "C"
#endif

James Zern's avatar
James Zern committed
446
#endif  // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_