apps/ccam/imageaccess.h

Go to the documentation of this file.
00001 // imageaccess.h
00002 // * modified for model 313
00003 
00004 #ifndef MAP_OPTIONS                     
00005 #ifndef MAP_FILE                        
00006   #define MAP_OPTIONS MAP_PRIVATE               /* Sun */
00007 #else
00008   #define MAP_OPTIONS MAP_FILE|MAP_PRIVATE      /* Linux */
00009 #endif
00010 #endif
00011 #ifndef MAX_IMAGE_WIDTH
00012  #define MAX_IMAGE_WIDTH  1288
00013  #define MAX_IMAGE_HEIGHT 1032
00014 #endif
00015 
00016 //#define MD(x) fprintf(stderr,"%s:%d:",__FILE__,__LINE__);x
00017 #define MD(x)
00018 
00019 struct pixel_buffers {
00020   int                     data_fd;      // frame read pseudo-file file descriptor
00021   unsigned char   rgb[MAX_IMAGE_WIDTH*3];       // r-g-b-r-g-b... bayer-decoded data
00022   int                     imageWidth;
00023   int                     imageHeight;
00024   unsigned char * this; // pointer to current line of 8-bit data (to decoded data or DMA line (if 8-bit)
00025   unsigned char * prev; // pointer to previous line
00026   unsigned char * next;
00027   int                     depth;        //  only 8/not 8 (16) bits/pixel
00028   int                     shft;         //      0-5 - software "gain"
00029   int                     color;        // 0 -mono, 1 - rgb, 2 - pseudo color
00030   unsigned long   BayerRows[3][( MAX_IMAGE_WIDTH >> 2) +4];      // not used in 8-bit, 0-shift mode
00031   int                     BayerOrient; // pixel at 0/0: 0 - R, 1 G(R), 2 - G(B), 3 - B
00032   int                     bufferedRows[3]; // row numbers currently available in BayerRows[0], [1] and [2]
00033 // sequence changed to match bmp files (b-g-r-0)
00034 //    unsigned long   palette[256]; // lsb -r, next - g, next - b
00035   unsigned long   palette[256]; // lsb -b, next - g, next - r
00036 };
00037 
00038 // <0 - error, 0 - OK
00039 int initPixelBuffers(struct pixel_buffers * pbp,
00040                                         const char * dmaFileName,
00041                                         int     width,
00042                                         int height,
00043                                         int contrast,
00044                                         int colorMode,  // 0- b/w, 1 - color
00045                                         int bayer,      // 0..3 color under 0:0
00046                                         int     pixelDepth,             // 10,8,4
00047                                         const char * pseudo
00048                                         );
00049 void closePixelBuffers(struct pixel_buffers * pbp);     // just close data_fd;
00050                                          
00051 // in color mode will not return rows 0 and last, will start at second pixel in each row 
00052 unsigned char * getPixelRow(struct pixel_buffers * pbp,int row);        //returns pointer to row data (mono or color depending on mode)
00053 unsigned char * getMonoRow (struct pixel_buffers * pbp, int row, int bufn);
00054 // sequence changed to match bmp files (b-g-r-0)
00055 unsigned long * getPalette (struct pixel_buffers * pbp); // will return NULL if not defined

Generated on Thu Aug 7 16:18:59 2008 for elphel by  doxygen 1.5.1