forked from badman12345/osmose-rpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNearest2xVideoFilter.cpp
60 lines (53 loc) · 1.31 KB
/
Nearest2xVideoFilter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*****************************************************************************
*
* File: Nearest2xVideoFilter.h
*
* Project: Osmose emulator.
*
* Description: This class provide a code for the Nearest Neighbour 2x Video Filter.
*
* Author: Vedder Bruno
* Date 17/08/06 18:11 Tupiza, Bolivia.
*
* URL: http://bcz.emu-france.com/
*****************************************************************************/
#include "VideoFilter.h"
#include "Nearest2xVideoFilter.h"
Nearest2xVideoFilter::Nearest2xVideoFilter()
{
w_ = 256;
h_ = 192;
}
int Nearest2xVideoFilter::getFinalOutputWidth()
{
return w_ * 2;
}
int Nearest2xVideoFilter::getFinalOutputHeight()
{
return h_ * 2;
}
void Nearest2xVideoFilter::Filter(SDL_Surface *s, SDL_Surface *d)
{
u16 *src;
u32 *dst;
u32 src_index = 0;
u32 dst_index = 0;
src = (unsigned short *) s->pixels;
dst = (unsigned int *) d->pixels; ;
for (u32 o = 0; o < h_; o++)
{
for (u32 i = 0; i < w_; i++)
{
u16 col = src[src_index++];
u32 pix = (col | col << 16);
dst[dst_index] = pix;
dst[dst_index + w_] = pix;
dst_index++;
}
dst_index += w_;
}
}
string Nearest2xVideoFilter::getFilterName()
{
return string("Nearest 2x Video Filter - Bruno Vedder.");
}