aom_codec.h 15.3 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 12 13 14 15 16 17 18
 */

/*!\defgroup codec Common Algorithm Interface
 * This abstraction allows applications to easily support multiple video
 * formats with minimal code duplication. This section describes the interface
 * common to all codecs (both encoders and decoders).
 * @{
 */

James Zern's avatar
James Zern committed
19
/*!\file
John Koleszar's avatar
John Koleszar committed
20 21 22 23 24 25
 * \brief Describes the codec algorithm interface to applications.
 *
 * This file describes the interface between an application and a
 * video codec algorithm.
 *
 * An application instantiates a specific codec instance by using
Adrian Grange's avatar
Adrian Grange committed
26
 * aom_codec_init() and a pointer to the algorithm's interface structure:
John Koleszar's avatar
John Koleszar committed
27 28
 *     <pre>
 *     my_app.c:
Adrian Grange's avatar
Adrian Grange committed
29
 *       extern aom_codec_iface_t my_codec;
John Koleszar's avatar
John Koleszar committed
30
 *       {
Adrian Grange's avatar
Adrian Grange committed
31 32
 *           aom_codec_ctx_t algo;
 *           res = aom_codec_init(&algo, &my_codec);
John Koleszar's avatar
John Koleszar committed
33 34 35 36
 *       }
 *     </pre>
 *
 * Once initialized, the instance is manged using other functions from
Adrian Grange's avatar
Adrian Grange committed
37
 * the aom_codec_* family.
John Koleszar's avatar
John Koleszar committed
38
 */
James Zern's avatar
James Zern committed
39 40
#ifndef VPX_VPX_CODEC_H_
#define VPX_VPX_CODEC_H_
Adrian Grange's avatar
Adrian Grange committed
41

