Linux2009. 4. 28. 00:40
JPEG 관련 free 라이브러리를 제공하는 홈페이지이다.
검색을 해보니 jpeg decompress를 하면 bmp으로 나오도록 지원을 하는 듯 하다.

/////////////////////////////////////////////////////////////////////////////
// Creation 30/12/2003                                               
// 
// 
//                             JPG2BMP.C
//                             ---------
// 
// 
// Sylvain MARECHAL - sylvain.marechal1@libertysurf.fr
/////////////////////////////////////////////////////////////////////////////
// 
//  Convert a jpg to a bmp file
//  look at jpeg-6b/djpeg.c for more details
// 
/////////////////////////////////////////////////////////////////////////////
#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
#include "jversion.h"		/* for version message */

#include "ctype.h"		/* to declare isprint() */

#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
#ifdef __MWERKS__
#include "sioux.h"              /* Metrowerks needs this */
#include "console.h"		/* ... and this */
#endif
#ifdef THINK_C
#include "console.h"		/* Think declares it here */
#endif
#endif
#include "jpg2bmp.h"		/* for version message */


/* Create the add-on message string table. */
/*
#define JMESSAGE(code,string)	string ,

static const char * const cdjpeg_message_table[] = {
#include "cderror.h"
  NULL
};
*/
//#define MAIN
#ifdef MAIN
// The test program
int main( int argc, char * argv[] )
{
    if( argc != 3 )
    {
	printf( "Usage : %s [file_in.jpg] [file_out.bmp]\n" );
	return 1;
    }
    return Jpg2Bmp( argv[1], argv[2] );
}
#endif



int Jpg2Bmp( char * pszJpgFile, char * pszBmpFile )
{
  struct jpeg_decompress_struct cinfo;
  struct jpeg_error_mgr jerr;
  djpeg_dest_ptr dest_mgr = NULL;
  FILE * input_file;
  FILE * output_file;
  JDIMENSION num_scanlines;

  /* Initialize the JPEG decompression object with default error handling. */
  cinfo.err = jpeg_std_error(&jerr);
  jpeg_create_decompress(&cinfo);
  /* Add some application-specific error messages (from cderror.h) */
//  jerr.addon_message_table = cdjpeg_message_table;
  jerr.first_addon_message = JMSG_FIRSTADDONCODE;
  jerr.last_addon_message = JMSG_LASTADDONCODE;

  /* Open the input file. */
  if ((input_file = fopen(pszJpgFile, READ_BINARY)) == NULL) {
      return -1;
  }

  /* Open the output file. */
    if ((output_file = fopen(pszBmpFile, WRITE_BINARY)) == NULL) {
      return -1;
    }

  /* Specify data source for decompression */
  jpeg_stdio_src(&cinfo, input_file);

  /* Read file header, set default decompression parameters */
  (void) jpeg_read_header(&cinfo, TRUE);

  /* Adjust default decompression parameters by re-parsing the options */
  //file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);

  /* Initialize the output module now to let it override any crucial
   * option settings (for instance, GIF wants to force color quantization).
   */
    dest_mgr = jinit_write_bmp(&cinfo, FALSE);
  dest_mgr->output_file = output_file;

  /* Start decompressor */
  (void) jpeg_start_decompress(&cinfo);

  /* Write output file header */
  (*dest_mgr->start_output) (&cinfo, dest_mgr);

  /* Process data */
  while (cinfo.output_scanline < cinfo.output_height) {
    num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
					dest_mgr->buffer_height);
    (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
  }

  /* Finish decompression and release memory.
   * I must do it in this order because output module has allocated memory
   * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
   */
  (*dest_mgr->finish_output) (&cinfo, dest_mgr);
  (void) jpeg_finish_decompress(&cinfo);
  jpeg_destroy_decompress(&cinfo);

  /* Close files, if we opened them */
    fclose(input_file);
    fclose(output_file);

  /* All done. */
  return jerr.num_warnings ? -1 : 0;
}


[예제 : ce.sharif.edu/~haghshenas/files/c/jpg2bmp.c]

