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