View Single Post
Old 10th November 2011, 20:59   #3  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Really? Your whole kingdom?
Code:
            if (aY1>=BThresh && aY1<=WThresh && bY1>=BThresh && bY1<=WThresh) {
               dest_data[x]   = (aY1 + bY1) / 2; // if both in safe range repl w avg(a,b)
               dest_data[x+1] = (aU + bU) / 2;
               dest_data[x+3] = (aV + bV) / 2;
            } else {
               dest_data[x]   = aY1; // else don't change
               dest_data[x+1] = aU;
               dest_data[x+3] = aV;
            } 
            if (aY2>=BThresh && aY2<=WThresh && bY2>=BThresh && bY2<=WThresh) {
               dest_data[x+2]   = (aY2 + bY2) / 2; // if both in safe range repl w avg(a,b)
               dest_data[x+1] = (aU + bU) / 2;
               dest_data[x+3] = (aV + bV) / 2;
            } else {
               dest_data[x+1] = aU;
               dest_data[x+2] = aY2;
               dest_data[x+3] = aV;
            }

            if (aY1>=WThresh && bY1<aY1 && bY1>BThresh) { // if a is white, take b if darker (but not black)
			   dest_data[x]   = bY1; // Take b luma
			   dest_data[x+1] = bU; // ... and chroma
			   dest_data[x+3] = bV;
            } 
            if (aY2>=WThresh && bY2<aY2 && bY1>BThresh) {
			   dest_data[x+1] = bU;
			   dest_data[x+2] = bY2;
			   dest_data[x+3] = bV;
            } // color of b is taken if any Y were replaced
            if (aY1<=BThresh && bY1>aY1 && bY1<WThresh) { // if a is black, take b if lighter (but not white)
			   dest_data[x]   = bY1;
			   dest_data[x+1] = bU;
			   dest_data[x+3] = bV;
            } 
            if (aY2<=BThresh && bY2>aY2 && bY2<WThresh) {
			   dest_data[x+1] = bU;
			   dest_data[x+2] = bY2;
			   dest_data[x+3] = bV;
            }
I'm not releasing the full source now. Really, no one wants to look at it.
jmac698 is offline   Reply With Quote