New Interframe filter now removed the depreciated function
This commit is contained in:
parent
60af0a06fc
commit
a3b3fa41ec
|
@ -21,15 +21,6 @@ void interframe_filter::setWidth(unsigned int _width)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void interframe_filter::run(u8 *srcPtr, int starty, int height)
|
|
||||||
{
|
|
||||||
if(!getWidth())
|
|
||||||
{
|
|
||||||
throw std::runtime_error("ERROR: Filter width not set");
|
|
||||||
}
|
|
||||||
this->run(srcPtr, get_horiz_bytes(), getWidth(), starty, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
SmartIB::SmartIB()
|
SmartIB::SmartIB()
|
||||||
{
|
{
|
||||||
frm1 = (u8 *)calloc(322*242,4);
|
frm1 = (u8 *)calloc(322*242,4);
|
||||||
|
@ -53,27 +44,22 @@ SmartIB::~SmartIB()
|
||||||
frm1 = frm2 = frm3 = NULL;
|
frm1 = frm2 = frm3 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartIB::run(u8 *srcPtr, u32 srcPitch, int width, int starty, int height)
|
void SmartIB::run(u8 *srcPtr, int starty, int height)
|
||||||
{
|
{
|
||||||
setWidth(width);
|
//Actual width needs to take into account the +1 border
|
||||||
//Make sure the math was correct
|
unsigned int width = getWidth() +1;
|
||||||
if( (srcPitch != get_horiz_bytes()) )
|
|
||||||
{
|
|
||||||
throw std::runtime_error("ERROR: Filter programmer is an idiot, and messed up an important calculation!");
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4;
|
u32 *src0 = (u32 *)srcPtr + starty * width;
|
||||||
u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4;
|
u32 *src1 = (u32 *)frm1 + starty * width;
|
||||||
u32 *src2 = (u32 *)frm2 + starty * srcPitch / 4;
|
u32 *src2 = (u32 *)frm2 + starty * width;
|
||||||
u32 *src3 = (u32 *)frm3 + starty * srcPitch / 4;
|
u32 *src3 = (u32 *)frm3 + starty * width;
|
||||||
|
|
||||||
u32 colorMask = 0xfefefe;
|
u32 colorMask = 0xfefefe;
|
||||||
|
|
||||||
int sPitch = srcPitch >> 2;
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (int j = 0; j < height; j++)
|
for (int j = 0; j < height; j++)
|
||||||
for (int i = 0; i < sPitch; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
u32 color = src0[pos];
|
u32 color = src0[pos];
|
||||||
src0[pos] =
|
src0[pos] =
|
||||||
(src1[pos] != src2[pos]) &&
|
(src1[pos] != src2[pos]) &&
|
||||||
|
@ -116,25 +102,20 @@ MotionBlurIB::~MotionBlurIB()
|
||||||
frm1 = frm2 = frm3 = NULL;
|
frm1 = frm2 = frm3 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionBlurIB::run(u8 *srcPtr, u32 srcPitch, int width, int starty, int height)
|
void MotionBlurIB::run(u8 *srcPtr, int starty, int height)
|
||||||
{
|
{
|
||||||
setWidth(width);
|
//Actual width needs to take into account the +1 border
|
||||||
//Make sure the math was correct
|
unsigned int width = getWidth() +1;
|
||||||
if( (srcPitch != get_horiz_bytes()) )
|
|
||||||
{
|
|
||||||
throw std::runtime_error("ERROR: Filter programmer is an idiot, and messed up an important calculation!");
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 *src0 = (u32 *)srcPtr + starty * srcPitch / 4;
|
u32 *src0 = (u32 *)srcPtr + starty * width;
|
||||||
u32 *src1 = (u32 *)frm1 + starty * srcPitch / 4;
|
u32 *src1 = (u32 *)frm1 + starty * width;
|
||||||
|
|
||||||
u32 colorMask = 0xfefefe;
|
u32 colorMask = 0xfefefe;
|
||||||
|
|
||||||
int sPitch = srcPitch >> 2;
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (int j = 0; j < height; j++)
|
for (int j = 0; j < height; j++)
|
||||||
for (int i = 0; i < sPitch; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
u32 color = src0[pos];
|
u32 color = src0[pos];
|
||||||
src0[pos] = (((color & colorMask) >> 1) +
|
src0[pos] = (((color & colorMask) >> 1) +
|
||||||
((src1[pos] & colorMask) >> 1));
|
((src1[pos] & colorMask) >> 1));
|
||||||
|
|
|
@ -11,6 +11,8 @@ class interframe_filter
|
||||||
private:
|
private:
|
||||||
///The filter's width
|
///The filter's width
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
|
///The filter's height
|
||||||
|
unsigned int height;
|
||||||
///Don't need to calculate these every time (based off width)
|
///Don't need to calculate these every time (based off width)
|
||||||
unsigned int horiz_bytes;
|
unsigned int horiz_bytes;
|
||||||
// unsigned int horiz_bytes_out;
|
// unsigned int horiz_bytes_out;
|
||||||
|
@ -26,10 +28,12 @@ public:
|
||||||
///Always use this after initialization if using the new run function.
|
///Always use this after initialization if using the new run function.
|
||||||
void setWidth(unsigned int _width);
|
void setWidth(unsigned int _width);
|
||||||
unsigned int getWidth() {return width;}
|
unsigned int getWidth() {return width;}
|
||||||
///DEPRECATED Original Interframe function
|
///Set the number of horizontal rows in the image
|
||||||
virtual void run(u8 *srcPtr, u32 srcPitch, int width, int starty, int height) {}
|
///Always use this after initialization if using the new run function.
|
||||||
|
void setHeight(unsigned int _height){height=_height;}
|
||||||
|
unsigned int getHeight() {return height;}
|
||||||
///New smarter Interframe function
|
///New smarter Interframe function
|
||||||
virtual void run(u8 *srcPtr, int starty, int height);
|
virtual void run(u8 *srcPtr, int starty, int height) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ public:
|
||||||
SmartIB();
|
SmartIB();
|
||||||
~SmartIB();
|
~SmartIB();
|
||||||
std::string getName() {return "SmartIB";}
|
std::string getName() {return "SmartIB";}
|
||||||
void run(u8 *srcPtr, u32 srcPitch, int width, int starty, int height);
|
void run(u8 *srcPtr, int starty, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MotionBlurIB : public interframe_filter
|
class MotionBlurIB : public interframe_filter
|
||||||
|
@ -60,7 +64,7 @@ public:
|
||||||
MotionBlurIB();
|
MotionBlurIB();
|
||||||
~MotionBlurIB();
|
~MotionBlurIB();
|
||||||
std::string getName() {return "MotionBlurIB";}
|
std::string getName() {return "MotionBlurIB";}
|
||||||
void run(u8 *srcPtr, u32 srcPitch, int width, int starty, int height);
|
void run(u8 *srcPtr, int starty, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1004,6 +1004,7 @@ DrawingPanel::DrawingPanel(int _width, int _height) :
|
||||||
scale = myFilter->getScale();
|
scale = myFilter->getScale();
|
||||||
myFilter->setWidth(width);
|
myFilter->setWidth(width);
|
||||||
iFilter->setWidth(width);
|
iFilter->setWidth(width);
|
||||||
|
iFilter->setHeight(height);
|
||||||
|
|
||||||
std::cerr << "width: " << width << " Height: " << height << std::endl;
|
std::cerr << "width: " << width << " Height: " << height << std::endl;
|
||||||
#define out_16 (systemColorDepth == 16)
|
#define out_16 (systemColorDepth == 16)
|
||||||
|
|
Loading…
Reference in New Issue