| 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) { | 68 static INLINE uint16_t clip_pixel_highbd(int val, int bd) { |
| 69 switch (bd) { | 69 switch (bd) { |
| 70 case 8: | 70 case 8: |
| 71 default: | 71 default: |
| 72 return (uint16_t)clamp(val, 0, 255); | 72 return (uint16_t)clamp(val, 0, 255); |
| 73 case 10: | 73 case 10: |
| 74 return (uint16_t)clamp(val, 0, 1023); | 74 return (uint16_t)clamp(val, 0, 1023); |
| 75 case 12: | 75 case 12: |
| 76 return (uint16_t)clamp(val, 0, 4095); | 76 return (uint16_t)clamp(val, 0, 4095); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Note: |
| 81 // tran_low_t is the datatype used for final transform coefficients. |
| 82 // tran_high_t is the datatype used for intermediate transform stages. |
| 83 typedef int64_t tran_high_t; |
| 84 typedef int32_t tran_low_t; |
| 85 |
| 80 #define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) | 86 #define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) |
| 81 #define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) | 87 #define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) |
| 88 |
| 89 #else |
| 90 |
| 91 // Note: |
| 92 // tran_low_t is the datatype used for final transform coefficients. |
| 93 // tran_high_t is the datatype used for intermediate transform stages. |
| 94 typedef int32_t tran_high_t; |
| 95 typedef int16_t tran_low_t; |
| 82 #endif // CONFIG_VP9_HIGHBITDEPTH | 96 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 83 | 97 |
| 84 #if CONFIG_DEBUG | 98 #if CONFIG_DEBUG |
| 85 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ | 99 #define CHECK_MEM_ERROR(cm, lval, expr) do { \ |
| 86 lval = (expr); \ | 100 lval = (expr); \ |
| 87 if (!lval) \ | 101 if (!lval) \ |
| 88 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ | 102 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, \ |
| 89 "Failed to allocate "#lval" at %s:%d", \ | 103 "Failed to allocate "#lval" at %s:%d", \ |
| 90 __FILE__, __LINE__); \ | 104 __FILE__, __LINE__); \ |
| 91 } while (0) | 105 } while (0) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 #define VP9_SYNC_CODE_2 0x42 | 117 #define VP9_SYNC_CODE_2 0x42 |
| 104 | 118 |
| 105 #define VP9_FRAME_MARKER 0x2 | 119 #define VP9_FRAME_MARKER 0x2 |
| 106 | 120 |
| 107 | 121 |
| 108 #ifdef __cplusplus | 122 #ifdef __cplusplus |
| 109 } // extern "C" | 123 } // extern "C" |
| 110 #endif | 124 #endif |
| 111 | 125 |
| 112 #endif // VP9_COMMON_VP9_COMMON_H_ | 126 #endif // VP9_COMMON_VP9_COMMON_H_ |
| OLD | NEW |