|
|
|
@ -61,7 +61,7 @@ void VideoFrame::CopyFrom(VideoFrame *source) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VideoFrame::CopyFrom(FloatImage *source) {
|
|
|
|
|
float min, max;
|
|
|
|
|
float min, max, f;
|
|
|
|
|
int x, y, i, idx;
|
|
|
|
|
unsigned char v;
|
|
|
|
|
|
|
|
|
@ -80,7 +80,10 @@ void VideoFrame::CopyFrom(FloatImage *source) {
|
|
|
|
|
for (y = 0; y < h; y++) for (x = 0; x < w; x++)
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
idx = 3 * (y * w + x);
|
|
|
|
|
v = (float)(256.0 * (source->data[idx+i]-min) / (max-min));
|
|
|
|
|
f = (float)(255.0 * (source->data[idx+i]-min) / (max-min));
|
|
|
|
|
if (f < 0.0) v = 0;
|
|
|
|
|
else if (f > 255.0) v = 255;
|
|
|
|
|
else v = f;
|
|
|
|
|
data[idx+i] = v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|