Esato

Forum > Sony Ericsson / Sony > Software, Firmware and Drivers > How to increase sharpness in C902 original camdriver?

Author How to increase sharpness in C902 original camdriver?
zide
Satio Silver
Joined: Jul 20, 2009
Posts: 481
From: Portugal
PM
Posted: 2010-04-16 04:18
Reply with quoteEdit/Delete This PostPrint this post
Hello guys,

I want to increase the sharpness of the latest C902 camdriver. Do you know where should I edit?
See my photos taken with the C902, Satio or E72 in here!
brazzuka's
Xperia X10 White
Joined: Nov 14, 2007
Posts: > 500
From: South World-Antartida-Sweden
PM, WWW
Posted: 2010-04-16 12:50
Reply with quoteEdit/Delete This PostPrint this post

@ zide wrote:
Hello guys,
I want to increase the sharpness of the latest C902 camdriver. Do you know where should I edit?

model c902/c903/w902 basics functions find this line in customize area in scenes
#SET_REG(22,XX) //FPS
#SET_REG(64,XX) // Constant shutter
#COM_EVENT(06,XX) // Exposure
#COM_EVENT(43,XX) // Focus
#COM_EVENT(54,XX) // Brigthness
#COM_EVENT(55,XX) // Contrast
#COM_EVENT(56,XX) // Sharpness
#COM_EVENT(57,XX) // Hue
#COM_EVENT(58,XX) // Colors Saturation
#SET_REG(61,XX) //ISO auto
etc...
[xx]=value The Hexadecimal are counted from 0 to F:

Example:
/ / NORMAL MODE -------> Name of the scene that will be implemented

FPS = 0A; -------> Frames per second (Increase the value for shots fired in rapid decline and slow)
EXPOSURE = 00; -------> Exposure (Increase the value for brighter pictures)
FOCUS = 00; -------> Focus (Works only to focus on infinity. 0 -> Default infinite, 120 -> Macro)
SHUTTERSPEED = 1D; -------> Shutter (Lower value for shooting fast and slow increase value for firing)
CONTRAST = 02; -------> Contrast (Increase the value to decline to higher contrast and lower contrast)
BRIGHTNESS = 00; -------> Brightness (Increase the value to a higher brightness)
HUE = 20; -------> color temperature (It seems not work for this model, leave as is)
SHARPNESS = 02; Sharpness -------> (Increase the value and increases the sharpness, but also the noise)
zide
Satio Silver
Joined: Jul 20, 2009
Posts: 481
From: Portugal
PM
Posted: 2010-04-17 04:01
Reply with quoteEdit/Delete This PostPrint this post
Mate, sorry my dumbness, but could you please specifie it? Here is the driver, where do I change it?

Thanks

// Release history
//================================================================================

// 2008-07-23 Rev 2.1 Released by Markus Bylesjo for Alona
// 2008-05-29 Rev 2.0 Released by Petter Ostlund for Alona
// 2008-05-12 Rev 1.9 Release for Alona
// 2008-04-11 Rev 1.8 Release for Alona
// 2008-04-09 Rev 1.7 Release for Alona
// 2008-04-02 Rev 1.6 Release for Alona
// 2008-03-31 Rev 1.5 Release for Alona
// 2008-03-06 Rev 1.4 Release for Alona
// 2008-02-14 Rev 1.3 Release for Alona
// 2008-02-01 Rev 1.2 Release for Alona
// 2008-01-29 Rev 1.1 Release for Alona
// 2008-01-22 Rev 1.0 Release for Alona
// 2008-01-07 Rev 0.9 Release for Alona
// 2007-12-11 Rev 0.8 Release for Alona
// 2007-12-04 Rev 0.7 Release for Alona
// 2007-11-23 Rev 0.6 Release for Alona
// 2007-11-14 Rev 0.5 Release for Alona
// 2007-10-24 Rev 0.4 Release for Alona
// 2007-10-17 Rev 0.3 Release for Alona
// 2007-10-08 Rev 0.2 Release for Alona
// 2007-08-27 Rev 0.1 Release for Alona

//Information section
//=========================================================

info_name= ;
info_vendor= ;
info_major_ver=2;
info_minor_ver=1;

// Platform registers used
//=========================================================
// 0, Used in CLEAR_EVENT_FIFO,
// POLL_EVENT_ID,
// jpeg_qtable_selector
// WAIT_FOR_TRIG
// 1, Used in SET_REG,
// CLEAR_EVENT
// SEND_COMMAND,
// jpeg_qtable_selector
// 2, Used in CLEAR_EVENT (Event info stored),
// CLEAR_EVENT_FIFO,
// POLL_EVENT_ID,
// jpeg_qtable_selector
// 3, Used in CLEAR_EVENT (Event id stored),
// CLEAR_EVENT_FIFO,
// POLL_EVENT_ID,
// 4, Used in READ_REG (value stored)
// Property 6
// 5, Used in Property 6,10,15,20,23
// UPDATE_MIN_FRMRATE
// UPDATE_PHOTO
// UPDATE_WB
// 6,
// 7, JPEG -> draft auto 1 = Done 0 = Not done
// 8, Start-up flag 1 = startup 0 = not startu
// 9, 0:Init 1:ReadyForBurstOutput 2:WaitForEV_RECORD_STATUS 3:BurstOutput
// a, Used to remember EV value
// b, Used in Property 29, BestPic operation
// seq_pv_verify
// c, Used for flash ratio
// d, Used to remember Xenon flash mode (property 14)
// e, Used for picture readout, 0 => normal, burst 1 => read out pict 1 ...
// f, Used as flags:
// bit 0, Image stabilization 1 = ON, 0 = OFF
// bit 1, High sensitivity 1 = ON, 0 = OFF
// bit 2, Any draft mode 1 = YES, 0 = NO
// bit 3, Snapshot format 1 = JPEG, 0 = YCbCr
// bit 4, Flash LED needed 1 = Yes, 0 = NO
// bit 5, JPEG compression 1 = Normal, 0 = Low compression
// bit 6, Flash was used 1 = True, 0 = False
// bit 7, Menu mode(low frate) 1 = True, 0 = False
// bit 8, Face detection 1 = ON, 0 = OFF
// bit 9, Focus range 1 = Full, 0 = Normal
// bit A, Photometry spot 1 = ON, 0 = OFF
// g, Used for x-coordinate of AF-area
// h, Used for y-coordinate of AF-area
// i, Used for width of AF-area
//
// Macros for camera
//================================================

SET_REG = // Sets register to value
05 02 00 !0 !1 $f // Syntax: SET_REG(REG,VAL)
$r2 1 1 $d0002 //
;

READ_REG = // Read from camera and put result in platf. reg 4
05 01 00 !0 01 $f // Syntax: READ_REG(REG)
$r2 4 4 $d0002 // Result saved in reg 4.
;

CLEAR_EVENT = // Clears event register. FIFO is not cleared
05 01 00 03 03 $f // Packet length, access code, id number, reg to read (int source), req packet length
$r4 1 123 $d0002 // Put Int_source in reg 1, Event_info in reg 2 and Event_id in reg 3
$c3 00 // If internal register 3 holds 0 (means the queue was empty)
$"CAMDRIVER0: Queue_was_empty"
$cl
$"CAMDRIVER0: Cleared_Int_Source_%1_Event_Info_%2_Event_ID_%3"
$cx
#SET_REG(06,03) // Clears the event
;

CLEAR_EVENT_FIFO = // Clears the event FIFO
$s0 01 // Set internal register 0 to 0x01 (otherwise the loop won't even start)
[ 0 ff // Loop 0xff times or quit looping when internal register 0 holds 0
#CLEAR_EVENT // Read the event and clear it
$c3 00 // If internal register 3 holds 00 (= if EVENT_ID equals 00, meaning the queue is empty)
$s0 00 // Set internal register 0 to 0x00 in order to exit the loop
$cx
]
;

SEND_COMMAND = // Only send command, no reply is read out
06 02 00 01 !1 !0 $f // Syntax: SEND_COMMAND(REG,VALUE)
$r3 111 $d0002 //
;

