프로그램 사용/libjpeg2009. 7. 10. 17:34
일단 해보니..
struct jpeg_decompress_struct 에
quantize_colors 항목을 TRUE로 설정해주면
colormap 에 팔레트가 생성이되고,
actual_number_of_colors 에는 실제 사용한 색상수 출력이 된다고 하는데..

팔레트가 어떻게 되는지 libjpeg.doc에 제대로 나와있지 않다..
아래의 링크를 조금은 유심히 보고 수정요망

After this call, the final output image dimensions, including any requested
scaling, are available in the JPEG object; so is the selected colormap, if
colormapped output has been requested.  Useful fields include

    output_width        image width and height, as scaled
    output_height
    out_color_components    # of color components in out_color_space
    output_components    # of color components returned per pixel
    colormap        the selected colormap, if any
    actual_number_of_colors        number of entries in colormap

output_components is 1 (a colormap index) when quantizing colors; otherwise it
equals out_color_components.  It is the number of JSAMPLE values that will be
emitted per pixel in the output arrays.

Typically you will need to allocate data buffers to hold the incoming image.
You will need output_width * output_components JSAMPLEs per scanline in your
output buffer, and a total of output_height scanlines will be returned.

Note: if you are using the JPEG library's internal memory manager to allocate
data buffers (as djpeg does), then the manager's protocol requires that you
request large buffers *before* calling jpeg_start_decompress().  This is a
little tricky since the output_XXX fields are not normally valid then.  You
can make them valid by calling jpeg_calc_output_dimensions() after setting the
relevant parameters (scaling, output color space, and quantization flag).

...

The decompression parameters that determine the basic properties of the
returned image are:

J_COLOR_SPACE out_color_space
    Output color space.  jpeg_read_header() sets an appropriate default
    based on jpeg_color_space; typically it will be RGB or grayscale.
    The application can change this field to request output in a different
    colorspace.  For example, set it to JCS_GRAYSCALE to get grayscale
    output from a color file.  (This is useful for previewing: grayscale
    output is faster than full color since the color components need not
    be processed.)  Note that not all possible color space transforms are
    currently implemented; you may need to extend jdcolor.c if you want an
    unusual conversion.

...

boolean quantize_colors
    If set TRUE, colormapped output will be delivered.  Default is FALSE,
    meaning that full-color output will be delivered.

...

When quantize_colors is TRUE, the target color map is described by the next
two fields.  colormap is set to NULL by jpeg_read_header().  The application
can supply a color map by setting colormap non-NULL and setting
actual_number_of_colors to the map size.  Otherwise, jpeg_start_decompress()
selects a suitable color map and sets these two fields itself.
[Implementation restriction: at present, an externally supplied colormap is
only accepted for 3-component output color spaces.]

JSAMPARRAY colormap
    The color map, represented as a 2-D pixel array of out_color_components
    rows and actual_number_of_colors columns.  Ignored if not quantizing.
    CAUTION: if the JPEG library creates its own colormap, the storage
    pointed to by this field is released by jpeg_finish_decompress().
    Copy the colormap somewhere else first, if you want to save it.

int actual_number_of_colors
    The number of colors in the color map.

...

int out_color_components    Number of color components in out_color_space.
int output_components        Number of color components returned.

[출처 : libjpeg.doc]





