| 1 | /***************************************************************************\
|
|---|
| 2 | *
|
|---|
| 3 | * Module Name: DIVE.H
|
|---|
| 4 | *
|
|---|
| 5 | * OS/2 2.1 Multimedia Extensions Display Engine API data structures
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright (c) International Business Machines Corporation 1993, 1994
|
|---|
| 8 | * All Rights Reserved
|
|---|
| 9 | *
|
|---|
| 10 | *
|
|---|
| 11 | * Module Name: FOURCC.H
|
|---|
| 12 | *
|
|---|
| 13 | * OS/2 Warp Multimedia Extensions Color space definitions
|
|---|
| 14 | *
|
|---|
| 15 | * Copyright (c) International Business Machines Corporation 1993, 1995
|
|---|
| 16 | * All Rights Reserved
|
|---|
| 17 | *
|
|---|
| 18 | \*****************************************************************************/
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | /****************************************************************************\
|
|---|
| 22 | * 11-Nov-96: (Jrg) Translation of original C header files from Warp 4.0
|
|---|
| 23 | * Toolkit to Speed-Pascal.
|
|---|
| 24 | * 19-Aug-97 (Jrg) Included definitions from FOURCC.H header file to avoid
|
|---|
| 25 | * problem with FOURCC being a type and unit identifier at the
|
|---|
| 26 | * same time.
|
|---|
| 27 | \****************************************************************************/
|
|---|
| 28 |
|
|---|
| 29 | unit Dive;
|
|---|
| 30 |
|
|---|
| 31 | interface
|
|---|
| 32 |
|
|---|
| 33 | uses
|
|---|
| 34 | OS2Def;
|
|---|
| 35 |
|
|---|
| 36 | const
|
|---|
| 37 | MAX_DIVE_INSTANCES = 64;
|
|---|
| 38 |
|
|---|
| 39 | type
|
|---|
| 40 | FOURCC = ULONG;
|
|---|
| 41 | HDIVE = ULONG;
|
|---|
| 42 |
|
|---|
| 43 | const
|
|---|
| 44 | DIVE_SUCCESS = $00000000;
|
|---|
| 45 | DIVE_ERR_INVALID_INSTANCE = $00001000;
|
|---|
| 46 | DIVE_ERR_SOURCE_FORMAT = $00001001;
|
|---|
| 47 | DIVE_ERR_DESTINATION_FORMAT = $00001002;
|
|---|
| 48 | DIVE_ERR_BLITTER_NOT_SETUP = $00001003;
|
|---|
| 49 | DIVE_ERR_INSUFFICIENT_LENGTH = $00001004;
|
|---|
| 50 | DIVE_ERR_TOO_MANY_INSTANCES = $00001005;
|
|---|
| 51 | DIVE_ERR_NO_DIRECT_ACCESS = $00001006;
|
|---|
| 52 | DIVE_ERR_NOT_BANK_SWITCHED = $00001007;
|
|---|
| 53 | DIVE_ERR_INVALID_BANK_NUMBER = $00001008;
|
|---|
| 54 | DIVE_ERR_FB_NOT_ACQUIRED = $00001009;
|
|---|
| 55 | DIVE_ERR_FB_ALREADY_ACQUIRED = $0000100a;
|
|---|
| 56 | DIVE_ERR_ACQUIRE_FAILED = $0000100b;
|
|---|
| 57 | DIVE_ERR_BANK_SWITCH_FAILED = $0000100c;
|
|---|
| 58 | DIVE_ERR_DEACQUIRE_FAILED = $0000100d;
|
|---|
| 59 | DIVE_ERR_INVALID_PALETTE = $0000100e;
|
|---|
| 60 | DIVE_ERR_INVALID_DESTINATION_RECTL = $0000100f;
|
|---|
| 61 | DIVE_ERR_INVALID_BUFFER_NUMBER = $00001010;
|
|---|
| 62 | DIVE_ERR_SSMDD_NOT_INSTALLED = $00001011;
|
|---|
| 63 | DIVE_ERR_BUFFER_ALREADY_ACCESSED = $00001012;
|
|---|
| 64 | DIVE_ERR_BUFFER_NOT_ACCESSED = $00001013;
|
|---|
| 65 | DIVE_ERR_TOO_MANY_BUFFERS = $00001014;
|
|---|
| 66 | DIVE_ERR_ALLOCATION_ERROR = $00001015;
|
|---|
| 67 | DIVE_ERR_INVALID_LINESIZE = $00001016;
|
|---|
| 68 | DIVE_ERR_FATAL_EXCEPTION = $00001017;
|
|---|
| 69 | DIVE_ERR_INVALID_CONVERSION = $00001018;
|
|---|
| 70 | DIVE_ERR_VSD_ERROR = $00001019;
|
|---|
| 71 | DIVE_ERR_COLOR_SUPPORT = $0000101a;
|
|---|
| 72 | DIVE_ERR_OUT_OF_RANGE = $0000101b;
|
|---|
| 73 | DIVE_WARN_NO_SIZE = $00001100;
|
|---|
| 74 |
|
|---|
| 75 | DIVE_BUFFER_SCREEN = $00000000;
|
|---|
| 76 | DIVE_BUFFER_GRAPHICS_PLANE = $00000001;
|
|---|
| 77 | DIVE_BUFFER_ALTERNATE_PLANE = $00000002;
|
|---|
| 78 |
|
|---|
| 79 | DIVE_FULLY_VISIBLE = $ffffffff;
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | /* Notes:
|
|---|
| 83 | Associated/Allocated memory buffers start at: $00000010
|
|---|
| 84 |
|
|---|
| 85 | Specifing DIVE_BUFFER_GRAPHICS_PLANE results in the image being
|
|---|
| 86 | transferred to the graphics plane.
|
|---|
| 87 | Specifing DIVE_BUFFER_ALTERNATE_PLANE results in the image being
|
|---|
| 88 | transferred to the alternate (e.g. overlay) plane. If your
|
|---|
| 89 | hardware doesn't support such a plane, this is an error.
|
|---|
| 90 | Specifing DIVE_BUFFER_SCREEN will result in the image being
|
|---|
| 91 | transferred to either the graphics plane buffer or the alternate
|
|---|
| 92 | plane buffer based on if an alternate buffer exists and based on
|
|---|
| 93 | the suitability the overlay plane to accelerate the scaling of
|
|---|
| 94 | the image. If DIVE chooses to use the alternate buffer, it
|
|---|
| 95 | will also paint the overlay "key" color on the graphics plane.
|
|---|
| 96 | This automatic painting does not occur if the alternate plane
|
|---|
| 97 | is explicitly specified.
|
|---|
| 98 | */
|
|---|
| 99 |
|
|---|
| 100 | type
|
|---|
| 101 | DIVE_CAPS = record
|
|---|
| 102 | ulStructLen: ULONG; /* Set equal to sizeof(DIVE_CAPS) */
|
|---|
| 103 | ulPlaneCount: ULONG; /* Number of defined planes. */
|
|---|
| 104 |
|
|---|
| 105 | /* Info returned in the following fields pertains to ulPlaneID. */
|
|---|
| 106 | fScreenDirect: BOOL; /* TRUE if can get addressability to vram. */
|
|---|
| 107 | fBankSwitched: BOOL; /* TRUE if vram is bank-switched. */
|
|---|
| 108 | ulDepth: ULONG; /* Number of bits per pixel. */
|
|---|
| 109 | ulHorizontalResolution: ULONG; /* Screen width in pixels. */
|
|---|
| 110 | ulVerticalResolution: ULONG; /* Screen height in pixels. */
|
|---|
| 111 | ulScanLineBytes: ULONG; /* Screen scan line size in bytes. */
|
|---|
| 112 | fccColorEncoding: FOURCC; /* Colorspace encoding of the screen. */
|
|---|
| 113 | ulApertureSize: ULONG; /* Size of vram aperture in bytes. */
|
|---|
| 114 |
|
|---|
| 115 | ulInputFormats: ULONG; /* Number of input color formats. */
|
|---|
| 116 | ulOutputFormats: ULONG; /* Number of output color formats. */
|
|---|
| 117 | ulFormatLength: ULONG; /* Length of format buffer. */
|
|---|
| 118 | pFormatData: Pointer; /* Pointer to color format buffer FOURCC's.*/
|
|---|
| 119 | end;
|
|---|
| 120 |
|
|---|
| 121 | PDIVE_CAPS = ^DIVE_CAPS;
|
|---|
| 122 |
|
|---|
| 123 | SETUP_BLITTER = record
|
|---|
| 124 |
|
|---|
| 125 | /* Set the ulStructLen field equal to the amount of the structure used. */
|
|---|
| 126 | /* allowable: blank lines below mark sizes of 8, 28, 32, 52, 60, or 68. */
|
|---|
| 127 | ulStructLen: ULONG;
|
|---|
| 128 | /* Set the ulInvert flags based on the following: */
|
|---|
| 129 | /* b0001 = d01 = h01 = flip the image in the horizontal direction. */
|
|---|
| 130 | /* b0010 = d02 = h02 = flip the image in the vertical direction. */
|
|---|
| 131 | /* All other bits ignored. */
|
|---|
| 132 | fInvert: ULONG;
|
|---|
| 133 |
|
|---|
| 134 | /* This is the color format of the source data. See "FOURCC.H" */
|
|---|
| 135 | fccSrcColorFormat: FOURCC;
|
|---|
| 136 | /* This is the width of the source image in pixels. */
|
|---|
| 137 | ulSrcWidth: ULONG;
|
|---|
| 138 | /* This is the height of the source image in pixels. */
|
|---|
| 139 | ulSrcHeight: ULONG;
|
|---|
| 140 | /* This is the horizontal offset from which to start displaying for */
|
|---|
| 141 | /* use in displaying a sub-portion of the source image. */
|
|---|
| 142 | ulSrcPosX: ULONG;
|
|---|
| 143 | /* This is the vertical offset from which to start displaying. */
|
|---|
| 144 | ulSrcPosY: ULONG;
|
|---|
| 145 |
|
|---|
| 146 | /* This is the dither type to use. 0 defines no dither and 1 */
|
|---|
| 147 | /* defines 2x2 dither (all others ignored). Note: dithering is only */
|
|---|
| 148 | /* supported in direct color to LUT8 conversions. */
|
|---|
| 149 | ulDitherType: ULONG;
|
|---|
| 150 |
|
|---|
| 151 | /* This is the color format of the destinaion data. See "FOURCC.H" */
|
|---|
| 152 | fccDstColorFormat: FOURCC;
|
|---|
| 153 | /* This is the width of the destination image in pixels. */
|
|---|
| 154 | ulDstWidth: ULONG;
|
|---|
| 155 | /* This is the height of the destination image in pixels. */
|
|---|
| 156 | ulDstHeight: ULONG;
|
|---|
| 157 | /* This is the horizontal offset from which to start displaying for */
|
|---|
| 158 | /* use in displaying to sub-portion of the destination image. */
|
|---|
| 159 | lDstPosX: LONG;
|
|---|
| 160 | /* This is the vertical offset from which to start displaying. */
|
|---|
| 161 | lDstPosY: LONG;
|
|---|
| 162 |
|
|---|
| 163 | /* This is the world screen horizontal position, where 0 is left. */
|
|---|
| 164 | /* These are ignored if the destination is not the screen. */
|
|---|
| 165 | lScreenPosX: LONG;
|
|---|
| 166 | /* This is the world screen vertical position, where 0 is bottom. */
|
|---|
| 167 | lScreenPosY: LONG;
|
|---|
| 168 |
|
|---|
| 169 | /* This is the number of visible rectangular regions being passed in. */
|
|---|
| 170 | /* These are ignored if the destination is not the screen. */
|
|---|
| 171 | /* Also, if you application *KNOWS* that the region is fully visible */
|
|---|
| 172 | /* (like not going to the screen), the you can use DIVE_FULLY_VISIBLE */
|
|---|
| 173 | /* instead of making up a bogus visible region structure. */
|
|---|
| 174 | ulNumDstRects: ULONG;
|
|---|
| 175 | /* This points to an array of visible regions which defines what */
|
|---|
| 176 | /* portions of the source image are to be displayed. */
|
|---|
| 177 | pVisDstRects: PRECTL; /* Pointer to array of visible rectangles. */
|
|---|
| 178 | end;
|
|---|
| 179 |
|
|---|
| 180 | PSETUP_BLITTER = ^SETUP_BLITTER;
|
|---|
| 181 |
|
|---|
| 182 | imports
|
|---|
| 183 |
|
|---|
| 184 | /*
|
|---|
| 185 | ULONG APIENTRY DiveQueryCaps ( PDIVE_CAPS pDiveCaps,
|
|---|
| 186 | ULONG ulPlaneBufNum );
|
|---|
| 187 | */
|
|---|
| 188 |
|
|---|
| 189 | function DiveQueryCaps ( pDiveCaps: PDIVE_CAPS;
|
|---|
| 190 | ulPlaneBufNum: ULONG ): ULONG;
|
|---|
| 191 |
|
|---|
| 192 | APIENTRY; 'DIVE' NAME 'DiveQueryCaps';
|
|---|
| 193 |
|
|---|
| 194 | /*
|
|---|
| 195 | ULONG APIENTRY DiveOpen ( HDIVE *phDiveInst,
|
|---|
| 196 | BOOL fNonScreenInstance,
|
|---|
| 197 | PVOID ppFrameBuffer );
|
|---|
| 198 | */
|
|---|
| 199 |
|
|---|
| 200 | function DiveOpen ( var phDiveInst: HDIVE;
|
|---|
| 201 | fNonScreenInstance: BOOL;
|
|---|
| 202 | ppFrameBuffer: Pointer ): ULONG;
|
|---|
| 203 |
|
|---|
| 204 | APIENTRY; 'DIVE' name 'DiveOpen';
|
|---|
| 205 |
|
|---|
| 206 | /*
|
|---|
| 207 | ULONG APIENTRY DiveSetupBlitter ( HDIVE hDiveInst,
|
|---|
| 208 | PSETUP_BLITTER pSetupBlitter );
|
|---|
| 209 | */
|
|---|
| 210 |
|
|---|
| 211 | function DiveSetupBlitter ( hDiveInst: HDIVE;
|
|---|
| 212 | pSetupBlitter: PSETUP_BLITTER ): ULONG;
|
|---|
| 213 |
|
|---|
| 214 | APIENTRY; 'DIVE' name 'DiveSetupBlitter';
|
|---|
| 215 |
|
|---|
| 216 | /*
|
|---|
| 217 | ULONG APIENTRY DiveBlitImage ( HDIVE hDiveInst,
|
|---|
| 218 | ULONG ulSrcBufNumber,
|
|---|
| 219 | ULONG ulDstBufNumber );
|
|---|
| 220 | */
|
|---|
| 221 |
|
|---|
| 222 | function DiveBlitImage ( hDiveInst: HDIVE;
|
|---|
| 223 | ulSrcBufNumber: ULONG;
|
|---|
| 224 | ulDstBufNumber: ULONG ): ULONG;
|
|---|
| 225 |
|
|---|
| 226 | APIENTRY; 'DIVE' name 'DiveBlitImage';
|
|---|
| 227 |
|
|---|
| 228 | (*
|
|---|
| 229 |
|
|---|
| 230 | #ifdef INCL_MM_OS2
|
|---|
| 231 | /* Same as DiveBlitImage, except pbLineMask points to one byte per line */
|
|---|
| 232 | /* in source image buffer such that 0: unchanged, $FF: changed */
|
|---|
| 233 | ULONG APIENTRY DiveBlitImageLines ( HDIVE hDiveInst,
|
|---|
| 234 | ULONG ulSrcBufNumber,
|
|---|
| 235 | ULONG ulDstBufNumber,
|
|---|
| 236 | PBYTE pbLineMask );
|
|---|
| 237 | #endif
|
|---|
| 238 |
|
|---|
| 239 | *)
|
|---|
| 240 |
|
|---|
| 241 | /*
|
|---|
| 242 | ULONG APIENTRY DiveClose ( HDIVE hDiveInst );
|
|---|
| 243 | */
|
|---|
| 244 |
|
|---|
| 245 | function DiveClose ( hDiveInst: HDIVE ): ULONG;
|
|---|
| 246 |
|
|---|
| 247 | APIENTRY; 'DIVE' name 'DiveClose';
|
|---|
| 248 |
|
|---|
| 249 | /*
|
|---|
| 250 | ULONG APIENTRY DiveAcquireFrameBuffer ( HDIVE hDiveInst,
|
|---|
| 251 | PRECTL prectlDst );
|
|---|
| 252 | */
|
|---|
| 253 |
|
|---|
| 254 | function DiveAcquireFrameBuffer ( hDiveInst: HDIVE;
|
|---|
| 255 | prectlDst: PRECTL ): ULONG;
|
|---|
| 256 |
|
|---|
| 257 | APIENTRY; 'DIVE' name 'DiveAcquireFrameBuffer';
|
|---|
| 258 |
|
|---|
| 259 | /*
|
|---|
| 260 | ULONG APIENTRY DiveSwitchBank ( HDIVE hDiveInst,
|
|---|
| 261 | ULONG ulBankNumber );
|
|---|
| 262 | */
|
|---|
| 263 |
|
|---|
| 264 | function DiveSwitchBank ( hDiveInst: HDIVE;
|
|---|
| 265 | ulBankNumber: ULONG ): ULONG;
|
|---|
| 266 |
|
|---|
| 267 | APIENTRY; 'DIVE' name 'DiveSwitchBank';
|
|---|
| 268 |
|
|---|
| 269 | /*
|
|---|
| 270 | ULONG APIENTRY DiveDeacquireFrameBuffer ( HDIVE hDiveInst );
|
|---|
| 271 | */
|
|---|
| 272 |
|
|---|
| 273 | function DiveDeacquireFrameBuffer ( hDiveInst: HDIVE ): ULONG;
|
|---|
| 274 |
|
|---|
| 275 | APIENTRY; 'DIVE' name 'DiveDeacquireFrameBuffer';
|
|---|
| 276 |
|
|---|
| 277 | /*
|
|---|
| 278 | ULONG APIENTRY DiveCalcFrameBufferAddress ( HDIVE hDiveInst,
|
|---|
| 279 | PRECTL prectlDest,
|
|---|
| 280 | PBYTE *ppDestinationAddress,
|
|---|
| 281 | PULONG pulBankNumber,
|
|---|
| 282 | PULONG pulRemLinesInBank );
|
|---|
| 283 | */
|
|---|
| 284 |
|
|---|
| 285 | function DiveCalcFrameBufferAddress ( hDiveInst: HDIVE;
|
|---|
| 286 | prectlDest: PRECTL;
|
|---|
| 287 | var ppDestinationAddress: BYTE;
|
|---|
| 288 | pulBankNumber: PULONG;
|
|---|
| 289 | pulRemLinesInBank: PULONG ): ULONG;
|
|---|
| 290 |
|
|---|
| 291 | APIENTRY; 'DIVE' name 'DiveCalcFrameBufferAddress';
|
|---|
| 292 |
|
|---|
| 293 | /* Notes on DiveAllocImageBuffer:
|
|---|
| 294 | If pbImageBuffer is not NULL, the buffer is associated rather than
|
|---|
| 295 | allocated. If pbImageBuffer is not NULL and the buffer number
|
|---|
| 296 | pointed to by pulBufferNumber is non-zero, a new buffer pointer is
|
|---|
| 297 | associated with the buffer number. Even though no memory is
|
|---|
| 298 | allocated by DiveAllocImageBuffer when user-allocated buffers are
|
|---|
| 299 | associated, DiveFreeImageBuffer should be called to release the
|
|---|
| 300 | buffer association to avoid using up available buffer indexes.
|
|---|
| 301 | The specified line size will be used if a buffer is allocated in
|
|---|
| 302 | system memory, or if a user buffer is associated. If the
|
|---|
| 303 | specified line size is zero, the allocated line size is rounded up
|
|---|
| 304 | to the nearest DWORD boundry.
|
|---|
| 305 | */
|
|---|
| 306 |
|
|---|
| 307 | /*
|
|---|
| 308 | ULONG APIENTRY DiveAllocImageBuffer ( HDIVE hDiveInst,
|
|---|
| 309 | PULONG pulBufferNumber,
|
|---|
| 310 | FOURCC fccColorSpace,
|
|---|
| 311 | ULONG ulWidth,
|
|---|
| 312 | ULONG ulHeight,
|
|---|
| 313 | ULONG ulLineSizeBytes,
|
|---|
| 314 | PBYTE pbImageBuffer );
|
|---|
| 315 | */
|
|---|
| 316 |
|
|---|
| 317 | function DiveAllocImageBuffer ( hDiveInst: HDIVE;
|
|---|
| 318 | pulBufferNumber: PULONG;
|
|---|
| 319 | fccColorSpace: FOURCC;
|
|---|
| 320 | ulWidth: ULONG;
|
|---|
| 321 | ulHeight: ULONG;
|
|---|
| 322 | ulLineSizeBytes: ULONG;
|
|---|
| 323 | pbImageBuffer: PBYTE ): ULONG;
|
|---|
| 324 |
|
|---|
| 325 | APIENTRY; 'DIVE' name 'DiveAllocImageBuffer';
|
|---|
| 326 |
|
|---|
| 327 | /*
|
|---|
| 328 | ULONG APIENTRY DiveFreeImageBuffer ( HDIVE hDiveInst,
|
|---|
| 329 | ULONG ulBufferNumber );
|
|---|
| 330 | */
|
|---|
| 331 |
|
|---|
| 332 | function DiveFreeImageBuffer ( hDiveInst: HDIVE;
|
|---|
| 333 | ulBufferNumber: ULONG ): ULONG;
|
|---|
| 334 |
|
|---|
| 335 | APIENTRY; 'DIVE' name 'DiveFreeImageBuffer';
|
|---|
| 336 |
|
|---|
| 337 | /*
|
|---|
| 338 | ULONG APIENTRY DiveBeginImageBufferAccess ( HDIVE hDiveInst,
|
|---|
| 339 | ULONG ulBufferNumber,
|
|---|
| 340 | PBYTE *ppbImageBuffer,
|
|---|
| 341 | PULONG pulBufferScanLineBytes,
|
|---|
| 342 | PULONG pulBufferScanLines );
|
|---|
| 343 | */
|
|---|
| 344 |
|
|---|
| 345 | function DiveBeginImageBufferAccess ( hDiveInst: HDIVE;
|
|---|
| 346 | ulBufferNumber: ULONG;
|
|---|
| 347 | var ppbImageBuffer: PBYTE;
|
|---|
| 348 | pulBufferScanLineBytes: PULONG;
|
|---|
| 349 | pulBufferScanLines: PULONG ): ULONG;
|
|---|
| 350 |
|
|---|
| 351 | APIENTRY; 'DIVE' name 'DiveBeginImageBufferAccess';
|
|---|
| 352 |
|
|---|
| 353 | /*
|
|---|
| 354 | ULONG APIENTRY DiveEndImageBufferAccess ( HDIVE hDiveInst,
|
|---|
| 355 | ULONG ulBufferNumber );
|
|---|
| 356 | */
|
|---|
| 357 |
|
|---|
| 358 | function DiveEndImageBufferAccess ( hDiveInst: HDIVE;
|
|---|
| 359 | ulBufferNumber: ULONG ): ULONG;
|
|---|
| 360 |
|
|---|
| 361 | APIENTRY; 'DIVE' name 'DiveEndImageBufferAccess';
|
|---|
| 362 |
|
|---|
| 363 | /* Notes on palettes:
|
|---|
| 364 | Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set
|
|---|
| 365 | the physical palette. If your application MUST set the PHYSICAL palette,
|
|---|
| 366 | try using no more than 236 entries (the middle 236: 10-245, thus leaving
|
|---|
| 367 | the top and bottom 10 entries for the Workplace Shell). If your
|
|---|
| 368 | application MUST use ALL 256 entries, it must do so as a full-screen
|
|---|
| 369 | (i.e. maximized) application. Remember, No WM_REALIZEPALETTE message
|
|---|
| 370 | will be sent to other running applications, meaning they will not redraw
|
|---|
| 371 | and their colors will be all wrong. It is not recommended that a
|
|---|
| 372 | developer use these commands:
|
|---|
| 373 |
|
|---|
| 374 | To set physical palette, do the following:
|
|---|
| 375 | hps = WinGetPS ( HWND_DESKTOP );
|
|---|
| 376 | hdc = GpiQueryDevice ( hps );
|
|---|
| 377 | GpiCreateLogColorTable ( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
|
|---|
| 378 | LCOLF_CONSECRGB, 0, 256, (PLONG)plRGB2Entries );
|
|---|
| 379 | Gre32EntrY3 ( hdc, 0L, $000060C6L );
|
|---|
| 380 | WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
|
|---|
| 381 | WinReleasePS ( hps );
|
|---|
| 382 |
|
|---|
| 383 | To reset physical palette, do the following:
|
|---|
| 384 | hps = WinGetPS ( HWND_DESKTOP );
|
|---|
| 385 | hdc = GpiQueryDevice ( hps );
|
|---|
| 386 | Gre32EntrY3 ( hdc, 0L, $000060C7L );
|
|---|
| 387 | WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
|
|---|
| 388 | WinReleasePS ( hps );
|
|---|
| 389 | */
|
|---|
| 390 |
|
|---|
| 391 | end;
|
|---|
| 392 |
|
|---|
| 393 | /* Use either of the two defines as the pRGB2Entries pointer to have DIVE */
|
|---|
| 394 | /* query and set the physical or default palette as source or destination. */
|
|---|
| 395 |
|
|---|
| 396 | const
|
|---|
| 397 | DIVE_PALETTE_PHYSICAL = PBYTE($00000000);
|
|---|
| 398 | DIVE_PALETTE_DEFAULT = PBYTE($ffffffff);
|
|---|
| 399 |
|
|---|
| 400 | imports
|
|---|
| 401 |
|
|---|
| 402 | /*
|
|---|
| 403 | ULONG APIENTRY DiveSetDestinationPalette ( HDIVE hDiveInst,
|
|---|
| 404 | ULONG ulStartIndex,
|
|---|
| 405 | ULONG ulNumEntries,
|
|---|
| 406 | PBYTE pbRGB2Entries );
|
|---|
| 407 | */
|
|---|
| 408 |
|
|---|
| 409 | function DiveSetDestinationPalette ( hDiveInst: HDIVE;
|
|---|
| 410 | ulStartIndex: ULONG;
|
|---|
| 411 | ulNumEntries: ULONG;
|
|---|
| 412 | pbRGB2Entries: PBYTE ): ULONG;
|
|---|
| 413 |
|
|---|
| 414 | APIENTRY; 'DIVE' name 'DiveSetDestinationPalette';
|
|---|
| 415 |
|
|---|
| 416 | /*
|
|---|
| 417 | ULONG APIENTRY DiveSetSourcePalette ( HDIVE hDiveInst,
|
|---|
| 418 | ULONG ulStartIndex,
|
|---|
| 419 | ULONG ulNumEntries,
|
|---|
| 420 | PBYTE pbRGB2Entries );
|
|---|
| 421 | */
|
|---|
| 422 |
|
|---|
| 423 | function DiveSetSourcePalette ( hDiveInst: HDIVE;
|
|---|
| 424 | ulStartIndex: ULONG;
|
|---|
| 425 | ulNumEntries: ULONG;
|
|---|
| 426 | pbRGB2Entries: PBYTE ): ULONG;
|
|---|
| 427 |
|
|---|
| 428 | APIENTRY; 'DIVE' name 'DiveSetSourcePalette';
|
|---|
| 429 |
|
|---|
| 430 | (*
|
|---|
| 431 | #ifdef INCL_MM_OS2
|
|---|
| 432 | ULONG APIENTRY DiveSetTransparentBlitMode ( HDIVE hDiveInst,
|
|---|
| 433 | ULONG ulTransBlitMode,
|
|---|
| 434 | ULONG ulValue1,
|
|---|
| 435 | ULONG ulValue2 );
|
|---|
| 436 | *)
|
|---|
| 437 | /* The following transparent blitting modes are supported: */
|
|---|
| 438 |
|
|---|
| 439 | end;
|
|---|
| 440 |
|
|---|
| 441 | const
|
|---|
| 442 | DIVE_TBM_NONE = $00;
|
|---|
| 443 | /* No transparency, i.e. all pixels are transferred (default) */
|
|---|
| 444 |
|
|---|
| 445 | DIVE_TBM_EXCLUDE_SOURCE_VALUE = $01;
|
|---|
| 446 | /* Source pixels with values that exactly match the value specified in */
|
|---|
| 447 | /* ulValue1 are not transferred. */
|
|---|
| 448 |
|
|---|
| 449 | DIVE_TBM_EXCLUDE_SOURCE_RGB_RANGE = $02;
|
|---|
| 450 | /* Source pixels with values that lie within the range specified in RGB */
|
|---|
| 451 | /* color space specified by ulValue1 (minimum) and ulValue2 (maximum) */
|
|---|
| 452 | /* are not transferred by DiveBlitImage. */
|
|---|
| 453 |
|
|---|
| 454 | DIVE_TBM_INCLUDE_SOURCE_RGB_RANGE = $03;
|
|---|
| 455 | /* Source pixels with values that lie outside the range specified in RGB */
|
|---|
| 456 | /* color space specified by ulValue1 (minimum) and ulValue2 (maximum) */
|
|---|
| 457 | /* are not transferred by DiveBlitImage. */
|
|---|
| 458 |
|
|---|
| 459 | DIVE_TBM_EXCLUDE_SOURCE_YUV_RANGE = $04;
|
|---|
| 460 | /* Source pixels with values that lie within the range specified in RGB */
|
|---|
| 461 | /* color space specified by ulValue1 (minimum) and ulValue2 (maximum) */
|
|---|
| 462 | /* are not transferred by DiveBlitImage. */
|
|---|
| 463 |
|
|---|
| 464 | DIVE_TBM_INCLUDE_SOURCE_YUV_RANGE = $05;
|
|---|
| 465 | /* Source pixels with values that lie outside the range specified in RGB */
|
|---|
| 466 | /* color space specified by ulValue1 (minimum) and ulValue2 (maximum) */
|
|---|
| 467 | /* are not transferred by DiveBlitImage. */
|
|---|
| 468 |
|
|---|
| 469 | /* Notes on transparent blitting:
|
|---|
| 470 | Supported transparent blitting functions are all based on source pixel
|
|---|
| 471 | values. A pixel in the destination image buffer is not modified if the
|
|---|
| 472 | corresponding pixel in the source buffer is "transparent". The color
|
|---|
| 473 | values or color value ranges specified in ulValue1 and ulValue2 are
|
|---|
| 474 | dependent on the source image color format (fccSrcColorFormat) and the
|
|---|
| 475 | color space in which the range comparison is taking place.
|
|---|
| 476 |
|
|---|
| 477 | FOURCC_LUT8:
|
|---|
| 478 | The color value is specified in the low 8 bits of parameter
|
|---|
| 479 |
|
|---|
| 480 | FOURCC_Y888, FOURCC_Y2X2, FOURCC_Y4X4, FOURCC_YUV9, FOURCC_Y644, FOURCC_Y422:
|
|---|
| 481 | 23:8 - Y, 15:8 - U, 7:8 - V (bits 31:8 ignored)
|
|---|
| 482 |
|
|---|
| 483 | FOURCC_R565, FOURCC_R555, FOURCC_R664, FOURCC_RGB3, FOURCC_BGR3, FOURCC_RGB4,
|
|---|
| 484 | FOURCC_BGR4:
|
|---|
| 485 | 23:8 - R, 15:8 - G, 7:8 - B (bits 31:8 ignored)
|
|---|
| 486 | R, G, and B components are specified with 8 bit significance, regardless
|
|---|
| 487 | of significance in the source data.
|
|---|
| 488 |
|
|---|
| 489 | Transparent blitting of other source image formats is not supported.
|
|---|
| 490 |
|
|---|
| 491 | For range comparisons in RGB or YUV, the three components are compared
|
|---|
| 492 | independently against the minimum and maximum values specified by the
|
|---|
| 493 | ulValue1 and ulValue2 parameters respectively. A value is considered to
|
|---|
| 494 | within the specified range if all three components satisfy:
|
|---|
| 495 | min <= value <= max.
|
|---|
| 496 |
|
|---|
| 497 | For EXCLUDE_SOURCE_VALUE tranparent blitting, the specified value in
|
|---|
| 498 | ulValue1 is assumed to be in the source color space as described above.
|
|---|
| 499 | For range comparisons, the values specified in ulValue1 and ulValue2 are
|
|---|
| 500 | assumed to be in the color space in which the range comparison is to be
|
|---|
| 501 | performed, either YUV or RGB.
|
|---|
| 502 |
|
|---|
| 503 | - For range comparisons in YUV where the source data format is a YUV
|
|---|
| 504 | form, the values in ulValue1 and ulValue2 are in the source YUV
|
|---|
| 505 | format.
|
|---|
| 506 |
|
|---|
| 507 | - For range comparisons in YUV where the source data format is RGB,
|
|---|
| 508 | conversion of source data format from RGB to YUV using standard
|
|---|
| 509 | CCIR601 equations is assumed (refer to fourcc.h).
|
|---|
| 510 |
|
|---|
| 511 | - For range comparisons in RGB where the source data format is an RGB
|
|---|
| 512 | form, the values in ulValue1 and ulValue2 specify the RGB range with
|
|---|
| 513 | 5 bits significance in R, 6 bits in G, and 5 bits in B.
|
|---|
| 514 |
|
|---|
| 515 | - For range comparisons in RGB where the source data format is YUV,
|
|---|
| 516 | conversion of source data format from YUV to RGB using standard
|
|---|
| 517 | CCIR601 equations is assumed (refer to fourcc.h).
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 | */
|
|---|
| 522 |
|
|---|
| 523 | const
|
|---|
| 524 | FOURCC_SCRN = 0;
|
|---|
| 525 |
|
|---|
| 526 | FOURCC_R565 = Ord('R')
|
|---|
| 527 | + Ord('5') shl 8
|
|---|
| 528 | + Ord('6') shl 16
|
|---|
| 529 | + Ord('5') shl 24; // mmioFOURCC( 'R', '5', '6', '5' )
|
|---|
| 530 |
|
|---|
| 531 | FOURCC_R555 = Ord('R')
|
|---|
| 532 | + Ord('5') shl 8
|
|---|
| 533 | + Ord('5') shl 16
|
|---|
| 534 | + Ord('5') shl 24; // mmioFOURCC( 'R', '5', '5', '5' )
|
|---|
| 535 |
|
|---|
| 536 | FOURCC_R664 = Ord('R')
|
|---|
| 537 | + Ord('6') shl 8
|
|---|
| 538 | + Ord('6') shl 16
|
|---|
| 539 | + Ord('4') shl 24; // mmioFOURCC( 'R', '6', '6', '4' )
|
|---|
| 540 |
|
|---|
| 541 | FOURCC_RGB3 = Ord('R')
|
|---|
| 542 | + Ord('G') shl 8
|
|---|
| 543 | + Ord('B') shl 16
|
|---|
| 544 | + Ord('3') shl 24; // mmioFOURCC( 'R', 'G', 'B', '3' )
|
|---|
| 545 |
|
|---|
| 546 | FOURCC_BGR3 = Ord('B')
|
|---|
| 547 | + Ord('G') shl 8
|
|---|
| 548 | + Ord('R') shl 16
|
|---|
| 549 | + Ord('3') shl 24; // mmioFOURCC( 'B', 'G', 'R', '3' )
|
|---|
| 550 |
|
|---|
| 551 | FOURCC_RGB4 = Ord('R')
|
|---|
| 552 | + Ord('G') shl 8
|
|---|
| 553 | + Ord('B') shl 16
|
|---|
| 554 | + Ord('4') shl 24; // mmioFOURCC( 'R', 'G', 'B', '4' )
|
|---|
| 555 |
|
|---|
| 556 | FOURCC_BGR4 = Ord('B')
|
|---|
| 557 | + Ord('G') shl 8
|
|---|
| 558 | + Ord('R') shl 16
|
|---|
| 559 | + Ord('4') shl 24; // mmioFOURCC( 'B', 'G', 'R', '4' )
|
|---|
| 560 |
|
|---|
| 561 | FOURCC_LUT8 = Ord('L')
|
|---|
| 562 | + Ord('U') shl 8
|
|---|
| 563 | + Ord('T') shl 16
|
|---|
| 564 | + Ord('8') shl 24; // mmioFOURCC( 'L', 'U', 'T', '8' )
|
|---|
| 565 |
|
|---|
| 566 | FOURCC_LT12 = Ord('L')
|
|---|
| 567 | + Ord('T') shl 8
|
|---|
| 568 | + Ord('1') shl 16
|
|---|
| 569 | + Ord('2') shl 24; // mmioFOURCC( 'L', 'T', '1', '2' )
|
|---|
| 570 |
|
|---|
| 571 | FOURCC_GREY = Ord('G')
|
|---|
| 572 | + Ord('R') shl 8
|
|---|
| 573 | + Ord('E') shl 16
|
|---|
| 574 | + Ord('Y') shl 24; // mmioFOURCC( 'G', 'R', 'E', 'Y' )
|
|---|
| 575 |
|
|---|
| 576 | FOURCC_GY16 = Ord('G')
|
|---|
| 577 | + Ord('Y') shl 8
|
|---|
| 578 | + Ord('1') shl 16
|
|---|
| 579 | + Ord('6') shl 24; // mmioFOURCC( 'G', 'Y', '1', '6' )
|
|---|
| 580 |
|
|---|
| 581 | FOURCC_Y888 = Ord('Y')
|
|---|
| 582 | + Ord('8') shl 8
|
|---|
| 583 | + Ord('8') shl 16
|
|---|
| 584 | + Ord('8') shl 24; // mmioFOURCC( 'Y', '8', '8', '8' )
|
|---|
| 585 |
|
|---|
| 586 | FOURCC_Y2X2 = Ord('Y')
|
|---|
| 587 | + Ord('2') shl 8
|
|---|
| 588 | + Ord('X') shl 16
|
|---|
| 589 | + Ord('2') shl 24; // mmioFOURCC( 'Y', '2', 'X', '2' )
|
|---|
| 590 |
|
|---|
| 591 | FOURCC_Y4X4 = Ord('Y')
|
|---|
| 592 | + Ord('4') shl 8
|
|---|
| 593 | + Ord('X') shl 16
|
|---|
| 594 | + Ord('4') shl 24; // mmioFOURCC( 'Y', '4', 'X', '4' )
|
|---|
| 595 |
|
|---|
| 596 | FOURCC_YUV9 = Ord('Y')
|
|---|
| 597 | + Ord('U') shl 8
|
|---|
| 598 | + Ord('V') shl 16
|
|---|
| 599 | + Ord('9') shl 24; // mmioFOURCC( 'Y', 'U', 'V', '9' )
|
|---|
| 600 |
|
|---|
| 601 | FOURCC_Y644 = Ord('Y')
|
|---|
| 602 | + Ord('6') shl 8
|
|---|
| 603 | + Ord('4') shl 16
|
|---|
| 604 | + Ord('4') shl 24; // mmioFOURCC( 'Y', '6', '4', '4' )
|
|---|
| 605 |
|
|---|
| 606 | FOURCC_MONO = Ord('M')
|
|---|
| 607 | + Ord('O') shl 8
|
|---|
| 608 | + Ord('N') shl 16
|
|---|
| 609 | + Ord('O') shl 24; // mmioFOURCC( 'M', 'O', 'N', 'O' )
|
|---|
| 610 |
|
|---|
| 611 | FOURCC_Y422 = Ord('Y')
|
|---|
| 612 | + Ord('4') shl 8
|
|---|
| 613 | + Ord('2') shl 16
|
|---|
| 614 | + Ord('2') shl 24; // mmioFOURCC( 'Y', '4', '2', '2' )
|
|---|
| 615 |
|
|---|
| 616 | FOURCC_Y42B = Ord('Y')
|
|---|
| 617 | + Ord('4') shl 8
|
|---|
| 618 | + Ord('2') shl 16
|
|---|
| 619 | + Ord('B') shl 24; // mmioFOURCC( 'Y', '4', '2', 'B' )
|
|---|
| 620 |
|
|---|
| 621 | FOURCC_Y42D = Ord('Y')
|
|---|
| 622 | + Ord('4') shl 8
|
|---|
| 623 | + Ord('2') shl 16
|
|---|
| 624 | + Ord('D') shl 24; // mmioFOURCC( 'Y', '4', '2', 'D' )
|
|---|
| 625 |
|
|---|
| 626 | FOURCC_Y411 = Ord('Y')
|
|---|
| 627 | + Ord('4') shl 8
|
|---|
| 628 | + Ord('1') shl 16
|
|---|
| 629 | + Ord('1') shl 24; // mmioFOURCC( 'Y', '4', '1', '1' )
|
|---|
| 630 |
|
|---|
| 631 | FOURCC_VGA = Ord('V')
|
|---|
| 632 | + Ord('G') shl 8
|
|---|
| 633 | + Ord('A') shl 16
|
|---|
| 634 | + Ord(' ') shl 24; // mmioFOURCC( 'V', 'G', 'A', ' ' )
|
|---|
| 635 |
|
|---|
| 636 | /******************************************************************************
|
|---|
| 637 |
|
|---|
| 638 | DIVE color format definitions:
|
|---|
| 639 |
|
|---|
| 640 | FOURCC_SCRN : Use the fourcc of the screen, typically LUT8, R565, or BGR3.
|
|---|
| 641 |
|
|---|
| 642 | FOURCC_R565 : This is single plane two byte per pixel format:
|
|---|
| 643 | in USHORT: "rrrr rggg gggb bbbb"
|
|---|
| 644 | "4321 0543 2104 3210"
|
|---|
| 645 | in memory: "gggb bbbb rrrr rggg"
|
|---|
| 646 | "2104 3210 4321 0543"
|
|---|
| 647 |
|
|---|
| 648 | FOURCC_R555 : This is single plane two byte per pixel format:
|
|---|
| 649 | in USHORT: "xrrr rrgg gggb bbbb"
|
|---|
| 650 | "-432 1043 2104 3210"
|
|---|
| 651 | in memory: "gggb bbbb xrrr rrgg"
|
|---|
| 652 | "2104 3210 -432 1043"
|
|---|
| 653 |
|
|---|
| 654 | FOURCC_R664 : This is single plane two byte per pixel format:
|
|---|
| 655 | in USHORT: "rrrr rrgg gggg bbbb"
|
|---|
| 656 | "5432 1054 3210 3210"
|
|---|
| 657 | in memory: "gggg bbbb rrrr rrgg"
|
|---|
| 658 | "3210 3210 5432 1054"
|
|---|
| 659 |
|
|---|
| 660 | FOURCC_RGB3 : This is single plane three byte per pixel format:
|
|---|
| 661 | in ULONG: "xxxx xxxx bbbb bbbb gggg gggg rrrr rrrr"
|
|---|
| 662 | "---- ---- 7654 3210 7654 3210 7654 3210"
|
|---|
| 663 | in memory: "rrrr rrrr gggg gggg bbbb bbbb"
|
|---|
| 664 | "7654 3210 7654 3210 7654 3210"
|
|---|
| 665 |
|
|---|
| 666 | FOURCC_BGR3 : This is single plane three byte per pixel format:
|
|---|
| 667 | in ULONG: "xxxx xxxx rrrr rrrr gggg gggg bbbb bbbb"
|
|---|
| 668 | "---- ---- 7654 3210 7654 3210 7654 3210"
|
|---|
| 669 | in memory: "bbbb bbbb gggg gggg rrrr rrrr"
|
|---|
| 670 | "7654 3210 7654 3210 7654 3210"
|
|---|
| 671 |
|
|---|
| 672 | FOURCC_RGB4 : This is single plane four byte per pixel format:
|
|---|
| 673 | in ULONG: "0000 0000 bbbb bbbb gggg gggg rrrr rrrr"
|
|---|
| 674 | "---- ---- 7654 3210 7654 3210 7654 3210"
|
|---|
| 675 | in memory: "rrrr rrrr gggg gggg bbbb bbbb 0000 0000"
|
|---|
| 676 | "7654 3210 7654 3210 7654 3210 ---- ----"
|
|---|
| 677 |
|
|---|
| 678 | FOURCC_BGR4 : This is single plane four byte per pixel format:
|
|---|
| 679 | in ULONG: "0000 0000 rrrr rrrr gggg gggg bbbb bbbb"
|
|---|
| 680 | "---- ---- 7654 3210 7654 3210 7654 3210"
|
|---|
| 681 | in memory: "bbbb bbbb gggg gggg rrrr rrrr 0000 0000"
|
|---|
| 682 | "7654 3210 7654 3210 7654 3210 ---- ----"
|
|---|
| 683 |
|
|---|
| 684 | FOURCC_LUT8 : This is a single plane one byte per pixel format:
|
|---|
| 685 | in BYTE: "7654 3210"
|
|---|
| 686 | in memory: "7654 3210"
|
|---|
| 687 | An 256 entry BGR4 palette represents the lookup table.
|
|---|
| 688 |
|
|---|
| 689 | FOURCC_LT12 : This is a single plane two byte per pixel format:
|
|---|
| 690 | in USHORT: "0000 ba98 7654 3210"
|
|---|
| 691 | in memory: "7654 3210 0000 ba98"
|
|---|
| 692 | An 4096 entry BGR4 palette represents the lookup table.
|
|---|
| 693 |
|
|---|
| 694 | FOURCC_Y888 : This is a three plane one byte per component pixel format:
|
|---|
| 695 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|---|
| 696 | ³ ³ In Y888, each of the three consecutive
|
|---|
| 697 | ³ Y ³ planse are of the same size (i.e. the
|
|---|
| 698 | ³ [0..255] ³ chrominance planes are not subsampled).
|
|---|
| 699 | ³ 7654 3210 ³
|
|---|
| 700 | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Normal CCIR601 conversions apply:
|
|---|
| 701 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ R = Y + ( Cr - 128 ) * 1.370
|
|---|
| 702 | ³ Cr ³ G = Y - ( Cb - 128 ) * 0.336
|
|---|
| 703 | ³ [0..255] ³ - ( Cr - 128 ) * 0.698
|
|---|
| 704 | ³ center = 128 ³ B = Y + ( Cb - 128 ) * 1.730
|
|---|
| 705 | ³ 7654 3210 ³
|
|---|
| 706 | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Y = R * 0.299 + G * 0.587 + B * 0.114
|
|---|
| 707 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ U = ( B - Y ) * 0.492
|
|---|
| 708 | ³ Cb ³ V = ( R - Y ) * 0.877
|
|---|
| 709 | ³ [0..255] ³ Cb = U + 128
|
|---|
| 710 | ³ center = 128 ³ Cr = V + 128
|
|---|
| 711 | ³ 7654 3210 ³
|
|---|
| 712 | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
|---|
| 713 |
|
|---|
| 714 | FOURCC_Y2X2 : This is a three plane one byte per component pixel format:
|
|---|
| 715 | ÚÄÄÄÄ¿
|
|---|
| 716 | ³ ³ Same as Y888, except that the Cr and Cb planes
|
|---|
| 717 | ³ ³ are subsampled 2x2.
|
|---|
| 718 | ÀÄÄÄÄÙ
|
|---|
| 719 | ÚÄÄ¿
|
|---|
| 720 | ³ ³
|
|---|
| 721 | ÀÄÄÙ
|
|---|
| 722 | ÚÄÄ¿
|
|---|
| 723 | ³ ³
|
|---|
| 724 | ÀÄÄÙ
|
|---|
| 725 |
|
|---|
| 726 | FOURCC_Y4X4 : This is a three plane one byte per component pixel format:
|
|---|
| 727 | ÚÄÄÄÄ¿
|
|---|
| 728 | ³ ³ Same as Y888, except that the Cr and Cb planes
|
|---|
| 729 | ³ ³ are subsampled 4x4.
|
|---|
| 730 | ÀÄÄÄÄÙ
|
|---|
| 731 | Ú¿
|
|---|
| 732 | ÀÙ
|
|---|
| 733 | Ú¿
|
|---|
| 734 | ÀÙ
|
|---|
| 735 |
|
|---|
| 736 | FOURCC_YUV9 : This is a three plane one byte per component pixel format:
|
|---|
| 737 | Same as Y4X4.
|
|---|
| 738 |
|
|---|
| 739 | FOURCC_Y644 : This is a two plane one byte per component pixel format:
|
|---|
| 740 | ÚÄÄÄÄ¿
|
|---|
| 741 | ³ ³ The first plane is a Y plane: "00YY YYYY" "--54 3210"
|
|---|
| 742 | ³ ³ The second plane a UV combined plane, and it
|
|---|
| 743 | ÀÄÄÄÄÙ is 4x4 subsampled: "UUUU VVVV" "3210 3210"
|
|---|
| 744 | Ú¿ To convert from the four-bit chrominance
|
|---|
| 745 | ÀÙ components to normal 8-bit, do:
|
|---|
| 746 | U = 6.375 * ( U' - 5 )
|
|---|
| 747 | V = 7.500 * ( V' - 6 )
|
|---|
| 748 |
|
|---|
| 749 | FOURCC_MONO : This is a single plane one bit per pixel format:
|
|---|
| 750 | ÚÄÄÄÄ¿
|
|---|
| 751 | ³ ³ Each byte is "0123 4567" in pixel order left to
|
|---|
| 752 | ³ ³ right where a zero bit corresponds to black and
|
|---|
| 753 | ÀÄÄÄÄÙ a one bit corresponds to white.
|
|---|
| 754 |
|
|---|
| 755 | FOURCC_Y422 : This is a single plane three component interleaved format:
|
|---|
| 756 | ÚÄÄÄÄ¿
|
|---|
| 757 | ³ ³ "yyyy yyyy" "uuuu uuuu" "yyyy yyyy" "vvvv vvvv"
|
|---|
| 758 | ³ ³ "7654 3210" "7654 3210" "7654 3210" "7654 3210"
|
|---|
| 759 | ÀÄÄÄÄÙ where each of the above repeating groups represent
|
|---|
| 760 | two pixels. The left Y, the U and the V combine to
|
|---|
| 761 | form the left CCIR601 color, and the right Y, the
|
|---|
| 762 | U and the V combine to form the right. This is
|
|---|
| 763 | effectively a 2x1 subsampling.
|
|---|
| 764 |
|
|---|
| 765 | FOURCC_Y42B : Same as FOURCC_Y422, except byte swapped within words:
|
|---|
| 766 | ÚÄÄÄÄ¿
|
|---|
| 767 | ³ ³ "uuuu uuuu" "yyyy yyyy" "vvvv vvvv" "yyyy yyyy"
|
|---|
| 768 | ³ ³ "7654 3210" "7654 3210" "7654 3210" "7654 3210"
|
|---|
| 769 | ÀÄÄÄÄÙ
|
|---|
| 770 |
|
|---|
| 771 | FOURCC_Y42D : Same as FOURCC_Y422, except byte swapped within DWORDs:
|
|---|
| 772 | ÚÄÄÄÄ¿
|
|---|
| 773 | ³ ³ "vvvv vvvv" "yyyy yyyy" "uuuu uuuu" "yyyy yyyy"
|
|---|
| 774 | ³ ³ "7654 3210" "7654 3210" "7654 3210" "7654 3210"
|
|---|
| 775 | ÀÄÄÄÄÙ
|
|---|
| 776 |
|
|---|
| 777 | FOURCC_Y411 : This is a single plane three component interleaved format:
|
|---|
| 778 | ÚÄÄÄÄ¿
|
|---|
| 779 | ³ ³ Use four consecutive 2-byte words as four pixels.
|
|---|
| 780 | ³ ³ The is effectively a 4x1 subsampling. Each word
|
|---|
| 781 | ÀÄÄÄÄÙ has it's own 7-bit luminance and a chrominance part:
|
|---|
| 782 |
|
|---|
| 783 | Cb6:Cb5:Cr6:Cr5:???:???:???:??? Ya6:Ya5:Ya4:Ya3:Ya2:Ya1:Ya0:???
|
|---|
| 784 | Cb4:Cb3:Cr4:Cr3:???:???:???:??? Yb6:Yb5:Yb4:Yb3:Yb2:Yb1:Yb0:???
|
|---|
| 785 | Cb2:Cb1:Cr2:Cr1:???:???:???:??? Yc6:Yc5:Yc4:Yc3:Yc2:Yc1:Yc0:???
|
|---|
| 786 | Cb0:???:Cr0:???:???:???:???:??? Yd6:Yd5:Yd4:Yd3:Yd2:Yd1:Yd0:???
|
|---|
| 787 | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|---|
| 788 | Therefore, four pixels in a ³ Cr ³
|
|---|
| 789 | row share a chrominace pair ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄŽ
|
|---|
| 790 | and look like: ³ Cb ³
|
|---|
| 791 | ÃÄÄÄÄÂÄÄÄÄÂÄÄÄÄÂÄÄÄÄŽ
|
|---|
| 792 | ³ Ya ³ Yb ³ Yc ³ Yd ³
|
|---|
| 793 | ÀÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÙ
|
|---|
| 794 |
|
|---|
| 795 | FOURCC_VGA : This is a single plane 16 color format:
|
|---|
| 796 | ÚÄÄÄÄ¿
|
|---|
| 797 | ³ ³ Each byte is "xxxx yyyy" "3210 3210" where 'x'
|
|---|
| 798 | ³ ³ is the first pixel and 'y' is the next. The 16
|
|---|
| 799 | ÀÄÄÄÄÙ colors are the standard VGA colors.
|
|---|
| 800 |
|
|---|
| 801 |
|
|---|
| 802 |
|
|---|
| 803 |
|
|---|
| 804 | DIVE conversion support matrix:
|
|---|
| 805 |
|
|---|
| 806 | R R R R B R B L L G G Y Y Y Y Y M Y Y V
|
|---|
| 807 | 5 5 6 G G G G U T R Y 8 2 4 U 6 O 4 4 G
|
|---|
| 808 | 6 5 6 B R B R T 1 E 1 8 X X V 4 N 2 1 A
|
|---|
| 809 | out |in 5 5 4 3 3 4 4 8 2 Y 6 8 2 4 9 4 O 2 1
|
|---|
| 810 | ----|--------------------------------------------------------------
|
|---|
| 811 | R565| X X X X X X X X X X X X X X X X X X
|
|---|
| 812 | R555| X X X X X X X X X X X X X X X X X X
|
|---|
| 813 | R664| X X X X X X X X X X X X X X X X X
|
|---|
| 814 | RGB3| X X X X X X X X X X X X X X X X X X
|
|---|
| 815 | BGR3| X X X X X X X X X X X X X X X X X X
|
|---|
| 816 | RGB4| X X X X X X X X X X X X X X X X X X
|
|---|
| 817 | BGR4| X X X X X X X X X X X X X X X X X X
|
|---|
| 818 | LUT8| X X X X X X X X X X X X X X X X X X
|
|---|
| 819 | LT12| X
|
|---|
| 820 | GREY| X
|
|---|
| 821 | GY16| X
|
|---|
| 822 | Y888|
|
|---|
| 823 | Y2X2|
|
|---|
| 824 | Y4X4|
|
|---|
| 825 | YUV9|
|
|---|
| 826 | Y644|
|
|---|
| 827 | MONO|
|
|---|
| 828 | Y422| X X X X X X X X X X X X X X X X X X
|
|---|
| 829 | Y411|
|
|---|
| 830 | VGA |
|
|---|
| 831 |
|
|---|
| 832 | ******************************************************************************/
|
|---|
| 833 |
|
|---|
| 834 | implementation
|
|---|
| 835 |
|
|---|
| 836 | end.
|
|---|
| 837 |
|
|---|