01 | /* |
02 | * Ordering of RGB data in scanlines passed to or from the application. |
03 | * If your application wants to deal with data in the order B,G,R, just |
04 | * change these macros. You can also deal with formats such as R,G,B,X |
05 | * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing |
06 | * the offsets will also change the order in which colormap data is organized. |
07 | * RESTRICTIONS: |
08 | * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. |
09 | * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not |
10 | * useful if you are using JPEG color spaces other than YCbCr or grayscale. |
11 | * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE |
12 | * is not 3 (they don't understand about dummy color components!). So you |
13 | * can't use color quantization if you change that value. |
14 | */ |
15 | #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ |
16 | #define RGB_GREEN 1 /* Offset of Green */ |
17 | #define RGB_BLUE 2 /* Offset of Blue */ |
18 | #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ |
libjpeg를 일반적인 표준 Bitmap 파일에 적용하기 위해서는 (혹은 Blit 함수에)
RGBQUAD나 RGBTRIPLE과 동일한 구조로 나오는 것이 좋다.
1 | typedef struct tagRGBQUAD { |
2 | BYTE rgbBlue; |
3 | BYTE rgbGreen; |
4 | BYTE rgbRed; |
5 | BYTE rgbReserved; |
6 | } RGBQUAD; |
1 | typedef struct tagRGBTRIPLE { |
2 | BYTE rgbtBlue; |
3 | BYTE rgbtGreen; |
4 | BYTE rgbtRed; |
5 | } RGBTRIPLE; |
이런 이유로 설정값을 바꾸지 않고 그냥 libjpeg를 사용하게 되면,
변환후에 RGB를 일일이 순서를 바꾸어 주어야 한다.
제약사항으로는
sample application인 djpeg cjpeg 는 적용이 되지 않고(어짜피 BGR로 표준 bitmap 포맷으로 나온다..)
YCbCr(YUV) <-> RGB 변환에만 적용이 된다는 것(JPEG가 YUV 아닌게 있던가?)
color quantizer는 RGBTIPLE(24bit)만 적용되지 RGBQUAD(32bit)는 적용되지 않는다.
솔찍히 먼소리인지 모르겠고.. 실질적으로 YUV->RGB 변환만 한다면 무시해도 될 듯하다.
'프로그램 사용 > libjpeg' 카테고리의 다른 글
libjpeg 런타임 에러발생 - struct mismatch (0) | 2009.05.21 |
---|---|
libjpeg 크로스컴파일 하기 - libjpeg cross-compile using libtool (0) | 2009.05.20 |
libtool: link: unable to infer tagged configuration (0) | 2009.05.18 |
libjpeg.doc 내용 중 scale / decompress 관련내용 (0) | 2009.05.18 |
libjpeg 사용예제 (2) | 2009.05.18 |