WAIT_FOR_TRIG = // Listen to TRIG
$h 0 02 5 1000 // Listen to trig on Application GPIO_02 = TRIG
$c0 00
$"CAMDRIVER0: TRIG_Timeout" // No event occured
$cl
$"CAMDRIVER0: TRIG_Recieved" // Event occured
$cx
;
// Reads and clears events until the specified event occurs.
POLL_EVENT_ID = // Syntax: POLL_EVENT_ID($s4 Event Identification)
!0 // "Execute" the first parameter
$s0 01 // Set internal register 0 to 0x01 (otherwise the loop won't even start)
[ 0 ff // Loop 0xff times or quit looping when internal register 0 holds 0
#CLEAR_EVENT // Clear event. If the event id (which the CLEAR_EVENT-makro will store in
// internal register 2) is equal to 0xea (= EV_MODE_CHANGED)
$-3 r4 // Subtract the contents of internal register 4 from the contents of register 3 (EVENT_ID)
// and store the result in internal register 3
$c3 00 // If internal register 3 holds 0
$"CAMDRIVER0: Successfully_acknowledged_Event_ID_%4"
$s0 00 // Set internal register 0 to 0x00 in order to exit the loop
$cx // End if
]
;

CAPTURE_EVENT =
#WAIT_FOR_TRIG
#CLEAR_EVENT
;

CHANGE_MODE = // Syntax: CHANGE_MODE(command, value)
#CLEAR_EVENT_FIFO // Clear the fifo
#SEND_COMMAND(!0,!1) // Send command
#POLL_EVENT_ID($s4 ea) // Wait for EV_mode_changed (0xea)
#SET_REG(06,03)
;

COM_EVENT = // Syntax: COM_EVENT(command, value)
#CLEAR_EVENT_FIFO
#SEND_COMMAND(!0,!1)
#WAIT_FOR_TRIG
#CLEAR_EVENT
;

UPDATE_WB = // Updates white balance if necessary
$p5 01
$c5 00 // WB is auto?
$cl
$u01 // Update WB
$cx;

UPDATE_PHOTO = // Updates photo metering
$p5 16
$c5 00 // Photo metering is not spot?
$cl
$u16 // Update photo metering => spot
$cx;


DOC_MODE = // Updates special doc scene settings
#COM_EVENT(06,FD) // Decrease exposure by 2/3
#COM_EVENT(55,01) // Increase contrast to 1
#COM_EVENT(56,08) // Increase sharpness to max (8)
#SET_REG(AD,FF) // Decrease flash pulse
;

NOT_DOC_MODE = // Reverses special doc scene settings
#COM_EVENT(06,00) // Reset exposure
#COM_EVENT(55,01) // Reset contrast
#COM_EVENT(56,06) // Reset sharpness
#SET_REG(AD,00) // Reset flash pulse width
;

UPDATE_MIN_FRMRATE = // Updates minimum framerate
$p5 10
$c5 03
#SET_REG(22,04) // DRAFT_MIN_FRMRATE 2 fps
$cl
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
$cx;

TO_DRAFT = // Changes to draft (but not on display)
$cf.02 0 // If not draft
#CHANGE_MODE(33,00) // MODE_MAIN
$sf.02 1 // Set draft flag to 1
$cl
$cx
;

//Camera characteristics section
//=========================================================

cam_power_on_0 = 5, 2, 63, 0, 01; // RST pin (PO3=Port 6, pin 3), delay 5ms
cam_power_on_1 = 5, 2, 61, 1, 01; // Videokamera standby (PO1=Port6, pin 1)
cam_power_on_2 = 5, 2, 62, 1, 00; // VDD_SD (PO2=Port 6, pin 2) delay 5ms
cam_power_on_3 = 5, 2, 60, 1, 01; // VDD_SA etc (PO0=Port6, pin 0) delay 5ms
cam_power_on_4 = 5, 3, 9, 6590,05; // Turn on 26 MHz clock, delay 5ms
cam_power_on_5 = 5, 2, 63, 1, 01; // Release RST (PO3=Port 6, pin 3)
cam_power_on_6 = 5, 1, 40, 1, 01; // VDD_FD_EN output
cam_power_on_7 = 5, 2, 40, 1, 01; // VDD_FD_EN high


cam_power_off_0 = 5, 2, 63, 0, 05; // RST pin (PO3=Port 6, pin 3), delay 5ms
cam_power_off_1 = 5, 3, 9, 0, 05; // Turn off 26 MHz clock and wait 5 ms
cam_power_off_2 = 5, 2, 60, 0, 05; // VDD_SA etc (PO0=Port6, pin 0) delay 5ms
cam_power_off_3 = 5, 2, 62, 0, 05; // VDD_SD (PO2=Port 6, pin 2) delay 5ms
cam_power_off_4 = 5, 2, 61, 0, 05; // Videokamera standby (PO1=Port6, pin 1)
cam_power_off_5 = 5, 2, 40, 0, 05; // VDD_FD_EN low

cam_i2c_address = 1F;
cam_i2c_clock = 190; // Default 400 kHz
cam_vf_clock_freq = 9, 6590; // 26 MHz clock
cam_ss_clock_freq = 9, 6590; // 26 MHz clock

cam_vf_format = B100;
cam_ss_format = 0001; // JPEG default
cam_ss_format_10 = B100; // YCbCr
cam_ss_format_11 = B100; // YCbCr

cam_data_offset = 2; // JPEG default
cam_data_offset_10 = 0; // YCbCr
cam_data_offset_11 = 0; // YCbCr

cam_vf_sync = 5;
cam_ss_sync = 5;

cam_post_processing_20 = 1; // viewfinder rotation
cam_post_processing_25 = 1; // videotelephony
cam_post_processing_26 = 1; // videotelephony
cam_post_processing_29 = 1; // video recording

cam_ss_jpeg_buf_size_1 = 25800; // 150 KB buffer for 640x480 SS
cam_ss_jpeg_buf_size_2 = 64000; // 400 KB buffer for 1280x960 SS
cam_ss_jpeg_buf_size_4 = 96000; // 600 KB buffer for 1632x1244 SS
cam_ss_jpeg_buf_size_5 = E1000; // 900 KB buffer for 2048x1536 SS
cam_ss_jpeg_buf_size_6 = 177000; //1500 KB buffer for 2592x1944 SS


// Supported sizes
//================================================

sup_sizes =

1[280,1E0,0], // SS 640 x 480 JPEG
2[500,3C0,0], // SS 1280 x 960 JPEG 1M

4[660,4C8,0], // SS 1632 x 1224 JPEG 2M
5[800,600,0], // SS 2048 x 1536 JPEG 3M
6[A20,798,0], // SS 2592 x 1944 JPEG 5M

10[140, F0,0], // SS 320 x 240 YCbCr
11[280,1E0,0], // SS 640 x 480 YCbCr

20[140,F0,BB8], // VF 320 x 240 YCbCr 30 fps
21[140,F0,5DC], // VF 320 x 240 YCbCr 15 fps

25[60,80,4B0], // VT 96 x 128 YCbCr 12 fps max
26[90,B0,4B0], // VT 144 x 176 YCbCr 12 fps max

29[90,B0,3E8], // VR 144 x 176 YCbCr 10 fps fixed
2a[140,F0,BB8], // VR 320 x 240 YCbCr 29,5 - 30 fps fixed
2b[140,F0,5DC], // VR 320 x 240 YCbCr 15 fps fixed
2c[140,F0,2EE], // VR 320 x 240 YCbCr 7.5 fps fixed
2f[140,F0,BB8] // VF 320 x 240 YCbCr 30 fps
;


// I2C sequences
//================================================

seq_init = // This sequence is run after power_on
$sa 09 // EV = 0
$sf 00 // Set all flags to zero
$sf.05 1 // Normal JPEG compression
$sf.02 1 // Set draft flag to YES
$s7 01 // Quick start
$se 00 // Normal snapshot operation
$sd 02 // Flash mode "auto"
$sg 00 // Reset x-coord AF
$sh 00 // Reset y-coord AF
$si 00 // Reset width AF
$sj 00 // Reset height AF
#CAPTURE_EVENT // EV_CAM_READY
#CAPTURE_EVENT // EV_MUTE_OFF
#SET_REG(29,01) // STILL_OUT_REPEAT = 1
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(6C,00) // No AF-light
08 02 00 9A // Start sending 4 bytes at adress 9A
32 10 30 3C // CC_OFFSET
$f $r5 11111 $d0002

08 02 00 A2 // Start sending 4 bytes at adress A2
00 21 // FLASH
01 21
$f $r5 11111 $d0002
#COM_EVENT(5A,01) // FLASH_INFO =1
;

seq_ping = ;


// Supported properties
//===================================================================

sup_properties =

