Created
August 10, 2017 18:02
-
-
Save LebedevRI/429a410ea5f19e2abb0b77bd0710b9bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <cstdlib> | |
#include <cstring> | |
using ushort16 = unsigned short; | |
class PentaxDecompressor { | |
enum class ThreadingModel { | |
// no threading whatsoever, need to do everything right here and now. | |
NoThreading = 0, | |
// threaded. only do the preparatory work that has to be done sequentially | |
MainThread = 1, | |
// threaded. runs strictly after MainThread. finishes decoding parallelized | |
SlaveThread = 2, | |
}; | |
template <ThreadingModel TM> | |
void decompressInternal(ushort16* dest) const{ | |
int pred[2]; | |
dest[0] = pred[0] = dest[0] + dest[0]; | |
dest[1] = pred[1] = dest[1] + dest[1]; | |
assert(dest[0] == pred[0]); | |
assert(dest[1] == pred[1]); | |
}; | |
public: | |
void decompress() const { | |
ushort16* dest = (ushort16*)malloc(128*sizeof(ushort16)); | |
// memset(dest, 0, 128*sizeof(ushort16)); | |
decompressInternal<ThreadingModel::SlaveThread>(dest); | |
}; | |
}; | |
int main () { | |
PentaxDecompressor p; | |
p.decompress(); | |
return 0; | |
} |
Author
LebedevRI
commented
Aug 10, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment