2017-08-18 23:52:53 +00:00
|
|
|
#include <qpdf/Pl_DCT.hh>
|
|
|
|
#include <qpdf/Pl_StdioFile.hh>
|
|
|
|
#include <qpdf/QUtil.hh>
|
|
|
|
|
|
|
|
#include <iostream>
|
2022-04-02 21:14:10 +00:00
|
|
|
#include <stdio.h>
|
2017-08-18 23:52:53 +00:00
|
|
|
#include <stdlib.h>
|
2022-04-02 21:14:10 +00:00
|
|
|
#include <string.h>
|
2017-08-18 23:52:53 +00:00
|
|
|
|
2022-04-02 21:14:10 +00:00
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
2017-08-18 23:52:53 +00:00
|
|
|
{
|
2022-04-02 21:14:10 +00:00
|
|
|
if (argc != 3) {
|
|
|
|
std::cerr << "Usage: dct_uncompress infile outfile" << std::endl;
|
2022-02-08 14:18:08 +00:00
|
|
|
exit(2);
|
2017-08-18 23:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char* infilename = argv[1];
|
|
|
|
char* outfilename = argv[2];
|
|
|
|
|
|
|
|
FILE* infile = QUtil::safe_fopen(infilename, "rb");
|
|
|
|
FILE* outfile = QUtil::safe_fopen(outfilename, "wb");
|
|
|
|
Pl_StdioFile out("stdout", outfile);
|
|
|
|
unsigned char buf[100];
|
|
|
|
bool done = false;
|
|
|
|
Pl_DCT dct("dct", &out);
|
2022-04-02 21:14:10 +00:00
|
|
|
while (!done) {
|
2022-02-08 14:18:08 +00:00
|
|
|
size_t len = fread(buf, 1, sizeof(buf), infile);
|
2022-04-02 21:14:10 +00:00
|
|
|
if (len <= 0) {
|
2022-02-08 14:18:08 +00:00
|
|
|
done = true;
|
2022-04-02 21:14:10 +00:00
|
|
|
} else {
|
2022-02-08 14:18:08 +00:00
|
|
|
dct.write(buf, len);
|
|
|
|
}
|
2017-08-18 23:52:53 +00:00
|
|
|
}
|
|
|
|
dct.finish();
|
|
|
|
fclose(infile);
|
|
|
|
fclose(outfile);
|
|
|
|
return 0;
|
|
|
|
}
|