#define CG newdata[4*(i+inX*j)+1]
#define CB newdata[4*(i+inX*j)+2]
+#define A ((long)(a))
+#define B ((long)(b))
+#define C ((long)(c))
+#define D ((long)(d))
+#define E ((long)(e))
+#define F ((long)(f))
+
#include <stdlib.h>
#include <stdio.h>
#include <IL/il.h>
void mustard(int mustard);
ILubyte enhance(ILubyte x, long r, long s, long t);
ILubyte enhance2(ILubyte x, ILubyte a, ILubyte b, ILubyte c, ILubyte d, ILubyte e, ILubyte f);
+ILubyte enhance3(ILubyte x, ILubyte a, ILubyte b, ILubyte c);
int main (int argc, const char *argv[]);
ILuint pix;
ILboolean q=true;
ILboolean pixOpen=false;
-ILuint inX, inY;
-ILubyte *newdata;
+
ILubyte enhance(ILubyte x, long r, long s, long t)
{
ILubyte enhance2(ILubyte x, ILubyte a, ILubyte b, ILubyte c, ILubyte d, ILubyte e, ILubyte f)
{
- return (ILubyte)((x<=a)?d:((x>=c)?f:((x>b)?(enhance(x,f-e,c-b,e*c-b*f)):((x<b)?(enhance(x,e-d,b-a,d*b-a*e)):e))));
+ return ((x<=a)?d:((x>=c)?f:((x>b)?(enhance(x,F-E,C-B,E*C-B*F)):((x<b)?(enhance(x,E-D,B-A,D*B-A*E)):e))));
+}
+
+ILubyte enhance3(ILubyte x, ILubyte a, ILubyte b, ILubyte c)
+{
+ return enhance(x,C-A,B-A,(B-C)*A);
}
int main (int argc, const char *argv[])
{
- ILubyte a,b,c,d,e,f;
+ ILubyte a,b,c,d,e,f,g;
+ ILubyte *h, *s, *l;
+ ILuint inX, inY;
+ ILubyte *newdata;
if(argc<9)
mustard(ARGUMENT_MUSTARD);
{
for(unsigned long j=0;j<inY;++j)
{
- //these things are #define'd
- if(CR>=CG)
+ if(CR==CG&&CG==CB)
+ continue;
+ //it'll stilll work correctly if two are equal.
+ if(CR>CG)
{
- if(CR>=CB)
+ if(CG>CB)
+ {
+ h=&(CR);
+ s=&(CG);
+ l=&(CB);
+ }
+ else if(CB>CR)
{
- if(CR>CG)
- {
- CR=enhance2(CR,a,b,c,d,e,f);
- if(CR==CB)
- CB=enhance2(CB,a,b,c,d,e,f);
- }
- else
- {
- if(CR>CB)
- {
- CR=enhance2(CR,a,b,c,d,e,f);
- if(CR==CG)
- CG=enhance2(CG,a,b,c,d,e,f);
- }
- }
+ h=&(CB);
+ s=&(CR);
+ l=&(CG);
}
else
- CB=enhance2(CB,a,b,c,d,e,f);
+ {
+ h=&(CR);
+ s=&(CB);
+ l=&(CG);
+ }
}
else
{
- if(CG>=CB)
+ if(CR>CB)
+ {
+ h=&(CG);
+ s=&(CR);
+ l=&(CB);
+ }
+ else if(CB>CG)
{
- CG=enhance2(CG,a,b,c,d,e,f);
- if(CG==CB)
- CB=enhance2(CB,a,b,c,d,e,f);
+ h=&(CB);
+ s=&(CG);
+ l=&(CR);
}
else
- CB=enhance2(CB,a,b,c,d,e,f);
+ {
+ h=&(CG);
+ s=&(CB);
+ l=&(CR);
+ }
}
+ g=*h;
+ *h=enhance2(*h,a,b,c,d,e,f);
+ *s=enhance3(*s,*l,g,*h);
}
}
if(!ilSave(IL_PNG,argv[2]))mustard(OUTPIX_MUSTARD);
#define WGET_PATH "/usr/bin/wget"
#define ENH_PATH "./bluenh"
+#define ENH_PATH2 "./bluenh2"
#define RM_PATH "/bin/rm"
#define LOG_PATH "/eizm/log/bluenh/bluenh.log"
#define USERAGENT "Bluenhancement\x20(1190.bicyclesonthemoon.dnsd.info/bluenh/bluenh.htm)"
void mustard(int mustard);
FILE *pix;
-unsigned char buf[1024];
+
char url[1024];
char path[256];
-char method[256];
s_cgi *cgi;
int t;
pid_t sub;
-struct stat st;
-unsigned long p;
-unsigned short q;
-char **up;
-// unsigned char a,b,c,d,e,f;
-// bool meg=false;
int main (int argc, char *argv[])
{
+ unsigned char buf[1024];
+ struct stat st;
+ unsigned long p;
+ unsigned short q;
+ char **up;
+ bool enh2;
+
cgi=cgiInit();
up=cgiGetFiles(cgi);
if(t)mustard(t);
}
+ enh2=(cgiGetValue(cgi,"bluenh2")!=NULL);
sub=fork();
if(sub==0)
{
- t=execl(ENH_PATH,ENH_PATH,path,path,cgiGetValue(cgi,"a")!=NULL?cgiGetValue(cgi,"a"):"0",cgiGetValue(cgi,"b")!=NULL?cgiGetValue(cgi,"b"):"127",cgiGetValue(cgi,"c")!=NULL?cgiGetValue(cgi,"c"):"255",cgiGetValue(cgi,"d")!=NULL?cgiGetValue(cgi,"d"):"0",cgiGetValue(cgi,"e")!=NULL?cgiGetValue(cgi,"e"):"127",cgiGetValue(cgi,"f")!=NULL?cgiGetValue(cgi,"f"):"255","q",(char *)0);
+ t=execl(enh2?ENH_PATH2:ENH_PATH,enh2?ENH_PATH2:ENH_PATH,path,path,cgiGetValue(cgi,"a")!=NULL?cgiGetValue(cgi,"a"):"0",cgiGetValue(cgi,"b")!=NULL?cgiGetValue(cgi,"b"):"127",cgiGetValue(cgi,"c")!=NULL?cgiGetValue(cgi,"c"):"255",cgiGetValue(cgi,"d")!=NULL?cgiGetValue(cgi,"d"):"0",cgiGetValue(cgi,"e")!=NULL?cgiGetValue(cgi,"e"):"127",cgiGetValue(cgi,"f")!=NULL?cgiGetValue(cgi,"f"):"255","q",(char *)0);
exit(t);
}
waitpid(sub,&t,0);