Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 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_ENCODER_HASH_H_ |
| 13 | #define AV1_ENCODER_HASH_H_ |
| 14 | |
| 15 | #include "./aom_config.h" |
| 16 | #include "aom/aom_integer.h" |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | typedef struct _crc_calculator { |
| 23 | uint32_t remainder; |
| 24 | uint32_t trunc_poly; |
| 25 | uint32_t bits; |
| 26 | uint32_t table[256]; |
| 27 | uint32_t final_result_mask; |
| 28 | } CRC_CALCULATOR; |
| 29 | |
| 30 | // Initialize the crc calculator. It must be executed at least once before |
| 31 | // calling av1_get_crc_value(). |
| 32 | void av1_crc_calculator_init(CRC_CALCULATOR *p_crc_calculator, uint32_t bits, |
| 33 | uint32_t truncPoly); |
| 34 | |
| 35 | uint32_t av1_get_crc_value(CRC_CALCULATOR *p_crc_calculator, uint8_t *p, |
| 36 | int length); |
| 37 | |
| 38 | #ifdef __cplusplus |
| 39 | } // extern "C" |
| 40 | #endif |
| 41 | |
| 42 | #endif // AV1_ENCODER_HASH_H_ |