Add frame info in bitstream debug tool
Change-Id: Iead3edd8563d7900481eb199e8b003d2d3df075b
This commit is contained in:
		@@ -114,14 +114,18 @@ static INLINE int aom_read(aom_reader *r, int prob) {
 | 
			
		||||
  {
 | 
			
		||||
    int ref_bit, ref_prob;
 | 
			
		||||
    const int queue_r = bitstream_queue_get_read();
 | 
			
		||||
    const int frame_idx = bitstream_queue_get_frame_read();
 | 
			
		||||
    bitstream_queue_pop(&ref_bit, &ref_prob);
 | 
			
		||||
    if (prob != ref_prob) {
 | 
			
		||||
      fprintf(stderr, "prob error, prob %d ref_prob %d queue_r %d\n", prob,
 | 
			
		||||
              ref_prob, queue_r);
 | 
			
		||||
      fprintf(
 | 
			
		||||
          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);
 | 
			
		||||
    }
 | 
			
		||||
    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);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,12 @@
 | 
			
		||||
#ifndef 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_dsp/prob.h"
 | 
			
		||||
#include "aom_util/debug_util.h"
 | 
			
		||||
@@ -38,6 +44,14 @@ static INLINE void aom_write(aom_writer *br, int bit, int probability) {
 | 
			
		||||
  register int shift;
 | 
			
		||||
 | 
			
		||||
#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);
 | 
			
		||||
#endif  // CONFIG_BITSTREAM_DEBUG
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,18 @@ static int queue_prev_w = -1;
 | 
			
		||||
static int skip_r = 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_read(int skip) { skip_r = skip; }
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,10 @@ void bitstream_queue_pop(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_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
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
 
 | 
			
		||||
@@ -3724,9 +3724,16 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
 | 
			
		||||
  struct aom_read_bit_buffer rb;
 | 
			
		||||
  int context_updated = 0;
 | 
			
		||||
  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));
 | 
			
		||||
  YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm);
 | 
			
		||||
  new_fb = get_frame_new_buffer(cm);
 | 
			
		||||
  xd->cur_buf = new_fb;
 | 
			
		||||
#if CONFIG_GLOBAL_MOTION
 | 
			
		||||
  xd->global_motion = cm->global_motion;
 | 
			
		||||
 
 | 
			
		||||
@@ -5198,6 +5198,7 @@ int av1_get_compressed_data(AV1_COMP *cpi, unsigned int *frame_flags,
 | 
			
		||||
  assert(cpi->oxcf.max_threads == 0 &&
 | 
			
		||||
         "bitstream debug tool does not support multithreading");
 | 
			
		||||
  bitstream_queue_record_write();
 | 
			
		||||
  bitstream_queue_set_frame_write(cm->current_video_frame * 2 + cm->show_frame);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  aom_usec_timer_start(&cmptimer);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user