2010-10-26 12:01:41 +00:00
|
|
|
#include <nall/platform.hpp>
|
|
|
|
#include <nall/stdint.hpp>
|
|
|
|
using namespace nall;
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
void filter_size(unsigned&, unsigned&);
|
2011-09-22 00:03:11 +00:00
|
|
|
void filter_render(uint16_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned);
|
2010-10-26 12:01:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dllexport void filter_size(unsigned &width, unsigned &height) {
|
|
|
|
height *= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
dllexport void filter_render(
|
2011-09-22 00:03:11 +00:00
|
|
|
uint16_t *output, unsigned outputPitch,
|
|
|
|
const uint16_t *input, unsigned inputPitch,
|
|
|
|
unsigned width, unsigned height
|
2010-10-26 12:01:41 +00:00
|
|
|
) {
|
2011-09-22 00:03:11 +00:00
|
|
|
outputPitch >>= 1, inputPitch >>= 1;
|
2010-10-26 12:01:41 +00:00
|
|
|
|
2011-09-22 00:03:11 +00:00
|
|
|
#pragma omp parallel for
|
2010-10-26 12:01:41 +00:00
|
|
|
for(unsigned y = 0; y < height; y++) {
|
2011-09-22 00:03:11 +00:00
|
|
|
const uint16_t *in = input + y * inputPitch;
|
|
|
|
uint16_t *out0 = output + y * outputPitch * 2;
|
|
|
|
uint16_t *out1 = output + y * outputPitch * 2 + outputPitch;
|
2010-10-26 12:01:41 +00:00
|
|
|
|
|
|
|
for(unsigned x = 0; x < width; x++) {
|
2011-09-22 00:03:11 +00:00
|
|
|
*out0++ = *in;
|
|
|
|
*out1++ = (*in++ & 0x7bde) >> 1;
|
2010-10-26 12:01:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|