blob: 3740620a2580217c7f8839aa8fdce410690785f9 [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"
David Barkerfa2865b2016-11-11 09:25:56 +000016#include "aom_dsp/prob.h"
Angie Chiang4de81ee2016-07-26 14:14:20 -070017
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Angie Chiang4de81ee2016-07-26 14:14:20 -070022/* 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. */
30int bitstream_queue_get_write(void);
31int bitstream_queue_get_read(void);
32void bitstream_queue_record_write(void);
33void bitstream_queue_reset_write(void);
David Barkerfa2865b2016-11-11 09:25:56 +000034void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs);
35void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs);
Angie Chiang4de81ee2016-07-26 14:14:20 -070036void bitstream_queue_set_skip_write(int skip);
37void bitstream_queue_set_skip_read(int skip);
Angie Chiangcb9a9eb2016-09-01 16:10:50 -070038void bitstream_queue_set_frame_write(int frame_idx);
Angie Chiang6062a8b2016-09-21 16:01:04 -070039int bitstream_queue_get_frame_write(void);
Angie Chiangcb9a9eb2016-09-01 16:10:50 -070040void bitstream_queue_set_frame_read(int frame_idx);
Angie Chiang6062a8b2016-09-21 16:01:04 -070041int bitstream_queue_get_frame_read(void);
Angie Chiang4de81ee2016-07-26 14:14:20 -070042
43#ifdef __cplusplus
44} // extern "C"
45#endif
46
Yaowu Xuf883b422016-08-30 14:01:10 -070047#endif // AOM_UTIL_DEBUG_UTIL_H_