John Koleszar's avatar
John Koleszar committed
42 43 44 45
#ifdef __cplusplus
extern "C" {
#endif

Adrian Grange's avatar
Adrian Grange committed
46 47
#include "./aom_integer.h"
#include "./aom_image.h"
John Koleszar's avatar
John Koleszar committed
48

clang-format's avatar
clang-format committed
49
/*!\brief Decorator indicating a function is deprecated */
John Koleszar's avatar
John Koleszar committed
50 51
#ifndef DEPRECATED
#if defined(__GNUC__) && __GNUC__
clang-format's avatar
clang-format committed
52
#define DEPRECATED __attribute__((deprecated))
John Koleszar's avatar
John Koleszar committed
53 54 55 56 57
#elif defined(_MSC_VER)
#define DEPRECATED
#else
#define DEPRECATED
#endif
clang-format's avatar
clang-format committed
58
#endif /* DEPRECATED */
59 60 61 62 63

#ifndef DECLSPEC_DEPRECATED
#if defined(__GNUC__) && __GNUC__
#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
#elif defined(_MSC_VER)
clang-format's avatar
clang-format committed
64 65
#define DECLSPEC_DEPRECATED __declspec(deprecated)
/**< \copydoc #DEPRECATED */
66 67
#else
#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
John Koleszar's avatar
John Koleszar committed
68
#endif
clang-format's avatar
clang-format committed
69
#endif /* DECLSPEC_DEPRECATED */
John Koleszar's avatar
John Koleszar committed
70

clang-format's avatar
clang-format committed
71
/*!\brief Decorator indicating a function is potentially unused */
John Koleszar's avatar
John Koleszar committed
72
#ifdef UNUSED
73
#elif defined(__GNUC__) || defined(__clang__)
clang-format's avatar
clang-format committed
74
#define UNUSED __attribute__((unused))
John Koleszar's avatar
John Koleszar committed
75 76 77 78
#else
#define UNUSED
#endif

clang-format's avatar
clang-format committed
79 80 81 82 83 84 85 86
/*!\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
 */
James Zern's avatar
James Zern committed
87
#define VPX_CODEC_ABI_VERSION (3 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
John Koleszar's avatar
John Koleszar committed
88

clang-format's avatar
clang-format committed
89 90 91 92
/*!\brief Algorithm return codes */
typedef enum {
  /*!\brief Operation completed without error */
  VPX_CODEC_OK,
John Koleszar's avatar
John Koleszar committed
93

clang-format's avatar
clang-format committed
94 95
  /*!\brief Unspecified error */
  VPX_CODEC_ERROR,
John Koleszar's avatar
John Koleszar committed
96

clang-format's avatar
clang-format committed
97 98
  /*!\brief Memory operation failed */
  VPX_CODEC_MEM_ERROR,
John Koleszar's avatar
John Koleszar committed
99

clang-format's avatar
clang-format committed
100 101
  /*!\brief ABI version mismatch */
  VPX_CODEC_ABI_MISMATCH,
John Koleszar's avatar
John Koleszar committed
102

clang-format's avatar
clang-format committed
103 104
  /*!\brief Algorithm does not have required capability */
  VPX_CODEC_INCAPABLE,
John Koleszar's avatar
John Koleszar committed
105

clang-format's avatar
clang-format committed
106
  /*!\brief The given bitstream is not supported.
John Koleszar's avatar
John Koleszar committed
107
   *
clang-format's avatar
clang-format committed
108 109 110 111
   * The bitstream was unable to be parsed at the highest level. The decoder
   * is unable to proceed. This error \ref SHOULD be treated as fatal to the
   * stream. */
  VPX_CODEC_UNSUP_BITSTREAM,
John Koleszar's avatar
John Koleszar committed
112

clang-format's avatar
clang-format committed
113
  /*!\brief Encoded bitstream uses an unsupported feature
John Koleszar's avatar
John Koleszar committed
114
   *
clang-format's avatar
clang-format committed
115 116 117 118
   * The decoder does not implement a feature required by the encoder. This
   * return code should only be used for features that prevent future
   * pictures from being properly decoded. This error \ref MAY be treated as
   * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
John Koleszar's avatar
John Koleszar committed
119
   */
clang-format's avatar
clang-format committed
120
  VPX_CODEC_UNSUP_FEATURE,
John Koleszar's avatar
John Koleszar committed
121

clang-format's avatar
clang-format committed
122
  /*!\brief The coded data for this stream is corrupt or incomplete
John Koleszar's avatar
John Koleszar committed
123
   *
clang-format's avatar
clang-format committed
124 125 126 127 128
   * There was a problem decoding the current frame.  This return code
   * should only be used for failures that prevent future pictures from
   * being properly decoded. This error \ref MAY be treated as fatal to the
   * stream or \ref MAY be treated as fatal to the current GOP. If decoding
   * is continued for the current GOP, artifacts may be present.
John Koleszar's avatar
John Koleszar committed
129
   */
clang-format's avatar
clang-format committed
130 131 132
  VPX_CODEC_CORRUPT_FRAME,

  /*!\brief An application-supplied parameter is not valid.
John Koleszar's avatar
John Koleszar committed
133 134
   *
   */
clang-format's avatar
clang-format committed
135
  VPX_CODEC_INVALID_PARAM,
John Koleszar's avatar
John Koleszar committed
136

clang-format's avatar
clang-format committed
137
  /*!\brief An iterator reached the end of list.
John Koleszar's avatar
John Koleszar committed
138 139
   *
   */
clang-format's avatar
clang-format committed
140
  VPX_CODEC_LIST_END
John Koleszar's avatar
John Koleszar committed
141

Adrian Grange's avatar
Adrian Grange committed
142
} aom_codec_err_t;
John Koleszar's avatar
John Koleszar committed
143

clang-format's avatar
clang-format committed
144 145 146
/*! \brief Codec capabilities bitfield
 *
 *  Each codec advertises the capabilities it supports as part of its
Adrian Grange's avatar
Adrian Grange committed
147
 *  ::aom_codec_iface_t interface structure. Capabilities are extra interfaces
clang-format's avatar
clang-format committed
148 149 150 151
 *  or functionality, and are not required to be supported.
 *
 *  The available flags are specified by VPX_CODEC_CAP_* defines.
 */
Adrian Grange's avatar
Adrian Grange committed
152
typedef long aom_codec_caps_t;
clang-format's avatar
clang-format committed
153 154
#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
John Koleszar's avatar
John Koleszar committed
155

clang-format's avatar
clang-format committed
156 157 158 159 160 161 162
/*! \brief Initialization-time Feature Enabling
 *
 *  Certain codec features must be known at initialization time, to allow for
 *  proper memory allocation.
 *
 *  The available flags are specified by VPX_CODEC_USE_* defines.
 */
Adrian Grange's avatar
Adrian Grange committed
163
typedef long aom_codec_flags_t;
John Koleszar's avatar
John Koleszar committed
164

clang-format's avatar
clang-format committed
165 166 167 168 169
/*!\brief Codec interface structure.
 *
 * Contains function pointers and other data private to the codec
 * implementation. This structure is opaque to the application.
 */
Adrian Grange's avatar
Adrian Grange committed
170
typedef const struct aom_codec_iface aom_codec_iface_t;
John Koleszar's avatar
John Koleszar committed
171

clang-format's avatar
clang-format committed
172 173 174 175 176
/*!\brief Codec private data structure.
 *
 * Contains data private to the codec implementation. This structure is opaque
 * to the application.
 */
Adrian Grange's avatar
Adrian Grange committed
177
typedef struct aom_codec_priv aom_codec_priv_t;
John Koleszar's avatar
John Koleszar committed
178

clang-format's avatar
clang-format committed
179 180 181 182
/*!\brief Iterator
 *
 * Opaque storage used for iterating over lists.
 */
Adrian Grange's avatar
Adrian Grange committed
183
typedef const void *aom_codec_iter_t;
John Koleszar's avatar
John Koleszar committed
184

clang-format's avatar
clang-format committed
185 186 187 188 189 190 191 192
/*!\brief Codec context structure
 *
 * All codecs \ref MUST support this context structure fully. In general,
 * this data should be considered private to the codec algorithm, and
 * not be manipulated or examined by the calling application. Applications
 * may reference the 'name' member to get a printable description of the
 * algorithm.
 */
Adrian Grange's avatar
Adrian Grange committed
193
typedef struct aom_codec_ctx {
clang-format's avatar
clang-format committed
194
  const char *name;             /**< Printable interface name */
Adrian Grange's avatar
Adrian Grange committed
195 196
  aom_codec_iface_t *iface;     /**< Interface pointers */
  aom_codec_err_t err;          /**< Last returned error */
clang-format's avatar
clang-format committed
197
  const char *err_detail;       /**< Detailed info, if available */
Adrian Grange's avatar
Adrian Grange committed
198
  aom_codec_flags_t init_flags; /**< Flags passed at init time */
clang-format's avatar
clang-format committed
199 200
  union {
    /**< Decoder Configuration Pointer */
Adrian Grange's avatar
Adrian Grange committed
201
    const struct aom_codec_dec_cfg *dec;
clang-format's avatar
clang-format committed
202
    /**< Encoder Configuration Pointer */
Adrian Grange's avatar
Adrian Grange committed
203
    const struct aom_codec_enc_cfg *enc;
clang-format's avatar
clang-format committed
204 205
    const void *raw;
  } config;               /**< Configuration pointer aliasing union */
Adrian Grange's avatar
Adrian Grange committed
206 207
  aom_codec_priv_t *priv; /**< Algorithm private storage */
} aom_codec_ctx_t;
clang-format's avatar
clang-format committed
208 209 210 211 212

/*!\brief Bit depth for codec
 * *
 * This enumeration determines the bit depth of the codec.
 */
Adrian Grange's avatar
Adrian Grange committed
213
typedef enum aom_bit_depth {
clang-format's avatar
clang-format committed
214 215 216
  VPX_BITS_8 = 8,   /**<  8 bits */
  VPX_BITS_10 = 10, /**< 10 bits */
  VPX_BITS_12 = 12, /**< 12 bits */
Adrian Grange's avatar
Adrian Grange committed
217
} aom_bit_depth_t;
John Koleszar's avatar
John Koleszar committed
218

clang-format's avatar
clang-format committed
219 220 221 222
/*
 * Library Version Number Interface
 *
 * For example, see the following sample return values:
Adrian Grange's avatar
Adrian Grange committed
223 224 225
 *     aom_codec_version()           (1<<16 | 2<<8 | 3)
 *     aom_codec_version_str()       "v1.2.3-rc1-16-gec6a1ba"
 *     aom_codec_version_extra_str() "rc1-16-gec6a1ba"
clang-format's avatar
clang-format committed
226
 */
John Koleszar's avatar
John Koleszar committed
227

clang-format's avatar
clang-format committed
228 229 230 231 232 233 234 235 236 237
/*!\brief Return the version information (as an integer)
 *
 * Returns a packed encoding of the library version number. This will only
 * include
 * the major.minor.patch component of the version number. Note that this encoded
 * value should be accessed through the macros provided, as the encoding may
 * change
 * in the future.
 *
 */
Adrian Grange's avatar
Adrian Grange committed
238
int aom_codec_version(void);
clang-format's avatar
clang-format committed
239 240 241 242 243 244
#define VPX_VERSION_MAJOR(v) \
  ((v >> 16) & 0xff) /**< extract major from packed version */
#define VPX_VERSION_MINOR(v) \
  ((v >> 8) & 0xff) /**< extract minor from packed version */
#define VPX_VERSION_PATCH(v) \
  ((v >> 0) & 0xff) /**< extract patch from packed version */
John Koleszar's avatar
John Koleszar committed
245

clang-format's avatar
clang-format committed
246
/*!\brief Return the version major number */
Adrian Grange's avatar
Adrian Grange committed
247
#define aom_codec_version_major() ((aom_codec_version() >> 16) & 0xff)
John Koleszar's avatar
John Koleszar committed
248

clang-format's avatar
clang-format committed
249
/*!\brief Return the version minor number */
Adrian Grange's avatar
Adrian Grange committed
250
#define aom_codec_version_minor() ((aom_codec_version() >> 8) & 0xff)
John Koleszar's avatar
John Koleszar committed
251

clang-format's avatar
clang-format committed
252
/*!\brief Return the version patch number */
Adrian Grange's avatar
Adrian Grange committed
253
#define aom_codec_version_patch() ((aom_codec_version() >> 0) & 0xff)
John Koleszar's avatar
John Koleszar committed
254

clang-format's avatar
clang-format committed
255 256 257 258 259 260 261 262 263
/*!\brief Return the version information (as a string)
 *
 * Returns a printable string containing the full library version number. This
 * may
 * contain additional text following the three digit version number, as to
 * indicate
 * release candidates, prerelease versions, etc.
 *
 */
Adrian Grange's avatar
Adrian Grange committed
264
const char *aom_codec_version_str(void);
John Koleszar's avatar
John Koleszar committed
265

clang-format's avatar
clang-format committed
266 267 268 269
/*!\brief Return the version information (as a string)
 *
 * Returns a printable "extra string". This is the component of the string
 * returned
Adrian Grange's avatar
Adrian Grange committed
270
 * by aom_codec_version_str() following the three digit version number.
clang-format's avatar
clang-format committed
271 272
 *
 */
Adrian Grange's avatar
Adrian Grange committed
273
const char *aom_codec_version_extra_str(void);
John Koleszar's avatar
John Koleszar committed
274

clang-format's avatar
clang-format committed
275 276 277
/*!\brief Return the build configuration
 *
 * Returns a printable string containing an encoded version of the build
Adrian Grange's avatar
Adrian Grange committed
278
 * configuration. This may be useful to aom support.
clang-format's avatar
clang-format committed
279 280
 *
 */
Adrian Grange's avatar
Adrian Grange committed
281
const char *aom_codec_build_config(void);
John Koleszar's avatar
John Koleszar committed
282

clang-format's avatar
clang-format committed
283 284 285 286 287 288 289
/*!\brief Return the name for a given interface
 *
 * Returns a human readable string for name of the given codec interface.
 *
 * \param[in]    iface     Interface pointer
 *
 */
Adrian Grange's avatar
Adrian Grange committed
290
const char *aom_codec_iface_name(aom_codec_iface_t *iface);
John Koleszar's avatar
John Koleszar committed
291

clang-format's avatar
clang-format committed
292 293 294 295 296 297 298 299 300 301
/*!\brief Convert error number to printable string
 *
 * Returns a human readable string for the last error returned by the
 * algorithm. The returned error will be one line and will not contain
 * any newline characters.
 *
 *
 * \param[in]    err     Error number.
 *
 */
Adrian Grange's avatar
Adrian Grange committed
302
const char *aom_codec_err_to_string(aom_codec_err_t err);
John Koleszar's avatar
John Koleszar committed
303

clang-format's avatar
clang-format committed
304 305 306 307 308 309 310 311 312 313
/*!\brief Retrieve error synopsis for codec context
 *
 * Returns a human readable string for the last error returned by the
 * algorithm. The returned error will be one line and will not contain
 * any newline characters.
 *
 *
 * \param[in]    ctx     Pointer to this instance's context.
 *
 */
Adrian Grange's avatar
Adrian Grange committed
314
const char *aom_codec_error(aom_codec_ctx_t *ctx);
John Koleszar's avatar
John Koleszar committed
315

clang-format's avatar
clang-format committed
316 317 318 319 320 321 322 323 324 325
/*!\brief Retrieve detailed error information for codec context
 *
 * Returns a human readable string providing detailed information about
 * the last error.
 *
 * \param[in]    ctx     Pointer to this instance's context.
 *
 * \retval NULL
 *     No detailed information is available.
 */
Adrian Grange's avatar
Adrian Grange committed
326
const char *aom_codec_error_detail(aom_codec_ctx_t *ctx);
John Koleszar's avatar
John Koleszar committed
327

clang-format's avatar
clang-format committed
328 329 330 331 332
/* REQUIRED FUNCTIONS
 *
 * The following functions are required to be implemented for all codecs.
 * They represent the base case functionality expected of all codecs.
 */
John Koleszar's avatar
John Koleszar committed
333

clang-format's avatar
clang-format committed
334 335 336 337 338 339 340 341 342 343 344
/*!\brief Destroy a codec instance
 *
 * Destroys a codec context, freeing any associated memory buffers.
 *
 * \param[in] ctx   Pointer to this instance's context
 *
 * \retval #VPX_CODEC_OK
 *     The codec algorithm initialized.
 * \retval #VPX_CODEC_MEM_ERROR
 *     Memory allocation failed.
 */
Adrian Grange's avatar
Adrian Grange committed
345
aom_codec_err_t aom_codec_destroy(aom_codec_ctx_t *ctx);
John Koleszar's avatar
John Koleszar committed
346

clang-format's avatar
clang-format committed
347 348 349 350 351 352 353
/*!\brief Get the capabilities of an algorithm.
 *
 * Retrieves the capabilities bitfield from the algorithm's interface.
 *
 * \param[in] iface   Pointer to the algorithm interface
 *
 */
Adrian Grange's avatar
Adrian Grange committed
354
aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface);
John Koleszar's avatar
John Koleszar committed
355

