• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 
12 #ifndef AOM_AV1_COMMON_COMMON_H_
13 #define AOM_AV1_COMMON_COMMON_H_
14 
15 /* Interface header for common constant data structures and lookup tables */
16 
17 #include <assert.h>
18 
19 #include "aom_dsp/aom_dsp_common.h"
20 #include "aom_mem/aom_mem.h"
21 #include "aom/aom_integer.h"
22 #include "aom_ports/bitops.h"
23 #include "config/aom_config.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define PI 3.141592653589793238462643383279502884
30 
31 // Only need this for fixed-size arrays, for structs just assign.
32 #define av1_copy(dest, src)              \
33   {                                      \
34     assert(sizeof(dest) == sizeof(src)); \
35     memcpy(dest, src, sizeof(src));      \
36   }
37 
38 // Use this for variably-sized arrays.
39 #define av1_copy_array(dest, src, n)           \
40   {                                            \
41     assert(sizeof(*(dest)) == sizeof(*(src))); \
42     memcpy(dest, src, n * sizeof(*(src)));     \
43   }
44 
45 #define av1_zero(dest) memset(&(dest), 0, sizeof(dest))
46 #define av1_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
47 
get_unsigned_bits(unsigned int num_values)48 static INLINE int get_unsigned_bits(unsigned int num_values) {
49   return num_values > 0 ? get_msb(num_values) + 1 : 0;
50 }
51 
52 #define CHECK_MEM_ERROR(cm, lval, expr) \
53   AOM_CHECK_MEM_ERROR(&cm->error, lval, expr)
54 
55 #define AOM_FRAME_MARKER 0x2
56 
57 #define AV1_MIN_TILE_SIZE_BYTES 1
58 
59 #ifdef __cplusplus
60 }  // extern "C"
61 #endif
62 
63 #endif  // AOM_AV1_COMMON_COMMON_H_
64