1*77c1e3ccSAndroid Build Coastguard Worker /* 2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2001-2016, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker * 4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker */ 11*77c1e3ccSAndroid Build Coastguard Worker 12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AOM_DSP_ENTCODE_H_ 13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AOM_DSP_ENTCODE_H_ 14*77c1e3ccSAndroid Build Coastguard Worker 15*77c1e3ccSAndroid Build Coastguard Worker #include <limits.h> 16*77c1e3ccSAndroid Build Coastguard Worker #include <stddef.h> 17*77c1e3ccSAndroid Build Coastguard Worker #include "aom_dsp/odintrin.h" 18*77c1e3ccSAndroid Build Coastguard Worker #include "aom_dsp/prob.h" 19*77c1e3ccSAndroid Build Coastguard Worker 20*77c1e3ccSAndroid Build Coastguard Worker #define EC_PROB_SHIFT 6 21*77c1e3ccSAndroid Build Coastguard Worker #define EC_MIN_PROB 4 // must be <= (1<<EC_PROB_SHIFT)/16 22*77c1e3ccSAndroid Build Coastguard Worker 23*77c1e3ccSAndroid Build Coastguard Worker /*OPT: od_ec_window must be at least 32 bits, but if you have fast arithmetic 24*77c1e3ccSAndroid Build Coastguard Worker on a larger type, you can speed up the decoder by using it here.*/ 25*77c1e3ccSAndroid Build Coastguard Worker typedef uint32_t od_ec_window; 26*77c1e3ccSAndroid Build Coastguard Worker 27*77c1e3ccSAndroid Build Coastguard Worker /*The size in bits of od_ec_window.*/ 28*77c1e3ccSAndroid Build Coastguard Worker #define OD_EC_WINDOW_SIZE ((int)sizeof(od_ec_window) * CHAR_BIT) 29*77c1e3ccSAndroid Build Coastguard Worker 30*77c1e3ccSAndroid Build Coastguard Worker /*The resolution of fractional-precision bit usage measurements, i.e., 31*77c1e3ccSAndroid Build Coastguard Worker 3 => 1/8th bits.*/ 32*77c1e3ccSAndroid Build Coastguard Worker #define OD_BITRES (3) 33*77c1e3ccSAndroid Build Coastguard Worker 34*77c1e3ccSAndroid Build Coastguard Worker #define OD_ICDF AOM_ICDF 35*77c1e3ccSAndroid Build Coastguard Worker 36*77c1e3ccSAndroid Build Coastguard Worker /*See entcode.c for further documentation.*/ 37*77c1e3ccSAndroid Build Coastguard Worker 38*77c1e3ccSAndroid Build Coastguard Worker OD_WARN_UNUSED_RESULT uint32_t od_ec_tell_frac(uint32_t nbits_total, 39*77c1e3ccSAndroid Build Coastguard Worker uint32_t rng); 40*77c1e3ccSAndroid Build Coastguard Worker 41*77c1e3ccSAndroid Build Coastguard Worker #endif // AOM_AOM_DSP_ENTCODE_H_ 42