vitdec.cpp
· 804 B · C++
Ham
#include <stdio.h>
#include <SatHelper/sathelper.h>
#define FRAMEBYTES 8192
#define FRAMEBITS (FRAMEBYTES * 8)
using namespace SatHelper;
using namespace std;
unsigned char symbols[8 * 2 * (FRAMEBYTES + 6)];
unsigned char bits[FRAMEBYTES];
unsigned char output[FRAMEBYTES];
int main(int argc, char **argv) {
FILE *f = fopen("jpss.dec", "rb");
FILE *z = fopen("jpss.vit.dec", "wb");
Viterbi27 viterbi(FRAMEBITS+6);
fseek(f, 0, 2);
int size = ftell(f);
fseek(f, 0, 0);
int bytesRead = 0;
while (bytesRead < size) {
fread(symbols, FRAMEBITS, 1, f);
viterbi.decode(symbols, output);
fwrite(output, FRAMEBYTES, 1, z);
bytesRead += FRAMEBITS;
}
cout << "File Size: " << size << endl;
//viterbi.decode(symbols, output);
fclose(f);
fclose(z);
return 0;
}
| 1 | #include <stdio.h> |
| 2 | #include <SatHelper/sathelper.h> |
| 3 | |
| 4 | #define FRAMEBYTES 8192 |
| 5 | #define FRAMEBITS (FRAMEBYTES * 8) |
| 6 | |
| 7 | using namespace SatHelper; |
| 8 | using namespace std; |
| 9 | |
| 10 | |
| 11 | unsigned char symbols[8 * 2 * (FRAMEBYTES + 6)]; |
| 12 | unsigned char bits[FRAMEBYTES]; |
| 13 | unsigned char output[FRAMEBYTES]; |
| 14 | |
| 15 | int main(int argc, char **argv) { |
| 16 | |
| 17 | FILE *f = fopen("jpss.dec", "rb"); |
| 18 | FILE *z = fopen("jpss.vit.dec", "wb"); |
| 19 | Viterbi27 viterbi(FRAMEBITS+6); |
| 20 | |
| 21 | fseek(f, 0, 2); |
| 22 | |
| 23 | int size = ftell(f); |
| 24 | |
| 25 | fseek(f, 0, 0); |
| 26 | |
| 27 | int bytesRead = 0; |
| 28 | |
| 29 | while (bytesRead < size) { |
| 30 | fread(symbols, FRAMEBITS, 1, f); |
| 31 | viterbi.decode(symbols, output); |
| 32 | fwrite(output, FRAMEBYTES, 1, z); |
| 33 | bytesRead += FRAMEBITS; |
| 34 | } |
| 35 | |
| 36 | cout << "File Size: " << size << endl; |
| 37 | |
| 38 | //viterbi.decode(symbols, output); |
| 39 | |
| 40 | fclose(f); |
| 41 | fclose(z); |
| 42 | return 0; |
| 43 | } |