| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 67 #if CONFIG_VP9_HIGHBITDEPTH |
| 68 static INLINE uint16_t clip_pixel_high(int val, int bd) { |
| 69 switch (bd) { |
| 70 case 8: |
| 71 default: |
| 72 return (uint16_t)clamp(val, 0, 255); |
| 73 case 10: |
| 74 return (uint16_t)clamp(val, 0, 1023); |
| 75 case 12: |
| 76 return (uint16_t)clamp(val, 0, 4095); |
| 77 } |
| 78 } |
| 79 |
| 68 #define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) | 80 #define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) |
| 69 #define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) | 81 #define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) |
| 70 #endif // CONFIG_VP9_HIGHBITDEPTH | 82 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 71 | 83 |
| 72 #if CONFIG_DEBUG | 84 #if CONFIG_DEBUG |
| 73 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ | 85 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ |
| 74 lval = (expr); \ | 86 lval = (expr); \ |
| 75 if (!lval) \ | 87 if (!lval) \ |
| 76 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ | 88 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ |
| 77 "Failed to allocate "#lval" at %s:%d", \ | 89 "Failed to allocate "#lval" at %s:%d", \ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 #define VP9_SYNC_CODE_2 0x42 | 103 #define VP9_SYNC_CODE_2 0x42 |
| 92 | 104 |
| 93 #define VP9_FRAME_MARKER 0x2 | 105 #define VP9_FRAME_MARKER 0x2 |
| 94 | 106 |
| 95 | 107 |
| 96 #ifdef __cplusplus | 108 #ifdef __cplusplus |
| 97 } // extern "C" | 109 } // extern "C" |
| 98 #endif | 110 #endif |
| 99 | 111 |
| 100 #endif // VP9_COMMON_VP9_COMMON_H_ | 112 #endif // VP9_COMMON_VP9_COMMON_H_ |
| OLD | NEW |