Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

cpfspd.h

Go to the documentation of this file.
00001 /*
00002  *  CVS id      :  $Id: cpfspd.h,v 2.61 2009/08/25 11:41:57 riemens Exp $ 
00003  *
00004  *  Name        :  cpfspd.h
00005  *
00006  *  Authors     :  Robert Jan Schutten
00007  *                 Bram Riemens
00008  *
00009  *  Function    :  Header file for cpfspd library
00010  */
00011 
00120 #ifndef CPFSPD_H_INCLUDED
00121 #define CPFSPD_H_INCLUDED
00122 
00123 #ifdef __cplusplus
00124 extern "C" {
00125 #endif /* __cplusplus */
00126 
00127 /* mandatory include of stdio.h; because of use of (FILE *) */
00128 #include <stdio.h>
00129 
00130 
00134 typedef enum {
00135     P_OK                            = 0,
00136     P_FILE_OPEN_FAILED              = 100,
00137     P_FILE_CREATE_FAILED            = 101,
00138     P_FILE_MODIFY_FAILED            = 102,
00139     P_FILE_IS_NOT_PFSPD_FILE        = 103,
00140     P_WRITE_FAILED                  = 110,
00141     P_READ_FAILED                   = 111,
00142     P_SEEK_FAILED                   = 112,
00143     P_NEGATIVE_SEEK_ON_STDIO        = 113,
00144     P_WRITE_BEYOND_EOF_STDOUT       = 115,
00145     P_REWRITE_ON_STDOUT             = 116,
00146     P_REWRITE_MODIFIED_HEADER       = 117,
00147     P_TOO_MANY_IMAGES               = 199,
00148     P_TOO_MANY_COMPONENTS           = 200,
00149     P_INVALID_COMPONENT             = 201,
00150     P_NO_IH_RECORDS_ALLOWED         = 202,
00151     P_ILLEGAL_BYTES_PER_REC         = 203,
00152     P_ILLEGAL_TEM_SBSMPL            = 204,
00153     P_INVALID_AUXILIARY             = 205,
00154     P_ILLEGAL_LIN_SBSMPL            = 206,
00155     P_ILLEGAL_PIX_SBSMPL            = 207,
00156     P_SHOULD_BE_INTERLACED          = 210,
00157     P_READ_CHR_FROM_LUM_ONLY        = 211,
00158     P_READ_RGB_FROM_LUM_ONLY        = 212,
00159     P_READ_PLANAR_CHR_FROM_MULT_CHR = 213,
00160     P_READ_RGB_FROM_YUV             = 214,
00161     P_READ_CHR_FROM_RGB             = 215,
00162     P_READ_CHR_FROM_STREAM          = 216,
00163     P_READ_RGB_FROM_STREAM          = 217,
00164     P_READ_INVALID_COMPONENT        = 218,
00165     P_WRITE_INVALID_COMPONENT       = 219,
00166     P_WRONG_LUM_COMP_SIZE           = 220,
00167     P_WRONG_CHR_COMP_SIZE           = 221,
00168     P_WRONG_RGB_COMP_SIZE           = 222,
00169     P_WRONG_STREAM_COMP_SIZE        = 223,
00170     P_WRONG_XYZ_COMP_SIZE           = 224,
00171     P_EXCEEDING_DESCRIPTION_SIZE    = 225,
00172     P_WRONG_EXTRA_COMP_SIZE         = 226,
00173     P_WRONG_SUBSAMPLE_FACTOR        = 227,
00174     P_EXCEEDING_AUXILIARY_DATA_SIZE = 228,
00175     P_EXCEEDING_AUXILIARY_HDR_SIZE  = 229,
00176     P_HEADER_IS_MODIFIED            = 230,
00177     P_INCOMP_MULT_COLOR_FORMAT      = 242,
00178     P_INCOMP_PLANAR_COLOR_FORMAT    = 243,
00179     P_ILLEGAL_COLOR_FORMAT          = 300,
00180     P_ILLEGAL_IMAGE_FREQUENCY       = 400,
00181     P_ILLEGAL_IMAGE_FREQ_MOD        = 410,
00182     P_ILLEGAL_ILP_FREQ_MOD          = 420,
00183     P_ILLEGAL_IMAGE_SIZE            = 500,
00184     P_ILLEGAL_INTERLACE             = 501,
00185     P_ILLEGAL_COMP_SIZE             = 502,
00186     P_ILLEGAL_PHSHFT                = 503,
00187     P_ILLEGAL_ASPECT_RATIO          = 600,
00188     P_ILLEGAL_SIZE_FREQUENCY        = 700,
00189     P_ILLEGAL_SIZE_INTERLACED_MODE  = 701,
00190     P_ILLEGAL_SIZE_PROGRESSIVE_MODE = 702,
00191     P_ILLEGAL_FORMAT_INTERL_MODE    = 703,
00192     P_ILLEGAL_NUM_OF_PIX_PER_LINE   = 710,
00193     P_ILLEGAL_FILE_DATA_FORMAT      = 800,
00194     P_FILE_DATA_FORMATS_NOT_EQUAL   = 810,
00195     P_ILLEGAL_MEM_DATA_FORMAT       = 820,
00196     P_UNKNOWN_FILE_TYPE             = 830,
00197     P_UNKNOWN_MEM_TYPE              = 840,
00198     P_INCOMP_FLOAT_CONVERSION       = 850,
00199     P_MALLOC_FAILED                 = 900
00200 } pT_status;
00217 #define P_FILENAME_MAX 1024
00218 
00223 /* Total number of global header records: global header structure and attributes */
00224 #define P_NUM_GLOB_RECS   2
00225 
00226 /* Global header structure */
00227 #define P_SNR_IMAGES        7      /* number of images                          */
00228 #define P_SNR_COMPON        5      /* number of components                      */
00229 #define P_SNR_FD_RECS       5      /* number of file description records        */
00230 #define P_SNR_AUXDAT_RECS   5      /* number of auxiliary data records          */
00231 #define P_SAPPL_TYPE       25      /* application type                          */
00232 #define P_SBYTES_REC        7      /* bytes per record                          */
00233 #define P_SENDIAN_CODE      1      /* A: big endian U: little endian            */
00234 #define P_SAUX_HDR_RECS     5      /* number of aux header records              */
00235 #define P_LEN_GLOB_STR     60      /* length of global header structure record  */
00236                                    /* = sum of all above record lengths         */
00237 
00238 /* Global header attributes */
00239 #define P_SIMA_FREQ        12      /* image frequency                           */
00240 #define P_SLIN_FREQ        12      /* line frequency                            */
00241 #define P_SPIX_FREQ        12      /* pixel frequency                           */
00242 #define P_SACT_LINES        6      /* active lines                              */
00243 #define P_SACT_PIXEL        6      /* active pixels                             */
00244 #define P_SINTERLACE        2      /* interlace factor                          */
00245 #define P_SH_PP_SIZE        5      /* horizontal proportional  picture size     */
00246 #define P_SV_PP_SIZE        5      /* vertical proportional picture size        */
00247 #define P_LEN_GLOB_ATT     60      /* length of global header attributes record */
00248                                    /* = sum of all above record lengths         */
00249 
00250 /* Total number of component records: component structure and attributes */
00251 #define P_NUM_COMP_RECS     2
00252 
00253 /* Component structure */
00254 #define P_SLIN_IMAGE        6      /* lines per image                           */
00255 #define P_SPIX_LINE         6      /* pixels per line                           */
00256 #define P_SDATA_FMT         4      /* data format                               */
00257 #define P_LEN_COMP_STR     16      /* length of component structure record      */
00258                                    /* = sum of all above record lengths         */
00259 
00260 /* Component attributes */
00261 #define P_STEM_SBSMPL       2      /* temporal subsampling                      */
00262 #define P_SLIN_SBSMPL       2      /* line subsampling                          */
00263 #define P_SPIX_SBSMPL       2      /* pixel subsampling                         */
00264 #define P_STEM_PHSHFT       2      /* temporal phase shift                      */
00265 #define P_SLIN_PHSHFT       2      /* line phase shift                          */
00266 #define P_SPIX_PHSHFT       2      /* pixel phase shift                         */
00267 #define P_SCOM_CODE         5      /* component code                            */
00268 #define P_LEN_COMP_ATT     17      /* length of component attributes record     */
00269                                    /* = sum of all above record lengths         */
00270 
00271 /* Description and auxilliary data */
00272 #define P_SDESCRIPTION   2048      /* description                               */
00273 #define P_BYTES_REC       512      /* alignment size for nr of bytes/rec        */
00274 #define P_SAUX_NAME        16      /* name of auxiliary data                    */
00275 #define P_SAUX_HDR      16384      /* size of auxiliary header                  */
00276 
00279 #define P_PFSPD_MAX_COMP 128
00280 
00284 #define P_Y_COM_CODE            "Y    "
00285 #define P_UV_COM_CODE           "U/V  "
00286 #define P_U_COM_CODE            "U    "
00287 #define P_V_COM_CODE            "V    "
00288 #define P_R_COM_CODE            "R    "
00289 #define P_G_COM_CODE            "G    "
00290 #define P_B_COM_CODE            "B    "
00291 #define P_S_COM_CODE            "S    "
00292 #define P_P_COM_CODE            "P    "
00293 #define P_XYZX_COM_CODE         "X    "
00294 #define P_XYZY_COM_CODE         "Y    "
00295 #define P_XYZZ_COM_CODE         "Z    "
00296 #define P_VOID_COM_CODE         "void "
00297 
00300 #define P_VIDEO_APPL_TYPE       "VIDEO                    "
00301 
00303 #define P_AUX_LAST              "       8"
00304 
00308 #define P_B8_DATA_FMT           "B*8 "
00309 #define P_B10_DATA_FMT          "B*10"
00310 #define P_B12_DATA_FMT          "B*12"
00311 #define P_B14_DATA_FMT          "B*14"
00312 #define P_I2_DATA_FMT           "I*2 "
00313 #define P_R2_DATA_FMT           "R*2 "
00314 
00317 /*
00318  * The following structures contain all information that is 
00319  * present in the pfspd headers.
00320  *
00321  * N.B. The names of all fields are identical to the names
00322  *      that are used in the standard pfspd access library.
00323  */
00324 
00326 typedef struct {
00327     int             lin_image;                  
00328     int             pix_line;                   
00329     char            data_fmt[P_SDATA_FMT + 1];  
00330     int             tem_sbsmpl;                 
00331     int             lin_sbsmpl;                 
00332     int             pix_sbsmpl;                 
00333     int             tem_phshft;                 
00334     int             lin_phshft;                 
00335     int             pix_phshft;                 
00336     char            com_code[P_SCOM_CODE + 1];  
00337 } pT_component;
00338 
00340 typedef struct {
00341     /*
00342      * These fields are actually written on disk.
00343      */
00344     int            nr_images;
00345     int            nr_compon;
00346     int            nr_fd_recs;
00347     int            nr_aux_data_recs;
00348     char           appl_type[P_SAPPL_TYPE + 1];
00349     int            bytes_rec;
00350     int            little_endian;    /* boolean: file endian mode */
00351     int            nr_aux_hdr_recs;
00352     double         ima_freq;
00353     double         lin_freq;
00354     double         pix_freq;
00355     int            act_lines;
00356     int            act_pixel;
00357     int            interlace;
00358     int            h_pp_size;
00359     int            v_pp_size;
00360     pT_component   comp[P_PFSPD_MAX_COMP];
00361 
00362     /*
00363      * The following field is an extension to the original header structure.
00364      * This is also written on disk.
00365      */
00366     char           description[P_SDESCRIPTION];
00367 
00368     /*
00369      * The following field modifies the behaviour of cpfspd functions.
00370      * The application may use this to control cpfspd.
00371      *
00372      * Note that the value is initialized at 0 in all functions that
00373      * initialize a header structure:
00374      *    p_create_header(), p_create_ext_header(), p_read_header().
00375      */
00376     int            disable_hdr_checks; /* boolean: 0: normal behaviour        */
00377                                        /* Value 1: function p_check_header()  */
00378                                        /* returns always P_OK. This function  */
00379                                        /* is also used internally by others.  */
00380                                        /* With checking disabled, and using   */
00381                                        /* the low level data access functions */
00382                                        /* on single components, any pfspd     */
00383                                        /* file can be accessed. This flag     */
00384                                        /* must be set by the application (no  */
00385                                        /* API support) and all risks of       */
00386                                        /* incorrect use are with the          */
00387                                        /* application programmer.             */
00388 
00389     /*
00390      * The following fields are internal administration of cpfspd.
00391      * They shall not be modified by the application.
00392      */
00393     int            modified;   /* this bit tells if the header has been    */
00394                                /* modified, when compared to a header that */
00395                                /* exists on disk                           */
00396     unsigned long  offset_lo;  /* position of current file pointer;        */
00397                                /* used for stdin/stdout read/write         */
00398                                /* the offset is maintained by cpfspd_low.c */
00399     unsigned long  offset_hi;  /* the offset_hi and offset_lo parts are    */
00400                                /* used to construct a 64 bit value on      */
00401                                /* platforms that support large files       */
00402                                /* this way, the cpfspd external interface  */
00403                                /* still complies to ANSI-C                 */
00404                                /* see module cpfspd_fio.c for more info    */
00405     unsigned char  aux_hdrs[P_SAUX_HDR];  /* (when used) auxiliary headers */
00406 } pT_header;
00407 
00418 #define P_COMPONENT_INIT   {0, 0, "", 0, 0, 0, 0, 0, 0, ""}
00419 #define P_HEADER_INIT      {0, 0, 0, 0, "", 0, 0, 0, \
00420                             0.0, 0.0, 0.0, 0, 0, 0, 0, 0, \
00421                             {P_COMPONENT_INIT, P_COMPONENT_INIT, /*   2 */ \
00422                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*   4 */ \
00423                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*   6 */ \
00424                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*   8 */ \
00425                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  10 */ \
00426                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  12 */ \
00427                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  14 */ \
00428                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  16 */ \
00429                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  18 */ \
00430                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  20 */ \
00431                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  22 */ \
00432                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  24 */ \
00433                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  26 */ \
00434                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  28 */ \
00435                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  30 */ \
00436                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  32 */ \
00437                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  34 */ \
00438                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  36 */ \
00439                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  38 */ \
00440                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  40 */ \
00441                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  42 */ \
00442                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  44 */ \
00443                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  46 */ \
00444                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  48 */ \
00445                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  50 */ \
00446                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  52 */ \
00447                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  54 */ \
00448                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  56 */ \
00449                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  58 */ \
00450                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  60 */ \
00451                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  62 */ \
00452                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  64 */ \
00453                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  66 */ \
00454                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  68 */ \
00455                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  70 */ \
00456                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  72 */ \
00457                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  74 */ \
00458                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  76 */ \
00459                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  78 */ \
00460                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  80 */ \
00461                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  82 */ \
00462                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  84 */ \
00463                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  86 */ \
00464                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  88 */ \
00465                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  90 */ \
00466                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  92 */ \
00467                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  94 */ \
00468                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  96 */ \
00469                              P_COMPONENT_INIT, P_COMPONENT_INIT, /*  98 */ \
00470                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 100 */ \
00471                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 102 */ \
00472                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 104 */ \
00473                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 106 */ \
00474                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 108 */ \
00475                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 110 */ \
00476                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 112 */ \
00477                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 114 */ \
00478                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 116 */ \
00479                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 118 */ \
00480                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 120 */ \
00481                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 122 */ \
00482                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 124 */ \
00483                              P_COMPONENT_INIT, P_COMPONENT_INIT, /* 126 */ \
00484                              P_COMPONENT_INIT, P_COMPONENT_INIT},/* 128 */ \
00485                             "", 0, 0, 0, 0, P_AUX_LAST}
00486 
00490 /********************
00491 * Header data types *
00492 ********************/
00493 
00494 
00503 #define P_STD_IMA_FREQ_50HZ      (50.00)
00504 #define P_STD_IMA_FREQ_60HZ      (59.94)
00505 #define P_STD_IMA_FREQ_REAL_60HZ (60.00)
00506 
00508 typedef enum {
00509     P_50HZ = 0,             /* 50 Hz                                          */
00510     P_60HZ,                 /* 60 Hz = 59.94 Hz !!                            */
00511     P_REAL_60HZ,            /* Real 60 Hz frequency;                          */
00512                             /*   (i.s.o. 59.94 Hz defined in ITU-R BT.470-6)  */
00513     P_75HZ,                 /* 1.5 times P_50HZ                               */
00514     P_90HZ,                 /* 1.5 times P_60HZ                               */
00515     P_REAL_90HZ,            /* 1.5 times P_REAL_60HZ                          */
00516     P_100HZ,                /* 2 times P_50HZ                                 */
00517     P_120HZ,                /* 2 times P_60HZ                                 */
00518     P_REAL_120HZ,           /* 2 times P_REAL_60HZ                            */
00519     P_25HZ,                 /* >   'Special' frequency types for movie        */
00520     P_24HZ,                 /*  >  material (note that these formats cannot   */
00521     P_REAL_24HZ,            /*   > be displayed directly by a regular         */
00522     P_30HZ,                 /*  >  display. The accompanying line/pixel       */
00523     P_REAL_30HZ,            /* >   frequencies will be set to zero!)          */
00524     P_UNKNOWN_FREQ          /* unknown frequency                              */
00525 } pT_freq;
00526 
00528 typedef enum {
00529     P_NO_COLOR = 0,         /* no color; only luminance                       */
00530     P_COLOR_422,            /* multiplexed yuv formats: YUV 4:2:2             */
00531     P_COLOR_420,            /*                          YUV 4:2:0             */
00532     P_COLOR_444_PL,         /* planar yuv formats:      YUV 4:4:4             */
00533     P_COLOR_422_PL,         /*                          YUV 4:2:2             */
00534     P_COLOR_420_PL,         /*                          YUV 4:2:0             */
00535     P_COLOR_RGB,            /* RGB format                                     */
00536     P_STREAM,               /* streaming ("S") format; used for CVBS streams; */
00537                             /* only frames are supported in the "S" format    */
00538     P_COLOR_XYZ,            /* XYZ format                                     */
00539     P_UNKNOWN_COLOR         /* unknown color format                           */
00540 } pT_color;
00541 
00543 typedef enum {
00544     P_4_3 = 0,              /* 4:3 aspect ratio                               */
00545     P_16_9,                 /* 16:9 aspect ratio                              */
00546     P_AS_WH,                /* as image width/height (square pixel)           */
00547     P_UNKNOWN_ASPECT_RATIO  /* unknown aspect ratio                           */
00548 } pT_asp_rat;
00549 
00551 typedef enum {
00552     P_8_BIT_FILE = 0,       /* 8 bits file format                             */
00553     P_10_BIT_FILE,          /* 10 bits file format                            */
00554     P_12_BIT_FILE,          /* 12 bits file format                            */
00555     P_14_BIT_FILE,          /* 14 bits file format                            */
00556     P_16_BIT_FILE,          /* 16 bits file format                            */
00557     P_16_REAL_FILE,         /* 16 bits real file format                       */
00558     P_UNKNOWN_DATA_FORMAT   /* unknown data format                            */
00559 } pT_data_fmt;
00560 
00562 typedef enum {
00563     P_SD = 0,               /* Standard definition                            */
00564     P_CIF,                  /* CIF & QCIF size (note that for CIF & QCIF      */
00565     P_QCIF,                 /* sized images line/pixel frequencies will be    */
00566                             /* set such that they can be displayed as SD      */
00567                             /* images, i.e. 13.5 MHz sample frequency &       */
00568                             /* approx. 16 or 32 kHz line frequency            */
00569     P_HDp,                  /* Progressive HD format                          */
00570     P_HDi,                  /* Interlaced HD format                           */
00571     P_UNKNOWN_SIZE          /* Unknown size                                   */
00572 } pT_size;
00573 
00575 typedef enum {
00576   P_FLOAT = 0,              /* float *abuf                                    */
00577   P_DOUBLE,                 /* double *abuf                                   */
00578   P_LONG,                   /* signed long *abuf                              */
00579   P_ULONG,                  /* unsigned long *abuf                            */
00580   P_INT,                    /* signed int *abuf                               */
00581   P_UINT,                   /* unsigned int *abuf                             */
00582   P_SHORT,                  /* signed short *abuf                             */
00583   P_USHORT,                 /* unsigned short *abuf                           */
00584   P_CHAR,                   /* signed char *abuf                              */
00585   P_UCHAR                   /* unsigned char *abuf                            */
00586 } pT_buf_type;
00587 
00588 
00720 extern pT_status p_check_header (const pT_header *header);
00721 
00723 extern pT_status p_read_header (const char *filename, 
00724                                 pT_header *header);
00725 
00729 extern pT_status p_write_header (const char *filename, 
00730                                  pT_header *header);
00731 
00753 extern pT_status p_rewrite_header (const char *filename, 
00754                                    pT_header *header);
00755 
00762 extern pT_status p_copy_header (pT_header *new_header, 
00763                                 const pT_header *header);
00764 
00769 extern pT_status p_print_header (const pT_header *header, 
00770                                  FILE *stream);
00771 
00786 extern pT_status p_create_header (pT_header *header, 
00787                                   pT_color color, 
00788                                   pT_freq image_freq);
00789 
00811 extern pT_status p_create_ext_header (pT_header *header, 
00812                                       pT_color color, 
00813                                       pT_freq image_freq,
00814                                       pT_size image_size,
00815                                       int pixels_per_line,
00816                                       int progressive,
00817                                       pT_asp_rat ratio);
00832 extern pT_status p_mod_num_frames (pT_header *header, 
00833                                    int num_frames);
00835 extern pT_status p_mod_color_format (pT_header *header, 
00836                                      pT_color color_format);
00838 extern pT_status p_mod_aspect_ratio (pT_header *header, 
00839                                      pT_asp_rat ratio);
00840 
00842 extern pT_status p_mod_to_progressive (pT_header *header);
00843 
00845 extern pT_status p_mod_to_interlaced (pT_header *header);
00846 
00851 extern pT_status p_mod_to_dbl_image_rate (pT_header *header);
00852 
00857 extern pT_status p_mod_to_onehalf_image_rate (pT_header *header);
00858 
00860 extern pT_status p_mod_image_size (pT_header* header,
00861                                    int width,
00862                                    int height);
00863 
00871 extern pT_status p_mod_defined_image_size (pT_header* header,
00872                                            pT_size image_size,
00873                                            int pixels_per_line);
00874 
00879 extern pT_status p_mod_all_freqs (pT_header *header,
00880                                   double image_freq,
00881                                   double line_freq,
00882                                   double pixel_freq);
00883 
00891 extern pT_status p_mod_defined_image_freq (pT_header* header,
00892                                            pT_freq image_freq);
00893 
00895 extern pT_status p_mod_file_data_format (pT_header *header, 
00896                                          pT_data_fmt file_data_fmt);
00897 
00899 extern pT_status p_mod_file_description (pT_header *header, 
00900                                          char *description);
00910 extern int         p_get_num_frames (const pT_header *header);
00912 extern int         p_is_interlaced (const pT_header *header);
00914 extern int         p_is_progressive (const pT_header *header);
00916 extern int         p_get_frame_width (const pT_header *header);
00918 extern int         p_get_frame_height (const pT_header *header);
00919 
00920 
00927 extern void        p_get_y_buffer_size (const pT_header *header, 
00928                                         int *width, 
00929                                         int *height);
00938 extern void        p_get_uv_buffer_size (const pT_header *header, 
00939                                          int *width, 
00940                                          int *height);
00947 extern void        p_get_rgb_buffer_size (const pT_header *header, 
00948                                           int *width, 
00949                                           int *height);
00954 extern void        p_get_s_buffer_size (const pT_header *header, 
00955                                         int *width, 
00956                                         int *height);
00957 
00959 extern pT_color    p_get_color_format (const pT_header *header);
00960 
00962 extern void        p_get_all_freqs (const pT_header *header, 
00963                                     double *image_freq, 
00964                                     double *line_freq, 
00965                                     double *pixel_freq);
00966 
00968 extern pT_freq     p_get_image_freq (const pT_header *header);
00969 
00971 extern pT_size     p_get_image_size (const pT_header *header);
00972 
00974 extern pT_asp_rat  p_get_aspect_ratio (const pT_header *header);
00975 
00977 extern pT_data_fmt p_get_file_data_format (const pT_header *header);
00978 
00982 extern char       *p_get_file_description (const pT_header *header);
00983 
01192 #define P_READ_Y         0
01193 #define P_READ_ALL       1
01194 #define P_READ_UV        2
01195 #define P_READ_U         3
01196 #define P_READ_V         4
01197 #define P_READ_R         5
01198 #define P_READ_G         6
01199 #define P_READ_B         7
01200 
01205 #define P_8_BIT_MEM      (0 * 16)
01206 #define P_10_BIT_MEM     (1 * 16)
01207 #define P_12_BIT_MEM     (2 * 16)
01208 #define P_14_BIT_MEM     (3 * 16)
01209 #define P_16_BIT_MEM     (4 * 16)
01210 #define P_16_BIT_MEM_LSB (5 * 16)
01211 #define P_AF_BIT_MEM     (7 * 16)
01212 
01253 /*
01254  * Multiplexed luminance/chrominance (YUV) or streaming (S) files.
01255  *
01256  * Supported color_format: P_NO_COLOR, 
01257  *                         P_COLOR_422, 
01258  *                         P_COLOR_420, 
01259  *                         P_STREAM.
01260  *
01261  */
01262 extern pT_status p_read_field
01263         (const char *filename, pT_header *header,
01264          int frame, int field,
01265          unsigned char *y_fld,
01266          unsigned char *uv_fld,
01267          int read_mode,
01268          int width, int fld_height, int stride);
01269 extern pT_status p_read_frame
01270         (const char *filename, pT_header *header,
01271          int frame,
01272          unsigned char *y_or_s_frm,
01273          unsigned char *uv_frm,
01274          int read_mode,
01275          int width, int frm_height, int stride);
01276 extern pT_status p_write_field
01277         (const char *filename, pT_header *header,
01278          int frame, int field,
01279          const unsigned char *y_fld,
01280          const unsigned char *uv_fld,
01281          int width, int fld_height, int stride);
01282 extern pT_status p_write_frame
01283         (const char *filename, pT_header *header,
01284          int frame,
01285          const unsigned char *y_or_s_frm,
01286          const unsigned char *uv_frm,
01287          int width, int frm_height, int stride);
01288 
01289 extern pT_status p_read_field_16
01290         (const char *filename, pT_header *header,
01291          int frame, int field,
01292          unsigned short *y_fld,
01293          unsigned short *uv_fld,
01294          int read_mode,
01295          int width, int fld_height, int stride);
01296 extern pT_status p_read_frame_16
01297         (const char *filename, pT_header *header,
01298          int frame,
01299          unsigned short *y_or_s_frm,
01300          unsigned short *uv_frm,
01301          int read_mode,
01302          int width, int frm_height, int stride);
01303 extern pT_status p_write_field_16
01304         (const char *filename, pT_header *header,
01305          int frame, int field,
01306          const unsigned short *y_fld,
01307          const unsigned short *uv_fld,
01308          int write_mode,
01309          int width, int fld_height, int stride);
01310 extern pT_status p_write_frame_16
01311         (const char *filename, pT_header *header,
01312          int frame,
01313          const unsigned short *y_or_s_frm,
01314          const unsigned short *uv_frm,
01315          int write_mode,
01316          int width, int frm_height, int stride);
01317 
01318 /*
01319  * Planar luminance/chrominance (YUV) or red/green/blue (RGB) files.
01320  *
01321  * Supported color_format: P_NO_COLOR, 
01322  *                         P_COLOR_444_PL, 
01323  *                         P_COLOR_422_PL, 
01324  *                         P_COLOR_420_PL, 
01325  *                         P_COLOR_RGB.
01326  *
01327  */
01328 extern pT_status p_read_field_planar
01329         (const char *filename, pT_header *header,
01330          int frame, int field,
01331          unsigned char *y_or_r_fld,
01332          unsigned char *u_or_g_fld,
01333          unsigned char *v_or_b_fld,
01334          int read_mode,
01335          int width, int fld_height, int stride, int uv_stride);
01336 extern pT_status p_read_frame_planar
01337         (const char *filename, pT_header *header,
01338          int frame,
01339          unsigned char *y_or_r_frm,
01340          unsigned char *u_or_g_frm,
01341          unsigned char *v_or_b_frm,
01342          int read_mode,
01343          int width, int frm_height, int stride, int uv_stride);
01344 extern pT_status p_write_field_planar
01345         (const char *filename, pT_header *header,
01346          int frame, int field,
01347          const unsigned char *y_or_r_fld,
01348          const unsigned char *u_or_g_fld,
01349          const unsigned char *v_or_b_fld,
01350          int width, int fld_height, int stride, int uv_stride);
01351 extern pT_status p_write_frame_planar
01352         (const char *filename, pT_header *header,
01353          int frame,
01354          const unsigned char *y_or_r_frm,
01355          const unsigned char *u_or_g_frm,
01356          const unsigned char *v_or_b_frm,
01357          int width, int frm_height, int stride, int uv_stride);
01358 
01359 extern pT_status p_read_field_planar_16
01360         (const char *filename, pT_header *header,
01361          int frame, int field,
01362          unsigned short *y_or_r_fld,
01363          unsigned short *u_or_g_fld,
01364          unsigned short *v_or_b_fld,
01365          int read_mode,
01366          int width, int fld_height, int stride, int uv_stride);
01367 extern pT_status p_read_frame_planar_16
01368         (const char *filename, pT_header *header,
01369          int frame,
01370          unsigned short *y_or_r_frm,
01371          unsigned short *u_or_g_frm,
01372          unsigned short *v_or_b_frm,
01373          int read_mode,
01374          int width, int frm_height, int stride, int uv_stride);
01375 extern pT_status p_write_field_planar_16
01376         (const char *filename, pT_header *header,
01377          int frame, int field,
01378          const unsigned short *y_or_r_fld,
01379          const unsigned short *u_or_g_fld,
01380          const unsigned short *v_or_b_fld,
01381          int write_mode,
01382          int width, int fld_height, int stride, int uv_stride);
01383 extern pT_status p_write_frame_planar_16
01384         (const char *filename, pT_header *header,
01385          int frame,
01386          const unsigned short *y_or_r_frm,
01387          const unsigned short *u_or_g_frm,
01388          const unsigned short *v_or_b_frm,
01389          int write_mode,
01390          int width, int frm_height, int stride, int uv_stride);
01391 
01433 extern pT_status p_read_field_comp
01434         (const char *filename, pT_header *header,
01435          int frame, int field, int comp,
01436          unsigned char *c_fld,
01437          int read_mode,
01438          int width, int fld_height, int stride);
01439 extern pT_status p_read_frame_comp
01440         (const char *filename, pT_header *header,
01441          int frame, int comp,
01442          unsigned char *c_frm,
01443          int read_mode,
01444          int width, int frm_height, int stride);
01445 extern pT_status p_write_field_comp
01446         (const char *filename, pT_header *header,
01447          int frame, int field, int comp,
01448          const unsigned char *c_fld,
01449          int width, int fld_height, int stride);
01450 extern pT_status p_write_frame_comp
01451         (const char *filename, pT_header *header,
01452          int frame, int comp,
01453          const unsigned char *c_frm,
01454          int width, int frm_height, int stride);
01455 
01456 extern pT_status p_read_field_comp_16
01457         (const char *filename, pT_header *header,
01458          int frame, int field, int comp,
01459          unsigned short *c_fld,
01460          int read_mode,
01461          int width, int fld_height, int stride);
01462 extern pT_status p_read_frame_comp_16
01463         (const char *filename, pT_header *header,
01464          int frame, int comp,
01465          unsigned short *c_frm,
01466          int read_mode,
01467          int width, int frm_height, int stride);
01468 extern pT_status p_write_field_comp_16
01469         (const char *filename, pT_header *header,
01470          int frame, int field, int comp,
01471          const unsigned short *c_fld,
01472          int write_mode,
01473          int width, int fld_height, int stride);
01474 extern pT_status p_write_frame_comp_16
01475         (const char *filename, pT_header *header,
01476          int frame, int comp,
01477          const unsigned short *c_frm,
01478          int write_mode,
01479          int width, int frm_height, int stride);
01497 extern int p_mod_add_comp (pT_header *header);
01498 
01502 extern int p_get_comp_by_name (const pT_header *header, const char *name);
01503 
01505 extern int p_get_num_comps (const pT_header *header);
01506 
01510 extern pT_status p_mod_set_comp_2
01511         (pT_header *header, const int comp,
01512          const char *name,
01513          const pT_data_fmt file_data_fmt,
01514          const int pix_subsample,
01515          const int line_subsample,
01516          const int multiplex_factor);
01517 
01521 #define p_mod_set_comp(h,c,n,d,p,l) p_mod_set_comp_2((h),(c),(n),(d),(p),(l),1)
01522 
01527 extern pT_status p_mod_rm_comp (pT_header *header, const int comp);
01528 
01530 extern pT_status p_mod_rm_extra_comps (pT_header *header);
01531 
01536 extern pT_status p_get_comp_2
01537         (const pT_header *header, const int comp,
01538          char *name,
01539          pT_data_fmt *file_data_fmt,
01540          int *pix_subsample,
01541          int *line_subsample,
01542          int *multiplex_factor);
01543 
01547 #define p_get_comp(h,c,n,d,p,l) p_get_comp_2((h),(c),(n),(d),(p),(l),NULL)
01548 
01555 extern pT_status p_get_comp_buffer_size (const pT_header *header, const int comp,
01556                                          int *width, int *height);
01599 extern pT_status p_cce_read_comp
01600         (const char *filename, pT_header *header,
01601          int frame, int field, int comp,
01602          void *abuf, pT_buf_type atype,
01603          int offset, int gain,
01604          int width, int height, int stride);
01605 
01606 extern pT_status p_cce_write_comp
01607         (const char *filename, pT_header *header,
01608          int frame, int field, int comp,
01609          const void *abuf, pT_buf_type atype,
01610          int offset, int gain,
01611          int width, int height, int stride);
01636 extern pT_status p_cce_read_float_xyz(
01637          const char *filename,
01638          pT_header *header,
01639          int frame,
01640          int field,
01641          float *r_or_x_frm,
01642          float *g_or_y_frm,
01643          float *b_or_z_frm,
01644          int width, int height, int stride );
01645 extern pT_status p_cce_write_float_xyz(
01646          const char *filename,
01647          pT_header *header,
01648          int frame,
01649          int field,
01650          float *r_or_x_frm,
01651          float *g_or_y_frm,
01652          float *b_or_z_frm,
01653          int width, int height, int stride );
01654 
01692 extern int p_mod_add_aux (
01693         pT_header     * header,
01694         int             max_size,
01695         const char    * name,
01696         int             descr_len,
01697         const char    * description );
01698 
01700 extern int p_get_num_aux (
01701         const pT_header *header );
01702 
01704 extern int p_get_aux_by_name (
01705         const pT_header * header,
01706         const char      * name );
01707 
01713 extern pT_status p_mod_rm_aux (
01714         pT_header     * header,
01715         int             aux_id );
01716 
01728 extern pT_status p_get_aux (
01729         const pT_header *header,
01730         int              aux_id,
01731         int  * max_size,
01732         char * name,
01733         int  * descr_len,
01734         char * description );
01735 
01747 extern pT_status p_read_aux (
01748         const char    * filename,
01749         pT_header     * header,
01750         int             frame,
01751         int             field,
01752         int             aux_id,
01753         int           * size,
01754         unsigned char * buf );
01755 
01756 
01768 extern pT_status p_write_aux (
01769         const char    * filename,
01770         pT_header     * header,
01771         int             frame,
01772         int             field,
01773         int             aux_id,
01774         int             size,
01775         unsigned char * buf );
01776 
01813 extern pT_status p_open_file (const char *filename, int write);
01814 extern pT_status p_close_file (const char *filename);
01837 extern pT_status p_set_file_buf_size (const int size_kb);
01838 extern int       p_get_file_buf_size (void);
01847 extern void     p_fatal_error (pT_status status, 
01848                                FILE *stream);
01854 extern void     p_fatal_error_fileio (pT_status status, 
01855                                       const char *filename,
01856                                       FILE *stream);
01858 extern char    *p_get_error_string (pT_status status);
01872 extern char *p_revision_str;
01873 
01875 extern char *p_get_version (void);
01876 
01880 extern char *p_get_magic (void);
01881 
01884 #ifdef __cplusplus
01885 } /* extern "C" */
01886 #endif /* __cplusplus */
01887 
01888 #endif /* end of #ifndef CPFSPD_H_INCLUDED */

Generated on Thu Nov 19 16:28:20 2009 for cpfspd by  doxygen 1.3.9.1