• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AOM_AV1_ENCODER_HASH_H_
13 #define AOM_AV1_ENCODER_HASH_H_
14 
15 #include "config/aom_config.h"
16 
17 #include "aom/aom_integer.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 typedef struct _crc_calculator {
24   uint32_t remainder;
25   uint32_t trunc_poly;
26   uint32_t bits;
27   uint32_t table[256];
28   uint32_t final_result_mask;
29 } CRC_CALCULATOR;
30 
31 // Initialize the crc calculator. It must be executed at least once before
32 // calling av1_get_crc_value().
33 void av1_crc_calculator_init(CRC_CALCULATOR *p_crc_calculator, uint32_t bits,
34                              uint32_t truncPoly);
35 uint32_t av1_get_crc_value(CRC_CALCULATOR *p_crc_calculator, uint8_t *p,
36                            int length);
37 
38 // CRC32C: POLY = 0x82f63b78;
39 typedef struct _CRC32C {
40   /* Table for a quadword-at-a-time software crc. */
41   uint32_t table[8][256];
42 } CRC32C;
43 
44 // init table for software version crc32c
45 void av1_crc32c_calculator_init(CRC32C *p_crc32c);
46 
47 #define AOM_BUFFER_SIZE_FOR_BLOCK_HASH (4096)
48 
49 #ifdef __cplusplus
50 }  // extern "C"
51 #endif
52 
53 #endif  // AOM_AV1_ENCODER_HASH_H_
54