root/platform/a540/sub/100b/lib.c

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

DEFINITIONS

This source file includes following definitions.
  1. hook_raw_image_addr
  2. hook_yuv_shooting_buf_addr
  3. hook_yuv_shooting_buf_width
  4. hook_yuv_shooting_buf_height
  5. vid_get_bitmap_fb
  6. vid_get_viewport_fb
  7. vid_get_viewport_fb_d
  8. vid_get_viewport_width_proper
  9. vid_get_viewport_width
  10. vid_get_viewport_height_proper
  11. vid_get_viewport_height
  12. review_fullscreen_mode
  13. postreview_fullscreen_mode
  14. raw_shoot_avail
  15. mf_slider_active
  16. vid_get_viewport_live_fb
  17. camera_jpeg_count_str
  18. vid_get_palette_type
  19. vid_get_palette_size
  20. vid_get_bitmap_active_palette
  21. vid_get_bitmap_active_buffer
  22. vid_get_viewport_fullscreen_height
  23. vid_get_viewport_fullscreen_width
  24. vid_get_viewport_display_xoffset
  25. vid_get_viewport_xoffset
  26. vid_get_viewport_display_yoffset
  27. vid_get_viewport_yoffset

   1 #include "platform.h"
   2 #include "keyboard.h"
   3 
   4 char *hook_raw_image_addr()
   5 {
   6     return (char*)0x105B8AC0; // OK (find on ".crw")
   7     
   8 }
   9 
  10 /*
  11 YUV buffer created in jpeg processing for < full size jpeg
  12 not currently used, kept for future reference
  13 */
  14 #if 0
  15 /*
  16 buffer that holds the uncompressed yuv source of the fresh jpeg
  17 not used for L or W picture size
  18 */
  19 char *hook_yuv_shooting_buf_addr() {
  20     return (char*)0x105599A0; // based on proximity to viewport_fb in ROM table at FFEF8370, by comparison to a410
  21 }
  22 
  23 /*
  24 via sub_FFCA2CC8, after EnableEngineClocks
  25 note these update during shooting, may hold incorrect values after resolution changes
  26 invalid for L or Wide (continues to hold previous value)
  27 */
  28 int hook_yuv_shooting_buf_width() {
  29     if (shooting_get_resolution() !=0 && shooting_get_resolution() !=8)
  30         return *(int*)0x33394; //FFCB1D50
  31     return 0;
  32 }
  33 
  34 int hook_yuv_shooting_buf_height() {
  35     if (shooting_get_resolution() !=0 && shooting_get_resolution() !=8)
  36         return *(int*)0x33398; //FFCB1D54
  37     return 0;
  38 }
  39 #endif
  40 
  41 void *vid_get_bitmap_fb()
  42 {
  43     return (void*)0x103C79A0; // OK (find in _CreatePhysicalVram)
  44 }
  45 
  46 void *vid_get_viewport_fb()
  47 {
  48     return (void*)0x105F17A0; // OK (find on "VRAM Address  : %p")
  49 }
  50 
  51 void *vid_get_viewport_fb_d()
  52 {
  53 // from ewavr 
  54   int x=(*(int*)0x63AD0); // found in sub_FFD25770
  55   return (void *)x;
  56 // if we start camera in PB mode with movie on display, this pointer will be NULL
  57 // _fb isn't valid data, but at least it doesn't crash
  58 //  return (void*) (x ? (void *)x : vid_get_viewport_fb()) ;
  59 }
  60 
  61 extern int _GetVRAMHPixelsSize();
  62 extern int _GetVRAMVPixelsSize();
  63 
  64 // for testing only, to simulate cameras with variable aspect
  65 // MODE_PORTRAIT uses 1:1 ( 528x240 ) and MODE_LANDSCAPE 16:9 (704x180)
  66 // no need to implement this on other cameras unless you are doing development
  67 //#define FAKE_ASPECT 1
  68 
  69 int vid_get_viewport_width_proper() {
  70     int m = mode_get();
  71     if((m&MODE_MASK) == MODE_PLAY) {
  72         return 704;
  73     }
  74 #ifdef FAKE_ASPECT
  75     // fake 1:1 mode
  76     if((m&MODE_SHOOTING_MASK) == MODE_PORTRAIT) {
  77         return 528;
  78     }
  79 #endif
  80     // return hard coded width since mode doesn't update at the same time as GetVRAMHPixelsSize
  81     if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
  82         return 352;
  83     }
  84     return _GetVRAMHPixelsSize();
  85 }
  86 
  87 int vid_get_viewport_width() {
  88     return vid_get_viewport_width_proper()>>1;
  89 }
  90 
  91 int vid_get_viewport_height_proper() {
  92     int m = mode_get();
  93     // TODO not correct if TV out connected
  94     if((m&MODE_MASK) == MODE_PLAY) {
  95         return 240;
  96     }
  97 #ifdef FAKE_ASPECT
  98     // fake 16:9 mode
  99     if((m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) {
 100         return 180; 
 101     }
 102 #endif
 103     // return hard coded width since mode doesn't update at the same time as GetVRAMHPixelsSize
 104     if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
 105         return 120; 
 106     }
 107     return _GetVRAMVPixelsSize();
 108 }
 109 
 110 long vid_get_viewport_height() {
 111     return vid_get_viewport_height_proper();
 112 }
 113 
 114 // the following aren't used, kept for informational purposes
 115 #if 0
 116 int review_fullscreen_mode(){ //from 710 added
 117  char r;
 118  get_parameter_data(53, &r, 1);
 119  return  r==0;
 120 }
 121 
 122 int postreview_fullscreen_mode(){ //from 710 added
 123  char r;
 124  get_parameter_data(54, &r, 1);
 125  return  r==0;
 126 }
 127 
 128 
 129 static int file_size_table[3][5]={{3110,2562,1666,1057,288},
 130                                   {1954,1441, 928, 608,176},
 131                                   {960,  736, 480, 320,112}};  // in KB   // from 710 added
 132                                         
 133                                   
 134 long raw_shoot_avail(){ // from 710 added
 135  long jpegs,size,quality;
 136  jpegs=atoi((char*)0x6E8D0); // orig.0x7BD98 find -> a9999
 137  get_property_case(23, (void *)&quality, 4);
 138  get_property_case(24, (void *)&size, 4);
 139  if ((size>4) || (quality>2)) return 0; 
 140  return (file_size_table[quality][size]*jpegs)/(file_size_table[quality][size]+(hook_raw_size()>>10));
 141 }
 142 
 143 
 144 int mf_slider_active() // from 710 added
 145 {
 146  return *(long*)0x6C8B0==0x100; // orig.0x798F0  found in "ControlSwitcher.c"
 147 }
 148 #endif
 149 
 150 void *vid_get_viewport_live_fb() // from 710 added
 151 {
 152     void **fb=(void **)0x5288;
 153     unsigned char buff = *((unsigned char*)0x5298);
 154     if (buff == 0) {
 155         buff = 2;
 156     }
 157     else {
 158         buff--;
 159     }
 160     return fb[buff];
 161 }
 162 
 163 
 164 char *camera_jpeg_count_str()
 165 {
 166     return (char*)0x6E8D0 ; // from 700 added orig. 0x78688
 167 }
 168 
 169 // PTP display stuff
 170 int vid_get_palette_type() { return 1; }
 171 int vid_get_palette_size() { return 16*4; }
 172 
 173 void *vid_get_bitmap_active_palette() {
 174     return (void *)0x634E0; // GetPaletteFromPhysicalScreen
 175 }
 176 
 177 void *vid_get_bitmap_active_buffer()
 178 {
 179     return (void*)(*(int*)0x5ED0); // FFD23420 DisplayPhysicalScreenWithYUVPalette
 180 }
 181 
 182 int vid_get_viewport_fullscreen_height() {
 183     // except for stitch, always full screen
 184     int m = mode_get();
 185     if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH
 186 #ifdef FAKE_ASPECT
 187          || (m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE
 188 #endif
 189          )) {
 190         return 240;
 191     }
 192     return vid_get_viewport_height_proper();
 193 }
 194 int vid_get_viewport_fullscreen_width() {
 195     // except for stitch, always full screen
 196     int m = mode_get();
 197     if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH
 198 #ifdef FAKE_ASPECT
 199          || (m&MODE_SHOOTING_MASK) == MODE_PORTRAIT
 200 #endif
 201     )) {
 202         return 704;
 203     }
 204     return vid_get_viewport_width_proper();
 205 }
 206 
 207 int vid_get_viewport_display_xoffset() {
 208     int m = mode_get();
 209     if((m&MODE_MASK) == MODE_PLAY) {
 210         return 0;
 211     } else if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
 212         short dir=0;
 213         short seq=0;
 214         get_property_case(PROPCASE_STITCH_DIRECTION,&dir,sizeof(dir));
 215         get_property_case(PROPCASE_STITCH_SEQUENCE,&seq,sizeof(seq));
 216         // overall stitch window is 3/4 screen width, centered
 217         // live part is 1/2, so margin is either 1/8th or 3/8th
 218         if(dir==0) {
 219             return seq?132:44;
 220         } else {
 221             return seq?44:132;
 222         }
 223 #ifdef FAKE_ASPECT
 224     } else if((m&MODE_SHOOTING_MASK) == MODE_PORTRAIT) {
 225         return 44;
 226 #endif
 227     }
 228     return 0;
 229 }
 230 
 231 #ifdef FAKE_ASPECT
 232 int vid_get_viewport_xoffset() {
 233     int m = mode_get();
 234     if((m&MODE_MASK) != MODE_PLAY && (m&MODE_SHOOTING_MASK) == MODE_PORTRAIT) {
 235        return 44;
 236     }
 237     return 0;
 238 }
 239 #endif
 240 
 241 int vid_get_viewport_display_yoffset() {
 242     int m = mode_get();
 243     if((m&MODE_MASK) == MODE_PLAY) {
 244         return 0;
 245     }
 246 #ifdef FAKE_ASPECT
 247     if((m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) {
 248        return 30;
 249     }
 250 #endif
 251     return ((m&MODE_SHOOTING_MASK) == MODE_STITCH)?60:0; // window is 120, centered in 240 screen
 252 }
 253 
 254 #ifdef FAKE_ASPECT
 255 int vid_get_viewport_yoffset() {
 256     int m = mode_get();
 257     if((m&MODE_MASK) != MODE_PLAY && (m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) {
 258        return 30;
 259     }
 260     return 0;
 261 }
 262 #endif

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