clang-format's avatar
clang-format committed
356 357 358 359 360 361 362 363 364 365 366 367
/*!\brief Control algorithm
 *
 * This function is used to exchange algorithm specific data with the codec
 * instance. This can be used to implement features specific to a particular
 * algorithm.
 *
 * This wrapper function dispatches the request to the helper function
 * associated with the given ctrl_id. It tries to call this function
 * transparently, but will return #VPX_CODEC_ERROR if the request could not
 * be dispatched.
 *
 * Note that this function should not be used directly. Call the
Adrian Grange's avatar
Adrian Grange committed
368
 * #aom_codec_control wrapper macro instead.
clang-format's avatar
clang-format committed
369 370 371 372 373 374 375 376 377 378 379
 *
 * \param[in]     ctx              Pointer to this instance's context
 * \param[in]     ctrl_id          Algorithm specific control identifier
 *
 * \retval #VPX_CODEC_OK
 *     The control request was processed.
 * \retval #VPX_CODEC_ERROR
 *     The control request was not processed.
 * \retval #VPX_CODEC_INVALID_PARAM
 *     The data was not valid.
 */
Adrian Grange's avatar
Adrian Grange committed
380
aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
John Koleszar's avatar
John Koleszar committed
381
#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
Adrian Grange's avatar
Adrian Grange committed
382
#define aom_codec_control(ctx, id, data) aom_codec_control_(ctx, id, data)
clang-format's avatar
clang-format committed
383 384 385
#define VPX_CTRL_USE_TYPE(id, typ)
#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
#define VPX_CTRL_VOID(id, typ)
John Koleszar's avatar
John Koleszar committed
386 387

