포터블 우분투를 실행하면 Xming을 구동하여 사용하는데 옵션이 특이해서
도움말을 찾아보게 되었다.
portable_ubuntu.conf 파일의 내용
kernel=vmlinux
cobd0=images\rootfs.img
cobd3="D:\Documents and Settings\czw5hv\Application Data\Windux\images\root.img"
cofs0=config
cofs1=c:\ #Para tener acceso a la unidad C:
#cofs1=otra_unidad:\ #Si se necesita tener acceso a otras unidades?ej: d:\
#scsi0=cdrom,\Device\Cdrom0 # Para tener acceso al CDROM de la PC
root=/dev/cobd0
ro
initrd=initrd.gz
mem=256
eth0=slirp,00:ff:75:39:D3:C1,tcp:22:22
exec0="Xming\Xming.exe :0 -notrayicon +bs -wm -auth Xauthority -clipboard -multiwindow -dpi 100"
exec1=pulseaudio-0.9.6\pulseaudio.exe # Ejecuta al servidor Pulse Audio para Windows
+bs enable any backing store support -wm WhenMapped default backing-store
위의 옵션들에 backing store라는 내용이 들어간다.
이곳저것 검색을 해봐도 딱히 시원한 대답은 없었지만, 검색 내용중 윈도우 내용이 복구 안될 경우
backing store를 X11에 설정한다는 내용이 발견되었다. 아마 clipping 영역 복구가 제대로 되지 않을 때,
강제로 복구 하도록 하는 옵션인거 같기도 하고.. 용어 내용만 봤을 경우 일종의 캐시 구조인거 같기도하고..
(고속일 수록 가격이 비싸고, 저속일수록 가격이 싸다. 단위용량당 가격적인 면에서
레지스터 > 캐쉬 > 메모리(DRAM) > HDD > ODD > TAPE 등의 순서를 피라미드식으로 이루게 되는데
memory hierarchy 라고 한다.)
Unfortunately some XFree86 drivers are buggy, and when you render an
accelerated primitive which overlaps an area which is not visible to
the user, the driver fails to update the backing store (it only draws
the clipped primitive using accelarated functions and does not complete
the job by calling the software renderer to update the backing store.)
[출처 : http://www.ibiblio.org/ggicore/documentation/libggi/current/display-x.7.html]
Usage...
Xming [:<display-number>] [option]
-a # mouse acceleration (pixels)
-ac disable access control restrictions
-audit int set audit trail level
-auth file select authorization file
-br create root window with black background +bs enable any backing store support
-bs disable any backing store support
-c turns off key-click
c # key-click volume (0-100)
-cc int default color visual class
-co file color database file
-core generate core dump on fatal error
-dpi int screen resolution in dots per inch
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f # bell base (0-100)
-fc string cursor font
-fn string default font name
-fp string default font path
-help prints message with these options
-I ignore all remaining arguments
-logo enable logo in screen saver
nologo disable logo in screen saver
-nolisten string don't listen on protocol
-noreset don't reset after last client exists
-reset reset after last client exists
-p # screen-saver pattern duration (minutes)
-pn accept failure to listen on all ports
-nopn reject failure to listen on all ports
-r turns off auto-repeat
r turns on auto-repeat
-render [default|mono|gray|color] set render color alloc policy
-s # screen-saver timeout (minutes)
-sp file security policy file
-su disable any save under support
-t # mouse threshold (pixels)
-terminate terminate at server reset
-to # connection time out
-tst disable testing extensions
ttyxx server started from init on /dev/ttyxx
v video blanking for screen-saver
-v screen-saver without video blanking -wm WhenMapped default backing-store
-wr create root window with white background
-x string loads named extension at init time
-maxbigreqsize set maximal bigrequest size
+extension name Enable extension
-extension name Disable extension
-query host-name contact named host for XDMCP
-broadcast broadcast for XDMCP
-indirect host-name contact named host for indirect XDMCP
-port port-num UDP port number to send messages to
-from local-address specify the local address to connect from
-once Terminate server after one session
-class display-class specify display class to send in manage
-cookie xdm-auth-bits specify the magic cookie for XDMCP
-displayID display-id manufacturer display ID for request
-kb disable the X Keyboard Extension
+kb enable the X Keyboard Extension
[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]
enable/disable accessx key sequences
-ardelay set XKB autorepeat delay
-arinterval set XKB autorepeat interval
-clipboard
Enables the integration between the Xming clipboard and
Windows clipboard.
-clipupdates num_boxes
Use a clipping region to constrain shadow update blits to
the updated region when num_boxes, or more, are in the
updated region. Diminished effect on current Windows
versions because they already group GDI operations together
in a batch, which has a similar effect.
-depth bits_per_pixel
Specify an optional bitdepth to use in fullscreen mode
with a DirectDraw engine.
-emulate3buttons [timeout]
Emulate a 3 button mouse with an optional timeout in
milliseconds. The default timeout is 50 milliseconds.
-engine engine_type_id
Override the server's automatically selected engine type:
1 - Shadow GDI
2 - Shadow DirectDraw
4 - Shadow DirectDraw4 Non-Locking
Do not use this parameter unless instructed to do so.
-fullscreen
Run the server in fullscreen mode with -depth and -refresh
set as required.
-ignoreinput
Ignore keyboard and mouse input. This is usually only used for
testing and debugging purposes.
-internalwm
EXPERIMENTAL: Run the internal window manager.
-[no]keyhook
Grab special windows key combinations like Alt-Tab or the Menu
key. These keys are discarded by default.
-lesspointer
Hide the windows mouse pointer when it is over an inactive
Xming window. This prevents ghost cursors appearing where
the Windows cursor is drawn over the X cursor.
-logfile filename
Write logmessages to <filename> instead of Xming.n.log,
where n is the display-number of the X Server.
-logverbose verbosity
Set the verbosity of logmessages. [NOTE: Only a few messages
respect the settings, so not much use yet]
0 - only print fatal error.
1 - print additional configuration information.
2 - print additional runtime information [default].
3 - print debugging and tracing information.
-[no]multimonitors (or -[no]multiplemonitors)
Use the entire virtual screen if multiple monitors are
present.
-multiwindow
Run the server in multiwindow mode. Not to be used
together with -rootless or -fullscreen.
-mwextwm
EXPERIMENTAL: Run the server in multiwindow external
window manager mode. Use with xwinwm.
-nodecoration
Do not draw a window border, title bar, etc. Windowed
mode only i.e. ignored when -fullscreen specified.
-noicons
Disable the conversion of X icons in multiwindow mode.
Use to prevent an infrequent crash in miGetImage().
This is a work-around that most people won't need.
-nounicodeclipboard
Disable Unicode in the clipboard.
-refresh rate_in_Hz
Specify an optional refresh rate to use in fullscreen mode
with a DirectDraw engine.
-rootless
Use a transparent root window with an external window
manager (such as openbox). Not to be used with
-multiwindow or with -fullscreen.
-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]
Enable screen scr_num and optionally specify a width and
height and initial position for that screen. Additionally
a monitor number can be specified to start the server on,
at which point, all coordinates become relative to that
monitor. Examples:
-screen 0 800x600+100+100@2 ;2nd monitor offset 100,100 size 800x600
-screen 0 1024x768@3 ;3rd monitor size 1024x768
-screen 0 @1 ;on 1st monitor using its full resolution (the default)
-scrollbars
In windowed mode, allow screens bigger than the Windows desktop.
Moreover, if the window has decorations, one can now resize
it. Do not use in conjunction with -multiwindow or with -rootless.
-silent-dup-error
If another instance of Xming is found running, exit silently
and don't display the error message.
-swcursor
Disable the usage of the windows cursor and use the X11 software
cursor instead.
-[no]trayicon
Do not create a tray icon. Default is to create one
icon per screen. You can globally disable tray icons with
-notrayicon, then enable it for specific screens with
-trayicon for those screens.
-[no]unixkill
Ctrl-Alt-Backspace exits the X Server. The Ctrl-Alt-Backspace
key combo is disabled by default.
-version
Write version and help text to the console (unless built
console-less) and to the log file.
-[no]winkill
Alt-F4 exits the X Server. The Alt-F4 key combo is enabled
by default.
-xkblayout XKBLayout
Set the layout to use for XKB. This defaults to a layout
matching your current layout from windows or us (i.e. USA)
if no matching layout was found.
For example: -xkblayout de
-xkbmodel XKBModel
Set the model to use for XKB. This defaults to pc105.
-xkboptions XKBOptions
Set the options to use for XKB. This defaults to not set.
-xkbrules XKBRules
Set the rules to use for XKB. This defaults to xorg.
-xkbvariant XKBVariant
Set the variant to use for XKB. This defaults to not set.
For example: -xkbvariant nodeadkeys
/*
* Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
* the offsets will also change the order in which colormap data is organized.
* RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
* is not 3 (they don't understand about dummy color components!). So you
* can't use color quantization if you change that value.
*/
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
libjpeg를 일반적인 표준 Bitmap 파일에 적용하기 위해서는 (혹은 Blit 함수에) RGBQUAD나 RGBTRIPLE과 동일한 구조로 나오는 것이 좋다.
unsigned int scale_num, scale_denom
scale_num/scale_denom 의 분수비로 영상 비율을 조절합니다.
기본값은 1/1 혹은 조절하지 않음입니다.
현재, 지원되는 조정 비율은 1/1, 1/2, 1/4, 1/8 입니다.
(라이브러리 설계는 무제한의 비율이 가능하도록 되어있지만,
빠른시일내로 적용되기는 힘들것으로 보입니다.)
작은 조절 비율은 적은 수의 픽셀 연산과 단순화된 IDCT 방법을
사용 할 수 있기 때문에, 매우 빠른 속도의 변환을 합니다
(scale_num은 분자, scale_denom은 분모입니다. 만약에 1/4로 하려고 한다면 scale_num = 1; scale_denom = 4; 로 하면 될 듯 합니다
- 확인요망)
unsigned int scale_num, scale_denom
Scale the image by the fraction scale_num/scale_denom. Default is
1/1, or no scaling. Currently, the only supported scaling ratios
are 1/1, 1/2, 1/4, and 1/8. (The library design allows for arbitrary
scaling ratios but this is not likely to be implemented any time soon.)
Smaller scaling ratios permit significantly faster decoding since
fewer pixels need be processed and a simpler IDCT method can be used.
6. while (scan lines remain to be read)
jpeg_read_scanlines(...);
jpeg_read_scanlines()을 한번 혹은 여러번 호출함으로서 압축해제 된 영상정보를 읽을 수 있습니다.
각각의 호출시에, 읽을 최대 scanline을 넘겨줍니다
(예를들어, working buffer의 높이); jpeg_read_scanlines() 은
많은 줄들의 값을 돌려줄 것 입니다. 돌려준 값은 실제로 읽은 줄의 갯수입니다.
돌려받은 영상정보의 형태(format)는 위의 "Data formats"에 기술되어 있습니다.
흑백과 색상이 있는 JPEG는 서로 다른 데이터 형태라는 것을 잊지마십시오!
영상정보는 상-하 순서로 주어집니다. 만약에 하-상 순서로 영상정보를 저장해야 한다면,
효과적으로 JPEG 라이브러리의 가상 배열 방식을 사용하여 뒤집을 수 있습니다.
예제 프로그램인 djpeg에서 이러한 사용예를 찾으실 수 있습니다.
6. while (scan lines remain to be read)
jpeg_read_scanlines(...);
Now you can read the decompressed image data by calling jpeg_read_scanlines()
one or more times. At each call, you pass in the maximum number of scanlines
to be read (ie, the height of your working buffer); jpeg_read_scanlines()
will return up to that many lines. The return value is the number of lines
actually read. The format of the returned data is discussed under "Data
formats", above. Don't forget that grayscale and color JPEGs will return
different data formats!
Image data is returned in top-to-bottom scanline order. If you must write
out the image in bottom-to-top order, you can use the JPEG library's virtual
array mechanism to invert the data efficiently. Examples of this can be
found in the sample application djpeg.
The library maintains a count of the number of scanlines returned so far
in the output_scanline field of the JPEG object. Usually you can just use
this variable as the loop counter, so that the loop test looks like
"while (cinfo.output_scanline < cinfo.output_height)". (Note that the test
should NOT be against image_height, unless you never use scaling. The image_height field is the height of the original unscaled image.)
The return value always equals the change in the value of output_scanline.
If you don't use a suspending data source, it is safe to assume that
jpeg_read_scanlines() reads at least one scanline per call, until the
bottom of the image has been reached.
If you use a buffer larger than one scanline, it is NOT safe to assume that
jpeg_read_scanlines() fills it. (The current implementation returns only a
few scanlines per call, no matter how large a buffer you pass.) So you must
always provide a loop that calls jpeg_read_scanlines() repeatedly until the
whole image has been read.
Data formats
픽셀들은 scanline 단위로 왼쪽에서 오른쪽 방향으로 저장됩니다
각각의 픽셀을 위한 값들은 열단위로 나란히 있습니다;
24-bit RGB 를 예를 들자면, R,G,B,R,G,B,R,G,B 순서로 되어있습니다. 각각의 scanline은
JSAMPLE 데이터 형의 배열로 되어있습니다 --- jmorecfg.h를 수정하지 않았다면,
일반적으로 "unsigned char" 입니다. (또한 jmorecfg.h를 수정함으로서
RGB 픽셀의 순서를 B,G,R 순서로 변경할수도 있습니다. 하지만 수정전에 제약사항을
먼저 읽어 보시기 바랍니다.)
Data formats
------------
Before diving into procedural details, it is helpful to understand the
image data format that the JPEG library expects or returns.
The standard input image format is a rectangular array of pixels, with each
pixel having the same number of "component" or "sample" values (color
channels). You must specify how many components there are and the colorspace
interpretation of the components. Most applications will use RGB data
(three components per pixel) or grayscale data (one component per pixel).
PLEASE NOTE THAT RGB DATA IS THREE SAMPLES PER PIXEL, GRAYSCALE ONLY ONE.
A remarkable number of people manage to miss this, only to find that their
programs don't work with grayscale JPEG files.
There is no provision for colormapped input. JPEG files are always full-color
or full grayscale (or sometimes another colorspace such as CMYK). You can
feed in a colormapped image by expanding it to full-color format. However
JPEG often doesn't work very well with source data that has been colormapped,
because of dithering noise. This is discussed in more detail in the JPEG FAQ
and the other references mentioned in the README file.
Pixels are stored by scanlines, with each scanline running from left to
right. The component values for each pixel are adjacent in the row; for
example, R,G,B,R,G,B,R,G,B,... for 24-bit RGB color. Each scanline is an
array of data type JSAMPLE --- which is typically "unsigned char", unless you've changed jmorecfg.h. (You can also change the RGB pixel layout, say
to B,G,R order, by modifying jmorecfg.h. But see the restrictions listed in
that file before doing so.)
int w = cinfo.image_width;
int h = cinfo.image_height;
int d = cinfo.jpeg_color_space;
int out_h = cinfo.output_height;
printf("width:%d height:%d depth:%d out_height:%d\n", w, h ,d, out_h);
unsigned char *data = new unsigned char[w * h * d];
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines(&cinfo, &data, 1);
data += d * cinfo.output_width;
}
jpeg_read_header() 한뒤
jpeg_read_scanline()까지는 알았지만, 문서를 대충 읽다 보니..
도무니 어떻게 메모리를 할당해야 할지 감이 안 잡혔는데..
이 문서를 보니 어떻게 하면 될꺼 같다라는 감이 조금은 온다.. 내일 해보고 결과를 적도록 해야겠다.
위에서 대로 전체 할당하고 jpeg_read_scanlines로 읽어 오니 잘된다!