root/platform/sx120is/sub/100b/movie_rec.c

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

DEFINITIONS

This source file includes following definitions.
  1. change_video_tables
  2. movie_record_task
  3. sub_0xFFD13FFC_my
  4. sub_FFE0E8E0_my

   1 #include "conf.h"
   2 
   3 /*
   4 void  set_quality(int *x){ // -17 highest; +12 lowest
   5  if (conf.video_mode) *x=12-((conf.video_quality-1)*(12+17)/(99-1));
   6 }
   7 */
   8 
   9 int *video_quality = &conf.video_quality;
  10 int *video_mode    = &conf.video_mode;
  11 
  12 
  13 long def_table[24]={0x2000, 0x38D, 0x788, 0x5800, 0x9C5, 0x14B8, 0x10000, 0x1C6A, 0x3C45, 0x8000, 0xE35, 0x1E23,
  14            0x1CCD, -0x2E1, -0x579, 0x4F33, -0x7EB, -0xF0C, 0xE666, -0x170A, -0x2BC6, 0x7333, -0xB85, -0x15E3};
  15 
  16 long table[24];
  17 
  18 void change_video_tables(int a, int b){
  19  int i;
  20  for (i=0;i<24;i++) table[i]=(def_table[i]*a)/b; 
  21 }
  22 
  23 long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
  24 
  25 void __attribute__((naked,noinline)) movie_record_task(){
  26  asm volatile(
  27                         "STMFD  SP!, {R2-R8,LR}\n"
  28                         "LDR    R7, =0x2710\n"
  29                         "LDR    R4, =0x61A0\n"
  30                         "MOV    R6, #0\n"
  31                         "MOV    R5, #1\n"
  32                                 
  33                 "loc_FFD14504:\n"               
  34                         "LDR    R0, [R4,#0x18]\n"
  35                         "MOV    R2, #0\n"
  36                         "ADD    R1, SP, #0x4\n"
  37                         "BL     sub_FFC1659C\n"
  38                         "LDR    R0, [R4,#0x20]\n"
  39                         "CMP    R0, #0\n"
  40                         "BNE    loc_FFD145D4\n"
  41                         "LDR    R0, [SP,#0x4]\n"
  42                         "LDR    R1, [R0]\n"
  43                         "SUB    R1, R1, #2\n"
  44                         "CMP    R1, #9\n"
  45                         "ADDLS  PC, PC, R1,LSL#2\n"
  46                         "B      loc_FFD145D4\n"
  47                                 
  48                 "loc_FFD14538:\n"
  49                                 "B      loc_FFD14588\n"
  50 
  51                 "loc_FFD1453C:\n"
  52                                 "B      loc_FFD145A8\n"
  53 
  54                 "loc_FFD14540:\n"
  55                                 "B      loc_FFD145B8\n"
  56 
  57                 "loc_FFD14544:\n"
  58                                 "B      loc_FFD145C0\n"
  59 
  60                 "loc_FFD14548:\n"
  61                                 "B      loc_FFD14590\n"
  62 
  63                 "loc_FFD1454C:\n"
  64                                 "B      loc_FFD145C8\n"
  65 
  66                 "loc_FFD14550:\n"
  67                                 "B      loc_FFD14598\n"
  68 
  69                 "loc_FFD14554:\n"
  70                                 "B      loc_FFD145D4\n"
  71 
  72                 "loc_FFD14558:\n"
  73                                 "B      loc_FFD145D0\n"
  74 
  75                 "loc_FFD1455C:\n"
  76                                 "B      loc_FFD14560\n"
  77                                 
  78                 "loc_FFD14560:\n"
  79                                 "LDR    R0, =0xFFD141FC\n"              // nullsub
  80                                 "STR    R6, [R4,#0x34]\n"
  81                                 "STR    R0, [R4,#0xA0]\n"
  82                                 "LDR    R0, =0xFFD13C80\n"
  83                                 "LDR    R2, =0xFFD13B9C\n"
  84                                 "LDR    R1, =0x4B5F4\n"
  85                                 "STR    R6, [R4,#0x24]\n"
  86                                 "BL             sub_FFC293B4\n"
  87                                 "STR    R5, [R4,#0x38]\n"
  88                                 "B              loc_FFD145D4\n"
  89                                 
  90                 "loc_FFD14588:\n"               
  91 // ok
  92             "BL     unlock_optical_zoom\n"              //  -----------> inserted                       
  93                         "BL     sub_FFD142F4\n"
  94                         "B              loc_FFD145D4\n"
  95                                 
  96                 "loc_FFD14590:\n"                                       
  97 
  98                         "BL     sub_0xFFD13FFC_my\n"                    // ------------> changed
  99                         //"BL   sub_FFD13FFC\n"
 100                         "B              loc_FFD145D4\n"
 101                                 
 102                 "loc_FFD14598:\n"                                       
 103                                 
 104                         "LDR    R1, [R0,#0x10]\n"
 105                         "LDR    R0, [R0,#4]\n"
 106                         "BL     sub_FFE10550\n"                         // AviWriter.c:705
 107                         "B              loc_FFD145D4\n"
 108                                 
 109                 "loc_FFD145A8:\n"                                               
 110                                 
 111                         "LDR    R0, [R4,#0x38]\n"
 112                         "CMP    R0, #5\n"
 113                         "STRNE  R5, [R4,#0x28]\n"
 114                         "B              loc_FFD145D4\n"
 115                                 
 116                 "loc_FFD145B8:\n"                                               
 117                                 
 118                         "BL     sub_FFD13E08\n"                         // MovieRecorder.c:1606 (calls LiveImageTool.RealStopMjpegMaking
 119                         "B              loc_FFD145D4\n"
 120                                 
 121                 "loc_FFD145C0:\n"                                       
 122                                 
 123                         "BL     sub_FFD13CCC\n"                         // MovieRecorder.c:1492
 124                         "B              loc_FFD145D4\n"
 125                                 
 126                 "loc_FFD145C8:\n"                                       
 127                                 
 128                         "BL     sub_FFD13B28\n"
 129                         "B              loc_FFD145D4\n"
 130                                 
 131                 "loc_FFD145D0:\n"               
 132                                                                 
 133                         "BL     sub_FFD14740\n"                         // MovieRecorder.c:1250
 134                                 
 135                 "loc_FFD145D4:\n"                               
 136                         "LDR    R1, [SP,#4]\n"
 137                         "LDR    R3, =0x330\n"
 138                         "STR    R6, [R1]\n"
 139                         "STR    R3, [SP,#0]\n"
 140                         "LDR    R0, [R4,#0x1C]\n"
 141                         "LDR    R3, =0xFFD13988\n"
 142                         "MOV    R2, R7\n"
 143                         "BL     sub_FFC16EF0\n"
 144                         "B              loc_FFD14504\n"
 145  );
 146 }
 147 
 148 void __attribute__((naked,noinline)) sub_0xFFD13FFC_my(){ 
 149  asm volatile(
 150                         "STMFD  SP!, {R4-R8,LR}\n"
 151                         "SUB    SP, SP, #0x40\n"                        
 152                         "MOV    R6, #0\n"
 153                         "LDR    R5, =0x61A0\n"
 154                         "MOV    R4, R0\n"
 155                         "STR    R6, [SP,#0x30]\n"
 156                         "STR    R6, [SP,#0x28]\n"
 157                         "LDR    R0, [R5,#0x38]\n"
 158                         "MOV    R8, #4\n"
 159                         "CMP    R0, #3\n"
 160                         "STREQ  R8, [R5,#0x38]\n"
 161                         "LDR    R0, [R5,#0xA0]\n"
 162                         "BLX    R0\n"                   // seems to compile fine with gcc (?)
 163                         "LDR    R0, [R5,#0x38]\n"
 164                         "CMP    R0, #4\n"
 165                         "BNE    loc_FFD140D4\n"
 166                         "ADD    R3, SP, #0x28\n"
 167                         "ADD    R2, SP, #0x2C\n"        // was wrong (0x24), corrected.
 168                         "ADD    R1, SP, #0x30\n"
 169                         "ADD    R0, SP, #0x34\n"
 170                         "BL     sub_FFE106E4\n"
 171                         "CMP    R0, #0\n"
 172                         "MOV    R7, #1\n"
 173                         "BNE    loc_FFD14078\n"
 174                         "LDR    R1, [R5,#0x28]\n"
 175                         "CMP    R1, #1\n"
 176                         "BNE    loc_FFD140DC\n"
 177                         "LDR    R1, [R5,#0x50]\n"
 178                         "LDR    R2, [R5,#0x3C]\n"
 179                         "CMP    R1, R2\n"
 180                         "BCC    loc_FFD140DC\n"
 181                                 
 182                 "loc_FFD14078:\n"               
 183                         "CMP    R0, #0x80000001\n"
 184                         "STREQ  R8, [R5,#0x54]\n"
 185                         "BEQ    loc_FFD140B0\n"
 186                         "CMP    R0, #0x80000003\n"
 187                         "STREQ  R7, [R5,#0x54]\n"
 188                         "BEQ    loc_FFD140B0\n"
 189                         "CMP    R0, #0x80000005\n"
 190                         "MOVEQ  R0, #2\n"
 191                         "BEQ    loc_FFD140AC\n"
 192                         "CMP    R0, #0x80000007\n"
 193                         "STRNE  R6, [R5,#0x54]\n"
 194                         "BNE    loc_FFD140B0\n"
 195                         "MOV    R0, #3\n"
 196                                 
 197                 "loc_FFD140AC:\n"               
 198                         "STR    R0, [R5,#0x54]\n"
 199                                 
 200                 "loc_FFD140B0:\n"               
 201                                 
 202                         "LDR    R0, =0x4B624\n"
 203                         "LDR    R0, [R0,#8]\n"
 204                         "CMP    R0, #0\n"
 205                         "BEQ    loc_FFD140C8\n"
 206                         "BL     sub_FFC38408\n"
 207                         "B              loc_FFD140CC\n"
 208                                 
 209                 "loc_FFD140C8:\n"               
 210                         "BL     sub_FFD13B28\n"
 211                                 
 212                 "loc_FFD140CC:\n"               
 213                         "MOV    R0, #5\n"
 214                         "STR    R0, [R5,#0x38]\n"
 215                                 
 216                 "loc_FFD140D4:\n"               
 217                                 
 218                         "ADD    SP, SP, #0x40\n"
 219                         "LDMFD  SP!, {R4-R8,PC}\n"
 220                                 
 221                 "loc_FFD140DC:\n"               
 222                         "LDR    LR, [SP,#0x30]\n"
 223                         "CMP    LR, #0\n"
 224                         "BEQ    loc_FFD141A4\n"
 225                         "STR    R7, [R5,#0x2C]\n"
 226                         "LDR    R0, [R5,#0x6C]\n"
 227                         "LDR    R1, [R4,#0x14]\n"
 228                         "LDR    R2, [R4,#0x18]\n"
 229                         "LDR    R12, [R4,#0xC]\n"
 230                         "ADD    R3, SP, #0x38\n"
 231                         "ADD    R8, SP, #0x14\n"
 232                         "STMIA  R8, {R0-R3}\n"
 233                         "LDR    R3, [R5,#0x58]\n"
 234                         "ADD    R2, SP, #0x3C\n"
 235                         "ADD    R8, SP, #0x8\n"
 236                         "LDRD   R0, [SP,#0x28]\n"                       
 237                         "STMIA  R8, {R0,R2,R3}\n"
 238                         "STR    R1, [SP,#0x4]\n"
 239                         "STR    LR, [SP,#0x0]\n"
 240                         "LDMIB  R4, {R0,R1}\n"
 241                         "LDR    R3, [SP,#0x34]\n"
 242                         "MOV    R2, R12\n"
 243                         "BL     sub_FFDE0EF4\n"
 244                         "LDR    R0, [R5,#0x10]\n"
 245                         "MOV    R1, #0x3E8\n"
 246                         "BL     sub_FFC169B8\n"
 247                         "CMP    R0, #9\n"
 248                         "BNE    loc_FFD14158\n"
 249                         "BL     sub_FFE10CC0\n"
 250                         "MOV    R0, #0x90000\n"
 251                         "STR    R7, [R5,#0x38]\n"
 252                         "B              loc_FFD14170\n"
 253                                 
 254                 "loc_FFD14158:\n"
 255                         "LDR    R0, [SP,#0x38]\n"
 256                         "CMP    R0, #0\n"
 257                         "BEQ    loc_FFD14178\n"
 258                         "BL     sub_FFE10CC0\n"
 259                         "MOV    R0, #0xA0000\n"
 260                         "STR    R7, [R5,#0x38]\n"
 261                                 
 262                 "loc_FFD14170:\n"
 263                         "BL     sub_FFC660FC\n"
 264                         "B              loc_FFD140D4\n"
 265                                 
 266                 "loc_FFD14178:\n"
 267                         "BL     sub_FFDE0FB8\n"
 268                         "LDR    R0, [SP,#0x34]\n"
 269                         "LDR    R1, [SP,#0x3C]\n"
 270                         "BL     sub_FFE10A68\n"
 271                         "LDR    R0, [R5,#0x4C]\n"
 272                         "LDR    R1, =0x620C\n"
 273                         "ADD    R0, R0, #1\n"
 274                         "STR    R0, [R5,#0x4C]\n"
 275                         "LDR    R0, [SP,#0x3C]\n"
 276                         "MOV    R2, #0\n"                       
 277                         "BL     sub_FFE0E8E0_my\n"              // changed
 278                         
 279                 "loc_FFD141A4:\n"               
 280                         "LDR    R0, [R5,#0x50]\n"
 281                         "ADD    R0, R0, #1\n"
 282                         "STR    R0, [R5,#0x50]\n"
 283                         "LDR    R1, [R5,#0x78]\n"
 284                         "MUL    R0, R1, R0\n"
 285                         "LDR    R1, [R5,#0x74]\n"
 286                         "BL     sub_FFE92664\n"
 287                         "MOV    R4, R0\n"
 288                         "BL     sub_FFE10CF8\n"
 289                         "LDR    R1, [R5,#0x70]\n"
 290                         "CMP    R1, R4\n"
 291                         "BNE    loc_FFD141E0\n"
 292                         "LDR    R0, [R5,#0x30]\n"
 293                         "CMP    R0, #1\n"
 294                         "BNE    loc_FFD141F4\n"
 295                                 
 296                 "loc_FFD141E0:\n"
 297                         "LDR    R1, [R5,#0x84]\n"
 298                         "MOV    R0, R4\n"
 299                         "BLX    R1\n"
 300                         "STR    R4, [R5,#0x70]\n"
 301                         "STR    R6, [R5,#0x30]\n"
 302                                 
 303                 "loc_FFD141F4:\n"               
 304                         "STR    R6, [R5,#0x2C]\n"
 305                         "B      loc_FFD140D4\n"
 306  );
 307 }
 308 
 309 void __attribute__((naked,noinline)) sub_FFE0E8E0_my(){ 
 310  asm volatile(
 311                 "STMFD  SP!, {R4-R8,LR} \n"     
 312                 "LDR    R4, =0x96E4\n"
 313                 "LDR    LR, [R4]\n"
 314                 "LDR    R2, [R4,#8]\n"
 315                 "CMP    LR, #0\n"
 316                 "LDRNE  R3, [R4,#0xC]\n"
 317                 "MOV    R5, R2\n"
 318                 "CMPNE  R3, #1\n"
 319                 "MOVEQ  R2, #0\n"
 320                 "STREQ  R0, [R4]\n"
 321                 "STREQ  R2, [R4,#0xC]\n"
 322                 "BEQ    loc_FFE0E9AC\n"
 323                 "LDR    R3, [R4,#4]\n"
 324 //"LDR  R7, =0xFFEE015C \n"
 325                 "LDR    R7, =table\n"                   // -----> changed
 326                 "ADD    R12, R3, R3,LSL#1\n"
 327                 "LDR    R3, [R7,R12,LSL#2]\n"
 328                 "ADD    R6, R7, #0x30\n"
 329                 "LDR    R8, [R6,R12,LSL#2]\n"
 330                 "SUB    R3, LR, R3\n"
 331                 "CMP    R3, #0\n"
 332                 "SUB    LR, LR, R8\n"
 333                 "BLE    loc_FFE0E968\n"
 334                 "ADD    R12, R7, R12,LSL#2\n"
 335                 "LDR    LR, [R12,#4]\n"
 336                 "CMP    LR, R3\n"
 337                 "ADDGE  R2, R2, #1\n"
 338                 "BGE    loc_FFE0E95C\n"
 339                 "LDR    R12, [R12,#8]\n"
 340                 "CMP    R12, R3\n"
 341                 "ADDLT  R2, R2, #3\n"
 342                 "ADDGE  R2, R2, #2\n"
 343                 
 344 "loc_FFE0E95C:\n"
 345                 // number of entries in the table? if >= 26, set to 25
 346 //      "CMP    R2, #0x17 \n"
 347 //      "MOVGE  R2, #0x16 \n"
 348                 "CMP     R2, #0x1A\n"   // ---------> changed
 349                 "MOVGE   R2, #0x19\n"   // ---------> changed
 350                 "B      loc_FFE0E99C\n"
 351                 
 352 "loc_FFE0E968:\n"               
 353                 "CMP    LR, #0\n"
 354                 "BGE    loc_FFE0E99C\n"
 355                 "ADD    R3, R6, R12,LSL#2\n"
 356                 "LDR    R12, [R3,#4]\n"
 357                 "CMP    R12, LR\n"
 358                 "SUBLE  R2, R2, #1\n"
 359                 "BLE    loc_FFE0E994\n"
 360                 "LDR    R3, [R3,#8]\n"
 361                 "CMP    R3, LR\n"
 362                 "SUBGT  R2, R2, #3\n"
 363                 "SUBLE  R2, R2, #2\n"
 364 
 365 "loc_FFE0E994:\n"
 366                 "CMP    R2, #0\n"
 367                 "MOVLT  R2, #0\n"
 368                 
 369 "loc_FFE0E99C:\n"               
 370                 "CMP    R2, R5\n"
 371                 "STRNE  R2, [R4,#8]\n"
 372                 "MOVNE  R2, #1\n"
 373                 "STRNE  R2, [R4,#0xC]\n"
 374                 
 375 "loc_FFE0E9AC:\n"               
 376 //"LDR  R2, =0xFFEE0100 \n"                     
 377                 "LDR    R2, =CompressionRateTable\n"                    //----------> changed
 378                 "LDR    R3, [R4,#8] \n"
 379                 "LDR    R2, [R2,R3,LSL#2] \n"
 380 
 381                 "LDR     R3, =video_mode\n"      // --------> inserted
 382                 "LDR     R3, [R3]\n"             // --------> inserted
 383                 "LDR     R3, [R3]\n"             // --------> inserted
 384                 "CMP     R3, #1\n"               // --------> inserted
 385                 "LDREQ   R3, =video_quality\n"   // --------> inserted    
 386                 "LDREQ   R3, [R3]\n"             // --------> inserted     
 387                 "LDREQ   R2, [R3]\n"             // --------> inserted     
 388                 "STR    R2, [R1] \n"
 389                 "STR    R0, [R4] \n"
 390 
 391                 "BL      mute_on_zoom\n"         // --------> inserted 
 392 
 393                 "LDMFD  SP!, {R4-R8,PC} \n"
 394                 );
 395 } 

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