0[3,f,9], // Exposure
1[0,4,0], // White balance
2[0,3,0], // Flicker
3[0,1,0], // Vertical mirroring
4[0,1,0], // Horisontal mirroring
5[0,1,0], // JPEG compression
6[A,A0,A], // Step zoom
7[0,1,0], // Night mode, HS ON/OFF
8[0,4,0], // Effects
9[0,1,0], // Focus mode
A[0,2,0], // Focus operation
B[0,0,0], // EXIF info 1
C[0,0,0], // EXIF info 2
//D[0,0,0], //
E[0,4,0], // Xenon/Pulsed LED flash support
F[0,FFFFFFFF,0], // LED flash info
10[0,7,0], // Scenes
//11[0,4,0],
12[0,1,0], // Low framerate mode
//13[0,0,0], //
14[0,FFFFFFFF,0], // Set AF area
//15[0,0,0], //
16[0,1,0], // Photo metering
17[0,0,0], // Xenon flash required
18[0,1,0], // Image stabilization
19[0,2,0], // Continuous zoom
//1A[0,0,0],
1B[0,9,0], // Snapshot operation
1C[0,3,0], // BestPic picture size
1D[0,4,0], // BestPic Operation
1E[0,1,0], // Reset and Test pattern
1F[0,B,0] // Flash LED calibration and AE tests
;


// Property 0, Exposure
//---------------------------------------------------

seq_set_prop_0 =
#TO_DRAFT
$s5 %0 $ma 5 $-5 09
#COM_EVENT(06,$w5)
;

seq_get_prop_0 =
$m0 a $s1 00 $s2 00 $s3 00
;


// Property 1, White balance
//---------------------------------------------------

seq_set_prop_1_0 =
#TO_DRAFT
#COM_EVENT(11,00); // Auto
seq_set_prop_1_1 =
#TO_DRAFT
#COM_EVENT(11,03); // Incandescent
seq_set_prop_1_2 =
#TO_DRAFT
#COM_EVENT(11,04); // Flourescent
seq_set_prop_1_3 =
#TO_DRAFT
#COM_EVENT(11,05); // Outdoor clear sky
seq_set_prop_1_4 =
#TO_DRAFT
#COM_EVENT(11,06); // Outdoor cloudy


// Property 2, Flicker mode
//---------------------------------------------------

seq_set_prop_2_0 = #COM_EVENT(21,01); // Auto
seq_set_prop_2_1 = #COM_EVENT(21,02); // 50 Hz
seq_set_prop_2_2 = #COM_EVENT(21,03); // 60 Hz
seq_set_prop_2_3 = #COM_EVENT(21,00); // Disable


// Property 3, Vertical mirroring
//---------------------------------------------------

seq_set_prop_3_0 = #COM_EVENT(52,00); // Off
seq_set_prop_3_1 = #COM_EVENT(52,0A); // On


// Property 4, Horizontal mirroring
//---------------------------------------------------

seq_set_prop_4_0 = #COM_EVENT(52,00); // Off
seq_set_prop_4_1 = #COM_EVENT(52,05); // On


// Property 5, JPEG compression
//---------------------------------------------------

seq_set_prop_5_0 = $sf.05 1; // Normal compression
seq_set_prop_5_1 = $sf.05 0; // Low compression


// Property 6, Zoom
//---------------------------------------------------

seq_set_prop_6 = // Set zoom level y = -60x/150 + 68
#TO_DRAFT
$s4 %0 $ma 4
$*4 3C $/4 96
$s5 44 $-5 r4
#SET_REG(67,3C) // ZM_SMTH_SPEED = 60
#COM_EVENT(61,$w5); // Send value to camera

seq_get_prop_6 =
#TO_DRAFT
#READ_REG(69) // Get zoom level x = -150y/60 + 170
$*4 96 $/4 3C $s0 AA
$-0 r4 $s1 00 $s2 00 $s3 00;


// Property 7, Night mode
//---------------------------------------------------

seq_set_prop_7_0 = // Normal mode
// $"CAMDRIVER0: Night mode OFF"
// $sf.01 0
// #CHANGE_MODE(34,00) // Mode draft
// $cf.00 1 // If imst mode
// #CHANGE_MODE(35,00) // IS_DRAFT mode
// $cl
// $cx
;

seq_set_prop_7_1 = // HS mode ON
// $"CAMDRIVER0: Night mode ON"
// $sf.01 1
// #CHANGE_MODE(34,00) // Mode draft
// #CHANGE_MODE(37,00) // Mode HS draft
// $cf.00 1 // If imst mode
// #CHANGE_MODE(38,00) // Mode IS HS draft
// $cl
// $cx
;

// Property 8, Effects
//---------------------------------------------------
// 0 => normal, 1 => negative, 2 => solarize, 3 => sepia
// 4 => black&white

seq_set_prop_8 =
$s5 %0
#TO_DRAFT
#COM_EVENT(53,$w5)
;


// Property 9, Focus mode
//---------------------------------------------------

seq_set_prop_9_0 =
#TO_DRAFT
$sf.09 0 // Focus flag normal
#SET_REG(6A,00) // Normal range
;

seq_set_prop_9_1 =
#TO_DRAFT
$sf.09 1 // Focus flag full
#SET_REG(6A,01) // Full range
;


// Property 10, Focus operation
//----------------------------------------------------

seq_set_prop_a_0 = // Stop AF
$cf.02 0 // If not in draft mode
#CHANGE_MODE(33,00) // MODE_MAIN
$sf.02 1 // Set draft flag to 1
#COM_EVENT(43,00) // MANUAL_FOCUS = 00, Infinity
#COM_EVENT(5A,01) // FLASH_INFO = 01
$cx
;

seq_set_prop_a_1 = // Start AF
$sf.02 0 // Not in draft mode
$cf.09 1 // Full range?
#SET_REG(6A,05) // 3 frames for stab of AF-light
$cl // Else normal range
#SET_REG(6A,04) // 3 frames for stab of AF-light
$cx
#CHANGE_MODE(31,06) // Half-release
;

seq_set_prop_a_2 = // Go to infinity, do not autofocus!
#CHANGE_MODE(31,02) // Half-release
$sf.02 0 // Not in draft mode
;

seq_get_prop_a = // Status of focus operation
05 01 00 03 03 $f
$r4 1 123 $d0005
$c3 e9 // If EV_HALF_REL, e9
$b2 00 4 1 // Remove the flash notification bit
$c2 00
$"CAMDRIVER0: Focus_operation_succeded"
$s0 04
$cf.06 1 // check flash flag
#SEND_COMMAND(72,00)
#READ_REG(71)
$"CAMDRIVER0: Lens_position_=_%4"
$cg4 28 // 0x28 = 40d
#SET_REG(95,01) // ISO100
$cl
#SET_REG(95,04) // ISO200
$cx
$cl
$cx
$cl
$"CAMDRIVER0: Focus_operation_failed"
$s0 05
$cf.09 1 // Full range?
$"CAMDRIVER0: Autofocus full range"
#SET_REG(95,01) // ISO100
$cl
$"CAMDRIVER0: Autofocus normal range"
#SET_REG(95,04) // ISO200
$cx
$cx
$"CAMDRIVER0: Received_and_cleared_Int_Source_%0_Event_Info_%2_Event_ID_%3"
#SET_REG(06,03) // Clears the event
$cl
$"CAMDRIVER0: Focus_operation_not_finnished"
$s0 03
$cx
$s1 00 $s2 00 $s3 00;


// Property 11, EXIF 1
//----------------------------------------------------

seq_get_prop_b =
#COM_EVENT(72,00) // INFO_GET_DATA
05 01 00 B0 04 $f // Read 4 bytes from adress B0
$r5 0 0 1 2 3 $d0002 // ISO r0 r1, Shutter r2 r3
;

// Property 12, EXIF 2
//----------------------------------------------------

seq_get_prop_c =
#COM_EVENT(72,00) // INFO_GET_DATA
05 01 00 B4 02 $f // Read 2 bytes from adress B4
$r3 0 0 1 $d0002 // CC r0, Distance r1
$cf.06 1
$ce 00 // If not BestPic
$s2 01 // Flash
$cl
$s2 00 // BestPic, no flash used even if
$cx // it was dark
$cl
$s2 00 // No flash
$cx
#READ_REG(4A) $m3 4 // Q-value
;

// Property 14, Flash support
//----------------------------------------------------