[공식 : http://www.ijg.org/]
Posted by 구차니
Linux2009. 4. 28. 00:35

Name

convert - convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

Synopsis

convert input-file [options] output-file

Overview

The convert program is a member of the imagemagick(1) suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

For more information about the convert command, point your browser to file:///usr/share/doc/ImageMagick-6.2.8/www/convert.html or http://www.imagemagick.org/script/convert.php.

Run 'convert -help' to get a summary of the convert command options.

See-also

imagemagick(1)

Copyright

Copyright (C) 1999-2005 ImageMagick Studio LLC. Additional copyrights and licenses apply to this software, see http://www.imagemagick.org/script/license.php


[링크 : http://linux.die.net/man/1/convert]


리눅스에서 이미지 파일 포맷이나 크기 등을 변환해주는 프로그램이다.
상당히 유용해 보이지만, 마지막에 copyright로 인해서 상용제품에는 쓰는데 상당히 제약이 있을 것으로 보인다.
Posted by 구차니
Linux/Ubuntu2009. 4. 28. 00:04
음.. 아직까지는 괜찮겠군

오늘.. 잠자리에 들기는 글른건가?


멀 이리도 많이 삭제하려는건지 모르겠다만.. 웬지 보기에는.
필요 없는데 내가 설치를 한 녀석들 같은 느낌.. 자동으로 삭제 해주는 착한 센스?

'Linux > Ubuntu' 카테고리의 다른 글

ubuntu 내장 VNC 서버 - vino-server  (0) 2009.04.30
삼바 설치하기  (0) 2009.04.29
gnome-avrdude 컴파일하기  (6) 2009.04.27
ubuntu와 fedora의 비교  (0) 2009.04.26
Ubuntu에 VNC 설정하기  (0) 2009.04.25
Posted by 구차니
Linux/Ubuntu2009. 4. 27. 00:39
gnome-avrdude을 컴파일 하려면 이러한 에러가 발생한다.

checking for GNOME... configure: error: Package requirements (libgnome-2.0 libgnomeui-2.0 libglade-2.0 ) were not met:

No package 'libgnome-2.0' found
No package 'libgnomeui-2.0' found
No package 'libglade-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GNOME_CFLAGS
and GNOME_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

아무튼 여기에 없는 패키지는 아래의 것을 시냅틱 패키지 매니저에서 설치하면 된다.
libgnomeui-dev


아무래도.. 페도라에 익숙해져 있다 보니
dev 라는 접미어가 가지는 어감을 전혀 생각해보지를 못했다.(어쩌면.. 수면부족이라 그럴지도..)


사족 : 그냥 우분투에서 이녀석을 컴파일하기 위해서는
YACC와 위의 라이브러리가 필요한데, YACC는 bison으로 설치하면 된다.

'Linux > Ubuntu' 카테고리의 다른 글

삼바 설치하기  (0) 2009.04.29
ubuntu 9.04로 업그레이드  (0) 2009.04.28
ubuntu와 fedora의 비교  (0) 2009.04.26
Ubuntu에 VNC 설정하기  (0) 2009.04.25
kscope on Ubuntu 8.10  (0) 2009.04.24
Posted by 구차니
Linux/Ubuntu2009. 4. 26. 10:54
우분투의 장점
누군가가 미리 만들어 놓은 패키지가 존재한다면 컴파일러도 설치할 필요도 없이 사용이 가능하다.

우분투의 단점
누군가가 미리 만들어 놓은 패키지가 없다면 컴파일하기 너무 힘들다.


avrdude 컴파일 하려니 yacc없다고 하고(sudo apt-get bison)
그래서 깔고 했더니 sed가 오작동하고.. 그래서 찾아 봤더니 패키지가 존재해서 설치하고(sudo apt-get avrdude)
gnome-avrdude는 존재하지 않아 컴파일하려니 각종 에러가 발생한다 ㄱ-

아무튼.. 개발에 있어서는 확실히 페도라가 편한거 같기도 하고 아니거 같기도 하고..

'Linux > Ubuntu' 카테고리의 다른 글

ubuntu 9.04로 업그레이드  (0) 2009.04.28
gnome-avrdude 컴파일하기  (6) 2009.04.27
Ubuntu에 VNC 설정하기  (0) 2009.04.25
kscope on Ubuntu 8.10  (0) 2009.04.24
우분투 설치중  (6) 2009.04.24
Posted by 구차니
Linux/Ubuntu2009. 4. 25. 00:42
X11이 가동중이라면(다르게 말해서 Gnome이나 KDE 등이 실행중이라면, 혹은 runlevel이 5라면)
localhost:0.0 은 사용중이므로 사용할 수가 없다.
(그러니까 기본값인 5900은 실질적으로 X윈도우가 기본 구동되는 우분투에서는 사용할 수 없다.)


그런 이유로 다른 포트로 설정을 해주어야 하는데..
시스템 > 기본 설정 > 원격 데스크탑 설정을 눌러주면 아래와 같이 실행된다.

공유에서 다른 사용자가 데스크탑을 볼 수 있도록 합니다.
다른 사용자가 데스크탑을 제어할 수 있도록 합니다. 를 체크해준 후
아래의 확인을 하도록 물어보기는 끄고, 사용자가 이 암호를 입력하여야 합니다 를 체크하고 암호를 입력해줍니다.


그리고 고급 탭에서는
보조 포트 사용을 해준다음, 5901이나 5902등, 5900번을 피해서 사용하시면 되겠습니다.
로컬 연결만 허용은, SSH 터널링 등을 통해서 안전하게 사용하기 위해서 사용하는 것으로
그냥 vnc로 바로 접속하기 위해서는 체크를 꺼주어야 합니다.


'Linux > Ubuntu' 카테고리의 다른 글

gnome-avrdude 컴파일하기  (6) 2009.04.27
ubuntu와 fedora의 비교  (0) 2009.04.26
kscope on Ubuntu 8.10  (0) 2009.04.24
우분투 설치중  (6) 2009.04.24
ubuntu 8.10 설치 실패.. 아놔 CD 관리 ㅠ.ㅠ  (2) 2009.04.23
Posted by 구차니
Linux2009. 4. 24. 14:56
$ addr2line --help
Usage: addr2line [option(s)] [addr(s)]
 Convert addresses into line number/file name pairs.
 If no addresses are specified on the command line, they will be read from stdin
 The options are:
  @<file>                Read options from <file>
  -b --target=<bfdname>  Set the binary file format
  -e --exe=<executable>  Set the input file name (default is a.out)
  -i --inlines           Unwind inlined functions
  -j --section=<name>    Read section-relative offsets instead of addresses
  -s --basenames         Strip directory names
  -f --functions         Show function names
  -C --demangle[=style]  Demangle function names
  -h --help              Display this information
  -v --version           Display the program's version

addr2line: supported targets: elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big srec symbolsrec tekhex binary ihex trad-core
Report bugs to <URL:http://www.sourceware.org/bugzilla/> and hjl@lucon.org

$ addr2line -e a.out -f 0xaaaaaaa
이런식으로 사용하면 함수 이름이 뿅 하고 나오나?

[발견  :  http://blog.naver.com/carnola?Redirect=Log&logNo=70033330562]
Posted by 구차니
Linux2009. 4. 24. 14:11
352 static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
353 {
354 u_int rm;
355 int ret, index;
356
357 index = (instruction>>8)&15; /* 0x0F00 */
358 rm = regs->regs[index];
359
360 /* shout about the first ten userspace fixups */
361 if (user_mode(regs) && handle_unaligned_notify_count>0) {
362 handle_unaligned_notify_count--;
363
364 printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
365 current->comm,current->pid,(u16*)regs->pc,instruction);
366 }
...
487 }


[링크 : http://www.gelato.unsw.edu.au/lxr/source/arch/sh/kernel/traps.c]

Fixing up unaligned userspace access in "stbmw.out" pid=378 pc=0x29aa1848 ins=0x6111
이러한 커널 경고 메시지가 나올 때
PID는 Process ID
PC는 Program counter
INS는 INStruction 을 의미한다.


Fixing up unaligned userspace access in "sh" pid=48 pc=0x0ccda168 ins=0x60f0
Fixing up unaligned userspace access in "sh" pid=48 pc=0x0ccd9eac ins=0x9015

DissAddr Obj Code Dissassembly

0CCDA158 6893 MOV R9,R8
0CCDA15A 410B JSR @R1
0CCDA15C 7801 ADD #H'01,R8
0CCDA15E 64A2 MOV.L @R10,R4
0CCDA160 3488 SUB R8,R4
0CCDA162 D13C MOV.L @(H'00F0:8,PC),R1
0CCDA164 410B JSR @R1
0CCDA166 0009 NOP
0CCDA168 60F0 MOV.B @R15,R0 ## Faulting Address
0CCDA16A 8809 CMP/EQ #H'09,R0
0CCDA16C 8904 BT @H'CCDA178:8
0CCDA16E 9162 MOV.W @(H'00C4:8,PC),R1
0CCDA170 31FC ADD R15,R1
0CCDA172 9061 MOV.W @(H'00C2:8,PC),R0
0CCDA174 5119 MOV.L @(H'24:4,R1),R1
0CCDA176 0F16 MOV.L R1,@(R0,R15)
0CCDA178 AE21 BRA @H'CCD9DBE:12
0CCDA17A 0009 NOP

[링크 : http://markmail.org/message/yfqbcoa6xumlk6pdb+state:results]

그나저나.. so 파일로 분산해서 사용할 때는 어떻게 해야 하나..
Posted by 구차니
Linux/Ubuntu2009. 4. 24. 01:32
kate 패키지가 패키지 매니저에서 제대로 설치 되지 않기 때문에
kscope가 제대로 실행되지 않는다.

그런 이유로 아래의 패키지를 받아서 설치 해야 한다.

kate_3.5.9.dfsg.1-6_alpha.deb 822 KB 2008년 12월 16일 18시 32분 00초
kate_3.5.9.dfsg.1-6_amd64.deb 819 KB 2008년 12월 05일 00시 17분 00초
kate_3.5.9.dfsg.1-6_arm.deb 773 KB 2008년 12월 05일 21시 17분 00초
kate_3.5.9.dfsg.1-6_armel.deb 778 KB 2008년 12월 04일 23시 47분 00초
kate_3.5.9.dfsg.1-6_hppa.deb 840 KB 2008년 12월 09일 06시 47분 00초
kate_3.5.9.dfsg.1-6_i386.deb 806 KB 2008년 12월 03일 21시 17분 00초
kate_3.5.9.dfsg.1-6_ia64.deb 919 KB 2008년 12월 04일 06시 17분 00초
kate_3.5.9.dfsg.1-6_mips.deb 769 KB 2008년 12월 04일 09시 17분 00초
kate_3.5.9.dfsg.1-6_mipsel.deb 763 KB 2008년 12월 04일 21시 32분 00초
kate_3.5.9.dfsg.1-6_powerpc.deb 822 KB 2008년 12월 04일 14시 02분 00초
kate_3.5.9.dfsg.1-6_s390.deb 829 KB 2008년 12월 04일 11시 17분 00초
kate_3.5.9.dfsg.1-6_sparc.deb 790 KB 2008년 12월 04일 21시 32분 00초

[링크 : ftp://ftp.debian.org/debian/pool/main/k/kdebase/]

나의 경우에는 펜티엄4 이므로 i386을 설치 하면된다.

$ file /usr/local/lib/*
libkateinterfaces.so.0:     symbolic link to `libkateinterfaces.so.0.0.0'
libkateinterfaces.so.0.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped
libkateutils.so.0:          ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped
python2.5:                  setgid directory

i386 패키지를 섩치하면 x86-64 버전으로 설치가 된다.


그리고  kscope를 실행하면~


쨔잔~ 이렇게 나온다(아직 쓸줄은 모른다 ㅠ.ㅠ)


[발견 : http://mtsparrow.blogspot.com/2009/02/ubuntu-810-64bit-kscope.html]
[원본 : http://blog.naver.com/sglinux2418/60214557]

'Linux > Ubuntu' 카테고리의 다른 글

gnome-avrdude 컴파일하기  (6) 2009.04.27
ubuntu와 fedora의 비교  (0) 2009.04.26
Ubuntu에 VNC 설정하기  (0) 2009.04.25
우분투 설치중  (6) 2009.04.24
ubuntu 8.10 설치 실패.. 아놔 CD 관리 ㅠ.ㅠ  (2) 2009.04.23
Posted by 구차니
Linux/Ubuntu2009. 4. 24. 00:52

페도라를 쓰다가 처음으로 우분투를 설치해봤다.
예전에는 항상 USBLive로만 했는데, 처음으로 정식 설치를 했다.

일단 될지 안될지 모르지만, KCachegrind를 설치 하기 위해서 패키지 매니저에서 업데이트를 했는데...
페도라에서는 거의 CPU 가 항상 90에서 100%를 찍었는데(yum을 통한 업데이트시)
우분투는 평균적으로 50% 정도를 찍는 매우 안정적인 모습을 보여준다.

플래시도 잘나오고 ... 이거 물건이잖아! 라는 느낌 -ㅁ-!


그런데.. 페도라에서 너무 익숙해져 있어서였는지 모르겠지만...
tree라던가 mc 라던가 디렉토리 구조라던가 너무 달라서 적응이 안된다.
desktop을 지향하면서 만든 ubuntu의 한계라고 할수도 있겠지만.. 아무튼 페도라에서 있던 웬만한 명령어들이
웬만해서는 다 안된다는 건 참... 답답하다고 해야 하나..
아무튼 익숙해져 봐야겠다.. OTL


예상대로.. kscope는 libkateinterface.so.0 가 없다고 안된다.. 머.. 보나마나 강제로 연결해줘도 버전 문제로
안될 가능성이 높아 보이니.. 이거참... KDE 3.3을 어떻게 설치 해야 하나?

meld는 요렇고롱 잘되고

Kcachegrind도 잘되는데

왜...!!! Kscope만 안될까 ㅠ.ㅠ

'Linux > Ubuntu' 카테고리의 다른 글

gnome-avrdude 컴파일하기  (6) 2009.04.27
ubuntu와 fedora의 비교  (0) 2009.04.26
Ubuntu에 VNC 설정하기  (0) 2009.04.25
kscope on Ubuntu 8.10  (0) 2009.04.24
ubuntu 8.10 설치 실패.. 아놔 CD 관리 ㅠ.ㅠ  (2) 2009.04.23
Posted by 구차니