#else
Adrian Grange's avatar
Adrian Grange committed
388
/*!\brief aom_codec_control wrapper macro
clang-format's avatar
clang-format committed
389 390
 *
 * This macro allows for type safe conversions across the variadic parameter
Adrian Grange's avatar
Adrian Grange committed
391
 * to aom_codec_control_().
clang-format's avatar
clang-format committed
392 393 394 395 396
 *
 * \internal
 * It works by dispatching the call to the control function through a wrapper
 * function named with the id parameter.
 */
Adrian Grange's avatar
Adrian Grange committed
397 398
#define aom_codec_control(ctx, id, data) \
  aom_codec_control_##id(ctx, id, data) /**<\hideinitializer*/
John Koleszar's avatar
John Koleszar committed
399

Adrian Grange's avatar
Adrian Grange committed
400
/*!\brief aom_codec_control type definition macro
clang-format's avatar
clang-format committed
401 402
 *
 * This macro allows for type safe conversions across the variadic parameter
Adrian Grange's avatar
Adrian Grange committed
403
 * to aom_codec_control_(). It defines the type of the argument for a given
clang-format's avatar
clang-format committed
404 405 406 407 408 409 410 411
 * control identifier.
 *
 * \internal
 * It defines a static function with
 * the correctly typed arguments as a wrapper to the type-unsafe internal
 * function.
 */