seq_set_prop_e_0 = // Off
$sd 00
#SET_REG(6C,00) // No AF-assist light
#SET_REG(91,00) // FLASH_XENON_MODE = 0
$"CAMDRIVER0: Flash LED OFF"
;

seq_set_prop_e_1 = $sd 01;

seq_set_prop_e_2 =
$sd 02 // Auto internal flash
$"CAMDRIVER0: Flash LED AUTO"
;

seq_set_prop_e_3 =
$sd 03 // Auto red-eye
;

seq_set_prop_e_4 = // Forced on, only for testing
$sd 04
#SET_REG(6C,1B) // 3 frames, camera controls AF
#SET_REG(A7,70) // FLASH_PLED_LUMI_RATIO = 7.0 100mA prepuls
#SET_REG(91,06) // Adjusted exposure
$"CAMDRIVER0: Flash LED ON (Forced)"
;

// Property 15 Flash LED calibration and current
//----------------------------------------------------

seq_set_prop_f = // Sets LED current and CC
$s0 00 $s1 00 // Initialize
$s0 %0 $/0 0F // FLASH CURRENT LSB
$s1 %1 $*1 0F // FLASH CURRENT MSB
$+0 r1

$s5 %2 // Flash CC_B
$s6 %3 // Flash CC_R

$+5 05 // Increase blue with 5 steps
$-6 0A // Decrease red with 10 steps

$"CAMDRIVER0: Modified_current_value_%0"
$cg0 44 // >1100
$sc 80 // 8.0
$"CAMDRIVER0: 1200_mA"
$+5 03
$-6 01
$cl $cx

$cs0 45 // 900
$sc 70 // 7.0
$"CAMDRIVER0: 1000_mA"
$+5 04
$-6 01
$cl $cx
$cl $cx

$cs0 39 // 700
$sc 60 // 6.0
$"CAMDRIVER0: 800_mA"
$+5 06
$-6 02
$cl $cx
$cl $cx

$cs0 2C // 500
$sc 50 // 5.0
$"CAMDRIVER0: 600_mA"
$+5 08
$-6 03
$cl $cx
$cl $cx

$c0 00 // No current?
$sc 00
$cl
$cx

#SET_REG(A7,$wc) // FLASH_PLED_LUMI_RATIO = reg c
$"CAMDRIVER0: FLASH_CC_B_%5"
#SET_REG(99,$w5) // FLASH_CC_B
$"CAMDRIVER0: FLASH_CC_R_%6"
#SET_REG(98,$w6) // FLASH_CC_R
;

// Property 16, Scenes
//----------------------------------------------------

seq_set_prop_10_0 = // Normal
$sa 09
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,00) // Auto scene
#UPDATE_WB
#UPDATE_PHOTO
#NOT_DOC_MODE // Must be called before UPDATE_ISO
#CHANGE_MODE(34,00)
#COM_EVENT(5A,01) // FLASH_INFO = 1
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_1 = // Portrait
$sa 09
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,01) // Portrait scene
#UPDATE_WB
#NOT_DOC_MODE
#CHANGE_MODE(34,00)
#COM_EVENT(5A,01) // FLASH_INFO = 1
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_2 = // Landscape
$sa 09
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,06) // Landscape scene
#UPDATE_WB
#NOT_DOC_MODE
#CHANGE_MODE(34,00)
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_3 = // Night
$sa 09
#TO_DRAFT
#SET_REG(64,23) // SCENE_SLOW_SHUTTER = 35, 1/2
#SET_REG(22,02) // DRAFT_MIN_FRMRATE 1 fps
#COM_EVENT(51,04) // Night scene
#UPDATE_WB
#NOT_DOC_MODE
#CHANGE_MODE(34,00)
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_4 = // Night portrait
;

seq_set_prop_10_5 = // Beach & snow
$sa 09
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,02) // Beach & snow scene
#UPDATE_WB
#NOT_DOC_MODE
#CHANGE_MODE(34,00)
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_6 = // Sports
$sa 09
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,05) // Sports scene
#UPDATE_WB
#NOT_DOC_MODE
#CHANGE_MODE(34,00)
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;

seq_set_prop_10_7 = // Document
$sa 07
#TO_DRAFT
#SET_REG(64,1D) // SCENE_SLOW_SHUTTER = 29, 1/8
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
#COM_EVENT(51,00) // Custom scene
#UPDATE_WB
#DOC_MODE
#CHANGE_MODE(34,00)
#COM_EVENT(5A,01) // FLASH_INFO = 1
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cl // Not in IS
$cx
;


// Property 18, Framerate reduction/restoration for GUI speed
//------------------------------------------------------------

seq_set_prop_12_0 = // Restore framerate
$"CAMDRIVER0: Restore framerate"
$sf.07 0 // Set flag to "not in menu"
$z5 // Put res id in reg 5
$c5 20 // If res id 0x20
$p6 10 // Put scene value in reg 6
$c6 03 // Scene is night?
#SET_REG(22,02) // DRAFT_MIN_FRMRATE 1 fps
$cl
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
$cx
#SET_REG(21,3C) // DRAFT_MAX_FRMRATE 30 fps
$cx
$c5 2f // If res id 0x20
$p6 10 // Put scene value in reg 6
$c6 03 // Scene is night?
#SET_REG(22,02) // DRAFT_MIN_FRMRATE 1 fps
$cl
#SET_REG(22,0A) // DRAFT_MIN_FRMRATE 5 fps
$cx
#SET_REG(21,3C) // DRAFT_MAX_FRMRATE 30 fps
$cx
$c5 21 // If res id 0x21
06 02 00 21 // Start sending 2 bytes at adress 21
3C // DRAFT_MAX_FRMRATE 30 fps
0A // RAFT_MIN_FRMRATE 5 fps
$f $r3 111 $d0002
$cx
$c5 25 // If res id 0x25
06 02 00 21 // Start sending 2 bytes at adress 21
18 // DRAFT_MAX_FRMRATE 12 fps
18 // RAFT_MIN_FRMRATE 12 fps
$f $r3 111 $d0002
$cx
$c5 26 // If res id 0x26
06 02 00 21 // Start sending 2 bytes at adress 21
18 // DRAFT_MAX_FRMRATE 12 fps
18 // RAFT_MIN_FRMRATE 12 fps
$f $r3 111 $d0002
$cx
$c5 29 // If res id 0x29
06 02 00 24 // Start sending 2 bytes at adress 24
14 // HS_DRAFT_MAX_FRMRATE 10 fps
14 // HS_DRAFT_MIN_FRMRATE 10 fps
$f $r3 111 $d0002
$cx
$c5 2a // If res id 0x2a
06 02 00 24 // Start sending 2 bytes at adress 24
3C // HS_DRAFT_MAX_FRMRATE 30 fps
3B // HS_DRAFT_MIN_FRMRATE 29,5 fps
$f $r3 111 $d0002
$cx
$c5 2b // If res id 0x2b
06 02 00 24 // Start sending 2 bytes at adress 24
1E // HS_DRAFT_MAX_FRMRATE 10 fps
1E // HS_DRAFT_MIN_FRMRATE 10 fps
$f $r3 111 $d0002
$cx
$c5 2c // If res id 0x2c
06 02 00 24 // Start sending 2 bytes at adress 24
0F // HS_DRAFT_MAX_FRMRATE 7,5 fps
0F // HS_DRAFT_MIN_FRMRATE 7,5 fps
$f $r3 111 $d0002
$cl $cx

#CHANGE_MODE(34,00)
#COM_EVENT(5A,01) // FLASH_INFO = 1
$cf.00 1 // If imst mode
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cf.01 1 // If (IS) HS mode
#CHANGE_MODE(38,00) // Mode IS HS draft
$cl
$cx
$cl // Not in IS
$cf.01 1 // If HS mode
#CHANGE_MODE(37,00) // Mode HS draft
$cl
$cx
$cx
;

seq_set_prop_12_1 = // Decrease framerate
$"CAMDRIVER0: Decrease framerate"
$sf.07 1 // Set flag to "menu" mode
#SET_REG(22,0F) // DRAFT_MIN_FRMRATE 7,5 fps
#SET_REG(25,0F) // HS_DRAFT_MIN_FRMRATE 7,5 fps
#SET_REG(21,0F) // DRAFT_MAX_FRMRATE 7,5 fps
#SET_REG(24,0F) // HS_DRAFT_MAX_FRMRATE 7,5 fps
#CHANGE_MODE(34,00)
;


// Property 20 , Set Autofocus area
//----------------------------------------------------

seq_set_prop_14 = // Set AF window
$s5 00
$s5 %0 $mg 5 // Put H-position in reg g
$s5 %1 $mh 5 // Put V-position in reg h
$s5 %2 $mi 5 // Put Witdth and height of AE in reg i
$s5 %3 // Put FD ON/OFF
$c5 00 // FD Off?
$sf.08 0 // Set FD flag OFF
#SET_REG(6D,00) // SCAN_AF_AREA_OFFSET_H
#SET_REG(6E,00) // SCAN_AF_AREA_OFFSET_V
#COM_EVENT(02,00) // AE_MODE = 0x00
$cl // Else FD ON
$sf.08 1 // Set FD flag ON
$cf.0a 1 // Spot ON?
#SET_REG(6D,00) // SCAN_AF_AREA_OFFSET_H
#SET_REG(6E,00) // SCAN_AF_AREA_OFFSET_V
#COM_EVENT(02,00) // AE_MODE = 0x00
$cl
#SET_REG(6D,$wg) // SCAN_AF_AREA_OFFSET_H
#SET_REG(6E,$wh) // SCAN_AF_AREA_OFFSET_V
#SET_REG(8B,$wi) // AE_AREA_HALF_SIZE_H
#SET_REG(8C,$wi) // AE_AREA_HALF_SIZE_V
#SEND_COMMAND(02,05) // AE_MODE = 0x05 (Face detection)
$cx
$cx
;


// Property 22, Photo metering
//----------------------------------------------------

seq_set_prop_16_0 =
#TO_DRAFT
#COM_EVENT(08,00) // Multimode
$sf.0A 0 // Spot flag OFF
;

seq_set_prop_16_1 =
#TO_DRAFT
#COM_EVENT(08,01) // Spot
#COM_EVENT(02,00) // AE_MODE = 0x00
$sf.0A 1 // Spot flag ON
;


// Property 23, Flash required
//----------------------------------------------------

seq_get_prop_17 = // Return values: 0 = No flash, 1 = flash
$sf.06 0 // Initialize flash flag
#READ_REG(93)
$-4 02
$m0 4
$c0 01 // Low light?
$cc 00
#SET_REG(91,00) // Set flash OFF - no current
$cl
$cd 00 // Flash OFF?
#SET_REG(91,00) // Set flash OFF
$cl // Else check light level, Auto, Auto RER
$sf.06 1 // Set flash flag
#SET_REG(6C,23) // 4 frames, camera controls AF
#SET_REG(91,06) // Exposure adjustment
$cx
$cx
$cl
#SET_REG(91,00) // Set flash OFF
#SET_REG(6C,00) // No AF-light
$cx
$s1 00 $s2 00 $s3 00
;

// Property 24, Image stabilization
//----------------------------------------------------

seq_set_prop_18_0 = // IS Off
#TO_DRAFT
#CHANGE_MODE(34,00) // DRAFT_MODE
$sf.00 0
#COM_EVENT(5A,01) // FLASH_INFO = 1
$cf.01 1 // If HS mode
#CHANGE_MODE(37,00) // Mode HS draft
$cl
$cx
;

seq_set_prop_18_1 = // IS On
#TO_DRAFT
$sf.00 1
#CHANGE_MODE(35,00) // IS_DRAFT mode
$cf.01 1 // If (IS) HS mode
#CHANGE_MODE(38,00) // Mode IS HS draft
$cl
$cx
;

// Property 25, Continuous zoom
//----------------------------------------------------

seq_set_prop_19_0 = // Stop
#TO_DRAFT
#COM_EVENT(61,84);
seq_set_prop_19_1 = // Zoom in
#TO_DRAFT
#SET_REG(67,01) // ZM_SMTH_SPEED = 1
#COM_EVENT(61,04);
seq_set_prop_19_2 = // Zoom out
#TO_DRAFT
#SET_REG(67,01) // ZM_SMTH_SPEED = 1
#COM_EVENT(61,40);

// Property 27, Snapshot operation
//----------------------------------------------------

seq_set_prop_1b = $se %0; // 0 => Normal, Read out pict 1-9 in BestPic


// Property 28, BestPic image size
//----------------------------------------------------

seq_set_prop_1c_0 = // 5M
#SET_REG(2D,01) // BURST_JPEG_IMAGE_SIZE = 5M
#SET_REG(42,46) // JPEG_INIT_QUALITY = 70d, 0x46
$cf.05 1 // If normal
#SET_REG(45,5A) // JPEG_BURST_TARGET_RATE = 90d 850KB
$cl // Else low compr
#SET_REG(45,5F) // JPEG_BURST_TARGET_RATE = 95d = 897KB
$cx;

seq_set_prop_1c_1 = // 3M
#SET_REG(2D,03) // BURST_JPEG_IMAGE_SIZE = 3M
#SET_REG(42,40) // JPEG_INIT_QUALITY = 64d, 0x40
$cf.05 1 // If normal
#SET_REG(45,40) // JPEG_BURST_TARGET_RATE = 64d 605 KB
$cl // Else low compr
#SET_REG(45,46) // JPEG_BURST_TARGET_RATE = 70d 662 KB
$cx;

seq_set_prop_1c_2 = // 1M
#SET_REG(2D,06) // BURST_JPEG_IMAGE_SIZE = SXGA
#SET_REG(42,32) // JPEG_INIT_QUALITY = 50d, 0x32
$cf.05 1 // If normal
#SET_REG(45,14) // JPEG_BURST_TARGET_RATE = 20d 189KB
$cl // Else low compr
#SET_REG(45,1E) // JPEG_BURST_TARGET_RATE = 30d 283KB
$cx;

seq_set_prop_1c_3 = // VGA
#SET_REG(2D,08) // BURST_JPEG_IMAGE_SIZE = VGA
#SET_REG(42,20) // JPEG_INIT_QUALITY = 32d, 0x20
$cf.05 1 // If normal
#SET_REG(45,05) // JPEG_BURST_TARGET_RATE = 5d 43KB
$cl // Else low compr
#SET_REG(45,0A) // JPEG_BURST_TARGET_RATE = 10d 95KB
$cx;


// Property 29, BestPic operation,
//----------------------------------------------------

seq_set_prop_1d_0 = // Normal burst operation
$sb 00;

seq_set_prop_1d_1 = // Half speed burst operation
$sb 01;

seq_set_prop_1d_2 = // Abort Burst operation
$sb 02;

seq_set_prop_1d_3 = // Start Burst (only for ITP)
#CHANGE_MODE(31,02) // Half-release with focus set to inf
#CHANGE_MODE(39,04)
;

seq_set_prop_1d_4 = // Stop Burst (only for ITP)
#COM_EVENT(3A,00) // Take picture
;

// Reset and test pattern, property 30
//---------------------------------------------------------------

seq_get_prop_1e = // Read AE value
#SEND_COMMAND(71,FF) // Send command INFO_GET_CONV
$d0010
#POLL_EVENT_ID($s4 e5) // Wait for EV_CONVERGENCE (0xe5)
$d0032
#COM_EVENT(72,00)
$d0032
#READ_REG(62)
$s2 00 $s3 00
$m0 4
#READ_REG(63)
$m1 4
$"CAMDRIVER0: AE_=_%1%0"
;

seq_set_prop_1e_0 =
$go 63 0 // Reset low
$d0020
$go 63 1 // Reset high
#CAPTURE_EVENT // EV_CAM_READY
#CAPTURE_EVENT // EV_MUTE_OFF
#SET_REG(29,01) // STILL_OUT_REPEAT = 1
#SET_REG(6C,00) // No AF-light
;

seq_set_prop_1e_1 = // Testpattern
#SET_REG(81,01)
#SET_REG(84,01)
#CHANGE_MODE(34,00)
;

// Led calibration, property 31
//----------------------------------------------------------------

seq_get_prop_1f =
#CLEAR_EVENT_FIFO // Clear the fifo
#SEND_COMMAND(71,FF) // Send command INFO_GET_CONV
$d0010
#POLL_EVENT_ID($s4 e5) // Wait for EV_CONVERGENCE (0xe5)
$d0032
#COM_EVENT(11,02) // CC_MODE = 0x02, All pull in
$d00A0 // Vänta 160 ms
#READ_REG(89) // Read CC_R_LEVEL
$"CAMDRIVER0: CC_R_LEVEL_%0=_%4"
$m5 4
#READ_REG(8A) // Read CC_B_LEVEL
$"CAMDRIVER0: CC_B_LEVEL_%0=_%4"
$m6 4
#COM_EVENT(11,00) // CC_MODE = 0x00, Auto
$m0 5 $m1 6 $s2 00 $s3 00
;

seq_set_prop_1f_0 = // Calibrate LED, only testing
#CLEAR_EVENT_FIFO // Clear the fifo
#SEND_COMMAND(71,FF) // Send command INFO_GET_CONV
$d0010
#POLL_EVENT_ID($s4 e5) // Wait for EV_CONVERGENCE (0xe5)
$d0032
#COM_EVENT(11,02) // CC_MODE = 0x02, All pull in
$d00A0
#READ_REG(89) // Read CC_R_LEVEL
$"CAMDRIVER0: CC_R_LEVEL_%0=_%4"
$m5 4
$+5 02
#READ_REG(8A) // Read CC_B_LEVEL
$"CAMDRIVER0: CC_B_LEVEL_%0=_%4"
$m6 4
$+6 05
#COM_EVENT(11,00) // CC_MODE = 0x00, Auto
$m0 5 $m1 6 $s2 00 $s3 00
#SET_REG(98,$w5) // FLASH_CC_R
#SET_REG(99,$w6) // FLASH_CC_B
;

seq_set_prop_1f_1 = // 1200 mA
$"CAMDRIVER0: 1200_mA"
$s5 5F // Flash CC_B
$s6 2B // Flash CC_R
$+6 02 // Increase red with two steps
$sc 6D // 6.8
$+5 03
$-6 01
$cl $cx
#SET_REG(A7,$wc) // FLASH_PLED_LUMI_RATIO = reg c
#SET_REG(99,$w5) // FLASH_CC_B
#SET_REG(98,$w6) // FLASH_CC_R
;

seq_set_prop_1f_2 = // 1000 mA
$"CAMDRIVER0: 1000_mA"
$s5 5F // Flash CC_B
$s6 2B // Flash CC_R
$+6 02 // Increase red with two steps
$sc 60 // 6.0
$+5 04
$-6 01
#SET_REG(A7,$wc) // FLASH_PLED_LUMI_RATIO = reg c
#SET_REG(99,$w5) // FLASH_CC_B
#SET_REG(98,$w6) // FLASH_CC_R
;

seq_set_prop_1f_3 =
$"CAMDRIVER0: 800_mA"
$s5 5F // Flash CC_B
$s6 2B // Flash CC_R
$+6 02 // Increase red with two steps
$sc 52 // 5.1
$+5 06
$-6 02
#SET_REG(A7,$wc) // FLASH_PLED_LUMI_RATIO = reg c
#SET_REG(99,$w5) // FLASH_CC_B
#SET_REG(98,$w6) // FLASH_CC_R
;

seq_set_prop_1f_4 =
$"CAMDRIVER0: 600_mA"
$s5 5F // Flash CC_B
$s6 2B // Flash CC_R
$+6 02 // Increase red with two steps
$sc 46 // 4.4
$+5 08
$-6 03
#SET_REG(A7,$wc) // FLASH_PLED_LUMI_RATIO = reg c
#SET_REG(99,$w5) // FLASH_CC_B
#SET_REG(98,$w6) // FLASH_CC_R
;

seq_set_prop_1f_5 =
#SET_REG(95,01) // FLASH_FORCE_ISO = ISO 100
$"CAMDRIVER0: ISO100"
;

seq_set_prop_1f_6 =
#SET_REG(95,04) // FLASH_FORCE_ISO = ISO 200
$"CAMDRIVER0: ISO200"
;

seq_set_prop_1f_7 =
#SET_REG(95,07) // FLASH_FORCE_ISO = ISO 400
$"CAMDRIVER0: ISO400"
;

seq_set_prop_1f_8 =
#SEND_COMMAND(71,32) // Send command INFO_GET_CONV
#POLL_EVENT_ID($s4 e5) // Wait for EV_CONVERGENCE (0xe5)
;

seq_set_prop_1f_9 =
#COM_EVENT(11,02) // CC_MODE = 0x02, All pull in
;

seq_set_prop_1f_a =
#COM_EVENT(11,00) // CC_MODE = 0x00, Auto
;

seq_set_prop_1f_b =
#READ_REG(89) // Read CC_R_LEVEL
$"CAMDRIVER0: CC_R_LEVEL_%0=_%4"
$m5 4
$+5 02
#READ_REG(8A) // Read CC_B_LEVEL
$"CAMDRIVER0: CC_B_LEVEL_%0=_%4"
;


// Viewfinder and snapshot sequences
//=================================================================

seq_ss_config_1 =
$sf.03 1 // JPEG flag to 1
#SET_REG(26,08) // 640 x 480 JPEG and JPEG IMST
$cf.05 1 // If normal compression
$"CAMDRIVER0: VGA NORMAL COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
96 00 // JPEG_MAX_CODE_SIZE = 150d
A0 00 // JPEG_MIN_CODE_SIZE = 10d
37 00 // JPEG_TARGET_CODE_SIZE = 55d
46 // JPEG_INIT_QUALITY = 70d
3C // JPEG_FIRST_QUALITY = 60d
32 // JPEG_LAST_QUALITY = 50d
$f $ra 1111111111 $d0002
$cl // Else low compression
$"CAMDRIVER0: VGA LOW COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
96 00 // JPEG_MAX_CODE_SIZE = 150d
A0 00 // JPEG_MIN_CODE_SIZE = 50d
50 00 // JPEG_TARGET_CODE_SIZE = 80d
50 // JPEG_INIT_QUALITY = 80d
46 // JPEG_FIRST_QUALITY = 70d
3C // JPEG_LAST_QUALITY = 60d
$f $ra 1111111111 $d0002
$cx
;

seq_ss_config_2 =
$sf.03 1 // JPEG flag to 1
#SET_REG(26,06) // 1280 x 960 JPEG and JPEG IMST
$cf.05 1 // If normal compression
$"CAMDRIVER0: 1M NORMAL COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
90 01 // JPEG_MAX_CODE_SIZE = 400d
3C 00 // JPEG_MIN_CODE_SIZE = 60d
C8 00 // JPEG_TARGET_CODE_SIZE = 200d
46 // JPEG_INIT_QUALITY = 70d
3C // JPEG_FIRST_QUALITY = 60d
32 // JPEG_LAST_QUALITY = 50d
$f $ra 1111111111 $d0002
$cl // Else low compression
$"CAMDRIVER0: 1M LOW COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
90 01 // JPEG_MAX_CODE_SIZE = 400d
64 00 // JPEG_MIN_CODE_SIZE = 100d
2C 01 // JPEG_TARGET_CODE_SIZE = 300d
50 // JPEG_INIT_QUALITY = 80d
46 // JPEG_FIRST_QUALITY = 70d
3C // JPEG_LAST_QUALITY = 60d
$f $ra 1111111111 $d0002
$cx
;

seq_ss_config_4 =
$sf.03 1 // JPEG flag to 1
#SET_REG(26,05) // 1632 x 1224 JPEG and JPEG IMST
$cf.05 1 // If normal compression
$"CAMDRIVER0: 2M NORMAL COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
58 02 // JPEG_MAX_CODE_SIZE = 600d
96 00 // JPEG_MIN_CODE_SIZE = 150d
90 01 // JPEG_TARGET_CODE_SIZE = 400d
46 // JPEG_INIT_QUALITY = 70d
3C // JPEG_FIRST_QUALITY = 60d
32 // JPEG_LAST_QUALITY = 50d
$f $ra 1111111111 $d0002
$cl // Else low compression
$"CAMDRIVER0: 2M LOW COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
58 02 // JPEG_MAX_CODE_SIZE = 600d
90 01 // JPEG_MIN_CODE_SIZE = 400d
F4 01 // JPEG_TARGET_CODE_SIZE = 500d
50 // JPEG_INIT_QUALITY = 80d
46 // JPEG_FIRST_QUALITY = 70d
3C // JPEG_LAST_QUALITY = 60d
$f $ra 1111111111 $d0002
$cx
;

