2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
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.
12 #ifndef AOM_UTIL_DEBUG_UTIL_H_
13 #define AOM_UTIL_DEBUG_UTIL_H_
15 #include "./aom_config.h"
16 #include "aom_dsp/prob.h"
22 void bitstream_queue_set_frame_write(int frame_idx
);
23 int bitstream_queue_get_frame_write(void);
24 void bitstream_queue_set_frame_read(int frame_idx
);
25 int bitstream_queue_get_frame_read(void);
27 #if CONFIG_BITSTREAM_DEBUG
28 /* This is a debug tool used to detect bitstream error. On encoder side, it
29 * pushes each bit and probability into a queue before the bit is written into
30 * the Arithmetic coder. On decoder side, whenever a bit is read out from the
31 * Arithmetic coder, it pops out the reference bit and probability from the
32 * queue as well. If the two results do not match, this debug tool will report
33 * an error. This tool can be used to pin down the bitstream error precisely.
34 * By combining gdb's backtrace method, we can detect which module causes the
36 int bitstream_queue_get_write(void);
37 int bitstream_queue_get_read(void);
38 void bitstream_queue_record_write(void);
39 void bitstream_queue_reset_write(void);
40 void bitstream_queue_pop(int *result
, aom_cdf_prob
*cdf
, int *nsymbs
);
41 void bitstream_queue_push(int result
, const aom_cdf_prob
*cdf
, int nsymbs
);
42 void bitstream_queue_set_skip_write(int skip
);
43 void bitstream_queue_set_skip_read(int skip
);
44 #endif // CONFIG_BITSTREAM_DEBUG
46 #if CONFIG_MISMATCH_DEBUG
47 void mismatch_move_frame_idx_w();
48 void mismatch_move_frame_idx_r();
49 void mismatch_reset_frame(int num_planes
);
50 void mismatch_record_block_pre(const uint8_t *src
, int src_stride
,
51 int frame_offset
, int plane
, int pixel_c
,
52 int pixel_r
, int blk_w
, int blk_h
, int highbd
);
53 void mismatch_record_block_tx(const uint8_t *src
, int src_stride
,
54 int frame_offset
, int plane
, int pixel_c
,
55 int pixel_r
, int blk_w
, int blk_h
, int highbd
);
56 void mismatch_check_block_pre(const uint8_t *src
, int src_stride
,
57 int frame_offset
, int plane
, int pixel_c
,
58 int pixel_r
, int blk_w
, int blk_h
, int highbd
);
59 void mismatch_check_block_tx(const uint8_t *src
, int src_stride
,
60 int frame_offset
, int plane
, int pixel_c
,
61 int pixel_r
, int blk_w
, int blk_h
, int highbd
);
62 #endif // CONFIG_MISMATCH_DEBUG
68 #endif // AOM_UTIL_DEBUG_UTIL_H_