-
Notifications
You must be signed in to change notification settings - Fork 4
/
debug.c
executable file
·88 lines (75 loc) · 1.85 KB
/
debug.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "misc.h"
FILE *_t_stream;
void trace(char *fmt, ...)
{
va_list ap;
if (!_t_stream) return;
va_start(ap,fmt);
vfprintf(_t_stream, fmt, ap);
va_end(ap);
// fflush(_t_stream);
}
void trace_block(int *block)
{
int i, j;
if (!_t_stream) return;
if (!block) trace("trace_block(0)\n");
for (i=0; i<BLOCK_SIZE; i++) {
for (j=0; j<BLOCK_SIZE; j++)
trace("%4d ", (char)block[i*BLOCK_SIZE + j]);
trace("\n");
}
fflush(_t_stream);
}
void trace_cblock(unsigned char *block, int size)
{
int i, j;
if (!_t_stream) return;
if (!block) trace("trace_block(0)\n");
for (i=0; i<size; i++) {
for (j=0; j<size; j++)
trace("%4d ", block[i*size + j]);
trace("\n");
}
fflush(_t_stream);
}
void trace_iblock(int *block, int size)
{
int i, j;
if (!_t_stream) return;
if (!block) trace("trace_block(0)\n");
for (i=0; i<size; i++) {
for (j=0; j<size; j++)
trace("%4d ", block[i*size + j]);
trace("\n");
}
fflush(_t_stream);
}
void trace_pic_mv(PICTURE *pic)
{
MACROBLOCK *mb;
int i, j, sad = 0, nsad = 0, motest_sp = 0;
fprintf(stderr, "MV:\n");
for (i=0; i<pic->nmy; i++) {
for (j=0; j<pic->nmx; j++) {
mb = &pic->mb[i][j];
if (mb->type != MODE_INTRA && mb->type!=MODE_INTRA_Q) {
// fprintf(stderr, "%2d,%2d ", mb->mv[0].hx, mb->mv[0].hy);
nsad++;
sad += mb->sad[0];
motest_sp += mb->motest_sp;
} else
;// fprintf(stderr, " .,. ");
}
// fprintf(stderr, "\n");
}
if (nsad) {
fprintf(stderr, "avg SAD == %d\n", sad/nsad);
fprintf(stderr, "avg SP == %d\n", motest_sp/nsad);
}
}
void trace_stat(PCT_STAT *stat)
{
trace("Coeff_Y: %d\nCoeff_C: %d\nVectors: %d\nCBPY\t: %d\nMCBPC\t: %d\nMODB\t: %d\nCBPB\t: %d\nCOD\t: %d\nDQUANT\t: %d\nheader\t: %d\nTotal\t: %d\n",
stat->coeff_y, stat->coeff_c, stat->vectors, stat->cbpy, stat->mcbpc, stat->modb, stat->cbpb, stat->cod, stat->dquant, stat->header, stat->header+stat->framesize);
}