Commit b1823a7d authored by Yaowu Xu's avatar Yaowu Xu
Browse files

fixed a crash when MODE_STATS is enabled

The MODE_STATS macro was used to #ifdef around code for mode entropy
stats collection, this commit fixed a crash when MODE_STATS is on.
The commit also changed a number of array definitions to use defined
macros instead of hard-coded numbers.

Change-Id: I114592f53a1e44e31e455f5725f036ae6168735a
parent d0e3acf9
......@@ -65,10 +65,10 @@ static void adjust_act_zbin( VP8_COMP *cpi, MACROBLOCK *x );
#ifdef MODE_STATS
unsigned int inter_y_modes[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int inter_y_modes[MB_MODE_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int inter_uv_modes[VP8_UV_MODES] = {0, 0, 0, 0};
unsigned int inter_b_modes[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int y_modes[VP8_YMODES] = {0, 0, 0, 0, 0};
unsigned int inter_b_modes[B_MODE_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int y_modes[VP8_YMODES] = {0, 0, 0, 0, 0, 0};
unsigned int i8x8_modes[VP8_I8X8_MODES]={0 };
unsigned int uv_modes[VP8_UV_MODES] = {0, 0, 0, 0};
unsigned int uv_modes_y[VP8_YMODES][VP8_UV_MODES]=
......@@ -80,7 +80,7 @@ unsigned int uv_modes_y[VP8_YMODES][VP8_UV_MODES]=
{0, 0, 0, 0},
{0, 0, 0, 0}
};
unsigned int b_modes[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int b_modes[B_MODE_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#endif
......
......@@ -25,12 +25,12 @@ extern void vp8_build_block_offsets(MACROBLOCK *x);
extern void vp8_setup_block_ptrs(MACROBLOCK *x);
#ifdef MODE_STATS
extern unsigned int inter_y_modes[10];
extern unsigned int inter_uv_modes[4];
extern unsigned int inter_b_modes[15];
extern unsigned int y_modes[5];
extern unsigned int uv_modes[4];
extern unsigned int b_modes[14];
extern unsigned int inter_y_modes[MB_MODE_COUNT];
extern unsigned int inter_uv_modes[VP8_UV_MODES];
extern unsigned int inter_b_modes[B_MODE_COUNT];
extern unsigned int y_modes[VP8_YMODES];
extern unsigned int uv_modes[VP8_UV_MODES];
extern unsigned int b_modes[B_MODE_COUNT];
#endif
extern void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm);
......
......@@ -148,10 +148,10 @@ extern int y_modes[VP8_YMODES] ;
extern int i8x8_modes[VP8_I8X8_MODES];
extern int uv_modes[VP8_UV_MODES] ;
extern int uv_modes_y[VP8_YMODES][VP8_UV_MODES];
extern int b_modes[10] ;
extern int inter_y_modes[10] ;
extern int inter_uv_modes[4] ;
extern unsigned int inter_b_modes[15];
extern int b_modes[B_MODE_COUNT];
extern int inter_y_modes[MB_MODE_COUNT] ;
extern int inter_uv_modes[VP8_UV_MODES] ;
extern unsigned int inter_b_modes[B_MODE_COUNT];
#endif
extern void (*vp8_short_fdct4x4)(short *input, short *output, int pitch);
......@@ -2748,10 +2748,14 @@ void vp8_remove_compressor(VP8_PTR *ptr)
}
fprintf(f, "Modes in Inter Frames:\n");
fprintf(f, "Y: %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d\n",
inter_y_modes[0], inter_y_modes[1], inter_y_modes[2], inter_y_modes[3], inter_y_modes[4],
inter_y_modes[5], inter_y_modes[6], inter_y_modes[7], inter_y_modes[8], inter_y_modes[9]);
fprintf(f, "UV:%8d, %8d, %8d, %8d\n", inter_uv_modes[0], inter_uv_modes[1], inter_uv_modes[2], inter_uv_modes[3]);
fprintf(f,
"Y: %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d, %8d\n",
inter_y_modes[0], inter_y_modes[1], inter_y_modes[2],
inter_y_modes[3], inter_y_modes[4], inter_y_modes[5],
inter_y_modes[6], inter_y_modes[7], inter_y_modes[8],
inter_y_modes[9], inter_y_modes[10]);
fprintf(f, "UV:%8d, %8d, %8d, %8d\n", inter_uv_modes[0],
inter_uv_modes[1], inter_uv_modes[2], inter_uv_modes[3]);
fprintf(f, "B: ");
{
int i;
......
......@@ -77,10 +77,10 @@ typedef struct
int y_modes[VP8_YMODES];
int uv_modes[VP8_UV_MODES];
int i8x8_modes[VP8_I8X8_MODES];
int b_modes[10];
int b_modes[B_MODE_COUNT];
int inter_y_modes[MB_MODE_COUNT];
int inter_uv_modes[VP8_UV_MODES];
int inter_b_modes[10];
int inter_b_modes[B_MODE_COUNT];
#endif
/* interframe intra mode probs */
vp8_prob ymode_prob[VP8_YMODES-1], uv_mode_prob[VP8_UV_MODES-1];
......
......@@ -35,11 +35,11 @@ extern const MV_REFERENCE_FRAME vp8_ref_frame_order[MAX_MODES];
#ifdef MODE_STATS
extern int y_modes[VP8_YMODES];
extern int uv_modes[VP8_UV_MODES];
extern int b_modes[10];
extern int b_modes[B_MODE_COUNT];
extern int inter_y_modes[10];
extern int inter_y_modes[MB_MODE_COUNT];
extern int inter_uv_modes[VP8_UV_MODES];
extern int inter_b_modes[10];
extern int inter_b_modes[B_MODE_COUNT];
#endif
// Bits Per MB at different Q (Multiplied by 512)
......
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