#define VPX_CTRL_USE_TYPE(id, typ)                                           \
Adrian Grange's avatar
Adrian Grange committed
412
  static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int, typ) \
clang-format's avatar
clang-format committed
413 414
      UNUSED;                                                                \
                                                                             \
Adrian Grange's avatar
Adrian Grange committed
415
  static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx,        \
clang-format's avatar
clang-format committed
416
                                                int ctrl_id, typ data) {     \
Adrian Grange's avatar
Adrian Grange committed
417
    return aom_codec_control_(ctx, ctrl_id, data);                           \
John Koleszar's avatar
John Koleszar committed
418 419
  } /**<\hideinitializer*/

Adrian Grange's avatar
Adrian Grange committed
420
/*!\brief aom_codec_control deprecated type definition macro
clang-format's avatar
clang-format committed
421 422 423 424 425 426 427 428 429 430
 *
 * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
 * deprecated and should not be used. Consult the documentation for your
 * codec for more information.
 *
 * \internal
 * It defines a static function with the correctly typed arguments as a
 * wrapper to the type-unsafe internal function.
 */
#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)                        \
Adrian Grange's avatar
Adrian Grange committed
431 432
  DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
      aom_codec_ctx_t *, int, typ) DEPRECATED UNUSED;                \
clang-format's avatar
clang-format committed
433
                                                                     \
