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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/*
frame dumper
Copyright (C) 2001 Martin Vogt
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation.
For more information look at the file COPYRIGHT in this package
*/
typedef float REAL;
#define SSLIMIT 18
#define SBLIMIT 32
#include "dump.h"
#include <stdio.h>
Dump::Dump() {
}
Dump::~Dump() {
}
void Dump::dump(REAL out[SBLIMIT][SSLIMIT]) {
FILE* f=fopen("dump.raw","a+");
int i;
int j;
for(i=0;i<SBLIMIT;i++) {
fprintf(f,"Line:%d\n",i);
for(j=0;j<SSLIMIT;j++) {
fprintf(f,"%.25f\n",out[i][j]);
}
}
fclose(f);
}
void Dump::dump(REAL out[SBLIMIT*SSLIMIT]) {
FILE* f=fopen("dump.raw","a+");
int i;
int line=0;
for(i=0;i<SBLIMIT*SSLIMIT;i++) {
if ( (i % SSLIMIT) == 0) {
fprintf(f,"Line:%d\n",line++);
}
fprintf(f,"%.25f\n",out[i]);
}
fclose(f);
}
void Dump::dump2(REAL out[SSLIMIT*SBLIMIT]) {
FILE* f=fopen("dump.raw","a+");
int i;
int j;
int line=0;
for(i=0;i<SSLIMIT;i++) {
fprintf(f,"Line:%d\n",line++);
for(j=0;j<SBLIMIT;j++) {
fprintf(f,"%.25f\n",out[i*SBLIMIT+j]);
}
}
fclose(f);
}
void Dump::dump(REAL out[SSLIMIT][SBLIMIT]) {
FILE* f=fopen("dump.raw","a+");
int i;
int j;
for(i=0;i<SBLIMIT;i++) {
fprintf(f,"Line:%d\n",i);
for(j=0;j<SSLIMIT;j++) {
fprintf(f,"%.25f\n",out[j][i]);
}
}
fclose(f);
}
void Dump::dump(int out[SBLIMIT][SSLIMIT]) {
FILE* f=fopen("dump.raw","a+");
int i;
int j;
for(i=0;i<SBLIMIT;i++) {
fprintf(f,"Line:%d\n",i);
for(j=0;j<SSLIMIT;j++) {
if (out[i][j] == 0) {
fprintf(f," %d ",out[i][j]);
continue;
}
if (out[i][j] < 0) {
fprintf(f," -x");
continue;
}
fprintf(f," +x");
}
fprintf(f," \n");
}
fclose(f);
}
void Dump::dump(char* ptr,int len,int ldelete) {
FILE* f;
if (ldelete) {
f=fopen("/tmp/dump.raw","w+");
} else {
f=fopen("/tmp/dump.raw","a+");
}
fwrite(ptr,len,1,f);
fclose(f);
}
void Dump::scale_zero(layer3scalefactor* out) {
int i;
int j;
for(i=0;i<23;i++) {
out->l[i]=0;
}
for(i=0;i<3;i++) {
for(j=0;j<13;j++) {
out->s[i][j]=0;
}
}
}
void Dump::dump(layer3scalefactor* out) {
FILE* f=fopen("dump.raw","a+");
int i;
int j;
for(i=0;i<23;i++) {
fprintf(f,"l[%d]=%d\n",i,out->l[i]);
}
for(i=0;i<3;i++) {
for(j=0;j<13;j++) {
fprintf(f,"s[%d][%d]=%d\n",i,j,out->s[i][j]);
}
}
fprintf(f,"---------\n");
fclose(f);
}
|