Yushin Cho | 77bba8d | 2016-11-04 16:36:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2001-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 | */ |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 11 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 12 | #ifndef AOM_AOM_DSP_ENTCODE_H_ |
| 13 | #define AOM_AOM_DSP_ENTCODE_H_ |
Sebastien Alaiwan | 148f6e6 | 2018-03-02 15:31:59 +0100 | [diff] [blame] | 14 | |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 15 | #include <limits.h> |
| 16 | #include <stddef.h> |
| 17 | #include "av1/common/odintrin.h" |
Thomas Daede | 837262b | 2017-11-06 20:07:01 -0800 | [diff] [blame] | 18 | #include "aom_dsp/prob.h" |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 19 | |
Thomas Davies | 736ddef | 2017-11-09 09:46:08 +0000 | [diff] [blame] | 20 | #define EC_PROB_SHIFT 6 |
| 21 | #define EC_MIN_PROB 4 // must be <= (1<<EC_PROB_SHIFT)/16 |
Thomas Davies | 736ddef | 2017-11-09 09:46:08 +0000 | [diff] [blame] | 22 | |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 23 | /*OPT: od_ec_window must be at least 32 bits, but if you have fast arithmetic |
| 24 | on a larger type, you can speed up the decoder by using it here.*/ |
| 25 | typedef uint32_t od_ec_window; |
| 26 | |
Wan-Teh Chang | ed997ab | 2018-08-14 12:35:17 -0700 | [diff] [blame] | 27 | /*The size in bits of od_ec_window.*/ |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 28 | #define OD_EC_WINDOW_SIZE ((int)sizeof(od_ec_window) * CHAR_BIT) |
| 29 | |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 30 | /*The resolution of fractional-precision bit usage measurements, i.e., |
| 31 | 3 => 1/8th bits.*/ |
| 32 | #define OD_BITRES (3) |
| 33 | |
Thomas Daede | 837262b | 2017-11-06 20:07:01 -0800 | [diff] [blame] | 34 | #define OD_ICDF AOM_ICDF |
Timothy B. Terriberry | 41b4f75 | 2017-03-07 17:45:30 -0800 | [diff] [blame] | 35 | |
Nathan E. Egge | 1078dee | 2016-03-06 10:59:29 -0500 | [diff] [blame] | 36 | /*See entcode.c for further documentation.*/ |
| 37 | |
| 38 | OD_WARN_UNUSED_RESULT uint32_t od_ec_tell_frac(uint32_t nbits_total, |
| 39 | uint32_t rng); |
| 40 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 41 | #endif // AOM_AOM_DSP_ENTCODE_H_ |