[링크 : http://svn.neurostechnology.com/filedetails.php]
[링크 : http://www.koders.com/c/fid95CCE6190079AB3FDDE3C71309BA75EB5BA943FC.aspx]
Posted by 구차니
프로그램 사용2009. 7. 10. 11:02

방문"기록" 저장안함이 "지록" 으로 오타가 났다.
흠.. 어느 경로를 통해서 알려줘야 하나?

흐음.. 이미 5월에 포스팅 된 내용이군..
[링크 : http://forums.mozilla.or.kr/viewtopic.php?f=2&t=11525&sid=1e8b2575b8473a2e6ca57f4af9c2dc1c#p39600]


그리고 3.5가 구동이 어~~~~~엄청 느린 문제가 요근래에 있었는데
C:\Documents and Settings\[userid]\Local Settings
아래의 History / Temp / Temporary Internet Files
디렉토리의 내용을 비워주면 날아다닌다. 경이로울 정도의 구동속도!!!

Posted by 구차니

[링크 : http://www.eclipse.org/downloads/]

간만에 이클립스 홈페이지를 가니, C/C++ 용 Eclipse 란게 보였다.
오홍~ 이제 공식적으로 지원하나 보다~ 라고 생각하고 구글신에게 경배를 조금 드렸더니
아래와 같은 IBM의 문서가 나왔다.

내부적으로는
cygwin(혹은 minGW) 과 eclipse + CDT(C/C++ Development Toolkit) 를 이용하여 개발환경을 구축하며.
이러한 구축방법에 대해서 상세히 기술되어 있다.

[링크 : http://www.ibm.com/developerworks/kr/library/os-ecc/]


'프로그램 사용 > eclipse CDT & minGW' 카테고리의 다른 글

eclipse CDT plugin 설치하기  (2) 2012.01.29
eclipse에서 archive (*.a) 링크하기  (0) 2012.01.18
eclipse CDT 에서 include 경로 추가하기  (0) 2012.01.17
MinGW  (0) 2010.09.07
eclipse CDT  (0) 2009.07.13
Posted by 구차니
아직 확실하게 쓸줄은 모르지만..
아무튼 이더리얼에서 가장 중요한 것은 필터링을 하는 방법이라고 생각이 된다.

수 많은 패킷중에 원하는 내용을 골라내야 하므로 필터링 방법이 복잡해 질 수 밖에 없고,
그로 인해서 wireshark에서 필터는 매우 어려운 편이다.


위에 보면 filter 라는 부분이 있는데, 이 부분이 display filter 부분이다.
이와는 별개로 capture filter 라는 부분도 있는데,
필터사용 방법은 동일하나,
네트워크 데이터 량이 너무 많을 경우에는 capture 필터로 한번 걸러내고
display filter로 두 번 걸러내는 것이 좋지 않을까 생각을 한다.


capture 필터는, 캡쳐시에 걸러내주는 역활을 한다.



display filter와 capture filter를 클릭했을때 나오는 다이얼로그 윈도우로
사용하는 문법과 내용은 동일하다.


아무튼 중요한 것은 아래의 filter string이다.

예를들어 위에 나온 내용처럼
특정 프로토콜만 보고 싶거나, 특정 프로토콜을 제외하고 다른 것을 보고 싶을 경우,
필터를 사용하게 되는데,
"프로토콜은 소문자" 로 적어주고
보고 싶으면 프로토콜 이름만 (예, arp)
보고 싶지않으면 not 프로토콜 이름으로 적어주면 된다. (예, not arp)

그리고 조건을 붙일때는 or , and 로 조건을 붙여주면 된다.

'프로그램 사용 > wireshark(ethereal)' 카테고리의 다른 글

linux cooked capture  (0) 2023.09.04
wireshark에서 DHCP 캡쳐하기  (0) 2011.10.05
ubuntu에 ethereal(wireshark) 설치하기  (0) 2009.07.04
ethereal -> wireshark  (0) 2009.07.04
Posted by 구차니
$ sudo apt-get install ethereal
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
상태 정보를 읽는 중입니다... 완료
ethereal 패키지를 사용할 수 없습니다.  하지만 다른 패키지가 참조하고 있습니다.
해당 패키지가 누락되었거나 지워졌다는 뜻입니다. 아니면 또 다른 곳에서
패키지를 받아와야 하는 경우일 수도 있습니다.
하지만 다음 패키지가 대체합니다:
  wireshark
E: ethereal 패키지는 설치할 수 있는 후보가 없습니다

2009/07/04 - [프로그램 사용] - ethereal -> wireshark

상표권 문제로 ethereal은 wireshark로 대체 되었고, 그런 이유로 우분투에서 설치하기 위해서는
시냅틱 패키지에서 ethereal로 찾아도 나오지 않는다.

ethereal을 설치하기 위해서는 아래와 같이 입력한다.
 $ sudo apt-get install wireshark

그리고 실행시에는 wireshark (as root)로 실행을 해야지 장치목록이 제대로 뜬다.
이러한 장치는 root 권한이 없으면 접근할 수 없기 때문에, root로 구동을 해야한다.
Posted by 구차니
2006년도에 상표명 분쟁으로  ethereal이 wireshark로 변경이 되었다고 한다.

Wireshark is a free packet sniffer computer application. It is used for network troubleshooting, analysis, software and communications protocol development, and education. Originally named Ethereal, in May 2006 the project was renamed Wireshark due to trademark issues.

[링크 : http://en.wikipedia.org/wiki/Wireshark]

가장 잘 알려진 네트워크 프로토콜 분석기인 Ethereal이 Wireshark로 개명되었습니다. 핵심 개발자가 다른 회사로 가면서 기존 회사가 Ethereal을 상표명으로 등록하였는데 기존 회사가 해당 상표명을 계속 유지하고자 했기 때문입니다.

[링크 : http://kldp.org/node/71004]

아무튼, 이제 ethereal은 잊고 wireshark를 기억해야겠다 ㅠ.ㅠ
Posted by 구차니
- 조금 더 조사해보고 다시 써야함 -

libjpeg를 이용하여 jpeg를 변환하는데 다른건 잘되길래
테스트 하기위해 gimp에서 grayscale로 변환하였고, 데이터 상으로는 8bit 이미지로 출력이 되었다.
막상 화면에 뿌리려고 보니 기본 루틴이 24bit라서 이상하게 나오는데,
나오는 모습을 보니 묘하다고 해야 하나.. 아무튼 grayscale이니 1byte 단위로  gray만 출력하는 것으로 보인다.

그런데.. 흑백 bitmap은 구조가 어떻게 되려나?


jpg(좌) bmp(우)


회색 이미지는 GIMP에서 jpg를 grayscale로 변환후, bmp로 저장한 것이다.
이 파일 내용을 보니, 헤더 다음에 위와 같이 000 111 222 이런 식으로 반복되는 것이 있는데,
bitmap은 별도의  grayscale이 존재하는 것이 아니라, 256 indexed color로 저장이되며, 결국 "팔레트로 표현"이 된다.

Posted by 구차니
프로그램 사용2009. 7. 3. 11:55
개인적으로 가장 마음에 드는 변화는 탭에 +가 생겼다는 겁니다!!!
예전에 잠시 크롬을 사용할 때 부러웠던 부분이었는데 말이죠 ㅋ


아무튼 현재까지 가장 마음에 드는 부분입니다 +_+!
(이전 버전에는 탭 우클릭 새 탭/ 혹은 Ctrl-t를 했어야 했는데 말이죠)
Posted by 구차니
$ more hello.c
#include <unistd.h>

int flag = 0;

void aa()
{
        sleep(1);
}

void bb()
{
        sleep(1);
}

void tt()
{
        if(flag^=1)
                aa();
        else    bb();
}

void main()
{
        int test;
        char str[] = "Hello World!";
        for(test = 0; test < 100; test++)
        {
                printf("Hello World!\n");
                tt();
        }
        test = 1 + 1;

}

위의 소스를
$ gcc -g -o a.out hello.c
로 디버깅이 가능하도록 컴파일을 해준다.

그리고
$ gdb a.out
으로 디버깅을 시작한다.

아무튼~ step과 next 라는 명령어가 있는데
비슷하면서도 다른 역활을 한다.


29                      tt();
(gdb) step
tt () at hello.c:17
17              if(flag^=1)
(gdb) l
12              sleep(1);
13      }
14
15      void tt()
16      {
17              if(flag^=1)
18                      aa();
19              else    bb();
20      }
21
(gdb) next
18                      aa();
(gdb) next
20      }
(gdb)


일단 step은 말그대로 한단계 나아가고, 함수를 만나면 함수 안으로 들어간다. (비쥬얼 스튜디오의 F11)
그리고 next는 다음 줄로 나아가므로, 함수를 만나면 함수 다음줄로 넘어간다. (비쥬얼 스튜디오의 F10)

그리고 어셈블리 레벨에서 진행하려면 ni / si (instruction) 을 입력하면 된다.
Posted by 구차니
gdb 내부 명령어 모음집

가장 눈여겨 볼 만한 부분은
help breakpoints
help running
help stack
으로

gdb에서 한줄 실행, 함수 들어가기, 나가기 등은 running에
함수 불려진 순서등의추적은 stack에
브레이크 포인트 생성/삭제는 breakpoints의 항목에 들어 있다.

일단 Visual Studio에서 많이 쓰는것들로

브레이크 포인트 설정은 break 와 delete breakpoints 이다. (F8)
(gdb) help break
Set breakpoint at specified line or function.
break [LOCATION] [thread THREADNUM] [if CONDITION]
LOCATION may be a line number, function name, or "*" and an address.
If a line number is specified, break at start of code for that line.
If a function is specified, break at start of code for that function.
If an address is specified, break at that exact address.
With no LOCATION, uses current execution address of selected stack frame.
This is useful for breaking on return to a stack frame.

THREADNUM is the number from "info threads".
CONDITION is a boolean expression.

Multiple breakpoints at one place are permitted, and useful if conditional.

Do "help breakpoints" for info on other commands dealing with breakpoints.
--------------------------------------------------------------------------------
(gdb) help delete breakpoints
Delete some breakpoints or auto-display expressions.
Arguments are breakpoint numbers with spaces in between.
To delete all breakpoints, give no argument.
This command may be abbreviated "delete".

그리고 한줄 실행은 next(행단위 실행 F10) / step(함수단위 실행 F11) 으로
원하는 곳까지 실행은 breakpoint를 잡은후 continue를 하면 된다.

(gdb) help next
Step program, proceeding through subroutine calls.
Like the "step" command as long as subroutine calls do not happen;
when they do, the call is treated as one instruction.
Argument N means do this N times (or till program stops for another reason).

(gdb) help step
Step program until it reaches a different source line.
Argument N means do this N times (or till program stops for another reason).

(gdb) help jump
Continue program being debugged at specified line or address.
Give as argument either LINENUM or *ADDR, where ADDR is an expression for an address to start at.

gdb의 차이점은, 현재 실행중인 라인을 보기가 조금은 힘들다는 것인데,
소스를 보기 위해서는 list를 입력하면 된다.
(gdb) help list
List specified function or line.
With no argument, lists ten more lines after or around previous listing.
"list -" lists the ten lines before a previous ten-line listing.
One argument specifies a line, and ten lines are listed around that line.
Two arguments with comma between specify starting and ending lines to list.
Lines can be specified in these ways:
  LINENUM, to list around that line in current file,
  FILE:LINENUM, to list around that line in that file,
  FUNCTION, to list around beginning of that function,
  FILE:FUNCTION, to distinguish among like-named static functions.
  *ADDRESS, to list around the line containing that address.
With two args if one is empty it stands for ten lines away from the other arg.




Posted by 구차니