From 880a3e084651509177b8cbcc1104f7cee3c97ac6 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sun, 25 Nov 2012 20:52:16 +0100 Subject: Remove old logotool from tree --- Makefile | 13 ++--- logotool/Makefile | 14 ----- logotool/README | 17 ------ logotool/compress.c | 145 -------------------------------------------------- logotool/logotool.c | 130 -------------------------------------------- logotool/rgb2yuv.c | 111 -------------------------------------- logotool/uncompress.c | 123 ------------------------------------------ 7 files changed, 3 insertions(+), 550 deletions(-) delete mode 100644 logotool/Makefile delete mode 100644 logotool/README delete mode 100644 logotool/compress.c delete mode 100644 logotool/logotool.c delete mode 100644 logotool/rgb2yuv.c delete mode 100644 logotool/uncompress.c diff --git a/Makefile b/Makefile index f40c91b..58156ff 100644 --- a/Makefile +++ b/Makefile @@ -2,36 +2,29 @@ include config.mk PREFIX?=/usr/local DESTDIR?= -all: logot frontend +all: frontend cd src && ${MAKE} all frontend: -cd src/gui && ${MAKE} all -static: logot +static: cd src && ${MAKE} static - cd logotool && ${MAKE} static -allusb: logot +allusb: cd src && ${MAKE} allusb -logot: - cd logotool && ${MAKE} all - clean: cd src && ${MAKE} clean - cd logotool && ${MAKE} clean install: mkdir -p ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}${PREFIX}/share/applications/ cp src/0xFFFF ${DESTDIR}${PREFIX}/bin -cp src/gui/goxf ${DESTDIR}${PREFIX}/bin - cp logotool/logotool ${DESTDIR}${PREFIX}/bin cp 0xFFFF.desktop ${DESTDIR}${PREFIX}/share/applications/ deinstall: rm -f ${DESTDIR}${PREFIX}/bin/0xFFFF - rm -f ${DESTDIR}${PREFIX}/bin/logotool rm -f ${DESTDIR}${PREFIX}/bin/goxf rm ${DESTDIR}${PREFIX}/share/applications/0xFFFF.desktop diff --git a/logotool/Makefile b/logotool/Makefile deleted file mode 100644 index a12d145..0000000 --- a/logotool/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -OBJ=logotool.o compress.o uncompress.o rgb2yuv.o -#CFLAGS=-Wall -g -BIN=logotool - -all: ${BIN} - -${BIN}: ${OBJ} - ${CC} ${OBJ} -o logotool - -static: ${BIN} - ${CC} -static ${OBJ} -o logotool - -clean: - rm -f ${OBJ} logotool diff --git a/logotool/README b/logotool/README deleted file mode 100644 index b872d3a..0000000 --- a/logotool/README +++ /dev/null @@ -1,17 +0,0 @@ -Compressing/Uncompressing images -================================ - -To compress your image type: - - $ gimp -> create an image and save as raw rgb (24 bits) - $ logotool -w 300 -h 200 -c MyImage.rgb - -This command will create MyImage.rgb.logo - -You can check if the image is fine typing: - - $ logotool -u MyImage.rgb.logo - -To see the image you'll need mplayer and type this: - - $ `logotool -u MyImage.rgb.logo` diff --git a/logotool/compress.c b/logotool/compress.c deleted file mode 100644 index c65158c..0000000 --- a/logotool/compress.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * logotool - tool to modify logo images with simple compression - * Copyright (C) 2007 - * pancake - * esteve - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -extern int rgba; - -int isbe() -{ - int a=1; char *b=(char *)&a; - return (int)b[0]; -} - -void ememcpy(char *dst, char *src) -{ - char buffer[4]; - memcpy(buffer, src, 4); - dst[0] = buffer[3]; dst[1] = buffer[2]; - dst[2] = buffer[1]; dst[3] = buffer[0]; -} - -int compress_image(char *srcf, char *dstf, int w, int h) -{ - char buf[256]; - char tmp[256]; - int fdout; - FILE *fd; - int i,ret; - - fd = fopen(srcf, "rb"); - if (fd == NULL) { - printf("Cannot open file '%s' \n", srcf); - return 1; - } - - fdout = open( dstf, O_TRUNC | O_CREAT | O_WRONLY , 0660 ); - if (fdout == -1) { - printf("Cannot open file '%s' for writing\n", dstf); - return 1; - } - - if (isbe()) { - char oop[4]; - ememcpy((char *)&oop, (char *)&w); - write(fdout, &oop, 4); - ememcpy((char *)&oop, (char *)&h); - write(fdout, &oop, 4); - } else { - write(fdout, &w, 4); - write(fdout, &h, 4); - } - - fseek(fd, 0, SEEK_END); - if (!rgba && ftell(fd)%3) { - fprintf(stderr, "Oops..looks like RGBA..forcing -a\n"); - rgba = 1; - } - fseek(fd, 0, SEEK_SET); - -#define MAX 3*80 - if (rgba) { - for(;;) { - unsigned char c; - ret = fread(&buf, 1, MAX, fd); - if (ret <= 0) break; - c = ret/4; - write(fdout,&c, 1); - for(i=0;i %d (ret %d)\n",i,ret-i, ret); -for(i=0;i5) { -// if (i==MAX) { - if (0x80>ret) printf("PRON\n"); - c = 0x80 | ret; //(int)((2*ret/3)>>1); - write(fdout,&c, 1); - tmp[0] = buf[i+0]&0xf8; - tmp[0] |= buf[i+1]&0x07; - tmp[1] = buf[i+1]&0xe0; - tmp[1] |= buf[i+1]&0x1f; - write(fdout, tmp, 2); - // restore state - memcpy(buf,buf+i,ret-i); - ret -= i; - } - -#endif diff --git a/logotool/logotool.c b/logotool/logotool.c deleted file mode 100644 index fe7de3b..0000000 --- a/logotool/logotool.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * logotool - tool to modify logo images with simple compression - * Copyright (C) 2007 - * pancake - * esteve - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define VERSION "0.1" - -int uncompress_image(char *srcf, char *dstf); -int compress_image(char *srcf, char *dstf, int w, int h); -int rgb2yuv(char *from, char *to, int width, int height); -int rgba = 0; - -static int show_usage() -{ - printf("Usage: logotool [-flags]\n"); - printf(" -u [img] uncompress image to img.rgb\n"); - printf(" -c [img] compres a 24 bit rgb raw image to a 16(565) one\n"); - printf(" -m [img] show image using mplayer (dumps to .yuv)\n"); - printf(" -v [img] view uncompressed image using the 'display'\n"); - printf(" command from ImageMagick (in monochrome)\n"); - printf(" -w specify width (required for -v and -c)\n"); - printf(" -a force RGBA instead of RGB when compressing (use with -c)\n"); - printf(" -h specify height (required for -v and -c)\n"); - printf(" -V version number\n"); - printf("\n"); - printf("Example:\n"); - printf(" $ `logotool -u logo-file` # uncompress and display a logo\n"); - return 1; -} - -int main ( int argc , char** argv ) -{ - int c; - int w=0,h=0; - char *mimg = NULL; - char *cimg = NULL; - char *uimg = NULL; - char *view = NULL; - - while((c = getopt(argc, argv, "w:h:Vv:u:c:m:a")) != -1) { - switch(c) { - case 'V': printf("%s\n", VERSION); return 0; - case 'u': uimg = optarg; break; - case 'c': cimg = optarg; break; - case 'm': mimg = optarg; break; - case 'a': rgba = 1; break; - case 'w': w = atoi(optarg); break; - case 'h': h = atoi(optarg); break; - case 'v': view = optarg; break; - } - } - - if (mimg) { - char *buf; - if (w==0||h==0) { - printf("You must specify width and height with '-w' and '-h'.\n"); - return 1; - } - - buf = (char *)malloc(strlen(mimg)+128); - sprintf(buf, "%s.rgb", mimg); - - if ( rgb2yuv(mimg, buf, w,h ) ) { - sprintf(buf, "echo pause | mplayer %s.rgb -slave -demuxer rawvideo -rawvideo fps=1:w=%d:h=%d", mimg, w,h); - system(buf); - } else { - printf("Oops\n"); - } - free(buf); - } else - if (view) { - char *buf; - - if (w==0||h==0) { - printf("You must specify width and height with '-w' and '-h'.\n"); - return 1; - } - buf = (char *)malloc(strlen(view)+128); - sprintf(buf, "display -size %dx%d -depth 16 %s", w,h,view); - printf("%s\n", buf); - system(buf); - free(buf); - } else - if (uimg) { - char *dst = (char*)malloc(strlen(uimg)+5); - strcpy(dst, uimg); - strcat(dst, ".gray"); - uncompress_image(uimg, dst); - free(dst); - } else - if (cimg) { - char *dst; - if (w==0||h==0) { - printf("You must specify width and height with '-w' and '-h'.\n"); - return 1; - } - dst = (char*)malloc(strlen(cimg)+6); - strcpy(dst, cimg); - strcat(dst, ".logo"); - compress_image(cimg, dst, w, h); - free(dst); - } else - show_usage(); - - return 0; -} diff --git a/logotool/rgb2yuv.c b/logotool/rgb2yuv.c deleted file mode 100644 index b3f2143..0000000 --- a/logotool/rgb2yuv.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * logotool - tool to modify logo images with simple compression - * Copyright (C) 2007 - * esteve - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include - - -void RGBtoYUV(unsigned short in565, unsigned char *yuv) -{ - /* 2 bytes, 565 - * RRRRR GGGGGG BBBBB - */ - - int i; - i = (in565>>8)&0xFF; - in565 = (in565<<8)&0xFF00; - in565 |= i; - - int rgb[3]; - - rgb[0] = (in565>>11)&0x1F; - rgb[1] = (in565>>5)&0x3F; - rgb[2] = (in565)&0x1F; - - rgb[0] = (rgb[0]<<3) | 0x7; - rgb[1] = (rgb[1]<<2) | 0x3; - rgb[2] = (rgb[2]<<3) | 0x7; - - /*yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]; - yuv[1] = (rgb[2]-yuv[0])*0.565 + 128; - yuv[2] = (rgb[0]-yuv[0])*0.713 + 128;*/ - - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); -} -// mplayer caca.yuv -demuxer rawvideo -rawvideo fps=1:w=416:h=70 //:i420 - - -int rgb2yuv(char *from, char *to, int width, int height) -{ - int fd=open (from, O_RDONLY ); - int fout= open ( to, O_CREAT| O_WRONLY , 0660 ); - int fsize; - unsigned char* src; - unsigned char* dstY; - unsigned char* dstU; - unsigned char* dstV; - unsigned char YUV[3]; - unsigned short inP; - int i,j; - - if (fd == -1) { - printf("cannot open %s\n", from); - return 0; - } - if (fout == -1) { - printf("cannot open %s\n", to); - return 0; - } - fsize = lseek ( fd, 0,SEEK_END); - fsize = lseek ( fd, 0,SEEK_CUR); - lseek ( fd,0, SEEK_SET); - - src=malloc ( fsize ); - dstY=malloc ( (fsize/2) ); - dstU=malloc ( (fsize/2) ); - dstV=malloc ( (fsize/2) ); - - - for ( i = 0 ; i < fsize; i+=2 ) { - read ( fd, &inP, 2 ); - RGBtoYUV ( inP, YUV ); - dstY[i>>1]=YUV[0]; - dstU[i>>1]=YUV[1]; - dstV[i>>1]=YUV[2]; - } - - for ( i = 0 ; i < (fsize/2); i++ ) - write ( fout,&dstY[i], 1); - - for ( i = 0 ; i < height ; i+=2 ) - for ( j = 0; j < width ; j +=2 ) - write ( fout,&dstU[j+(i*width)], 1); - - for ( i = 0 ; i < height ; i+=2 ) - for ( j = 0; j < width ; j +=2 ) - write ( fout,&dstV[j+(i*width)], 1); - return 1; -} diff --git a/logotool/uncompress.c b/logotool/uncompress.c deleted file mode 100644 index 7fb8b10..0000000 --- a/logotool/uncompress.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * logotool - tool to modify logo images with simple compression - * Copyright (C) 2007 - * pancake - * esteve - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -int uncompress_image(char *srcf, char *dstf) -{ - int fd; - int fout; - int width,height; - int fsize; - char* src; - char* dst; - char* src2; - char* eof; - char *deof; - char* dst2 = NULL; - unsigned char byte; - - fd = open( srcf, O_RDONLY ); - - if (fd == -1) { - printf("Cannot open file '%s'\n", srcf); - return 1; - } - - fout = open( dstf, O_CREAT | O_WRONLY , 0660 ); - - if (fout == -1) { - printf("Cannot open file '%s' for writing\n", dstf); - return 1; - } - - fprintf(stderr, "Input file: %s\n", srcf); - fprintf(stderr, "Output file: %s\n", dstf); - fsize = lseek ( fd, 0,SEEK_END); - fsize = lseek ( fd, 0,SEEK_CUR); - lseek ( fd,0, SEEK_SET); - - fsize -= 8; - - read ( fd, &width, 4 ); - read ( fd, &height, 4 ); - - fprintf(stderr, "Width: %d\nHeight: %d\n",width, height); - fprintf(stderr, "Input Size: %d\n",fsize); - src = malloc ( fsize ); - dst = malloc ( width*height*2 ); - deof = dst+width*height*2; - if (src == (void *)-1 || dst == (void *)-1 ) { - printf("Cannot malloc\n"); - return 1; - } - - memset(dst,'\0', width*height*2); - - read(fd, src, fsize); - eof = src+fsize; - - for(dst2 = dst, src2 = src; src2 0x7f) { - int i,j = byte&0x7f; - for(i=0; i++= deof || (src2+byte >= eof))) { - fprintf(stderr, "Break\n"); - break; - } - memcpy(dst2, src2, byte); - src2+=byte; dst2+=byte; - } - } - } - fprintf(stderr, "Output Size: %lld\n",(long long int)(dst2-dst)); - - if ((dst2-dst)!=(width*height*2)) - fprintf(stderr, "failed?\n"); - - write ( fout, dst, width*height*2); - - close(fout); - close(fd); - - //printf("./logotool -w %d -h %d -v %s || \n", width, height, dstf); - //printf("logotool -w %d -h %d -v %s\n", width, height, dstf); - printf("eval PATH=$PWD:$PATH logotool -w %d -h %d -m %s\n", width, height, dstf); - - return 0; -} -- cgit v1.2.3