| 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 22 matching lines...) Expand all Loading... |
| 33 assert(sizeof(dest) == sizeof(src)); \ | 33 assert(sizeof(dest) == sizeof(src)); \ |
| 34 vpx_memcpy(dest, src, sizeof(src)); \ | 34 vpx_memcpy(dest, src, sizeof(src)); \ |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Use this for variably-sized arrays. | 37 // Use this for variably-sized arrays. |
| 38 #define vp9_copy_array(dest, src, n) { \ | 38 #define vp9_copy_array(dest, src, n) { \ |
| 39 assert(sizeof(*dest) == sizeof(*src)); \ | 39 assert(sizeof(*dest) == sizeof(*src)); \ |
| 40 vpx_memcpy(dest, src, n * sizeof(*src)); \ | 40 vpx_memcpy(dest, src, n * sizeof(*src)); \ |
| 41 } | 41 } |
| 42 | 42 |
| 43 #define vp9_zero(dest) vpx_memset(&dest, 0, sizeof(dest)); | 43 #define vp9_zero(dest) vpx_memset(&dest, 0, sizeof(dest)) |
| 44 #define vp9_zero_array(dest, n) vpx_memset(dest, 0, n * sizeof(*dest)); | 44 #define vp9_zero_array(dest, n) vpx_memset(dest, 0, n * sizeof(*dest)) |
| 45 | 45 |
| 46 static INLINE uint8_t clip_pixel(int val) { | 46 static INLINE uint8_t clip_pixel(int val) { |
| 47 return (val > 255) ? 255u : (val < 0) ? 0u : val; | 47 return (val > 255) ? 255u : (val < 0) ? 0u : val; |
| 48 } | 48 } |
| 49 | 49 |
| 50 static INLINE int clamp(int value, int low, int high) { | 50 static INLINE int clamp(int value, int low, int high) { |
| 51 return value < low ? low : (value > high ? high : value); | 51 return value < low ? low : (value > high ? high : value); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static INLINE double fclamp(double value, double low, double high) { | 54 static INLINE double fclamp(double value, double low, double high) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 } while (0) | 77 } while (0) |
| 78 #else | 78 #else |
| 79 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ | 79 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ |
| 80 lval = (expr); \ | 80 lval = (expr); \ |
| 81 if (!lval) \ | 81 if (!lval) \ |
| 82 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ | 82 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ |
| 83 "Failed to allocate "#lval); \ | 83 "Failed to allocate "#lval); \ |
| 84 } while (0) | 84 } while (0) |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 #define SYNC_CODE_0 0x49 | 87 #define VP9_SYNC_CODE_0 0x49 |
| 88 #define SYNC_CODE_1 0x83 | 88 #define VP9_SYNC_CODE_1 0x83 |
| 89 #define SYNC_CODE_2 0x42 | 89 #define VP9_SYNC_CODE_2 0x42 |
| 90 |
| 91 #define VP9_FRAME_MARKER 0x2 |
| 90 | 92 |
| 91 | 93 |
| 92 #endif // VP9_COMMON_VP9_COMMON_H_ | 94 #endif // VP9_COMMON_VP9_COMMON_H_ |
| OLD | NEW |