Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit d42686c0 authored by a1ex's avatar a1ex
Browse files

600D: fix picture style (that was tricky)

--HG--
branch : unified
parent bae0579d4c3c
......@@ -782,42 +782,6 @@ INIT_FUNC( "lens", lens_init );
// picture style, contrast...
// -------------------------------------------
int get_prop_picstyle_index(int pic_style)
{
switch(pic_style)
{
case 0x81: return 1;
case 0x82: return 2;
case 0x83: return 3;
case 0x84: return 4;
case 0x85: return 5;
case 0x86: return 6;
case 0x21: return 7;
case 0x22: return 8;
case 0x23: return 9;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle: %x", pic_style);
return 0;
}
int get_prop_picstyle_from_index(int index)
{
switch(index)
{
case 1: return 0x81;
case 2: return 0x82;
case 3: return 0x83;
case 4: return 0x84;
case 5: return 0x85;
case 6: return 0x86;
case 7: return 0x21;
case 8: return 0x22;
case 9: return 0x23;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle index: %x", index);
return 0;
}
PROP_HANDLER(PROP_PICTURE_STYLE)
{
const uint32_t raw = *(uint32_t *) buf;
......@@ -826,55 +790,7 @@ PROP_HANDLER(PROP_PICTURE_STYLE)
return prop_cleanup( token, property );
}
struct prop_picstyle_settings picstyle_settings[10];
// prop_register_slave is much more difficult to use than copy/paste...
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_1 ) {
memcpy(&picstyle_settings[1], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_2 ) {
memcpy(&picstyle_settings[2], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_3 ) {
memcpy(&picstyle_settings[3], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_4 ) {
memcpy(&picstyle_settings[4], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_5 ) {
memcpy(&picstyle_settings[5], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_6 ) {
memcpy(&picstyle_settings[6], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_7 ) {
memcpy(&picstyle_settings[7], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_8 ) {
memcpy(&picstyle_settings[8], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_9 ) {
memcpy(&picstyle_settings[9], buf, 24);
return prop_cleanup( token, property );
}
extern struct prop_picstyle_settings picstyle_settings[];
// get contrast/saturation/etc from the current picture style
......@@ -896,7 +812,7 @@ lens_set_##param(int value) \
int i = lens_info.picstyle; \
if (!i) return; \
picstyle_settings[i].param = value; \
prop_request_change(PROP_PICSTYLE_SETTINGS_1 - 1 + i, &picstyle_settings[i], 24); \
prop_request_change(PROP_PICSTYLE_SETTINGS(i), &picstyle_settings[i], 24); \
} \
LENS_GET_FROM_PICSTYLE(contrast)
......
......@@ -186,3 +186,6 @@
#define DISPLAY_TRAP_FOCUS_POS_Y 330
#define DISPLAY_TRAP_FOCUS_MSG "TRAP \nFOCUS"
#define DISPLAY_TRAP_FOCUS_MSG_BLANK " \n "
#define NUM_PICSTYLES 9
#define PROP_PICSTYLE_SETTINGS(i) (PROP_PICSTYLE_SETTINGS_STANDARD - 1 + i)
......@@ -44,4 +44,87 @@ void lens_focus_ex(unsigned mode, int step, int active)
prop_request_change( PROP_LV_FOCUS, &focus, sizeof(focus) );
}*/
int get_prop_picstyle_from_index(int index)
{
switch(index)
{
case 1: return 0x81;
case 2: return 0x82;
case 3: return 0x83;
case 4: return 0x84;
case 5: return 0x85;
case 6: return 0x86;
case 7: return 0x21;
case 8: return 0x22;
case 9: return 0x23;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle index: %x", index);
return 0;
}
int get_prop_picstyle_index(int pic_style)
{
switch(pic_style)
{
case 0x81: return 1;
case 0x82: return 2;
case 0x83: return 3;
case 0x84: return 4;
case 0x85: return 5;
case 0x86: return 6;
case 0x21: return 7;
case 0x22: return 8;
case 0x23: return 9;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle: %x", pic_style);
return 0;
}
struct prop_picstyle_settings picstyle_settings[10];
// prop_register_slave is much more difficult to use than copy/paste...
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_STANDARD ) {
memcpy(&picstyle_settings[1], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_PORTRAIT ) {
memcpy(&picstyle_settings[2], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_LANDSCAPE ) {
memcpy(&picstyle_settings[3], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_NEUTRAL ) {
memcpy(&picstyle_settings[4], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_FAITHFUL ) {
memcpy(&picstyle_settings[5], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_MONOCHROME ) {
memcpy(&picstyle_settings[6], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF1 ) {
memcpy(&picstyle_settings[7], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF2 ) {
memcpy(&picstyle_settings[8], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF3 ) {
memcpy(&picstyle_settings[9], buf, 24);
return prop_cleanup( token, property );
}
......@@ -73,12 +73,14 @@
#define MVR_BUFFER_USAGE_SOUND div_maybe(-100*MEM(544 + MVR_992_STRUCT) + 100*MEM(532 + MVR_992_STRUCT), 0xa)
#define MVR_BUFFER_USAGE MAX(MVR_BUFFER_USAGE_FRAME, MVR_BUFFER_USAGE_SOUND)
#define MVR_FRAME_NUMBER (*(int*)(332 + MVR_992_STRUCT))
#define MVR_BYTES_WRITTEN (*(int*)(296 + MVR_992_STRUCT))
#define MOV_RES_AND_FPS_COMBINATIONS 9
#define MOV_OPT_NUM_PARAMS 2
#define MOV_GOP_OPT_NUM_PARAMS 5
#define MOV_OPT_STEP 5
#define AUDIO_MONITORING_HEADPHONES_CONNECTED (!((*(int*)0xc0220070) & 1))
#define HOTPLUG_VIDEO_OUT_PROP_DELIVER_ADDR 0x1a8c // this prop_deliver performs the action for Video Connect and Video Disconnect
#define HOTPLUG_VIDEO_OUT_STATUS_ADDR 0x1ac4 // passed as 2nd arg to prop_deliver; 1 = display connected, 0 = not, other values disable this event (trick)
......@@ -149,8 +151,7 @@
// Below this line, all constant are from 550D/T2i 1.0.9 and not yet confirmed for 600D/T3i 1.0.1 !!!
//~ #define YUV422_LV_BUFFER_DMA_ADDR (*(uint32_t*)0x246c)
#define YUV422_LV_BUFFER_DMA_ADDR YUV422_LV_BUFFER // not OK; just for compiling
#define YUV422_LV_BUFFER_DMA_ADDR (*(uint32_t*)0x2490)
// changes during record
......@@ -190,6 +191,7 @@
#define SENSOR_RES_Y 3465
#define FLASH_BTN_MOVIE_MODE (((*(int*)0x14c1c) & 0x40000) && (shooting_mode == SHOOTMODE_MOVIE))
#define FLASH_BTN_MOVIE_MODE 0
#define CLK_25FPS 0x1e24c // this is updated at 25fps and seems to be related to auto exposure
#define AJ_LCD_Palette 0x2CDB0
......@@ -202,16 +204,12 @@
#define MVR_FRAME_NUMBER (*(int*)(236 + MVR_992_STRUCT))
//#define MVR_LAST_FRAME_SIZE (*(int*)(512 + MVR_992_STRUCT))
#define MVR_BYTES_WRITTEN (*(int*)(228 + MVR_992_STRUCT))
#define MOV_REC_STATEOBJ (*(void**)0x5B34)
#define MOV_REC_CURRENT_STATE *(int*)(MOV_REC_STATEOBJ + 28)
#define AE_VALUE (*(int8_t*)0x14c25)
#define CURRENT_DIALOG_MAYBE (*(int*)0x39ac)
#define CURRENT_DIALOG_MAYBE 0
#define DLG_WB 5
#define DLG_FOCUS_MODE 9
#define DLG_DRIVE_MODE 8
......@@ -253,3 +251,6 @@
#define BGMT_PRESS_ZOOMIN_MAYBE -1
#define BGMT_UNPRESS_ZOOMIN_MAYBE -1
#define NUM_PICSTYLES 10
#define PROP_PICSTYLE_SETTINGS(i) ((i) == 1 ? PROP_PICSTYLE_SETTINGS_AUTO : PROP_PICSTYLE_SETTINGS_STANDARD - 2 + i)
......@@ -120,6 +120,11 @@ static int handle_buttons(struct event * event) {
menu_send_event(PRESS_DIRECT_PRINT_BUTTON);
return 0;
}
if (gui_state == GUISTATE_PLAYMENU)
{
livev_playback_toggle();
return 0;
}
case BGMT_ZOOM_OUT :
// Do nothing for now
break;
......
......@@ -6,18 +6,6 @@
extern int lv_focus_done;
struct lens_control {
// 0x00-0x1D4: not used
uint32_t off_0x1D4;uint32_t off_0x1D8;uint32_t off_0x1DC; //1D4: amount of rotation, 1D8: step size (?)
uint32_t off_0x1E0;uint32_t off_0x1E4;uint32_t off_0x1E8;uint32_t off_0x1EC;
uint32_t off_0x1F0;uint32_t off_0x1F4;uint32_t off_0x1F8;uint32_t off_0x1FC;
uint32_t off_0x200;uint32_t off_0x204;uint32_t off_0x208;uint32_t off_0x20C;
uint32_t off_0x210;uint32_t off_0x214;uint32_t off_0x218;uint32_t off_0x21C;
uint32_t off_0x220;uint32_t off_0x224;uint32_t off_0x228;
}__attribute__((packed));
struct lens_control lctr;
void
lens_focus(
unsigned mode,
......@@ -30,26 +18,133 @@ lens_focus(
while (lens_info.job_state) msleep(100);
lens_focus_wait();
lv_focus_done = 0;
lctr.off_0x228 = 0x1;
if (step<0) { lctr.off_0x228 += 0x8000; step = -step; }
float a = lens_info.lens_rotation/((float)step);
float b = lens_info.lens_step;
uint32_t* aconv = &a;
uint32_t* bconv = &b;
lctr.off_0x1D4 = SWAP_ENDIAN(*aconv); //0x00400F3C; // single floating point number: 0x008743286
lctr.off_0x1D8 = SWAP_ENDIAN(*bconv); // single floating point number: 1
lctr.off_0x1F4 = 0x08080000;
lctr.off_0x200 = 0x00003200;
lctr.off_0x20C = 0xFF000000;
lctr.off_0x210 = 0x000000FF;
lctr.off_0x214 = 0xFFFFFF00;
lctr.off_0x218 = 0x0000FFFF;
AfCtrl_SetLensParameterRemote(((char*)&lctr)-0x1D4);
struct prop_focus focus = {
.active = 1,
.mode = 7,
.step_hi = (step >> 8) & 0xFF,
.step_lo = (step >> 0) & 0xFF,
.unk = 0,
};
prop_request_change( PROP_LV_FOCUS, &focus, sizeof(focus) );
if (get_zoom_overlay_mode()==2) zoom_overlay_set_countdown(300);
}
/*
void lens_focus_ex(unsigned mode, int step, int active)
{
struct prop_focus focus = {
.active = active,
.mode = mode,
.step_hi = (step >> 8) & 0xFF,
.step_lo = (step >> 0) & 0xFF,
};
prop_request_change( PROP_LV_FOCUS, &focus, sizeof(focus) );
}*/
// picture style, contrast...
// -------------------------------------------
int get_prop_picstyle_from_index(int index)
{
switch(index)
{
case 1: return 0x87; // auto
case 2: return 0x81;
case 3: return 0x82;
case 4: return 0x83;
case 5: return 0x84;
case 6: return 0x85;
case 7: return 0x86;
case 8: return 0x21;
case 9: return 0x22;
case 10: return 0x23;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle index: %x", index);
return 0;
}
int get_prop_picstyle_index(int pic_style)
{
switch(pic_style)
{
case 0x87: return 1; // auto
case 0x81: return 2; // std
case 0x82: return 3; // portrait
case 0x83: return 4; // landscape
case 0x84: return 5; // neutral
case 0x85: return 6; // faithful
case 0x86: return 7; // mono
case 0x21: return 8; // user 1
case 0x22: return 9; // user 2
case 0x23: return 10; // user 3
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle: %x", pic_style);
return 0;
}
PROP_HANDLER(PROP_PICTURE_STYLE)
{
const uint32_t raw = *(uint32_t *) buf;
lens_info.raw_picstyle = raw;
lens_info.picstyle = get_prop_picstyle_index(raw);
return prop_cleanup( token, property );
}
struct prop_picstyle_settings picstyle_settings[NUM_PICSTYLES + 1];
// prop_register_slave is much more difficult to use than copy/paste...
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_AUTO ) {
memcpy(&picstyle_settings[1], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_STANDARD ) {
memcpy(&picstyle_settings[2], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_PORTRAIT ) {
memcpy(&picstyle_settings[3], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_LANDSCAPE ) {
memcpy(&picstyle_settings[4], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_NEUTRAL ) {
memcpy(&picstyle_settings[5], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_FAITHFUL ) {
memcpy(&picstyle_settings[6], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_MONOCHROME ) {
memcpy(&picstyle_settings[7], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF1 ) {
memcpy(&picstyle_settings[8], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF2 ) {
memcpy(&picstyle_settings[9], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF3 ) {
memcpy(&picstyle_settings[10], buf, 24);
return prop_cleanup( token, property );
}
......@@ -181,3 +181,6 @@
#define DISPLAY_TRAP_FOCUS_POS_Y 365
#define DISPLAY_TRAP_FOCUS_MSG "TRAP FOCUS"
#define DISPLAY_TRAP_FOCUS_MSG_BLANK " "
#define NUM_PICSTYLES 9
#define PROP_PICSTYLE_SETTINGS(i) (PROP_PICSTYLE_SETTINGS_STANDARD - 1 + i)
......@@ -53,3 +53,87 @@ lens_focus(
if (get_zoom_overlay_mode()==2) zoom_overlay_set_countdown(300);
}
int get_prop_picstyle_from_index(int index)
{
switch(index)
{
case 1: return 0x81;
case 2: return 0x82;
case 3: return 0x83;
case 4: return 0x84;
case 5: return 0x85;
case 6: return 0x86;
case 7: return 0x21;
case 8: return 0x22;
case 9: return 0x23;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle index: %x", index);
return 0;
}
int get_prop_picstyle_index(int pic_style)
{
switch(pic_style)
{
case 0x81: return 1;
case 0x82: return 2;
case 0x83: return 3;
case 0x84: return 4;
case 0x85: return 5;
case 0x86: return 6;
case 0x21: return 7;
case 0x22: return 8;
case 0x23: return 9;
}
bmp_printf(FONT_LARGE, 0, 0, "unk picstyle: %x", pic_style);
return 0;
}
struct prop_picstyle_settings picstyle_settings[10];
// prop_register_slave is much more difficult to use than copy/paste...
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_STANDARD ) {
memcpy(&picstyle_settings[1], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_PORTRAIT ) {
memcpy(&picstyle_settings[2], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_LANDSCAPE ) {
memcpy(&picstyle_settings[3], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_NEUTRAL ) {
memcpy(&picstyle_settings[4], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_FAITHFUL ) {
memcpy(&picstyle_settings[5], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_MONOCHROME ) {
memcpy(&picstyle_settings[6], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF1 ) {
memcpy(&picstyle_settings[7], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF2 ) {
memcpy(&picstyle_settings[8], buf, 24);
return prop_cleanup( token, property );
}
PROP_HANDLER( PROP_PICSTYLE_SETTINGS_USERDEF3 ) {
memcpy(&picstyle_settings[9], buf, 24);
return prop_cleanup( token, property );
}
......@@ -192,16 +192,17 @@
#define PROP_FILE_NUMBER_ALSO 0x02010004 // seems to mirror the previous one, but it's increased earlier
#define PROP_FOLDER_NUMBER 0x02010001 // 100, 101...
#define PROP_PICTURE_STYLE 0x80000028 // 0x81 = std, 82 = portrait, 83 = landscape, 84 = neutral, 85 = faithful, 86 = monochrome, 21 = user 1, 22 = user 2, 23 = user 3
#define PROP_PICSTYLE_SETTINGS_1 0x02060001 // 02060001 for std, 02060002 for portrait... 02060007 for user 1 ... 02060009 for user 3
#define PROP_PICSTYLE_SETTINGS_2 0x02060002
#define PROP_PICSTYLE_SETTINGS_3 0x02060003
#define PROP_PICSTYLE_SETTINGS_4 0x02060004
#define PROP_PICSTYLE_SETTINGS_5 0x02060005
#define PROP_PICSTYLE_SETTINGS_6 0x02060006
#define PROP_PICSTYLE_SETTINGS_7 0x02060007
#define PROP_PICSTYLE_SETTINGS_8 0x02060008
#define PROP_PICSTYLE_SETTINGS_9 0x02060009
#define PROP_PICTURE_STYLE 0x80000028 // 0x81 = std, 82 = portrait, 83 = landscape, 84 = neutral, 85 = faithful, 86 = monochrome, 21 = user 1, 22 = user 2, 23 = user 3
#define PROP_PICSTYLE_SETTINGS_STANDARD 0x02060001 // 02060001 for std, 02060002 for portrait... 02060007 for user 1 ... 02060009 for user 3
#define PROP_PICSTYLE_SETTINGS_PORTRAIT 0x02060002
#define PROP_PICSTYLE_SETTINGS_LANDSCAPE 0x02060003
#define PROP_PICSTYLE_SETTINGS_NEUTRAL 0x02060004
#define PROP_PICSTYLE_SETTINGS_FAITHFUL 0x02060005
#define PROP_PICSTYLE_SETTINGS_MONOCHROME 0x02060006
#define PROP_PICSTYLE_SETTINGS_USERDEF1 0x02060007
#define PROP_PICSTYLE_SETTINGS_USERDEF2 0x02060008
#define PROP_PICSTYLE_SETTINGS_USERDEF3 0x02060009
#define PROP_PICSTYLE_SETTINGS_AUTO 0x0206001e // 600D only
#define PROP_ALO 0x8000003D
#define ALO_STD 0
......
......@@ -1663,6 +1663,7 @@ picstyle_display( void * priv, int x, int y, int selected )
p == 0x84 ? "Neutral" :
p == 0x85 ? "Faithful" :
p == 0x86 ? "Monochrome" :
p == 0x87 ? "Auto" :
p == 0x21 ? "User Def 1" :
p == 0x22 ? "User Def 2" :
p == 0x23 ? "User Def 3" : "Unknown"
......@@ -1674,7 +1675,7 @@ static void
picstyle_toggle( int sign )
{
int p = lens_info.picstyle;
p = mod(p + sign - 1, 9) + 1;
p = mod(p + sign - 1, NUM_PICSTYLES) + 1;
p = get_prop_picstyle_from_index(p);
if (p) prop_request_change(PROP_PICTURE_STYLE, &p, 4);
menu_show_only_selected();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment