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