OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 static INLINE double fclamp(double value, double low, double high) { | 59 static INLINE double fclamp(double value, double low, double high) { |
60 return value < low ? low : (value > high ? high : value); | 60 return value < low ? low : (value > high ? high : value); |
61 } | 61 } |
62 | 62 |
63 static INLINE int get_unsigned_bits(unsigned int num_values) { | 63 static INLINE int get_unsigned_bits(unsigned int num_values) { |
64 return num_values > 0 ? get_msb(num_values) + 1 : 0; | 64 return num_values > 0 ? get_msb(num_values) + 1 : 0; |
65 } | 65 } |
66 | 66 |
| 67 #if CONFIG_VP9_HIGHBITDEPTH |
| 68 #define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) |
| 69 #define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) |
| 70 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 71 |
67 #if CONFIG_DEBUG | 72 #if CONFIG_DEBUG |
68 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ | 73 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ |
69 lval = (expr); \ | 74 lval = (expr); \ |
70 if (!lval) \ | 75 if (!lval) \ |
71 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ | 76 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ |
72 "Failed to allocate "#lval" at %s:%d", \ | 77 "Failed to allocate "#lval" at %s:%d", \ |
73 __FILE__, __LINE__); \ | 78 __FILE__, __LINE__); \ |
74 } while (0) | 79 } while (0) |
75 #else | 80 #else |
76 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ | 81 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ |
77 lval = (expr); \ | 82 lval = (expr); \ |
78 if (!lval) \ | 83 if (!lval) \ |
79 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ | 84 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ |
80 "Failed to allocate "#lval); \ | 85 "Failed to allocate "#lval); \ |
81 } while (0) | 86 } while (0) |
82 #endif | 87 #endif |
83 | 88 |
84 #define VP9_SYNC_CODE_0 0x49 | 89 #define VP9_SYNC_CODE_0 0x49 |
85 #define VP9_SYNC_CODE_1 0x83 | 90 #define VP9_SYNC_CODE_1 0x83 |
86 #define VP9_SYNC_CODE_2 0x42 | 91 #define VP9_SYNC_CODE_2 0x42 |
87 | 92 |
88 #define VP9_FRAME_MARKER 0x2 | 93 #define VP9_FRAME_MARKER 0x2 |
89 | 94 |
90 | 95 |
91 #ifdef __cplusplus | 96 #ifdef __cplusplus |
92 } // extern "C" | 97 } // extern "C" |
93 #endif | 98 #endif |
94 | 99 |
95 #endif // VP9_COMMON_VP9_COMMON_H_ | 100 #endif // VP9_COMMON_VP9_COMMON_H_ |
OLD | NEW |