Commit 0bfe4919 authored by Angie Chiang's avatar Angie Chiang Committed by Gerrit Code Review
Browse files

Merge "Add frame info in bitstream debug tool" into nextgenv2

parents a782a3b6 cb9a9ebd
...@@ -114,14 +114,18 @@ static INLINE int aom_read(aom_reader *r, int prob) { ...@@ -114,14 +114,18 @@ static INLINE int aom_read(aom_reader *r, int prob) {
{ {
int ref_bit, ref_prob; int ref_bit, ref_prob;
const int queue_r = bitstream_queue_get_read(); const int queue_r = bitstream_queue_get_read();
const int frame_idx = bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_bit, &ref_prob); bitstream_queue_pop(&ref_bit, &ref_prob);
if (prob != ref_prob) { if (prob != ref_prob) {
fprintf(stderr, "prob error, prob %d ref_prob %d queue_r %d\n", prob, fprintf(
ref_prob, queue_r); stderr,
"\n *** prob error, frame_idx_r %d prob %d ref_prob %d queue_r %d\n",
frame_idx, prob, ref_prob, queue_r);
assert(0); assert(0);
} }
if ((int)bit != ref_bit) { if ((int)bit != ref_bit) {
fprintf(stderr, "bit error, bit %d ref_bit %d\n", bit, ref_bit); fprintf(stderr, "\n *** bit error, frame_idx_r %d bit %d ref_bit %d\n",
frame_idx, bit, ref_bit);
assert(0); assert(0);
} }
} }
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
#ifndef AOM_DSP_BITWRITER_H_ #ifndef AOM_DSP_BITWRITER_H_
#define AOM_DSP_BITWRITER_H_ #define AOM_DSP_BITWRITER_H_
#include "./aom_config.h"
#if CONFIG_BITSTREAM_DEBUG
#include <stdio.h>
#endif
#include "aom_ports/mem.h" #include "aom_ports/mem.h"
#include "aom_dsp/prob.h" #include "aom_dsp/prob.h"
#include "aom_util/debug_util.h" #include "aom_util/debug_util.h"
...@@ -38,6 +44,14 @@ static INLINE void aom_write(aom_writer *br, int bit, int probability) { ...@@ -38,6 +44,14 @@ static INLINE void aom_write(aom_writer *br, int bit, int probability) {
register int shift; register int shift;
#if CONFIG_BITSTREAM_DEBUG #if CONFIG_BITSTREAM_DEBUG
// int queue_r = 0;
// int frame_idx_r = 0;
// int queue_w = bitstream_queue_get_write();
// int frame_idx_w = bitstream_queue_get_frame_write();
// if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
// fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
// frame_idx_w, queue_w);
// }
bitstream_queue_push(bit, probability); bitstream_queue_push(bit, probability);
#endif // CONFIG_BITSTREAM_DEBUG #endif // CONFIG_BITSTREAM_DEBUG
......
...@@ -21,6 +21,18 @@ static int queue_prev_w = -1; ...@@ -21,6 +21,18 @@ static int queue_prev_w = -1;
static int skip_r = 0; static int skip_r = 0;
static int skip_w = 0; static int skip_w = 0;
static int frame_idx_w = 0;
static int frame_idx_r = 0;
void bitstream_queue_set_frame_write(int frame_idx) { frame_idx_w = frame_idx; }
int bitstream_queue_get_frame_write() { return frame_idx_w; }
void bitstream_queue_set_frame_read(int frame_idx) { frame_idx_r = frame_idx; }
int bitstream_queue_get_frame_read() { return frame_idx_r; }
void bitstream_queue_set_skip_write(int skip) { skip_w = skip; } void bitstream_queue_set_skip_write(int skip) { skip_w = skip; }
void bitstream_queue_set_skip_read(int skip) { skip_r = skip; } void bitstream_queue_set_skip_read(int skip) { skip_r = skip; }
......
...@@ -34,6 +34,10 @@ void bitstream_queue_pop(int *result, int *prob); ...@@ -34,6 +34,10 @@ void bitstream_queue_pop(int *result, int *prob);
void bitstream_queue_push(int result, int prob); void bitstream_queue_push(int result, int prob);
void bitstream_queue_set_skip_write(int skip); void bitstream_queue_set_skip_write(int skip);
void bitstream_queue_set_skip_read(int skip); void bitstream_queue_set_skip_read(int skip);
void bitstream_queue_set_frame_write(int frame_idx);
int bitstream_queue_get_frame_write();
void bitstream_queue_set_frame_read(int frame_idx);
int bitstream_queue_get_frame_read();
#endif // CONFIG_BITSTREAM_DEBUG #endif // CONFIG_BITSTREAM_DEBUG
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -3724,9 +3724,16 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data, ...@@ -3724,9 +3724,16 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
struct aom_read_bit_buffer rb; struct aom_read_bit_buffer rb;
int context_updated = 0; int context_updated = 0;
uint8_t clear_data[MAX_AV1_HEADER_SIZE]; uint8_t clear_data[MAX_AV1_HEADER_SIZE];
const size_t first_partition_size = read_uncompressed_header( size_t first_partition_size;
YV12_BUFFER_CONFIG *new_fb;
#if CONFIG_BITSTREAM_DEBUG
bitstream_queue_set_frame_read(cm->current_video_frame * 2 + cm->show_frame);
#endif
first_partition_size = read_uncompressed_header(
pbi, init_read_bit_buffer(pbi, &rb, data, data_end, clear_data)); pbi, init_read_bit_buffer(pbi, &rb, data, data_end, clear_data));
YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm); new_fb = get_frame_new_buffer(cm);
xd->cur_buf = new_fb; xd->cur_buf = new_fb;
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
xd->global_motion = cm->global_motion; xd->global_motion = cm->global_motion;
......
...@@ -5198,6 +5198,7 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags, ...@@ -5198,6 +5198,7 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
assert(cpi->oxcf.max_threads == 0 && assert(cpi->oxcf.max_threads == 0 &&
"bitstream debug tool does not support multithreading"); "bitstream debug tool does not support multithreading");
bitstream_queue_record_write(); bitstream_queue_record_write();
bitstream_queue_set_frame_write(cm->current_video_frame * 2 + cm->show_frame);
#endif #endif
aom_usec_timer_start(&cmptimer); aom_usec_timer_start(&cmptimer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment