root/platform/ixus175_elph180/sub/100c/movie_rec.c

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

DEFINITIONS

This source file includes following definitions.
  1. change_video_tables
  2. set_quality
  3. save_original_bitrates
  4. modify_bitrate
  5. movie_record_task

   1 /*
   2  * movie_rec.c - auto-generated by CHDK code_gen.
   3  */
   4 #include "conf.h"
   5 
   6 static int bitrate_multiplier = 4; // unit: factory rate / 4
   7 static int bitrate_changed = 0;
   8 extern int video_target_framesize;
   9 extern int video_target_framesize2;
  10 
  11 
  12 static int orig_bitrate[2]; // original bitrates, saved at beginning of recording
  13 
  14 void change_video_tables(int a, int b) {
  15     bitrate_multiplier = (a<<2)/b;
  16     bitrate_changed = 1;
  17 }
  18 
  19 // firmware: -12 (best) ... +20 (worst)
  20 void  set_quality(int *x){ // -17 highest; +12 lowest
  21  if (conf.video_mode) *x=12-((conf.video_quality-1)*(12+17)/(99-1));
  22 }
  23 
  24 void save_original_bitrates() {
  25     orig_bitrate[0] = video_target_framesize;
  26     orig_bitrate[1] = video_target_framesize2;
  27     bitrate_changed = 1;
  28 }
  29 
  30 void modify_bitrate() {
  31     if (bitrate_changed) {
  32         bitrate_changed = 0;
  33         video_target_framesize = (orig_bitrate[0] * bitrate_multiplier) >> 2;
  34         video_target_framesize2 = (orig_bitrate[1] * bitrate_multiplier) >> 2;
  35     }
  36 }
  37 
  38 
  39 /*************************************************************/
  40 //** movie_record_task @ 0xFF9A96DC - 0xFF9A986C, length=101
  41 void __attribute__((naked,noinline)) movie_record_task() {
  42 asm volatile (
  43 "    STMFD   SP!, {R2-R10,LR} \n"
  44 "    LDR     R8, =0xFF9A92DC \n"
  45 "    LDR     R4, =0x7248 \n"
  46 "    LDR     R9, =0x549 \n"
  47 "    LDR     R10, =0x2710 \n"
  48 "    MVN     R7, #0 \n"
  49 "    MOV     R5, #1 \n"
  50 "    MOV     R6, #0 \n"
  51 
  52 "loc_FF9A96FC:\n"
  53 "    LDR     R0, [R4, #0x30] \n"
  54 "    MOV     R2, #0 \n"
  55 "    ADD     R1, SP, #4 \n"
  56 "    BL      sub_006B8568 /*_ReceiveMessageQueue*/ \n"
  57 "    LDR     R0, [R4, #0x38] \n"
  58 "    CMP     R0, #0 \n"
  59 "    LDRNE   R0, [R4, #0x14] \n"
  60 "    CMPNE   R0, #2 \n"
  61 "    LDRNE   R0, [R4, #0x4C] \n"
  62 "    CMPNE   R0, #6 \n"
  63 "    BNE     loc_FF9A9850 \n"
  64 "    LDR     R0, [SP, #4] \n"
  65 "    LDR     R1, [R0] \n"
  66 "    SUB     R1, R1, #2 \n"
  67 "    CMP     R1, #0xD \n"
  68 "    ADDCC   PC, PC, R1, LSL#2 \n"
  69 "    B       loc_FF9A9850 \n"
  70 "    B       loc_FF9A97C4 \n"
  71 "    B       loc_FF9A97F0 \n"
  72 "    B       loc_FF9A9800 \n"
  73 "    B       loc_FF9A9808 \n"
  74 "    B       loc_FF9A97CC \n"
  75 "    B       loc_FF9A9810 \n"
  76 "    B       loc_FF9A983C \n"
  77 "    B       loc_FF9A9844 \n"
  78 "    B       loc_FF9A97D8 \n"
  79 "    B       loc_FF9A9850 \n"
  80 "    B       loc_FF9A984C \n"
  81 "    B       loc_FF9A97A0 \n"
  82 "    B       loc_FF9A9774 \n"
  83 
  84 "loc_FF9A9774:\n"
  85 "    STR     R6, [R4, #0x48] \n"
  86 "    STR     R6, [R4, #0x3C] \n"
  87 "    STR     R7, [R4, #0xD4] \n"
  88 "    STRH    R6, [R4, #8] \n"
  89 "    STR     R8, [R4, #0xB4] \n"
  90 "    LDR     R0, [R4, #0x14] \n"
  91 "    ADD     R0, R0, #1 \n"
  92 "    STR     R0, [R4, #0x14] \n"
  93 "    MOV     R0, #6 \n"
  94 "    STR     R0, [R4, #0x4C] \n"
  95 "    B       loc_FF9A97BC \n"
  96 
  97 "loc_FF9A97A0:\n"
  98 "    STR     R6, [R4, #0x48] \n"
  99 "    STR     R7, [R4, #0xD4] \n"
 100 "    STR     R8, [R4, #0xB4] \n"
 101 "    LDR     R0, [R4, #0x14] \n"
 102 "    ADD     R0, R0, #1 \n"
 103 "    STR     R0, [R4, #0x14] \n"
 104 "    STR     R5, [R4, #0x4C] \n"
 105 
 106 "loc_FF9A97BC:\n"
 107 "    STR     R5, [R4, #0xC] \n"
 108 "    B       loc_FF9A9850 \n"
 109 
 110 "loc_FF9A97C4:\n"
 111 "    BL      sub_FF9A8FB4 \n"
 112 "    B       loc_FF9A9850 \n"
 113 
 114 "loc_FF9A97CC:\n"
 115 "    LDR     R1, [R4, #0xB4] \n"
 116 "    BLX     R1 \n"
 117 //begin patch
 118 "    LDR     R0, =video_compression_rate \n" // added
 119 "    BL      set_quality \n"                 // added
 120 //end patch
 121 "    B       loc_FF9A9850 \n"
 122 
 123 "loc_FF9A97D8:\n"
 124 "    LDR     R1, [R0, #0x18] \n"
 125 "    LDR     R2, [R0, #0x28] \n"
 126 "    LDR     R3, [R0, #0x24] \n"
 127 "    LDR     R0, [R0, #4] \n"
 128 "    BL      sub_FFAE37B0 \n"
 129 "    B       loc_FF9A9850 \n"
 130 
 131 "loc_FF9A97F0:\n"
 132 "    LDR     R0, [R4, #0x4C] \n"
 133 "    CMP     R0, #5 \n"
 134 "    STRNE   R5, [R4, #0x3C] \n"
 135 "    B       loc_FF9A9850 \n"
 136 
 137 "loc_FF9A9800:\n"
 138 "    BL      sub_FF9A8C24 \n"
 139 "    B       loc_FF9A9850 \n"
 140 
 141 "loc_FF9A9808:\n"
 142 "    BL      sub_FF9A8AE4 \n"
 143 "    B       loc_FF9A9850 \n"
 144 
 145 "loc_FF9A9810:\n"
 146 "    LDR     R0, =0xD0C3C \n"
 147 "    LDR     R0, [R0, #8] \n"
 148 "    CMP     R0, #0 \n"
 149 "    LDRNE   R2, =0xFF9A8A04 \n"
 150 "    LDRNE   R0, =0xFF9A8A8C \n"
 151 "    MOVNE   R3, #0 \n"
 152 "    MOVNE   R1, R3 \n"
 153 "    BLNE    sub_FF86F174 \n"
 154 "    MOV     R0, #3 \n"
 155 "    STR     R0, [R4, #0x4C] \n"
 156 "    B       loc_FF9A9850 \n"
 157 
 158 "loc_FF9A983C:\n"
 159 "    BL      sub_FF9A8978 \n"
 160 "    B       loc_FF9A9850 \n"
 161 
 162 "loc_FF9A9844:\n"
 163 "    BL      sub_FF9AA050 \n"
 164 "    B       loc_FF9A9850 \n"
 165 
 166 "loc_FF9A984C:\n"
 167 "    BL      sub_FF9A8854 \n"
 168 
 169 "loc_FF9A9850:\n"
 170 "    LDR     R1, [SP, #4] \n"
 171 "    LDR     R3, =0xFF9A8548 /*'MovieRecorder.c'*/ \n"
 172 "    STR     R6, [R1] \n"
 173 "    STR     R9, [SP] \n"
 174 "    LDR     R0, [R4, #0x34] \n"
 175 "    MOV     R2, R10 \n"
 176 "    BL      sub_006B7E04 /*_PostMessageQueueStrictly*/ \n"
 177 "    B       loc_FF9A96FC \n"
 178 );
 179 }

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