Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 6e0d64c | 2016-10-10 16:21:45 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 6e0d64c | 2016-10-10 16:21:45 -0700 | [diff] [blame] | 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. |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AOM_UTIL_DEBUG_UTIL_H_ |
| 13 | #define AOM_UTIL_DEBUG_UTIL_H_ |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 14 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 15 | #include "./aom_config.h" |
David Barker | fa2865b | 2016-11-11 09:25:56 +0000 | [diff] [blame] | 16 | #include "aom_dsp/prob.h" |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 22 | /* This is a debug tool used to detect bitstream error. On encoder side, it |
| 23 | * pushes each bit and probability into a queue before the bit is written into |
| 24 | * the Arithmetic coder. On decoder side, whenever a bit is read out from the |
| 25 | * Arithmetic coder, it pops out the reference bit and probability from the |
| 26 | * queue as well. If the two results do not match, this debug tool will report |
| 27 | * an error. This tool can be used to pin down the bitstream error precisely. |
| 28 | * By combining gdb's backtrace method, we can detect which module causes the |
| 29 | * bitstream error. */ |
| 30 | int bitstream_queue_get_write(void); |
| 31 | int bitstream_queue_get_read(void); |
| 32 | void bitstream_queue_record_write(void); |
| 33 | void bitstream_queue_reset_write(void); |
David Barker | fa2865b | 2016-11-11 09:25:56 +0000 | [diff] [blame] | 34 | void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs); |
| 35 | void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs); |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 36 | void bitstream_queue_set_skip_write(int skip); |
| 37 | void bitstream_queue_set_skip_read(int skip); |
Angie Chiang | cb9a9eb | 2016-09-01 16:10:50 -0700 | [diff] [blame] | 38 | void bitstream_queue_set_frame_write(int frame_idx); |
Angie Chiang | 6062a8b | 2016-09-21 16:01:04 -0700 | [diff] [blame] | 39 | int bitstream_queue_get_frame_write(void); |
Angie Chiang | cb9a9eb | 2016-09-01 16:10:50 -0700 | [diff] [blame] | 40 | void bitstream_queue_set_frame_read(int frame_idx); |
Angie Chiang | 6062a8b | 2016-09-21 16:01:04 -0700 | [diff] [blame] | 41 | int bitstream_queue_get_frame_read(void); |
Angie Chiang | 4de81ee | 2016-07-26 14:14:20 -0700 | [diff] [blame] | 42 | |
| 43 | #ifdef __cplusplus |
| 44 | } // extern "C" |
| 45 | #endif |
| 46 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 47 | #endif // AOM_UTIL_DEBUG_UTIL_H_ |