root/core/live_view.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __LIVE_VIEW_H
   2 #define __LIVE_VIEW_H
   3 
   4 // Note: used in modules and platform independent code. 
   5 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values)
   6 
   7 /*
   8 Protocol notes:
   9 - Unless otherwise specified, all structure values are packed in camera native (little
  10   endian) byte order
  11 - Frame buffer and palette data are in native camera formats
  12   Some documentation may be found at http://chdk.wikia.com/wiki/Frame_buffers 
  13 - The frame buffer descriptions returned may not be correct depending on the
  14   camera model and various camera settings (shooting mode, digital zoom, aspect ratio)
  15   This may result in partial images, garbage in the "valid" area or incorrect position
  16 - In some cases, the requested data may not be available. If this happens, the framebuffer
  17   or palette data offset will be zero. 
  18 - The frame buffer descriptions are returned regardless of whether the data is available
  19 - New enum values (e.g. aspect ratio, framebuffer type, palette type) may be added in minor
  20   versions.
  21 */
  22 // Live View protocol version
  23 #define LIVE_VIEW_VERSION_MAJOR 2  // increase only with backwards incompatible changes (and reset minor)
  24 #define LIVE_VIEW_VERSION_MINOR 2  // increase with extensions of functionality
  25 
  26 /*
  27 protocol version history
  28 < 2.0 - development versions
  29 2.0 - initial release, chdk 1.1
  30 2.1 - added palette type 4 - 16 entry VUYA, 2 bit alpha
  31 2.2 - digic 6-7 support. Added LV_ASPECT_3_2, LV_FB_YUV8B and LV_FB_YUV8C formats
  32 */
  33 
  34 
  35 // Control flags for determining which data block(s) to transfer
  36 #define LV_TFR_VIEWPORT         0x01
  37 #define LV_TFR_BITMAP           0x04
  38 #define LV_TFR_PALETTE          0x08
  39 #define LV_TFR_BITMAP_OPACITY   0x10
  40 
  41 // physical aspect ratio constants.
  42 enum lv_aspect_rato {
  43     LV_ASPECT_4_3,
  44     LV_ASPECT_16_9,
  45     // below added in 2.2
  46     LV_ASPECT_3_2,
  47 };
  48 
  49 /*
  50 Framebuffer types
  51 additional values will be added if new data formats appear
  52 */
  53 enum lv_fb_type {
  54     LV_FB_YUV8, // 8 bit per element UYVYYY, used for live view
  55     LV_FB_PAL8, // 8 bit paletted, used for bitmap overlay. Note palette data and type sent separately
  56     // below added in 2.2
  57     LV_FB_YUV8B,// 8 bit per element UYVY, used for live view and overlay on Digic 6
  58     LV_FB_YUV8C,// 8 bit per element UYVY, used for alternate Digic 6 live view
  59     LV_FB_OPACITY8,// 8 bit opacity / alpha buffer
  60 };
  61 
  62 /*
  63 framebuffer data description
  64 NOTE YUV pixels widths are based on the number of Y elements
  65 */
  66 typedef struct {
  67     int fb_type; // framebuffer type - note future versions might use different structures depending on type
  68     int data_start; // offset of data from start of live view header
  69     /*
  70     buffer width in pixels
  71     data size is always buffer_width*visible_height*(buffer bpp based on type)
  72     */
  73     int buffer_width;
  74     /*
  75     visible size in pixels
  76     describes data within the buffer which contains image data to be displayed
  77     any offsets within buffer data are added before sending, so the top left
  78     pixel is always the first first byte of data.
  79     width must always be <= buffer_width
  80     if buffer_width is > width, the additional data should be skipped
  81     visible_height also defines the number of data rows
  82     */
  83     int visible_width;
  84     int visible_height;
  85 
  86     /*
  87     margins
  88     pixels offsets needed to replicate display position on cameras screen
  89     not used for any buffer offsets
  90     */
  91     int margin_left;
  92     int margin_top;
  93 
  94     int margin_right;
  95     int margin_bot;
  96 } lv_framebuffer_desc;
  97 
  98 typedef struct {
  99     // live view sub-protocol version
 100     int version_major;
 101     int version_minor;
 102     int lcd_aspect_ratio; // physical aspect ratio of LCD
 103     int palette_type;
 104     int palette_data_start;
 105     // framebuffer descriptions are given as offsets, to allow expanding the structures in minor protocol changes
 106     int vp_desc_start;
 107     int bm_desc_start;
 108     int bmo_desc_start; // added in protocol 2.2
 109 } lv_data_header;
 110 
 111 #endif // __LIVE_VIEW_H

/* [<][>][^][v][top][bottom][index][help] */