Line data Source code
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 AV1_COMMON_COMMON_H_
13 : #define 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 :
24 : #ifdef __cplusplus
25 : extern "C" {
26 : #endif
27 :
28 : #define PI 3.141592653589793238462643383279502884
29 :
30 : // Only need this for fixed-size arrays, for structs just assign.
31 : #define av1_copy(dest, src) \
32 : { \
33 : assert(sizeof(dest) == sizeof(src)); \
34 : memcpy(dest, src, sizeof(src)); \
35 : }
36 :
37 : // Use this for variably-sized arrays.
38 : #define av1_copy_array(dest, src, n) \
39 : { \
40 : assert(sizeof(*(dest)) == sizeof(*(src))); \
41 : memcpy(dest, src, n * sizeof(*(src))); \
42 : }
43 :
44 : #define av1_zero(dest) memset(&(dest), 0, sizeof(dest))
45 : #define av1_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
46 :
47 0 : static INLINE int get_unsigned_bits(unsigned int num_values) {
48 0 : return num_values > 0 ? get_msb(num_values) + 1 : 0;
49 : }
50 :
51 : #define CHECK_MEM_ERROR(cm, lval, expr) \
52 : AOM_CHECK_MEM_ERROR(&cm->error, lval, expr)
53 : // TODO(yaowu: validate the usage of these codes or develop new ones.)
54 : #define AV1_SYNC_CODE_0 0x49
55 : #define AV1_SYNC_CODE_1 0x83
56 : #define AV1_SYNC_CODE_2 0x43
57 :
58 : #define AOM_FRAME_MARKER 0x2
59 :
60 : #ifdef __cplusplus
61 : } // extern "C"
62 : #endif
63 :
64 : #endif // AV1_COMMON_COMMON_H_
|