TuttleOFX
1
|
00001 // -*- mode: C++; tab-width: 4 -*- 00002 // vi: ts=4 00003 00004 /*! \file DPXHeader.h */ 00005 00006 /* 00007 * Copyright (c) 2009, Patrick A. Palmer. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions are met: 00012 * 00013 * - Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 00016 * - Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in the 00018 * documentation and/or other materials provided with the distribution. 00019 * 00020 * - Neither the name of Patrick A. Palmer nor the names of its 00021 * contributors may be used to endorse or promote products derived from 00022 * this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00027 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00028 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00029 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00030 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00031 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00032 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00033 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 */ 00036 00037 00038 // SMPTE DPX graphic file format v2.0 00039 00040 00041 #ifndef _DPX_DPXHEADER_H 00042 #define _DPX_DPXHEADER_H 1 00043 00044 #include <cstring> 00045 00046 #include "DPXStream.h" 00047 00048 00049 00050 /*! 00051 * \def SMPTE_VERSION 00052 * \brief SMPTE 268M-2003 DPX Version 00053 */ 00054 #define SMPTE_VERSION "V2.0" 00055 00056 /*! 00057 * \def MAX_ELEMENTS 00058 * \brief Maximum number of image elements 00059 */ 00060 #define MAX_ELEMENTS 8 00061 00062 /*! 00063 * \def MAX_COMPONENTS 00064 * \brief Maximum number of components per image element 00065 */ 00066 #define MAX_COMPONENTS 8 00067 00068 00069 /*! 00070 * \def MAGIC_COOKIE 00071 * \brief HEX value of "SDPX" 00072 */ 00073 #define MAGIC_COOKIE 0x53445058 00074 00075 00076 00077 00078 namespace dpx 00079 { 00080 00081 00082 // DPX data types 00083 00084 /*! 00085 * \typedef unsigned char U8 00086 * \brief Unsigned 8 bit integer 00087 */ 00088 typedef unsigned char U8; 00089 00090 /*! 00091 * \typedef unsigned char U16 00092 * \brief Unsigned 16 bit integer 00093 */ 00094 typedef unsigned short U16; 00095 00096 /*! 00097 * \typedef unsigned char U32 00098 * \brief Unsigned 32 bit integer 00099 */ 00100 typedef unsigned int U32; 00101 00102 /*! 00103 * \typedef float R32 00104 * \brief 32 bit floating point number 00105 */ 00106 typedef float R32; 00107 00108 /*! 00109 * \typedef float R64 00110 * \brief 64 bit floating point number 00111 */ 00112 typedef double R64; 00113 00114 /*! 00115 * \typedef char ASCII 00116 * \brief ASCII character 00117 */ 00118 typedef char ASCII; 00119 00120 00121 /*! 00122 * \enum DataSize 00123 * \brief Component Data Storage Data Type 00124 */ 00125 enum DataSize 00126 { 00127 kByte, //!< 8-bit size component 00128 kWord, //!< 00129 kInt, //!< 00130 kFloat, //!< 00131 kDouble //!< 00132 }; 00133 00134 00135 /*! 00136 * \enum Orientation 00137 * \brief Image Orientation Code 00138 */ 00139 enum Orientation 00140 { 00141 kLeftToRightTopToBottom = 0, //!< Oriented left to right, top to bottom 00142 kRightToLeftTopToBottom = 1, //!< Oriented right to left, top to bottom 00143 kLeftToRightBottomToTop = 2, //!< Oriented left to right, bottom to top 00144 kRightToLeftBottomToTop = 3, //!< Oriented right to left, bottom to top 00145 kTopToBottomLeftToRight = 4, //!< Oriented top to bottom, left to right 00146 kTopToBottomRightToLeft = 5, //!< Oriented top to bottom, right to left 00147 kBottomToTopLeftToRight = 6, //!< Oriented bottom to top, left to right 00148 kBottomToTopRightToLeft = 7, //!< Oriented bottom to top, right to left 00149 kUndefinedOrientation = 0xffff //!< Undefined orientation 00150 }; 00151 00152 00153 /*! 00154 * \enum Descriptor 00155 * \brief Image element Descriptor 00156 */ 00157 enum Descriptor 00158 { 00159 kUserDefinedDescriptor = 0, //!< User defined descriptor 00160 kRed = 1, //!< Red 00161 kGreen = 2, //!< Green 00162 kBlue = 3, //!< Blue 00163 kAlpha = 4, //!< Alpha 00164 kLuma = 6, //!< Luma (Y) 00165 kColorDifference = 7, //!< Color difference 00166 kDepth = 8, //!< Depth 00167 kCompositeVideo = 9, //!< Composite video 00168 kRGB = 50, //!< R,G,B 00169 kRGBA = 51, //!< R,G,B,A 00170 kABGR = 52, //!< A,B,G,R 00171 kCbYCrY = 100, //!< Cb,Y,Cr,Y (4:2:2) 00172 kCbYACrYA = 101, //!< Cb,Y,A,Cr,Y,A (4:2:2:4) 00173 kCbYCr = 102, //!< Cb,Y,Cr (4:4:4) 00174 kCbYCrA = 103, //!< Cb,Y,Cr,A (4:4:4:4) 00175 kUserDefined2Comp = 150, //!< User defined 2 component element 00176 kUserDefined3Comp = 151, //!< User defined 3 component element 00177 kUserDefined4Comp = 152, //!< User defined 4 component element 00178 kUserDefined5Comp = 153, //!< User defined 5 component element 00179 kUserDefined6Comp = 154, //!< User defined 6 component element 00180 kUserDefined7Comp = 155, //!< User defined 7 component element 00181 kUserDefined8Comp = 156, //!< User defined 8 component element 00182 kUndefinedDescriptor = 0xff //!< Undefined descriptor 00183 }; 00184 00185 00186 /*! 00187 * \enum Characteristic 00188 * \brief Transfer Characteristic and Colorimetric Specification 00189 */ 00190 enum Characteristic 00191 { 00192 kUserDefined = 0, //!< User defined 00193 kPrintingDensity, //!< Printing density 00194 kLinear, //!< Linear, transfer only 00195 kLogarithmic, //!< Logarithmic, transfer only 00196 kUnspecifiedVideo, //!< Unspecified video 00197 kSMPTE274M, //!< SMPTE 274M 00198 kITUR709, //!< ITU-R 709-4 00199 kITUR601, //!< ITU-R 601-5 system B or G 00200 kITUR602, //!< ITU-R 601-5 system M 00201 kNTSCCompositeVideo, //!< NTSC composite video 00202 kPALCompositeVideo, //!< PAL composite video 00203 kZLinear, //!< Z depth linear, transfer only 00204 kZHomogeneous, //!< Z depth homogeneous, transfer only 00205 kUndefinedCharacteristic = 0xff //!< Undefined 00206 }; 00207 00208 00209 /*! 00210 * \enum VideoSignal 00211 * \brief Video Signal Standard 00212 */ 00213 enum VideoSignal 00214 { 00215 kUndefined = 0, //!< Undefined 00216 kNTSC = 1, //!< NTSC 00217 kPAL = 2, //!< PAL 00218 kPAL_M = 3, //!< PAL-M 00219 kSECAM = 4, //!< SECAM 00220 k525LineInterlace43AR = 50, //!< YCbCr ITU-R 601-5 525-line, 2:1 interlace, 4:3 aspect ratio 00221 k625LineInterlace43AR = 51, //!< YCbCr ITU-R 601-5 625-line, 2:1 interlace, 4:3 aspect ratio 00222 k525LineInterlace169AR = 100, //!< YCbCr ITU-R 601-5 525-line, 2:1 interlace, 16:9 aspect ratio 00223 k625LineInterlace169AR = 101, //!< YCbCr ITU-R 601-5 625-line, 2:1 interlace, 16:9 aspect ratio 00224 k1050LineInterlace169AR = 150, //!< YCbCr 1050-line, 2:1 interlace, 16:9 aspect ratio 00225 k1125LineInterlace169AR_274 = 151, //!< YCbCr 1125-line, 2:1 interlace, 16:9 aspect ratio (SMPTE 274M) 00226 k1250LineInterlace169AR = 152, //!< YCbCr 1250-line, 2:1 interlace, 16:9 aspect ratio 00227 k1125LineInterlace169AR_240 = 153, //!< YCbCr 1125-line, 2:1 interlace, 16:9 aspect ratio (SMPTE 240M) 00228 k525LineProgressive169AR = 200, //!< YCbCr 525-line, 1:1 progressive, 16:9 aspect ratio 00229 k625LineProgressive169AR = 201, //!< YCbCr 625-line, 1:1 progressive, 16:9 aspect ratio 00230 k750LineProgressive169AR = 202, //!< YCbCr 750-line, 1:1 progressive, 16:9 aspect ratio (SMPTE 296M) 00231 k1125LineProgressive169AR = 203 //!< YCbCr 1125-line, 1:1 progressive, 16:9 aspect ratio (SMPTE 274M) 00232 }; 00233 00234 00235 /*! 00236 * \enum Packing 00237 * \brief Component data packing method 00238 */ 00239 enum Packing 00240 { 00241 kPacked = 0, //!< Packed into 32-bit words 00242 kFilledMethodA = 1, //!< Filled to 32-bit words, method A 00243 kFilledMethodB = 2 //!< Filled to 32-bit words, method B 00244 }; 00245 00246 00247 /*! 00248 * \enum Encoding 00249 * \brief Component data encoding method 00250 */ 00251 enum Encoding 00252 { 00253 kNone = 0, //<! No encoding 00254 kRLE = 1 //<! Run length encoding 00255 }; 00256 00257 00258 /*! 00259 * \struct ImageElement 00260 * \brief Data Structure for Image Element 00261 */ 00262 struct ImageElement 00263 { 00264 U32 dataSign; //!< Data sign (0 = unsigned, 1 = signed) 00265 U32 lowData; //!< Reference low data code value 00266 R32 lowQuantity; //!< Reference low quantity represented 00267 U32 highData; //!< Reference high data code value 00268 R32 highQuantity; //!< Reference high quantity represented 00269 U8 descriptor; //!< Descriptor \see Descriptor 00270 U8 transfer; //!< Transfer characteristic \see Characteristic 00271 U8 colorimetric; //!< Colorimetric Specification \see Characteristic 00272 U8 bitDepth; //!< Bit depth, valid values are 8,10,12,16,32,64 00273 U16 packing; //!< Packing \see Packing 00274 U16 encoding; //!< Encoding \see Encoding 00275 U32 dataOffset; //!< Offset to data 00276 U32 endOfLinePadding; //!< End-of-Line Padding 00277 U32 endOfImagePadding; //!< End-of-Image Padding 00278 ASCII description[32]; //!< Description of Image Element 00279 00280 /*! 00281 * \brief Constructor 00282 */ 00283 ImageElement(); 00284 }; 00285 00286 00287 00288 00289 /*! 00290 * \struct GenericHeader 00291 * \brief Generic File and Image Header Information 00292 */ 00293 struct GenericHeader 00294 { 00295 /*! 00296 * \name File Information Members 00297 */ 00298 //@{ 00299 U32 magicNumber; //!< Indicates start of DPX image file and is used to determine byte order. 00300 U32 imageOffset; //!< Offset to image data (in bytes) 00301 ASCII version[8]; //!< Version number of header format 00302 U32 fileSize; //!< Total file size (in bytes) 00303 U32 dittoKey; //!< Ditto Key (0 = same as previous frame, 1 = new) 00304 U32 genericSize; //!< Generic Header length (in bytes) 00305 U32 industrySize; //!< Industry Header length (in bytes) 00306 U32 userSize; //!< User defined header length (in bytes) 00307 ASCII fileName[100]; //!< File name 00308 ASCII creationTimeDate[24]; //!< Create date time /see DateTimeFormat 00309 ASCII creator[100]; //!< Creator 00310 ASCII project[200]; //!< Project name 00311 ASCII copyright[200]; //!< Copyright statement 00312 U32 encryptKey; //!< Encryption Key (0xffffffff if unencrypted) 00313 ASCII reserved1[104]; //!< Reserved 00314 /* end of group */ 00315 //@} 00316 00317 00318 /*! 00319 * \name Image Information Members 00320 */ 00321 //@{ 00322 U16 imageOrientation; //!< Image orientation \see Orientation 00323 U16 numberOfElements; //!< Number of elements (1-8) 00324 U32 pixelsPerLine; //!< Pixels per line 00325 U32 linesPerElement; //!< Lines per element 00326 ImageElement chan[MAX_ELEMENTS]; //!< Image element data structures 00327 ASCII reserved2[52]; //!< Reserved 00328 /* end of group */ 00329 //@} 00330 00331 00332 /*! 00333 * \name Image Origination Members 00334 */ 00335 //@{ 00336 U32 xOffset; //!< X offset 00337 U32 yOffset; //!< Y offset 00338 R32 xCenter; //!< X center 00339 R32 yCenter; //!< Y center 00340 U32 xOriginalSize; //!< X original size 00341 U32 yOriginalSize; //!< Y original size 00342 ASCII sourceImageFileName[100]; //!< Source image file name 00343 ASCII sourceTimeDate[24]; //!< Source date and time /see DateTimeFormat 00344 ASCII inputDevice[32]; //!< Input device name 00345 ASCII inputDeviceSerialNumber[32]; //!< Input device serial number 00346 U16 border[4]; //!< Border validity 00347 U32 aspectRatio[2]; //!< Pixel aspect ratio (horizontal:vertical) 00348 R32 xScannedSize; //!< X scanned size 00349 R32 yScannedSize; //!< Y scanned size 00350 ASCII reserved3[20]; //!< Reserved 00351 /* end of group */ 00352 //@} 00353 00354 /*! 00355 * \brief Constructor 00356 */ 00357 GenericHeader(); 00358 00359 /*! 00360 * \brief Reset class to initial state 00361 */ 00362 void Reset(); 00363 00364 00365 00366 /*! 00367 * \name File Information Methods 00368 */ 00369 //@{ 00370 00371 /*! 00372 * \brief Get magic number, used for byte ordering identification 00373 * \return magic number 00374 */ 00375 inline U32 MagicNumber() const; 00376 00377 /*! 00378 * \brief Get the offset in bytes to the start of the first image element 00379 * \return offset 00380 */ 00381 inline U32 ImageOffset() const; 00382 00383 /*! 00384 * \brief Set the offset in bytes to the start of the first image element 00385 * \param offset offset in bytes 00386 */ 00387 inline void SetImageOffset(const U32 offset); 00388 00389 /*! 00390 * \brief Get current version string of header 00391 * \param v buffer to place string, needs to be at least 8+1 bytes long 00392 */ 00393 inline void Version(char *v) const; 00394 00395 /*! 00396 * \brief Set the version string 00397 * \param v version string 00398 */ 00399 inline void SetVersion(const char *v); 00400 00401 /*! 00402 * \brief Get the size of the entire file 00403 * \return file size in bytes 00404 */ 00405 inline U32 FileSize() const; 00406 00407 /*! 00408 * \brief Set the size of the entire file 00409 * \param fs file size in bytes 00410 */ 00411 inline void SetFileSize(const U32 fs); 00412 00413 /*! 00414 * \brief Get the ditto key 00415 * \return ditto key 00416 */ 00417 inline U32 DittoKey() const; 00418 00419 /*! 00420 * \brief Set the ditto key 00421 * \param key ditto key 00422 */ 00423 inline void SetDittoKey(const U32 key); 00424 00425 /*! 00426 * \brief Get the size of the generic section within the header 00427 * \return generic header size in bytes 00428 */ 00429 inline U32 GenericSize() const; 00430 00431 /*! 00432 * \brief Get the size of the industry section within the header 00433 * \return industry header size in bytes 00434 */ 00435 inline U32 IndustrySize() const; 00436 00437 /*! 00438 * \brief Get the size of the user data 00439 * \return user data size in bytes 00440 */ 00441 inline U32 UserSize() const; 00442 00443 /*! 00444 * \brief Set the size of the user data 00445 * \param size user data size in bytes 00446 */ 00447 inline void SetUserSize(const U32 size); 00448 00449 /*! 00450 * \brief Get the file name 00451 * \param fn buffer to store filename (100+1 chars) 00452 */ 00453 inline void FileName(char *fn) const; 00454 00455 /*! 00456 * \brief Set the file name 00457 * \param fn buffer with filename 00458 */ 00459 inline void SetFileName(const char *fn); 00460 00461 /*! 00462 * \brief Get the creation time/date 00463 * \param ct buffer to store creation time/date (24+1 chars) 00464 */ 00465 inline void CreationTimeDate(char *ct) const; 00466 00467 /*! 00468 * \brief Set the creation time/date 00469 * \param ct buffer with creation time/date 00470 */ 00471 inline void SetCreationTimeDate(const char *ct); 00472 00473 00474 /*! 00475 * \brief Set the creation time/date 00476 * \param secs number of seconds since January 1, 1970 00:00 00477 */ 00478 void SetCreationTimeDate(const long secs); 00479 00480 /*! 00481 * \brief Get the creator 00482 * \param creat buffer to store creator (100+1 chars) 00483 */ 00484 inline void Creator(char *creat) const; 00485 00486 /*! 00487 * \brief Set the creator 00488 * \param creat buffer with creator 00489 */ 00490 inline void SetCreator(const char *creat); 00491 00492 /*! 00493 * \brief Get the project 00494 * \param prj buffer to store project (200+1 chars) 00495 */ 00496 inline void Project(char *prj) const; 00497 00498 /*! 00499 * \brief Set the project 00500 * \param prj buffer with project 00501 */ 00502 inline void SetProject(const char *prj); 00503 00504 /*! 00505 * \brief Get the copyright information 00506 * \param copy buffer to store copyright string (200+1 chars) 00507 */ 00508 inline void Copyright(char *copy) const; 00509 00510 /*! 00511 * \brief Set the copyright information 00512 * \param copy buffer with copyright string 00513 */ 00514 inline void SetCopyright(const char *copy); 00515 00516 /*! 00517 * \brief Get the encryption key (no encryption is 0xffffffff) 00518 * \return encryption key 00519 */ 00520 inline U32 EncryptKey() const; 00521 00522 /*! 00523 * \brief Set the encryption key (no encryption is 0xffffffff) 00524 * \param key encryption key 00525 */ 00526 inline void SetEncryptKey(const U32 key); 00527 /* end of group */ 00528 //@} 00529 00530 00531 /*! 00532 * \name Image Information Methods 00533 */ 00534 //@{ 00535 00536 /*! 00537 * \brief Get the image orientation 00538 * \return orientation enum 00539 */ 00540 inline Orientation ImageOrientation() const; 00541 00542 /*! 00543 * \brief Set the image orientation 00544 * \param orient orientation 00545 */ 00546 inline void SetImageOrientation(const Orientation orient); 00547 00548 /*! 00549 * \brief Get the number of elements 00550 * \return element count 00551 */ 00552 inline U16 NumberOfElements() const; 00553 00554 /*! 00555 * \brief Set the number of elements 00556 * \param num element count 00557 */ 00558 inline void SetNumberOfElements(const U16 num); 00559 00560 /*! 00561 * \brief Get the pixels per line 00562 * \return pixel count 00563 */ 00564 inline U32 PixelsPerLine() const; 00565 00566 /*! 00567 * \brief Set the pixels per line 00568 * \param ppl pixel count 00569 */ 00570 inline void SetPixelsPerLine(const U32 ppl); 00571 00572 /*! 00573 * \brief Get the lines per element 00574 * \return lines count 00575 */ 00576 inline U32 LinesPerElement() const; 00577 00578 /*! 00579 * \brief Set the lines per element 00580 * \param lpe lines count 00581 */ 00582 inline void SetLinesPerElement(const U32 lpe); 00583 00584 /*! 00585 * \brief Get the data sign (0 = unsigned, 1 = signed) 00586 * \param i element index (0-7) 00587 * \return data sign 00588 */ 00589 inline U32 DataSign(const int i) const; 00590 00591 /*! 00592 * \brief Set the data sign (0 = unsigned, 1 = signed) 00593 * \param i element index (0-7) 00594 * \param sign data sign 00595 */ 00596 inline void SetDataSign(const int i, const U32 sign); 00597 00598 /*! 00599 * \brief Get the minimum data value 00600 * \param i element index (0-7) 00601 * \return minimum value 00602 */ 00603 inline U32 LowData(const int i) const; 00604 00605 /*! 00606 * \brief Set the minimum data value 00607 * \param i element index (0-7) 00608 * \param data minimum value 00609 */ 00610 inline void SetLowData(const int i, const U32 data); 00611 00612 /*! 00613 * \brief Get the quantity of minimum data value 00614 * \param i element index (0-7) 00615 * \return quantity 00616 */ 00617 inline R32 LowQuantity(const int i) const; 00618 00619 /*! 00620 * \brief Set the quantity of minimum data value 00621 * \param i element index (0-7) 00622 * \param quant quantity 00623 */ 00624 inline void SetLowQuantity(const int i, const R32 quant); 00625 00626 /*! 00627 * \brief Get the maximum data value 00628 * \param i element index (0-7) 00629 * \return maximum value 00630 */ 00631 inline U32 HighData(const int i) const; 00632 00633 /*! 00634 * \brief Set the maximum data value 00635 * \param i element index (0-7) 00636 * \param data maximum value 00637 */ 00638 inline void SetHighData(const int i, const U32 data); 00639 00640 /*! 00641 * \brief Get the quantity of maximum data value 00642 * \param i element index (0-7) 00643 * \return quantity 00644 */ 00645 inline R32 HighQuantity(const int i) const; 00646 00647 /*! 00648 * \brief Set the quantity of maximum data value 00649 * \param i element index (0-7) 00650 * \param quant quantity 00651 */ 00652 inline void SetHighQuantity(const int i, const R32 quant); 00653 00654 /*! 00655 * \brief Get the component defintion 00656 * \param i element index (0-7) 00657 * \return component descriptor 00658 */ 00659 inline Descriptor ImageDescriptor(const int i) const; 00660 00661 /*! 00662 * \brief Set the component defintion 00663 * \param i element index (0-7) 00664 * \param desc component descriptor 00665 */ 00666 inline void SetImageDescriptor(const int i, const Descriptor desc); 00667 00668 /*! 00669 * \brief Get the amplitude transfer function 00670 * \param i element index (0-7) 00671 * \return transfer characteristic 00672 */ 00673 inline Characteristic Transfer(const int i) const; 00674 00675 /*! 00676 * \brief Set the amplitude transfer function 00677 * \param i element index (0-7) 00678 * \param ch transfer characteristic 00679 */ 00680 inline void SetTransfer(const int i, const Characteristic ch); 00681 00682 /*! 00683 * \brief Get the color reference 00684 * \param i element index (0-7) 00685 * \return colorimetric specification 00686 */ 00687 inline Characteristic Colorimetric(const int i) const; 00688 00689 /*! 00690 * \brief Set the color reference 00691 * \param i element index (0-7) 00692 * \param c colorimetric specification 00693 */ 00694 inline void SetColorimetric(const int i, const Characteristic c); 00695 00696 /*! 00697 * \brief Get the bit size of each component 00698 * \param i element index (0-7) 00699 * \return bit size 00700 */ 00701 inline U8 BitDepth(const int i) const; 00702 00703 /*! 00704 * \brief Set the bit size of each component 00705 * \param i element index (0-7) 00706 * \param depth bit size 00707 */ 00708 inline void SetBitDepth(const int i, const U8 depth); 00709 00710 /*! 00711 * \brief Get the data packing mode 00712 * \param i element index (0-7) 00713 * \return packing method 00714 */ 00715 inline Packing ImagePacking(const int i) const; 00716 00717 /*! 00718 * \brief Set the data packing mode 00719 * \param i element index (0-7) 00720 * \param pack packing method 00721 */ 00722 inline void SetImagePacking(const int i, const Packing pack); 00723 00724 /*! 00725 * \brief Get the encoding method 00726 * \param i element index (0-7) 00727 * \return encoding method 00728 */ 00729 inline Encoding ImageEncoding(const int i) const; 00730 00731 /*! 00732 * \brief Set the encoding method 00733 * \param i element index (0-7) 00734 * \param enc encoding method 00735 */ 00736 inline void SetImageEncoding(const int i, const Encoding enc); 00737 00738 /*! 00739 * \brief Get the offset to element 00740 * \param i element index (0-7) 00741 * \return offset in bytes from the start of the file 00742 */ 00743 inline U32 DataOffset(const int i) const; 00744 00745 /*! 00746 * \brief Set the offset to element 00747 * \param i element index (0-7) 00748 * \param offset offset in bytes from the start of the file 00749 */ 00750 inline void SetDataOffset(const int i, const U32 offset); 00751 00752 /*! 00753 * \brief Get the number of bytes padding the end of each line 00754 * \param i element index (0-7) 00755 * \return count 00756 */ 00757 inline U32 EndOfLinePadding(const int i) const; 00758 00759 /*! 00760 * \brief Set the number of bytes padding the end of each line 00761 * \param i element index (0-7) 00762 * \param eolp count 00763 */ 00764 inline void SetEndOfLinePadding(const int i, const U32 eolp); 00765 00766 /*! 00767 * \brief Get the number of bytes padding the end of the image element 00768 * \param i element index (0-7) 00769 * \return count 00770 */ 00771 inline U32 EndOfImagePadding(const int i) const; 00772 00773 /*! 00774 * \brief Set the number of bytes padding the end of the image element 00775 * \param i element index (0-7) 00776 * \param eoip count 00777 */ 00778 inline void SetEndOfImagePadding(const int i, const U32 eoip); 00779 00780 /*! 00781 * \brief Get the element description 00782 * \param i element index (0-7) 00783 * \param desc buffer to write description string (32+1 chars) 00784 */ 00785 inline void Description(const int i, char *desc) const; 00786 00787 /*! 00788 * \brief Set the element description 00789 * \param i element index (0-7) 00790 * \param desc buffer 00791 */ 00792 inline void SetDescription(const int i, const char *desc); 00793 00794 /* end of group */ 00795 //@} 00796 00797 /*! 00798 * \name Image Origination Methods 00799 */ 00800 //@{ 00801 00802 /*! 00803 * \brief Get the line offset (in pixels) from the first pixel in original image 00804 * \return offset count 00805 */ 00806 inline U32 XOffset() const; 00807 00808 /*! 00809 * \brief Set the line offset (in pixels) from the first pixel in original image 00810 * \param offset offset count 00811 */ 00812 inline void SetXOffset(const U32 offset); 00813 00814 /*! 00815 * \brief Get the frame offset (in lines) from the first line in original image 00816 * \return offset count 00817 */ 00818 inline U32 YOffset() const; 00819 00820 /*! 00821 * \brief Set the frame offset (in lines) from the first line in original image 00822 * \param offset offset count 00823 */ 00824 inline void SetYOffset(const U32 offset); 00825 00826 /*! 00827 * \brief Get the X image center in pixels 00828 * \return pixel position 00829 */ 00830 inline R32 XCenter() const; 00831 00832 /*! 00833 * \brief Set the X image center in pixels 00834 * \param center pixel position 00835 */ 00836 inline void SetXCenter(const R32 center); 00837 00838 /*! 00839 * \brief Get the Y image center in pixels 00840 * \return pixel position 00841 */ 00842 inline R32 YCenter() const; 00843 00844 /*! 00845 * \brief Set the Y image center in pixels 00846 * \param center pixel position 00847 */ 00848 inline void SetYCenter(const R32 center); 00849 00850 /*! 00851 * \brief Get the number of pixels per line in the original image 00852 * \return size 00853 */ 00854 inline U32 XOriginalSize() const; 00855 00856 /*! 00857 * \brief GSt the number of pixels per line in the original image 00858 * \param size size 00859 */ 00860 inline void SetXOriginalSize(const U32 size); 00861 00862 /*! 00863 * \brief Get the number of lines per image in the original image 00864 * \return size 00865 */ 00866 inline U32 YOriginalSize() const; 00867 00868 /*! 00869 * \brief Set the number of lines per image in the original image 00870 * \param size size 00871 */ 00872 inline void SetYOriginalSize(const U32 size); 00873 00874 /*! 00875 * \brief Get the source image file name that this image was extracted 00876 * \param fn buffer to write source file name (100+1) 00877 */ 00878 inline void SourceImageFileName(char *fn) const; 00879 00880 /*! 00881 * \brief Set the source image file name that this image was extracted 00882 * \param fn buffer with source file name 00883 */ 00884 inline void SetSourceImageFileName(const char *fn); 00885 00886 /*! 00887 * \brief Get the source image time and date that this image was extracted 00888 * \param td buffer to write time/date string (24+1) 00889 */ 00890 inline void SourceTimeDate(char *td) const; 00891 00892 /*! 00893 * \brief Set the source image time and date that this image was extracted 00894 * \param td buffer with time/date string 00895 */ 00896 inline void SetSourceTimeDate(const char *td); 00897 00898 /*! 00899 * \brief Set the source image time and date that this image was extracted 00900 * \param secs number of seconds since January 1, 1970 00:00 00901 */ 00902 void SetSourceTimeDate(const long secs); 00903 00904 /*! 00905 * \brief Get the input device name 00906 * \param dev buffer to write device (32+1) 00907 */ 00908 inline void InputDevice(char *dev) const; 00909 00910 /*! 00911 * \brief Set the input device name 00912 * \param dev buffer with device name 00913 */ 00914 inline void SetInputDevice(const char *dev); 00915 00916 /*! 00917 * \brief Get the input device serial number 00918 * \param sn buffer to write device serial number (32+1) 00919 */ 00920 inline void InputDeviceSerialNumber(char *sn) const; 00921 00922 /*! 00923 * \brief Set the input device serial number 00924 * \param sn buffer with device serial number 00925 */ 00926 inline void SetInputDeviceSerialNumber(const char *sn); 00927 00928 /*! 00929 * \brief Get the pixel offset for the border region 00930 * 00931 * There are 4 border pixel offsets that define a region -- X-left, X-right, Y-top, Y-bottom 00932 * 00933 * \param i border index (0-3) 00934 * \return offset in pixels 00935 */ 00936 inline U16 Border(const int i) const; 00937 00938 /*! 00939 * \brief Set the pixel offset for the border region 00940 * 00941 * There are 4 border pixel offsets that define a region -- X-left, X-right, Y-top, Y-bottom 00942 * 00943 * \param i border index (0-3) 00944 * \param bord offset in pixels 00945 */ 00946 inline void SetBorder(const int i, const U16 bord); 00947 00948 /*! 00949 * \brief Get the pixel aspect ratio (horizontal:vertical) 00950 * \param i aspect ratio index (0-1) 00951 * \return ratio quantity 00952 */ 00953 inline U32 AspectRatio(const int i) const; 00954 00955 /*! 00956 * \brief Set the pixel aspect ratio (horizontal:vertical) 00957 * \param i aspect ratio index (0-1) 00958 * \param ar ratio quantity 00959 */ 00960 inline void SetAspectRatio(const int i, const U32 ar); 00961 00962 /*! 00963 * \brief Get the horizontal size of the original scanned optical image 00964 * \return size in millimeters 00965 */ 00966 inline R32 XScannedSize() const; 00967 00968 /*! 00969 * \brief Set the horizontal size of the original scanned optical image 00970 * \param size size in millimeters 00971 */ 00972 inline void SetXScannedSize(const R32 size); 00973 00974 /*! 00975 * \brief Get the vertical size of the original scanned optical image 00976 * \return size in millimeters 00977 */ 00978 inline R32 YScannedSize() const; 00979 00980 /*! 00981 * \brief Set the vertical size of the original scanned optical image 00982 * \param size size in millimeters 00983 */ 00984 inline void SetYScannedSize(const R32 size); 00985 00986 /* end of group */ 00987 //@} 00988 00989 /*! 00990 * \brief Number of Active Elements in the Image 00991 * \return element count 00992 */ 00993 int ImageElementCount() const; 00994 00995 /*! 00996 * \brief Set member numberOfElements based on channel structure 00997 */ 00998 void CalculateNumberOfElements(); 00999 01000 /*! 01001 * \brief Number of components for the element 01002 * \return number of components 01003 */ 01004 int ImageElementComponentCount(const int element) const; 01005 01006 /*! 01007 * \brief DataSize required for individual image element components 01008 * \return datasize of element 01009 */ 01010 DataSize ComponentDataSize(const int element) const; 01011 01012 /*! 01013 * \brief Byte count of data element components 01014 * \return byte count 01015 */ 01016 int ComponentByteCount(const int element) const; 01017 01018 /* 01019 * \brief Byte size for each DataSize 01020 * \return byte count 01021 */ 01022 static int DataSizeByteCount(const DataSize ds); 01023 01024 }; 01025 01026 01027 /*! 01028 * \struct IndustryHeader 01029 * \brief Motion Picture and Television Industry Specific Information 01030 */ 01031 struct IndustryHeader 01032 { 01033 01034 /*! 01035 * \name Motion Picture Industry Specific Members 01036 */ 01037 //@{ 01038 ASCII filmManufacturingIdCode[2]; //!< Film edge code manufacturing ID code 01039 ASCII filmType[2]; //!< Film edge code type 01040 ASCII perfsOffset[2]; //!< Film edge code offset in perfs 01041 ASCII prefix[6]; //!< Film edge code prefix 01042 ASCII count[4]; //!< Film edge code count 01043 ASCII format[32]; //!< Format string, e.g. Academy 01044 U32 framePosition; //!< Frame position in sequence 01045 U32 sequenceLength; //!< Sequence length 01046 U32 heldCount; //!< Held count (1 = default) 01047 R32 frameRate; //!< Frame rate of original (frame / sec) 01048 R32 shutterAngle; //!< Shutter angle of camera (degrees) 01049 ASCII frameId[32]; //!< Frame identification, e.g. keyframe 01050 ASCII slateInfo[100]; //!< Slate information 01051 ASCII reserved4[56]; //!< Reserved 01052 /* end of group */ 01053 //@} 01054 01055 01056 /*! 01057 * \name Television Industry Specific Members 01058 */ 01059 //@{ 01060 U32 timeCode; //!< Time code 01061 U32 userBits; //!< User bits 01062 U8 interlace; //!< Interlace (0 = noninterlace, 1 = 2:1 interlace) 01063 U8 fieldNumber; //!< Field number 01064 U8 videoSignal; //!< Video signal \see VideoSignal 01065 U8 zero; //!< Structure alignment padding 01066 R32 horizontalSampleRate; //!< Horizontal sample rate (in Hz) 01067 R32 verticalSampleRate; //!< Vertical sample rate (in Hz) 01068 R32 temporalFrameRate; //!< Temporal sample rate (in Hz) 01069 R32 timeOffset; //!< Time offset from sync to first pixel (in ms) 01070 R32 gamma; //!< Gamma 01071 R32 blackLevel; //!< Black level 01072 R32 blackGain; //!< Black gain 01073 R32 breakPoint; //!< Break point 01074 R32 whiteLevel; //!< White level 01075 R32 integrationTimes; //!< Integration time (in sec) 01076 ASCII reserved5[76]; //!< Reserved 01077 /* end of group */ 01078 //@} 01079 01080 /*! 01081 * \brief Constructor 01082 */ 01083 IndustryHeader(); 01084 01085 /*! 01086 * \brief Reset class to initial state 01087 */ 01088 void Reset(); 01089 01090 01091 // set/get functions for the data methods 01092 01093 /*! 01094 * \name Motion Picture Industry Specific Methods 01095 */ 01096 //@{ 01097 01098 /*! 01099 * \brief Get the film edge code information that is machine readable 01100 * \param edge buffer to write film edge code information (16+1 chars) 01101 */ 01102 void FilmEdgeCode(char *edge) const; 01103 01104 /*! 01105 * \brief Set the film edge code information that is machine readable 01106 * \param edge buffer with film edge code information 01107 */ 01108 void SetFileEdgeCode(const char *edge); 01109 01110 /*! 01111 * \brief Get the format (e.g., Academy) 01112 * \param fmt buffer to write format information (32+1 chars) 01113 */ 01114 inline void Format(char *fmt) const; 01115 01116 /*! 01117 * \brief Set the format (e.g., Academy) 01118 * \param fmt buffer with format information 01119 */ 01120 inline void SetFormat(const char *fmt); 01121 01122 /*! 01123 * \brief Get the frame position in sequence 01124 * \return position 01125 */ 01126 inline U32 FramePosition() const; 01127 01128 /*! 01129 * \brief Set the frame position in sequence 01130 * \param pos position 01131 */ 01132 inline void SetFramePosition(const U32 pos); 01133 01134 /*! 01135 * \brief Get the total number of frames in sequence 01136 * \return length 01137 */ 01138 inline U32 SequenceLength() const; 01139 01140 /*! 01141 * \brief Set the total number of frames in sequence 01142 * \param len length 01143 */ 01144 inline void SetSequenceLength(const U32 len); 01145 01146 /*! 01147 * \brief Get the how many sequential frames for which to hold current frame 01148 * \return count 01149 */ 01150 inline U32 HeldCount() const; 01151 01152 /*! 01153 * \brief Set the how many sequential frames for which to hold current frame 01154 * \param count count 01155 */ 01156 inline void SetHeldCount(const U32 count); 01157 01158 /*! 01159 * \brief Get the frame rate (frames / second) 01160 * \return rate 01161 */ 01162 inline R32 FrameRate() const; 01163 01164 /*! 01165 * \brief Set the frame rate (frames / second) 01166 * \param rate rate 01167 */ 01168 inline void SetFrameRate(const R32 rate); 01169 01170 /*! 01171 * \brief Get the shutter angle of the motion picture camera 01172 * \return degress of the temporal sampling aperture 01173 */ 01174 inline R32 ShutterAngle() const; 01175 01176 /*! 01177 * \brief Set the shutter angle of the motion picture camera 01178 * \param angle degress of the temporal sampling aperture 01179 */ 01180 inline void SetShutterAngle(const R32 angle); 01181 01182 /*! 01183 * \brief Get the user-defined frame identification 01184 * \param id buffer to write frame identification (32+1 chars) 01185 */ 01186 inline void FrameId(char *id) const; 01187 01188 /*! 01189 * \brief Set the user-defined frame identification 01190 * \param id buffer with frame identification 01191 */ 01192 inline void SetFrameId(const char *id); 01193 01194 /*! 01195 * \brief Get the production information from the camera slate 01196 * \param slate buffer to write slate information (100+1 chars) 01197 */ 01198 inline void SlateInfo(char *slate) const; 01199 01200 /*! 01201 * \brief Set the production information from the camera slate 01202 * \param slate buffer with slate information 01203 */ 01204 inline void SetSlateInfo(const char *slate); 01205 01206 /* end of group */ 01207 //@} 01208 01209 /*! 01210 * \name Television Industry Specific Methods 01211 */ 01212 //@{ 01213 01214 /*! 01215 * \brief Get the time code 01216 * \param str buffer to write time code (12 chars) 01217 */ 01218 void TimeCode(char *str) const; 01219 01220 /*! 01221 * \brief Set the time code 01222 * \param str buffer with time code 01223 */ 01224 void SetTimeCode(const char *str); 01225 01226 /*! 01227 * \brief Get the user bits 01228 * \param str buffer to write user bits (12 chars) 01229 */ 01230 void UserBits(char *str) const; 01231 01232 /*! 01233 * \brief Set the user bits 01234 * \param str buffer with user bits 01235 */ 01236 void SetUserBits(const char *str); 01237 01238 /*! 01239 * \brief Get the interlace (0 = noninterlace, 1 = 2:1 interlace) 01240 * \return interlace value 01241 */ 01242 inline U8 Interlace() const; 01243 01244 /*! 01245 * \brief Set the interlace (0 = noninterlace, 1 = 2:1 interlace) 01246 * \param lace interlace value 01247 */ 01248 inline void SetInterlace(const U8 lace); 01249 01250 /*! 01251 * \brief Get the field number of the video decoded 01252 * \return field number 01253 */ 01254 inline U8 FieldNumber() const; 01255 01256 /*! 01257 * \brief Set the field number of the video decoded 01258 * \param fn field number 01259 */ 01260 inline void SetFieldNumber(const U8 fn); 01261 01262 /*! 01263 * \brief Get the video sournce 01264 * \return signal 01265 */ 01266 inline VideoSignal Signal() const; 01267 01268 /*! 01269 * \brief Set the video sournce 01270 * \param vs signal 01271 */ 01272 inline void SetSignal(const VideoSignal vs); 01273 01274 /*! 01275 * \brief Get the clock rate at which samples were aquired 01276 * \return rate 01277 */ 01278 inline R32 HorizontalSampleRate() const; 01279 01280 /*! 01281 * \brief Set the clock rate at which samples were aquired 01282 * \param rate rate 01283 */ 01284 inline void SetHorizontalSampleRate(const R32 rate); 01285 01286 /*! 01287 * \brief Get the rate at which scanning the whole image is repeated 01288 * \return rate 01289 */ 01290 inline R32 VerticalSampleRate() const; 01291 01292 /*! 01293 * \brief Set the rate at which scanning the whole image is repeated 01294 * \param rate rate 01295 */ 01296 inline void SetVerticalSampleRate(const R32 rate); 01297 01298 /*! 01299 * \brief Get the applied gamma correction 01300 * \return rate 01301 */ 01302 inline R32 TemporalFrameRate() const; 01303 01304 /*! 01305 * \brief Set the applied gamma correction 01306 * \param rate gamma 01307 */ 01308 inline void SetTemporalFrameRate(const R32 rate); 01309 01310 /*! 01311 * \brief Get the time offset from sync to first pixel 01312 * \return time in microseconds 01313 */ 01314 inline R32 TimeOffset() const; 01315 01316 /*! 01317 * \brief Set the time offset from sync to first pixel 01318 * \param offset time in microseconds 01319 */ 01320 inline void SetTimeOffset(const R32 offset); 01321 01322 /*! 01323 * \brief Get the applied gamma correction 01324 * \return gamma 01325 */ 01326 inline R32 Gamma() const; 01327 01328 /*! 01329 * \brief Set the applied gamma correction 01330 * \param g gamma 01331 */ 01332 inline void SetGamma(const R32 g); 01333 01334 /*! 01335 * \brief Get the reference black level 01336 * \return value 01337 */ 01338 inline R32 BlackLevel() const; 01339 01340 /*! 01341 * \brief Set the reference black level 01342 * \param bl value 01343 */ 01344 inline void SetBlackLevel(const R32 bl); 01345 01346 /*! 01347 * \brief Get the gain applied to signals below the breakpoint 01348 * \return value 01349 */ 01350 inline R32 BlackGain() const; 01351 01352 /*! 01353 * \brief Set the gain applied to signals below the breakpoint 01354 * \param bg value 01355 */ 01356 inline void SetBlackGain(const R32 bg); 01357 01358 /*! 01359 * \brief Get the breakpoint which gamma is applied 01360 * \return value 01361 */ 01362 inline R32 BreakPoint() const; 01363 01364 /*! 01365 * \brief Set the breakpoint which gamma is applied 01366 * \param bp value 01367 */ 01368 inline void SetBreakPoint(const R32 bp); 01369 01370 /*! 01371 * \brief Get the reference white level 01372 * \return value 01373 */ 01374 inline R32 WhiteLevel() const; 01375 01376 /*! 01377 * \brief Set the reference white level 01378 * \param wl value 01379 */ 01380 inline void SetWhiteLevel(const R32 wl); 01381 01382 /*! 01383 * \brief Get the temporal sampling rate of television cameras 01384 * \return rate 01385 */ 01386 inline R32 IntegrationTimes() const; 01387 01388 /*! 01389 * \brief Set the temporal sampling rate of television cameras 01390 * \param times rate 01391 */ 01392 inline void SetIntegrationTimes(const R32 times); 01393 01394 /* end of group */ 01395 //@} 01396 01397 protected: 01398 U32 TCFromString(const char *str) const; 01399 }; 01400 01401 01402 01403 /*! 01404 * \brief Complete DPX Header 01405 */ 01406 struct Header : public GenericHeader, public IndustryHeader 01407 { 01408 Header(); 01409 01410 /*! 01411 * \brief Set the header data to a known start state 01412 */ 01413 void Reset(); 01414 01415 /*! 01416 * \brief Set the Input Stream object to read header from 01417 */ 01418 bool Read(InStream *); 01419 01420 /*! 01421 * \brief Set the Output Stream object to write header to 01422 */ 01423 bool Write(OutStream *); 01424 01425 // write the offset within the header 01426 bool WriteOffsetData(OutStream *); 01427 01428 /*! 01429 * \brief Validate the header 01430 */ 01431 bool Validate(); 01432 01433 /*! 01434 * \brief Does header require endian byte swap 01435 * \return swap required true/false 01436 */ 01437 inline bool RequiresByteSwap() const; 01438 01439 /*! 01440 * \brief Check magic cookie 01441 * \return valid true/false 01442 */ 01443 static bool ValidMagicCookie(const U32 magic); 01444 01445 /*! 01446 * \brief Returns the size of the header 01447 * \return 2048 as defined by the standard 01448 */ 01449 const U32 Size() const; 01450 01451 /*! 01452 * \brief Calculate all of the offset members in the header 01453 */ 01454 void CalculateOffsets(); 01455 01456 /*! 01457 * \brief Determine whether the components of an element should be swapped \see ComponentOrdering 01458 * \param element image element 01459 * \return swap order of components 01460 */ 01461 bool DatumSwap(const int element) const; 01462 01463 /*! 01464 * \brief Set whether reader/writer should swap component ordering 01465 * \param swap allow swapping true/false 01466 */ 01467 void SetDatumSwap(const bool swap); 01468 01469 // system check, used only during platform port 01470 bool Check(); 01471 01472 /*! 01473 * \brief Height of the element adjusted for orientation 01474 * \return height 01475 */ 01476 U32 Height() const; 01477 01478 /*! 01479 * \brief Width of the element adjusted for orientation 01480 * \return width 01481 */ 01482 U32 Width() const; 01483 01484 01485 protected: 01486 bool DetermineByteSwap(const U32 magic) const; 01487 bool datumSwap; 01488 }; 01489 01490 01491 01492 01493 01494 /*! 01495 * \brief User Defined data 01496 */ 01497 struct UserDefinedData 01498 { 01499 ASCII userId[32]; //!< user data identification string 01500 U8 * data; //!< user data 01501 }; 01502 01503 01504 01505 inline bool Header::RequiresByteSwap() const 01506 { 01507 return this->DetermineByteSwap(this->magicNumber); 01508 } 01509 01510 inline const U32 Header::Size() const 01511 { 01512 return 2048; 01513 } 01514 01515 01516 01517 inline U32 GenericHeader::MagicNumber() const 01518 { 01519 return this->magicNumber; 01520 } 01521 01522 inline U32 GenericHeader::ImageOffset() const 01523 { 01524 return this->imageOffset; 01525 } 01526 01527 inline void GenericHeader::SetImageOffset(const U32 offset) 01528 { 01529 this->imageOffset = offset; 01530 } 01531 01532 inline void GenericHeader::Version(char *v) const 01533 { 01534 ::strncpy(v, this->version, 8); 01535 v[8] = '\0'; 01536 } 01537 01538 inline void GenericHeader::SetVersion(const char * v) 01539 { 01540 ::strncpy(this->version, v, 8); 01541 } 01542 01543 inline U32 GenericHeader::FileSize() const 01544 { 01545 return this->fileSize; 01546 } 01547 01548 inline void GenericHeader::SetFileSize(const U32 fs) 01549 { 01550 this->fileSize = fs; 01551 } 01552 01553 inline U32 GenericHeader::DittoKey() const 01554 { 01555 return this->dittoKey; 01556 } 01557 01558 inline void GenericHeader::SetDittoKey(const U32 key) 01559 { 01560 this->dittoKey = key; 01561 } 01562 01563 inline U32 GenericHeader::GenericSize() const 01564 { 01565 return this->genericSize; 01566 } 01567 01568 inline U32 GenericHeader::IndustrySize() const 01569 { 01570 return this->industrySize; 01571 } 01572 01573 inline U32 GenericHeader::UserSize() const 01574 { 01575 return this->userSize; 01576 } 01577 01578 inline void GenericHeader::SetUserSize(const U32 size) 01579 { 01580 this->userSize = size; 01581 } 01582 01583 inline void GenericHeader::FileName(char *fn) const 01584 { 01585 ::strncpy(fn, this->fileName, 100); 01586 fn[100] = '\0'; 01587 } 01588 01589 inline void GenericHeader::SetFileName(const char *fn) 01590 { 01591 ::strncpy(this->fileName, fn, 100); 01592 } 01593 01594 inline void GenericHeader::CreationTimeDate(char *ct) const 01595 { 01596 ::strncpy(ct, this->creationTimeDate, 24); 01597 ct[24] = '\0'; 01598 } 01599 01600 inline void GenericHeader::SetCreationTimeDate(const char *ct) 01601 { 01602 ::strncpy(this->creationTimeDate, ct, 24); 01603 } 01604 01605 inline void GenericHeader::Creator(char *creat) const 01606 { 01607 ::strncpy(creat, this->creator, 200); 01608 creat[200] = '\0'; 01609 } 01610 01611 inline void GenericHeader::SetCreator(const char *creat) 01612 { 01613 ::strncpy(this->creator, creat, 200); 01614 } 01615 01616 inline void GenericHeader::Project(char *prj) const 01617 { 01618 ::strncpy(prj, this->project, 200); 01619 prj[200] = '\0'; 01620 } 01621 01622 inline void GenericHeader::SetProject(const char *prj) 01623 { 01624 ::strncpy(this->project, prj, 200); 01625 } 01626 01627 inline void GenericHeader::Copyright(char *copy) const 01628 { 01629 ::strncpy(copy, this->copyright, 200); 01630 copy[200] = '\0'; 01631 } 01632 01633 inline void GenericHeader::SetCopyright(const char *copy) 01634 { 01635 ::strncpy(this->copyright, copy, 200); 01636 } 01637 01638 inline U32 GenericHeader::EncryptKey() const 01639 { 01640 return this->encryptKey; 01641 } 01642 01643 inline void GenericHeader::SetEncryptKey(const U32 key) 01644 { 01645 this->encryptKey = key; 01646 } 01647 01648 01649 inline Orientation GenericHeader::ImageOrientation() const 01650 { 01651 return Orientation(this->imageOrientation); 01652 } 01653 01654 inline void GenericHeader::SetImageOrientation(const Orientation orient) 01655 { 01656 this->imageOrientation = orient; 01657 } 01658 01659 inline U16 GenericHeader::NumberOfElements() const 01660 { 01661 return this->numberOfElements; 01662 } 01663 01664 inline void GenericHeader::SetNumberOfElements(const U16 num) 01665 { 01666 this->numberOfElements = num; 01667 } 01668 01669 inline U32 GenericHeader::PixelsPerLine() const 01670 { 01671 return this->pixelsPerLine; 01672 } 01673 01674 inline void GenericHeader::SetPixelsPerLine(const U32 ppl) 01675 { 01676 this->pixelsPerLine = ppl; 01677 } 01678 01679 inline U32 GenericHeader::LinesPerElement() const 01680 { 01681 return this->linesPerElement; 01682 } 01683 01684 inline void GenericHeader::SetLinesPerElement(const U32 lpe) 01685 { 01686 this->linesPerElement = lpe; 01687 } 01688 01689 inline U32 GenericHeader::DataSign(const int i) const 01690 { 01691 if (i < 0 || i >= MAX_ELEMENTS) 01692 return 0xffffffff; 01693 return this->chan[i].dataSign; 01694 } 01695 01696 inline void GenericHeader::SetDataSign(const int i, const U32 sign) 01697 { 01698 if (i < 0 || i >= MAX_ELEMENTS) 01699 return; 01700 this->chan[i].dataSign = sign; 01701 } 01702 01703 inline U32 GenericHeader::LowData(const int i) const 01704 { 01705 if (i < 0 || i >= MAX_ELEMENTS) 01706 return 0xffffffff; 01707 return this->chan[i].lowData; 01708 } 01709 01710 inline void GenericHeader::SetLowData(const int i, const U32 data) 01711 { 01712 if (i < 0 || i >= MAX_ELEMENTS) 01713 return; 01714 this->chan[i].lowData = data; 01715 } 01716 01717 inline R32 GenericHeader::LowQuantity(const int i) const 01718 { 01719 if (i < 0 || i >= MAX_ELEMENTS) 01720 return 0xffffffff; 01721 return this->chan[i].lowQuantity; 01722 } 01723 01724 inline void GenericHeader::SetLowQuantity(const int i, const R32 quant) 01725 { 01726 if (i < 0 || i >= MAX_ELEMENTS) 01727 return; 01728 this->chan[i].lowQuantity = quant; 01729 } 01730 01731 inline U32 GenericHeader::HighData(const int i) const 01732 { 01733 if (i < 0 || i >= MAX_ELEMENTS) 01734 return 0xffffffff; 01735 return this->chan[i].highData; 01736 } 01737 01738 inline void GenericHeader::SetHighData(const int i, const U32 data) 01739 { 01740 if (i < 0 || i >= MAX_ELEMENTS) 01741 return; 01742 this->chan[i].highData = data; 01743 } 01744 01745 inline R32 GenericHeader::HighQuantity(const int i) const 01746 { 01747 if (i < 0 || i >= MAX_ELEMENTS) 01748 return 0xffffffff; 01749 return this->chan[i].highQuantity; 01750 } 01751 01752 inline void GenericHeader::SetHighQuantity(const int i, const R32 quant) 01753 { 01754 if (i < 0 || i >= MAX_ELEMENTS) 01755 return; 01756 this->chan[i].highQuantity = quant; 01757 } 01758 01759 inline Descriptor GenericHeader::ImageDescriptor(const int i) const 01760 { 01761 if (i < 0 || i >= MAX_ELEMENTS) 01762 return Descriptor(0xff); 01763 return Descriptor(this->chan[i].descriptor); 01764 } 01765 01766 inline void GenericHeader::SetImageDescriptor(const int i, const Descriptor desc) 01767 { 01768 if (i < 0 || i >= MAX_ELEMENTS) 01769 return; 01770 this->chan[i].descriptor = desc; 01771 } 01772 01773 inline Characteristic GenericHeader::Transfer(const int i) const 01774 { 01775 if (i < 0 || i >= MAX_ELEMENTS) 01776 return Characteristic(0xff); 01777 return Characteristic(this->chan[i].transfer); 01778 } 01779 01780 inline void GenericHeader::SetTransfer(const int i, const Characteristic ch) 01781 { 01782 if (i < 0 || i >= MAX_ELEMENTS) 01783 return; 01784 this->chan[i].transfer = ch; 01785 } 01786 01787 inline Characteristic GenericHeader::Colorimetric(const int i) const 01788 { 01789 if (i < 0 || i >= MAX_ELEMENTS) 01790 return Characteristic(0xff); 01791 return Characteristic(this->chan[i].colorimetric); 01792 } 01793 01794 inline void GenericHeader::SetColorimetric(const int i, const Characteristic c) 01795 { 01796 if (i < 0 || i >= MAX_ELEMENTS) 01797 return; 01798 this->chan[i].colorimetric = c; 01799 } 01800 01801 inline U8 GenericHeader::BitDepth(const int i) const 01802 { 01803 if (i < 0 || i >= MAX_ELEMENTS) 01804 return 0xff; 01805 return this->chan[i].bitDepth; 01806 } 01807 01808 inline void GenericHeader::SetBitDepth(const int i, const U8 depth) 01809 { 01810 if (i < 0 || i >= MAX_ELEMENTS) 01811 return; 01812 this->chan[i].bitDepth = depth; 01813 } 01814 01815 inline Packing GenericHeader::ImagePacking(const int i) const 01816 { 01817 if (i < 0 || i >= MAX_ELEMENTS) 01818 return Packing(0xff); 01819 return Packing(this->chan[i].packing); 01820 } 01821 01822 inline void GenericHeader::SetImagePacking(const int i, const Packing pack) 01823 { 01824 if (i < 0 || i >= MAX_ELEMENTS) 01825 return; 01826 this->chan[i].packing = pack; 01827 } 01828 01829 inline Encoding GenericHeader::ImageEncoding(const int i) const 01830 { 01831 Encoding e = kNone; 01832 01833 if (i < 0 || i >= MAX_ELEMENTS) 01834 return kNone; 01835 01836 if (this->chan[i].encoding == 1) 01837 e = kRLE; 01838 01839 return e; 01840 } 01841 01842 inline void GenericHeader::SetImageEncoding(const int i, const Encoding enc) 01843 { 01844 if (i < 0 || i >= MAX_ELEMENTS) 01845 return; 01846 01847 this->chan[i].encoding = (enc == kNone ? 0 : 1); 01848 } 01849 01850 inline U32 GenericHeader::DataOffset(const int i) const 01851 { 01852 if (i < 0 || i >= MAX_ELEMENTS) 01853 return 0xffffffff; 01854 return this->chan[i].dataOffset; 01855 } 01856 01857 inline void GenericHeader::SetDataOffset(const int i, const U32 offset) 01858 { 01859 if (i < 0 || i >= MAX_ELEMENTS) 01860 return; 01861 this->chan[i].dataOffset = offset; 01862 } 01863 01864 inline U32 GenericHeader::EndOfLinePadding(const int i) const 01865 { 01866 if (i < 0 || i >= MAX_ELEMENTS) 01867 return 0xffffffff; 01868 if (this->chan[i].endOfLinePadding == 0xffffffff) 01869 return 0; 01870 return this->chan[i].endOfLinePadding; 01871 } 01872 01873 inline void GenericHeader::SetEndOfLinePadding(const int i, const U32 eolp) 01874 { 01875 if (i < 0 || i >= MAX_ELEMENTS) 01876 return; 01877 this->chan[i].endOfLinePadding = eolp; 01878 } 01879 01880 inline U32 GenericHeader::EndOfImagePadding(const int i) const 01881 { 01882 if (i < 0 || i >= MAX_ELEMENTS) 01883 return 0xffffffff; 01884 if (this->chan[i].endOfImagePadding == 0xffffffff) 01885 return 0; 01886 return this->chan[i].endOfImagePadding; 01887 } 01888 01889 inline void GenericHeader::SetEndOfImagePadding(const int i, const U32 eoip) 01890 { 01891 if (i < 0 || i >= MAX_ELEMENTS) 01892 return; 01893 this->chan[i].endOfImagePadding = eoip; 01894 } 01895 01896 inline void GenericHeader::Description(const int i, char *desc) const 01897 { 01898 if (i < 0 || i >= MAX_ELEMENTS) 01899 return; 01900 strncpy(desc, this->chan[i].description, 32); 01901 } 01902 01903 inline void GenericHeader::SetDescription(const int i, const char *desc) 01904 { 01905 if (i < 0 || i >= MAX_ELEMENTS) 01906 return; 01907 ::strncpy(this->chan[i].description, desc, 32); 01908 } 01909 01910 01911 inline U32 GenericHeader::XOffset() const 01912 { 01913 return this->xOffset; 01914 } 01915 01916 inline void GenericHeader::SetXOffset(const U32 offset) 01917 { 01918 this->xOffset = offset; 01919 } 01920 01921 inline U32 GenericHeader::YOffset() const 01922 { 01923 return this->yOffset; 01924 } 01925 01926 inline void GenericHeader::SetYOffset(const U32 offset) 01927 { 01928 this->yOffset = offset; 01929 } 01930 01931 inline R32 GenericHeader::XCenter() const 01932 { 01933 return this->xCenter; 01934 } 01935 01936 inline void GenericHeader::SetXCenter(const R32 center) 01937 { 01938 this->xCenter = center; 01939 } 01940 01941 inline R32 GenericHeader::YCenter() const 01942 { 01943 return this->yCenter; 01944 } 01945 01946 inline void GenericHeader::SetYCenter(const R32 center) 01947 { 01948 this->yCenter = center; 01949 } 01950 01951 inline U32 GenericHeader::XOriginalSize() const 01952 { 01953 return this->xOriginalSize; 01954 } 01955 01956 inline void GenericHeader::SetXOriginalSize(const U32 size) 01957 { 01958 this->xOriginalSize = size; 01959 } 01960 01961 inline U32 GenericHeader::YOriginalSize() const 01962 { 01963 return this->yOriginalSize; 01964 } 01965 01966 inline void GenericHeader::SetYOriginalSize(const U32 size) 01967 { 01968 this->yOriginalSize = size; 01969 } 01970 01971 inline void GenericHeader::SourceImageFileName(char *fn) const 01972 { 01973 ::strncpy(fn, this->sourceImageFileName, 100); 01974 fn[100] = '\0'; 01975 } 01976 01977 inline void GenericHeader::SetSourceImageFileName(const char *fn) 01978 { 01979 ::strncpy(this->sourceImageFileName, fn, 100); 01980 } 01981 01982 inline void GenericHeader::SourceTimeDate(char *td) const 01983 { 01984 ::strncpy(td, this->sourceTimeDate, 24); 01985 td[24] = '\0'; 01986 } 01987 01988 inline void GenericHeader::SetSourceTimeDate(const char *td) 01989 { 01990 ::strncpy(this->sourceTimeDate, td, 24); 01991 } 01992 01993 inline void GenericHeader::InputDevice(char *dev) const 01994 { 01995 ::strncpy(dev, this->inputDevice, 32); 01996 dev[32] = '\0'; 01997 } 01998 01999 inline void GenericHeader::SetInputDevice(const char *dev) 02000 { 02001 ::strncpy(this->inputDevice, dev, 32); 02002 } 02003 02004 inline void GenericHeader::InputDeviceSerialNumber(char *sn) const 02005 { 02006 ::strncpy(sn, this->inputDeviceSerialNumber, 32); 02007 sn[32] = '\0'; 02008 } 02009 02010 inline void GenericHeader::SetInputDeviceSerialNumber(const char *sn) 02011 { 02012 ::strncpy(this->inputDeviceSerialNumber, sn, 32); 02013 } 02014 02015 inline U16 GenericHeader::Border(const int i) const 02016 { 02017 if (i < 0 || i > 3) 02018 return 0xffff; 02019 02020 return this->border[i]; 02021 } 02022 02023 inline void GenericHeader::SetBorder(const int i, const U16 bord) 02024 { 02025 if (i < 0 || i > 3) 02026 return; 02027 this->border[i] = bord; 02028 } 02029 02030 inline U32 GenericHeader::AspectRatio(const int i) const 02031 { 02032 if (i != 0 && i != 1) 02033 return 0xffffffff; 02034 02035 return this->aspectRatio[i]; 02036 } 02037 02038 inline void GenericHeader::SetAspectRatio(const int i, const U32 ar) 02039 { 02040 if (i != 0 && i != 1) 02041 return; 02042 this->aspectRatio[i] = ar; 02043 } 02044 02045 inline R32 GenericHeader::XScannedSize() const 02046 { 02047 return this->xScannedSize; 02048 } 02049 02050 inline void GenericHeader::SetXScannedSize(const R32 size) 02051 { 02052 this->xScannedSize = size; 02053 } 02054 02055 inline R32 GenericHeader::YScannedSize() const 02056 { 02057 return this->yScannedSize; 02058 } 02059 02060 inline void GenericHeader::SetYScannedSize(const R32 size) 02061 { 02062 this->yScannedSize = size; 02063 } 02064 02065 02066 inline void IndustryHeader::Format(char *fmt) const 02067 { 02068 ::strncpy(fmt, this->format, 32); 02069 fmt[32] = '\0'; 02070 } 02071 02072 inline void IndustryHeader::SetFormat(const char *fmt) 02073 { 02074 ::strncpy(this->format, fmt, 32); 02075 } 02076 02077 inline U32 IndustryHeader::FramePosition() const 02078 { 02079 return this->framePosition; 02080 } 02081 02082 inline void IndustryHeader::SetFramePosition(const U32 pos) 02083 { 02084 this->framePosition = pos; 02085 } 02086 02087 inline U32 IndustryHeader::SequenceLength() const 02088 { 02089 return this->sequenceLength; 02090 } 02091 02092 inline void IndustryHeader::SetSequenceLength(const U32 len) 02093 { 02094 this->sequenceLength = len; 02095 } 02096 02097 inline U32 IndustryHeader::HeldCount() const 02098 { 02099 return this->heldCount; 02100 } 02101 02102 inline void IndustryHeader::SetHeldCount(const U32 count) 02103 { 02104 this->heldCount = count; 02105 } 02106 02107 inline R32 IndustryHeader::FrameRate() const 02108 { 02109 return this->frameRate; 02110 } 02111 02112 inline void IndustryHeader::SetFrameRate(const R32 rate) 02113 { 02114 this->frameRate = rate; 02115 } 02116 02117 inline R32 IndustryHeader::ShutterAngle() const 02118 { 02119 return this->shutterAngle; 02120 } 02121 02122 inline void IndustryHeader::SetShutterAngle(const R32 angle) 02123 { 02124 this->shutterAngle = angle; 02125 } 02126 02127 inline void IndustryHeader::FrameId(char *id) const 02128 { 02129 ::strncpy(id, this->frameId, 32); 02130 id[32] = '\0'; 02131 } 02132 02133 inline void IndustryHeader::SetFrameId(const char *id) 02134 { 02135 ::strncpy(this->frameId, id, 32); 02136 } 02137 02138 inline void IndustryHeader::SlateInfo(char *slate) const 02139 { 02140 ::strncpy(slate, this->slateInfo, 100); 02141 slate[100] = '\0'; 02142 } 02143 02144 inline void IndustryHeader::SetSlateInfo(const char *slate) 02145 { 02146 ::strncpy(this->slateInfo, slate, 100); 02147 } 02148 02149 02150 inline U8 IndustryHeader::Interlace() const 02151 { 02152 return this->interlace; 02153 } 02154 02155 inline void IndustryHeader::SetInterlace(const U8 lace) 02156 { 02157 this->interlace = lace; 02158 } 02159 02160 inline U8 IndustryHeader::FieldNumber() const 02161 { 02162 return this->fieldNumber; 02163 } 02164 02165 inline void IndustryHeader::SetFieldNumber(const U8 fn) 02166 { 02167 this->fieldNumber = fn; 02168 } 02169 02170 inline VideoSignal IndustryHeader::Signal() const 02171 { 02172 return VideoSignal(this->videoSignal); 02173 } 02174 02175 inline void IndustryHeader::SetSignal(const VideoSignal vs) 02176 { 02177 this->videoSignal = vs; 02178 } 02179 02180 inline R32 IndustryHeader::HorizontalSampleRate() const 02181 { 02182 return this->horizontalSampleRate; 02183 } 02184 02185 inline void IndustryHeader::SetHorizontalSampleRate(const R32 rate) 02186 { 02187 this->horizontalSampleRate = rate; 02188 } 02189 02190 inline R32 IndustryHeader::VerticalSampleRate() const 02191 { 02192 return this->verticalSampleRate; 02193 } 02194 02195 inline void IndustryHeader::SetVerticalSampleRate(const R32 rate) 02196 { 02197 this->verticalSampleRate = rate; 02198 } 02199 02200 inline R32 IndustryHeader::TemporalFrameRate() const 02201 { 02202 return this->temporalFrameRate; 02203 } 02204 02205 inline void IndustryHeader::SetTemporalFrameRate(const R32 rate) 02206 { 02207 this->temporalFrameRate = rate; 02208 } 02209 02210 inline R32 IndustryHeader::TimeOffset() const 02211 { 02212 return this->timeOffset; 02213 } 02214 02215 inline void IndustryHeader::SetTimeOffset(const R32 offset) 02216 { 02217 this->timeOffset = offset; 02218 } 02219 02220 inline R32 IndustryHeader::Gamma() const 02221 { 02222 return this->gamma; 02223 } 02224 02225 inline void IndustryHeader::SetGamma(const R32 g) 02226 { 02227 this->gamma = g; 02228 } 02229 02230 inline R32 IndustryHeader::BlackLevel() const 02231 { 02232 return this->blackLevel; 02233 } 02234 02235 inline void IndustryHeader::SetBlackLevel(const R32 bl) 02236 { 02237 this->blackLevel = bl; 02238 } 02239 02240 inline R32 IndustryHeader::BlackGain() const 02241 { 02242 return this->blackGain; 02243 } 02244 02245 inline void IndustryHeader::SetBlackGain(const R32 bg) 02246 { 02247 this->blackGain = bg; 02248 } 02249 02250 inline R32 IndustryHeader::BreakPoint() const 02251 { 02252 return this->breakPoint; 02253 } 02254 02255 inline void IndustryHeader::SetBreakPoint(const R32 bp) 02256 { 02257 this->breakPoint = bp; 02258 } 02259 02260 inline R32 IndustryHeader::WhiteLevel() const 02261 { 02262 return this->whiteLevel; 02263 } 02264 02265 inline void IndustryHeader::SetWhiteLevel(const R32 wl) 02266 { 02267 this->whiteLevel = wl; 02268 } 02269 02270 inline R32 IndustryHeader::IntegrationTimes() const 02271 { 02272 return this->integrationTimes; 02273 } 02274 02275 inline void IndustryHeader::SetIntegrationTimes(const R32 times) 02276 { 02277 this->integrationTimes = times; 02278 } 02279 02280 } 02281 02282 #endif