summaryrefslogtreecommitdiffstats
path: root/test/tjbench.c
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-02-06 16:56:55 +0100
commitf3f392caec43b4095bc1d84b315ed7972c13c144 (patch)
tree5c4ba8b5d38f1ae33de71507c5634a15a0b35bfe /test/tjbench.c
parent8c081c8888bccbf5adfe0fc4ec518e2cbfba9871 (diff)
parent0a70095271d845d16a3ed17354841b01f33963ad (diff)
downloadlibtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.tar.gz
libtdevnc-f3f392caec43b4095bc1d84b315ed7972c13c144.zip
Merge tag 'LibVNCServer-0.9.12'
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'test/tjbench.c')
-rw-r--r--test/tjbench.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/tjbench.c b/test/tjbench.c
index 29aa153..87e1591 100644
--- a/test/tjbench.c
+++ b/test/tjbench.c
@@ -178,7 +178,8 @@ int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf,
int y=(int)((double)srcbuf[rindex]*0.299
+ (double)srcbuf[gindex]*0.587
+ (double)srcbuf[bindex]*0.114 + 0.5);
- if(y>255) y=255; if(y<0) y=0;
+ if(y>255) y=255;
+ if(y<0) y=0;
dstbuf[rindex]=abs(dstbuf[rindex]-y);
dstbuf[gindex]=abs(dstbuf[gindex]-y);
dstbuf[bindex]=abs(dstbuf[bindex]-y);
@@ -226,7 +227,8 @@ void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
for(tilew=dotile? 8:w, tileh=dotile? 8:h; ; tilew*=2, tileh*=2)
{
- if(tilew>w) tilew=w; if(tileh>h) tileh=h;
+ if(tilew>w) tilew=w;
+ if(tileh>h) tileh=h;
ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh;
if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
@@ -323,7 +325,7 @@ void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
for(i=0; i<ntilesw*ntilesh; i++)
{
- if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;}
}
free(jpegbuf); jpegbuf=NULL;
free(jpegsize); jpegsize=NULL;
@@ -337,7 +339,7 @@ void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
{
for(i=0; i<ntilesw*ntilesh; i++)
{
- if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;}
}
free(jpegbuf); jpegbuf=NULL;
}
@@ -392,7 +394,8 @@ void dodecomptest(char *filename)
for(tilew=dotile? 16:w, tileh=dotile? 16:h; ; tilew*=2, tileh*=2)
{
- if(tilew>w) tilew=w; if(tileh>h) tileh=h;
+ if(tilew>w) tilew=w;
+ if(tileh>h) tileh=h;
ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh;
if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
@@ -455,7 +458,7 @@ void dodecomptest(char *filename)
{
for(i=0; i<ntilesw*ntilesh; i++)
{
- if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ if(jpegbuf[i]) {free(jpegbuf[i]); jpegbuf[i]=NULL;}
}
free(jpegbuf); jpegbuf=NULL;
}