2 * Copyright (c) 2019 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef VPX_VPX_UTIL_VPX_DEBUG_UTIL_H_
12 #define VPX_VPX_UTIL_VPX_DEBUG_UTIL_H_
14 #include "./vpx_config.h"
16 #include "vpx_dsp/prob.h"
22 #if CONFIG_BITSTREAM_DEBUG || CONFIG_MISMATCH_DEBUG
23 void bitstream_queue_set_frame_write(int frame_idx);
24 int bitstream_queue_get_frame_write(void);
25 void bitstream_queue_set_frame_read(int frame_idx);
26 int bitstream_queue_get_frame_read(void);
29 #if CONFIG_BITSTREAM_DEBUG
30 /* This is a debug tool used to detect bitstream error. On encoder side, it
31 * pushes each bit and probability into a queue before the bit is written into
32 * the Arithmetic coder. On decoder side, whenever a bit is read out from the
33 * Arithmetic coder, it pops out the reference bit and probability from the
34 * queue as well. If the two results do not match, this debug tool will report
35 * an error. This tool can be used to pin down the bitstream error precisely.
36 * By combining gdb's backtrace method, we can detect which module causes the
38 int bitstream_queue_get_write(void);
39 int bitstream_queue_get_read(void);
40 void bitstream_queue_record_write(void);
41 void bitstream_queue_reset_write(void);
42 void bitstream_queue_pop(int *result, int *prob);
43 void bitstream_queue_push(int result, const int prob);
44 void bitstream_queue_set_skip_write(int skip);
45 void bitstream_queue_set_skip_read(int skip);
46 #endif // CONFIG_BITSTREAM_DEBUG
48 #if CONFIG_MISMATCH_DEBUG
49 void mismatch_move_frame_idx_w(void);
50 void mismatch_move_frame_idx_r(void);
51 void mismatch_reset_frame(int num_planes);
52 void mismatch_record_block_pre(const uint8_t *src, int src_stride, int plane,
53 int pixel_c, int pixel_r, int blk_w, int blk_h,
55 void mismatch_record_block_tx(const uint8_t *src, int src_stride, int plane,
56 int pixel_c, int pixel_r, int blk_w, int blk_h,
58 void mismatch_check_block_pre(const uint8_t *src, int src_stride, int plane,
59 int pixel_c, int pixel_r, int blk_w, int blk_h,
61 void mismatch_check_block_tx(const uint8_t *src, int src_stride, int plane,
62 int pixel_c, int pixel_r, int blk_w, int blk_h,
64 #endif // CONFIG_MISMATCH_DEBUG
70 #endif // VPX_VPX_UTIL_VPX_DEBUG_UTIL_H_