Aside from random crashes, random glitches, and upside-down, avisynth filter works

Originally committed to SVN as r279.
This commit is contained in:
Rodrigo Braz Monteiro 2006-04-01 13:09:53 +00:00
parent ba2af9505e
commit 7a3ab721bb
2 changed files with 14 additions and 13 deletions

View file

@ -99,7 +99,7 @@ void PNGWrapper::Read(PRSVideoFrame *frame) {
frame->data[0] = new char[w*h*bpp];
frame->w = w;
frame->h = h;
frame->pitch = w;
frame->pitch = w*bpp;
frame->colorSpace = ColorSpace_RGB32;
// Copy data to frame

View file

@ -93,8 +93,8 @@ void PRSVideoFrame::Overlay(PRSVideoFrame *dstFrame,int x,int y,unsigned char al
int rowLen = MID(0,w,dstFrame->w - x);
// Values
char sc1,sc2,sc3,a,ia;
char dc1,dc2,dc3,da;
unsigned char sc1,sc2,sc3,a,ia;
unsigned char dc1,dc2,dc3,da;
// Draw each row
for (int j=0;j<height;j++) {
@ -103,24 +103,25 @@ void PRSVideoFrame::Overlay(PRSVideoFrame *dstFrame,int x,int y,unsigned char al
// Draw the row
for (int i=0;i<rowLen;i++) {
// Read colors
sc1 = *src++;
dc1 = *(dst);
sc2 = *src++;
dc2 = *(dst+1);
// Read source
sc3 = *src++;
dc3 = *(dst+2);
// Read alpha
sc2 = *src++;
sc1 = *src++;
a = *src++;
da = *(dst+3);
ia = 255-a;
// Read destination
dc1 = *(dst);
dc2 = *(dst+1);
dc3 = *(dst+2);
da = *(dst+3);
// Write colors
*dst++ = (sc1*a + dc1*ia)/255;
*dst++ = (sc2*a + dc2*ia)/255;
*dst++ = (sc3*a + dc3*ia)/255;
*dst++ = 255-(ia*(255-da)/255);
//*dst++ = 255-(ia*(255-da)/255);
*dst++ = da;
}
}
}