seq_ss_config_5 =
$sf.03 1 // JPEG output
#SET_REG(26,03) // 2048 x 1536 JPEG and JPEG IMST
$cf.05 1 // If normal compression
$"CAMDRIVER0: 3M NORMAL COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
20 03 // JPEG_MAX_CODE_SIZE = 800d
90 01 // JPEG_MIN_CODE_SIZE = 400d
58 02 // JPEG_TARGET_CODE_SIZE = 600d
46 // JPEG_INIT_QUALITY = 70d
3C // JPEG_FIRST_QUALITY = 60d
32 // JPEG_LAST_QUALITY = 50d
$f $ra 1111111111 $d0002
$cl // Else low compression
$"CAMDRIVER0: 3M LOW COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
84 03 // JPEG_MAX_CODE_SIZE = 900d
58 02 // JPEG_MIN_CODE_SIZE = 600d
52 03 // JPEG_TARGET_CODE_SIZE = 850d
50 // JPEG_INIT_QUALITY = 80d
46 // JPEG_FIRST_QUALITY = 70d
3C // JPEG_LAST_QUALITY = 60d
$f $ra 1111111111 $d0002
$cx
;

seq_ss_config_6 =
$sf.03 1 // JPEG output
#SET_REG(26,01) // 2592 x 1944 JPEG and JPEG IMST
$cf.05 1 // If normal compression
$"CAMDRIVER0: 5M NORMAL COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
46 05 // JPEG_MAX_CODE_SIZE = 1350d
9E 02 // JPEG_MIN_CODE_SIZE = 670d
E8 03 // JPEG_TARGET_CODE_SIZE = 1000d
46 // JPEG_INIT_QUALITY = 70d
3C // JPEG_FIRST_QUALITY = 60d
32 // JPEG_LAST_QUALITY = 50d
$f $ra 1111111111 $d0002
$cl // Else low compression
$"CAMDRIVER0: 5M LOW COMPRESSION"
0D 02 00 3C // Start sending 13 bytes at adress 3C
DC 05 // JPEG_MAX_CODE_SIZE = 1500d
B0 04 // JPEG_MIN_CODE_SIZE = 1200d
78 05 // JPEG_TARGET_CODE_SIZE = 1400d
50 // JPEG_INIT_QUALITY = 80d
46 // JPEG_FIRST_QUALITY = 70d
3C // JPEG_LAST_QUALITY = 60d
$f $ra 1111111111 $d0002
$cx
;

seq_ss_config_10 =
$sf.03 0 // YCbCr output
#SET_REG(26,0C) // 320 x 240 YCbCr and YCbCr IMST
;

seq_ss_config_11 =
$sf.03 0 // YCbCr output
#SET_REG(26,08) // 640 x 480 YCbCr and YCbCr IMST
;

seq_vf_config_20 = // Viewfinder
$"CAMDRIVER0: Viewfinder id 0x20"
#SET_REG(20,0C) // DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
#SET_REG(21,3C) // DRAFT_MAX_FRMRATE = 30 (60/2)
$cx
#UPDATE_MIN_FRMRATE
$sf.01 0 // HS OFF
;

seq_vf_config_21 = // Viewfinder for BestPic
$"CAMDRIVER0: Viewfinder id 0x21"
#SET_REG(20,0C) // DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
#SET_REG(21,1E) // DRAFT_MAX_FRMRATE = 15 (30/2)
$cx
#UPDATE_MIN_FRMRATE
$sf.01 0 // HS OFF
$s7 00
;

seq_vf_config_25 = // VT
$"CAMDRIVER0: Viewfinder id 0x25"
#SET_REG(20,14) // DRAFT_IMAGE_SIZE 96x128
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
06 02 00 21 // Start sending 2 bytes at adress 21
18 // DRAFT_MAX_FRMRATE 12 fps
18 // RAFT_MIN_FRMRATE 12 fps
$f $r3 111 $d0002
$cx
$sf.01 0 // HS OFF
$cf.02 0 // If not in any draft mode
#CHANGE_MODE(33,00) // MODE_MAIN
$sf.02 1 // Set draft flag to 1
$cl
#CHANGE_MODE(34,00) // normal draft
$cx
;

seq_vf_config_26 = // VT
$"CAMDRIVER0: Viewfinder id 0x26"
#SET_REG(20,12) // DRAFT_IMAGE_SIZE 144x176
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
06 02 00 21 // Start sending 2 bytes at adress 21
18 // DRAFT_MAX_FRMRATE 12 fps
18 // RAFT_MIN_FRMRATE 12 fps
$f $r3 111 $d0002
$cx
$sf.01 0 // HS OFF
$cf.02 0 // If not in any draft mode
#CHANGE_MODE(33,00) // MODE_MAIN
$sf.02 1 // Set draft flag to 1
$cl
#CHANGE_MODE(34,00) // normal draft
$cx
;

seq_vf_config_29 = // VR
$"CAMDRIVER0: Viewfinder id 0x29"
#SET_REG(23,12) // HS_DRAFT_IMAGE_SIZE 144x176
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
06 02 00 24 // Start sending 2 bytes at adress 24
14 // HS_DRAFT_MAX_FRMRATE 10 fps
14 // HS_DRAFT_MIN_FRMRATE 10 fps
$f $r3 111 $d0002
$cx
$sf.01 1 // HS ON
$s7 00
;

seq_vf_config_2a = // VR
$"CAMDRIVER0: Viewfinder id 0x2A"
#SET_REG(23,0C) // HS_DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
06 02 00 24 // Start sending 2 bytes at adress 24
3C // HS_DRAFT_MAX_FRMRATE 30 fps
3B // HS_DRAFT_MIN_FRMRATE 29.5 fps
$f $r3 111 $d0002
$cx
$sf.01 1 // HS ON
$s7 00
;

seq_vf_config_2b = // VR
$"CAMDRIVER0: Viewfinder id 0x2B"
#SET_REG(20,0C) // DRAFT_IMAGE_SIZE 320x240
#SET_REG(23,0C) // HS_DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If menu mode
// do not change max framerate
$cl
06 02 00 24 // Start sending 2 bytes at adress 24
1E // HS_DRAFT_MAX_FRMRATE 15 fps
1E // HS_DRAFT_MIN_FRMRATE 15 fps
$f $r3 111 $d0002
$cx
$sf.01 1 // HS ON
$s7 00
;

seq_vf_config_2c = // VR
$"CAMDRIVER0: Viewfinder id 0x2C"
#SET_REG(23,0C) // HS_DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
06 02 00 24 // Start sending 2 bytes at adress 24
0F // HS_DRAFT_MAX_FRMRATE 7.5 fps
0F // HS_DRAFT_MIN_FRMRATE 7.5 fps
$f $r3 111 $d0002
$cx
$sf.01 1 // HS ON
$s7 00
;

seq_vf_config_2f = // Viewfinder
$"CAMDRIVER0: Viewfinder id 0x2F"
#SET_REG(20,0C) // DRAFT_IMAGE_SIZE 320x240
$cf.07 1 // If in menu mode
// do not change max framerate
$cl
#SET_REG(21,3C) // DRAFT_MAX_FRMRATE = 30 (60/2)
$cx
#UPDATE_MIN_FRMRATE
$sf.01 0 // HS OFF
;

//-----------------------------------------------

seq_vf_start =
$c7 01
$cl
$cf.02 0 // If not in any draft mode
#CHANGE_MODE(33,00) // MODE_MAIN
#COM_EVENT(43,00) // MANUAL_FOCUS = 00, Infinity
#COM_EVENT(5A,01) // FLASH_INFO = 1
$sf.02 1 // Set draft flag to 1
$se 00 // Set snapshot operation to normal
$cl
$cf.00 1 // If imstab mode
$cf.01 1 // If HS mode
$d0005
#CHANGE_MODE(38,00) // IS HS mode
$cl // else
$d0005
#CHANGE_MODE(35,00) // IS mode
$cx
$cl
$cf.01 1 // If HS mode
$d0005
#CHANGE_MODE(37,00) // HS mode
$cl // else
$d0005
#CHANGE_MODE(34,00) // normal draft
#COM_EVENT(5A,01) // FLASH_INFO =1
$cx
$cx
$cx
$cx
$s7 00
;


seq_vf_stop = ;

seq_ss_start =
$cf.02 1 // If draft mode?
#CHANGE_MODE(31,02) // Half-release with focus set to inf
$sf.02 0 // Not in draft mode
$cl
$cx
;

seq_ss_take =
$ce 00 // If not BestPic
$cf.03 1 // IF JPEG
#CHANGE_MODE(36,80) // MODE_IMST_STILL_CAPT, JPEG
#CAPTURE_EVENT // EV_CAPTURE_STATUS, 02 e4
$cl // Else IMST OFF
#CHANGE_MODE(36,00) // MODE_STILL_CAPT, YCbCr
$cx
$cl // Else BestPic mode
#CHANGE_MODE(3A,$we) // Read out pict # stored in reg e
$cx
#CAPTURE_EVENT // Capture EV_CAPTURE_STATUS, 00 E4
;

