# HG changeset patch # User alex@thinkpad # Date 1520090166 -3600 # Sat Mar 03 16:16:06 2018 +0100 # Branch crop_rec_4k # Node ID 57b609e7786a9802d25c56f632561f05642905f5 # Parent dbaa3aea64ba135b8088e183fa9384611cf48537 lossless: experimental resolution overriding that should cover all DIGIC 5 models (to be tested) diff -r dbaa3aea64ba -r 57b609e7786a modules/silent/lossless.c --- a/modules/silent/lossless.c Sat Mar 03 16:01:35 2018 +0100 +++ b/modules/silent/lossless.c Sat Mar 03 16:16:06 2018 +0100 @@ -272,17 +272,77 @@ /* configure the processing modules */ TTL_Prepare(TTL_ResLock, &TTL_Args); + if (is_camera("DIGIC", "5")) /* some models (700D/100D/M/?) appear to work fine without these; why? */ + { + /* resolution is hardcoded in some places; patch them + * the hardware encoder (and other image processing modules that might be used) + * expect slice width and slice height for these registers + * Canon configuration: slice width = image width / 2, slice height = image height + * our configuration: slice width = image width, slice height = image height / 2 */ + EngDrvOut(0xC0F13068, PACK32(width*2 - 1, height/2 - 1)); /* 0xF6D171F on 5D3 */ + EngDrvOut(0xC0F12010, width - 1 ); /* 0xB8F on 5D3 */ + EngDrvOut(0xC0F12014, PACK32(width - 1, height/2 - 1)); /* 0xF6D0B8F on 5D3 */ + } + + if (is_camera("6D", "*") || + is_camera("650D", "*")) + { + /* not sure what exactly these do, but they seem to be required to get correct image + * taken from register log diffs: http://www.magiclantern.fm/forum/index.php?topic=18443.msg197987#msg197987 */ + EngDrvOut(0xC0F37610, 0); /* 0x11 on 650D, 0 on all other D5 (not sure if needed) */ + EngDrvOut(0xC0F37628, 0x71000); /* 72000 on 650D, 71000 on all other D5 */ + EngDrvOut(0xC0F3762C, 0x71000); /* 72000 on 650D, 71000 on all other D5 */ + EngDrvOut(0xC0F37630, 0x71000); /* 72000 on 650D, 71000 on all other D5 */ + EngDrvOut(0xC0F37634, 0x71000); /* 72000 on 6D and 650D, 71000 on all other D5 */ + EngDrvOut(0xC0F3763C, 0); /* 0x1000000 on 6D and 650D, 0 on all other D5 */ + EngDrvOut(0xC0F37640, 0); /* 0x2000000 on 6D and 650D, 0 on all other D5 */ + EngDrvOut(0xC0F37644, 0); /* 0x4000000 on 6D and 650D, 0 on all other D5 */ + EngDrvOut(0xC0F37648, 0); /* 0x8000000 on 6D and 650D, 0 on all other D5 */ + } + + if (is_camera("70D", "*")) + { + /* 70D is different */ + EngDrvOut(0xC0F37300, PACK32(width - 1, height/2 - 1)); /* 0xE7B0ADF on 70D */ + EngDrvOut(0xC0F373E8, PACK32(width - 1, height/2 - 1)); /* 0xE7B0ADF on 70D */ + } + else if (is_camera("DIGIC", "5")) + { + /* all other D5 models use this register instead */ + EngDrvOut(0xC0F375B4, PACK32(width - 1, height/2 - 1)); /* 0xF6D0B8F on 5D3 */ + } + + /* no idea what are these, or whether they are actually needed */ if (is_camera("5D3", "*")) { - /* resolution is hardcoded in some places; patch them */ - EngDrvOut(0xC0F375B4, PACK32(width - 1, height/2 - 1)); /* 0xF6D0B8F */ - EngDrvOut(0xC0F13068, PACK32(width*2 - 1, height/2 - 1)); /* 0xF6D171F */ - EngDrvOut(0xC0F12010, width - 1 ); /* 0xB8F */ - EngDrvOut(0xC0F12014, PACK32(width - 1, height/2 - 1)); /* 0xF6D0B8F */ + /* slice width / 10, slice height / 10 */ + /* [0xC0F375B4] <- 0xF6D0B8F */ EngDrvOut(0xC0F1201C, width/10 - 1 ); /* 0x127 */ EngDrvOut(0xC0F12020, PACK32(width/10 - 1, height/20 - 1)); /* 0x18A0127 */ } + if (is_camera("6D", "*") || + is_camera("70D", "*")) + { + /* slice width / 12, slice height / 12 */ + /* 6D: [0xC0F375B4] <- 0xE7B0ADF */ + /* 70D: [0xC0F37300] <- 0xE7B0ADF */ + EngDrvOut(0xC0F1201C, width/12 - 1 ); /* 0xE7 */ + EngDrvOut(0xC0F12020, PACK32(width/12 - 1, height/24 - 1)); /* 0x13400E7 */ + } + + if (is_camera("650D", "*") || + is_camera("700D", "*") || + is_camera("100D", "*") || + is_camera("EOSM", "*") || + is_camera("EOSM2", "*")) + { + /* slice width / 8, slice height / 8 */ + /* [0xC0F375B4] <- 0xDC70A4F (650D, 700D, 100D, EOSM, EOSM2) */ + EngDrvOut(0xC0F1201C, width/8 - 1 ); /* 0x149 */ + EngDrvOut(0xC0F12020, PACK32(width/8 - 1, height/16 - 1)); /* 0x1B80149 */ + } + /* need to read the image data in 2 slices * default configuration is 2 vertical slices; * however, using 2 horizontal slices makes it easy