Adrian Grange's avatar
Adrian Grange committed
434 435 436
  DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
      aom_codec_ctx_t *ctx, int ctrl_id, typ data) {                 \
    return aom_codec_control_(ctx, ctrl_id, data);                   \
John Koleszar's avatar
John Koleszar committed
437 438
  } /**<\hideinitializer*/

Adrian Grange's avatar
Adrian Grange committed
439
/*!\brief aom_codec_control void type definition macro
clang-format's avatar
clang-format committed
440 441
 *
 * This macro allows for type safe conversions across the variadic parameter
Adrian Grange's avatar
Adrian Grange committed
442
 * to aom_codec_control_(). It indicates that a given control identifier takes
clang-format's avatar
clang-format committed
443 444 445 446 447 448 449
 * no argument.
 *
 * \internal
 * It defines a static function without a data argument as a wrapper to the
 * type-unsafe internal function.
 */
#define VPX_CTRL_VOID(id)                                               \
Adrian Grange's avatar
Adrian Grange committed
450
  static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int) \
clang-format's avatar
clang-format committed
451 452
      UNUSED;                                                           \
                                                                        \
Adrian Grange's avatar
Adrian Grange committed
453
  static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx,   \
clang-format's avatar
clang-format committed
454
                                                int ctrl_id) {          \
Adrian Grange's avatar
Adrian Grange committed
455
    return aom_codec_control_(ctx, ctrl_id);                            \
John Koleszar's avatar
John Koleszar committed
456
  } /**<\hideinitializer*/
John Koleszar's avatar
John Koleszar committed
457 458 459

#endif

clang-format's avatar
clang-format committed
460
/*!@} - end defgroup codec*/
John Koleszar's avatar
John Koleszar committed
461 462 463
#ifdef __cplusplus
}
#endif
James Zern's avatar
James Zern committed
464
#endif  // VPX_VPX_CODEC_H_