seq_ss_verify = #CAPTURE_EVENT // Capture EV_CAPTURE_STATUS, 01 E4
$c2 01
$s0 01
$"CAMDRVIER0: Image_verified"
$cl
$"CAMDRIVER0: Image_not_verified"
$cx
;

seq_ss_stop =
$cf.03 1 // If JPEG
$ce 00 // IF normal snapshot
#TO_DRAFT // Also sets the draft flag
#COM_EVENT(43,00) // MANUAL_FOCUS = 00, Infinity
$s7 00 //
$cx
$cx
;

// Functions for synchronized viewfinder images in burst mode.

seq_pv_start =
$cf.02 1 // If draft mode?
#CHANGE_MODE(31,02) // Half-release with focus set to inf
$sf.02 0 // Not in draft mode
$cl
$cx
$"CAMDRIVER0: seq_pv_start"
$s9 00 // BurstStatus -> Init
$cb 00 // If normal interval
#CHANGE_MODE(39,04) // Mode burst start, BURST_INTERVAL = 0, BURST_REMAIN = 4
$cl // Else half speed, every 2nd frame
#CHANGE_MODE(39,14) // Mode burst start, BURST_INTERVAL = 1, BURST_REMAIN = 4
$cx;

seq_pv_stop =
$c9 01
$"CAMDRIVER0: seq_pv_stop"
$s9 03 // BurstStatus -> BurstOutput
#COM_EVENT(3A,00) // Take picture
$cl
$"CAMDRIVER0: seq_pv_stop is waiting for EV_RECORD_STATUS"
$s9 02 // BurstStatus -> WaitForEV_RECORD_STATUS
$cx;

seq_pv_verify =
$h0 02 5 0000 // Wait for TRIG
05 01 00 03 03 $f $r4 0 012 // [source, info, id]
05 02 00 06 03 $f // Release interrupt
$cb 02 // If Burst operation = abort?
$s0 ff // Abort!
$cl
$s0 00
$c2 e3
$b1 00 4 4
$c1 00
$s0 01 // Rotate, i.e synch vf-image
$"CAMDRIVER0: Rotate, synch vf"
$cl
$"CAMDRIVER0: Compr_failed_%0_%1_%2"
$cx
$cl
$cx
$c2 ea // If EVENT_MODE_CHANGED
$c1 50
$s0 ff // Done (Burst output)
$cl
$cx
$cl
$cx
$c2 ee // EV_RECORD_STATUS
$c9 02
$"CAMDRIVER0: EV_RECORD_STATUS(completed)"
$"CAMDRIVER0: Change the mode to BurstOutput"
$s9 03 // BurstStatus -> BurstOutput
#COM_EVENT(3A,00) // Take picture
$s0 00 // Reset register 0 to 0
$cl
$"CAMDRIVER0: EV_RECORD_STATUS(completed)"
$s9 01 // BurstStatus -> ReadyForBurstOutput
$cx
$cl
$cx
$cx;

// JPEG section
//================================================

jpeg_qtable_selector_0 =
$s2 00 #READ_REG(4A) // JPEG_HOST_QUALITY
$m0 4 $s1 00
$"CAMDRIVER0: qtable0=%0"
;

jpeg_qtable_selector_1 =
$s2 01 #READ_REG(4A) // JPEG_HOST_QUALITY
$m0 4 $s1 00
$"CAMDRIVER0: qtable1=%0"
;

jpeg_qtable_0 =
10 0B 0C 0E 0C 0A 10 0E
0D 0E 12 11 10 13 18 28
1A 18 16 16 18 31 23 25
1D 28 3A 33 3D 3C 39 33
38 37 40 48 5C 4E 40 44
57 45 37 38 50 6D 51 57
5F 62 67 68 67 3E 4D 71
79 70 64 78 5C 65 67 63
;

jpeg_qtable_1 =
11 12 12 18 15 18 2F 1A
1A 2F 63 42 38 42 63 63
63 63 63 63 63 63 63 63
63 63 63 63 63 63 63 63
63 63 63 63 63 63 63 63
63 63 63 63 63 63 63 63
63 63 63 63 63 63 63 63
63 63 63 63 63 63 63 63
;

jpeg_qtable_factors =
0,320100,190000,10AB00,C8000,A0000,85500,72500,64000,58E00,50000,
48C00,42B00,3D900,39200,35500,32000,2F100,2C700,2A200,28000,
26200,24600,22D00,21500,20000,1EC00,1DA00,1C900,1B900,1AB00,
19D00,19000,18400,17800,16E00,16400,15A00,15100,14800,14000,
13800,13100,12A00,12300,11C00,11600,11000,10B00,10500,10000,
FB00, F600, F100, EC00, E600, E100, DC00,D700,D200,CD00,
C800, C300, BD00, B800, B300, AE00, A900,A400,9F00,9A00,
9400, 8F00, 8A00, 8500, 8000, 7B00, 7600,7100,6C00,6600,
6100, 5C00, 5700, 5200, 4D00, 4800, 4300,3D00,3800,3300,
2E00, 2900, 2400, 1F00, 1A00, 1400, F00, A00, 500, 100
;

jpeg_header= FF D8
FF E0 00 10 4A 46 49 46 00 01 01 00 00 01 00 01 00 00
FF DB 00 84 00 $qt0 01 $qt1
FF C4 01 A2 00 00 01 05 01 01 01 01 01 01 00 00 00 00 00 00 00
00 01 02 03 04 05 06 07 08 09 0A 0B
01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00
00 01 02 03 04 05 06 07 08 09 0A 0B
10 00 02 01 03 03 02 04 03 05 05 04 04 00 00 01 7D
01 02 03 00 04 11 05 12 21 31 41 06 13 51 61 07
22 71 14 32 81 91 a1 08 23 42 b1 c1 15 52 d1 f0
24 33 62 72 82 09 0a 16 17 18 19 1a 25 26 27 28
29 2a 34 35 36 37 38 39 3a 43 44 45 46 47 48 49
4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68 69
6a 73 74 75 76 77 78 79 7a 83 84 85 86 87 88 89
8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5 a6 a7
a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 c4 c5
c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da e1 e2
e3 e4 e5 e6 e7 e8 e9 ea f1 f2 f3 f4 f5 f6 f7 f8
f9 fa
11 00 02 01 02 04 04 03 04 07 05 04 04 00 01 02 77
00 01 02 03 11 04 05 21 31 06 12 41 51 07 61 71
13 22 32 81 08 14 42 91 a1 b1 c1 09 23 33 52 f0
15 62 72 d1 0a 16 24 34 e1 25 f1 17 18 19 1a 26
27 28 29 2a 35 36 37 38 39 3a 43 44 45 46 47 48
49 4a 53 54 55 56 57 58 59 5a 63 64 65 66 67 68
69 6a 73 74 75 76 77 78 79 7a 82 83 84 85 86 87
88 89 8a 92 93 94 95 96 97 98 99 9a a2 a3 a4 a5
a6 a7 a8 a9 aa b2 b3 b4 b5 b6 b7 b8 b9 ba c2 c3
c4 c5 c6 c7 c8 c9 ca d2 d3 d4 d5 d6 d7 d8 d9 da
e2 e3 e4 e5 e6 e7 e8 e9 ea f2 f3 f4 f5 f6 f7 f8
f9 fa
[ This Message was edited by: zide on 2010-04-17 03:02 ]
See my photos taken with the C902, Satio or E72 in here!
zide
Satio Silver
Joined: Jul 20, 2009
Posts: 481
From: Portugal
PM
Posted: 2010-04-19 05:29
Reply with quoteEdit/Delete This PostPrint this post
I changed this lines:

NOT_DOC_MODE = // Reverses special doc scene settings
#COM_EVENT(06,00) // Reset exposure
#COM_EVENT(55,01) // Reset contrast
#COM_EVENT(56,06) // Reset sharpness
#SET_REG(AD,00) // Reset flash pulse width

But it does not seem to be have any difference!

Help guys!
[ This Message was edited by: zide on 2010-04-19 04:30 ]
See my photos taken with the C902, Satio or E72 in here!
Access the forum with a mobile phone via esato.mobi