blob: c52e3853549f3819e8f8b0c5e8a31ac9c579f375 [file] [log] [blame]
Angie Chiang4de81ee2016-07-26 14:14:20 -07001/*
Yaowu Xu6e0d64c2016-10-10 16:21:45 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Angie Chiang4de81ee2016-07-26 14:14:20 -07003 *
Yaowu Xu6e0d64c2016-10-10 16:21:45 -07004 * 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 Chiang4de81ee2016-07-26 14:14:20 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AOM_UTIL_DEBUG_UTIL_H_
13#define AOM_UTIL_DEBUG_UTIL_H_
Angie Chiang4de81ee2016-07-26 14:14:20 -070014
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "./aom_config.h"
Angie Chiang4de81ee2016-07-26 14:14:20 -070016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
Angie Chiang4de81ee2016-07-26 14:14:20 -070021/* This is a debug tool used to detect bitstream error. On encoder side, it
22 * pushes each bit and probability into a queue before the bit is written into
23 * the Arithmetic coder. On decoder side, whenever a bit is read out from the
24 * Arithmetic coder, it pops out the reference bit and probability from the
25 * queue as well. If the two results do not match, this debug tool will report
26 * an error. This tool can be used to pin down the bitstream error precisely.
27 * By combining gdb's backtrace method, we can detect which module causes the
28 * bitstream error. */
29int bitstream_queue_get_write(void);
30int bitstream_queue_get_read(void);
31void bitstream_queue_record_write(void);
32void bitstream_queue_reset_write(void);
33void bitstream_queue_pop(int *result, int *prob);
34void bitstream_queue_push(int result, int prob);
35void bitstream_queue_set_skip_write(int skip);
36void bitstream_queue_set_skip_read(int skip);
Angie Chiangcb9a9eb2016-09-01 16:10:50 -070037void bitstream_queue_set_frame_write(int frame_idx);
Angie Chiang6062a8b2016-09-21 16:01:04 -070038int bitstream_queue_get_frame_write(void);
Angie Chiangcb9a9eb2016-09-01 16:10:50 -070039void bitstream_queue_set_frame_read(int frame_idx);
Angie Chiang6062a8b2016-09-21 16:01:04 -070040int bitstream_queue_get_frame_read(void);
Angie Chiang4de81ee2016-07-26 14:14:20 -070041
42#ifdef __cplusplus
43} // extern "C"
44#endif
45
Yaowu Xuf883b422016-08-30 14:01:10 -070046#endif // AOM_UTIL_DEBUG_UTIL_H_