Back Forum Reply New

Need help debugging a filter

sorry, i know many won´t lie kto see topics liek this, but i´m deperate at the moment
i wrote i lil avisynth filter, but it doesn´t work (access violation)
the problem i need it to work in a few hours (17h as total maximum)
it´s a filter that works like a blue screen, just with black
it take 2 clips as aguments, and shows the first, except that it replacec all black in it with pixels at the same place in clip 2 (equal resolution, framerate and lenth should be)

PLEASE someone look at it, i´m sure it´s just  one or two newbie mistakes that can easily be corrected

bs.cpp

THX a lot
E-Male

p.s. if a filter like this already exists, pleas tell me

The loop should look something like this:

Code:
for (int y = 0; y lt; height; y++) { for (int x = 0; x lt; row_size; x+=2) {
   black = false;   if ((srcpa[x] == 16) amp;amp; (srcpa[x+1] == 128))     black = true;
   if (!black) {         dstp[x] = srcpa[x];  dstp[x+1] = srcpa[x+1];        } else {         dstp[x] = srcpb[x];  dstp[x+1] = srcpb[x+1];    } srcpa += src_pitch;  srcpb += src_pitch;  dstp += dst_pitch; }
}
But I don't know if what it does is correct - it does seem a bit strange to me though.  Are you assuming YUY2 as colorspace??

Quick/dirty solution is to maybe do a ConverttoRGB24 before this filter and use this modification of sh0dan's code for your filter :-Code:
for (int y = 0; y lt; height; y++) { for (int x = 0; x lt; row_size; x+=3) {
   black = false;   if ((srcpa[x] == 0) amp;amp; (srcpa[x+1] == 0) amp;amp; (srcpa[x+2] == 0))     black = true;
   if (!black) {         dstp[x] = srcpa[x];  dstp[x+1] = srcpa[x+1]; dstp[x+2] = srcpa[x+2];        } else {         dstp[x] = srcpb[x];  dstp[x+1] = srcpb[x+1]; dstp[x+2] = srcpb[x+2];   } srcpa += src_pitch;  srcpb += src_pitch;  dstp += dst_pitch; }
}
regards
Simon

p.s. if a filter like this already exists, pleas tell me

Look at ColorKeyMask here: index.php?page=Layer

thx guys
i used layer with brighten for the urgent stuff
i´ll look into finishing the filter later

and yes i assumed yuv
¥
Back Forum Reply New