Improving support for cameras with Canon raw - page 2 - General Discussion and Assistance - CHDK Forum  

Improving support for cameras with Canon raw

  • 16 Replies
  • 1443 Views
*

Offline reyalp

  • ******
  • 12650
Re: Improving support for cameras with Canon raw
« Reply #10 on: 23 / March / 2019, 19:42:23 »
Advertisements
I can pretty much guarantee remote shooting craws was never tested by the person who did the port eight year ago. 
Well yeah, remoteshoot has never formally supported Canon raw up to now, we (srsa_4c originally, I think) just observed at some point that the same filewrite hook appeared to work.
Quote
Is this likely to be an issue with where the hooks are placed?
A wild guess guess would be the filewrite code takes a code path for Canon raw that isn't hit for jpeg. My next step would probably be debug logging along the lines of what I have for FILEWRITE_DEBUG_LOG in ports like elph180 and g7x and just log what happens shooting raw vs jpeg without remote shoot
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 12650
Re: Improving support for cameras with Canon raw
« Reply #11 on: 08 / August / 2020, 22:54:26 »
Ping @koshy
I'd like to get some information about propcases on G11 if you still have it and are willing to test. Anyone else with a G11 or S90 is welcome to volunteer too ;)

Goal: Determine which propcases change when raw and raw + jpeg settings are changed

Probable propcases of interest
214: according to wiki,  0 RAW, 1 JPG, 2 RAW+JPG 
220 (PROPCASE_RESOLUTION): Should be 5 when raw is enabled, 0 = large jpeg etc.
284: according to wiki, Rec Raw + L-jpg (0=off, 1=on), writing has no effect

Test:

I'd suggest using chdkptp, change camera to rec, make sure shooting mode allows canon raw (like P).
For each of the following settings, set using Canon menus:
1) Raw disabled, by setting resolution to L
2) Raw enabled, raw + jpeg on
3) Raw enabled, raw + jpeg off
run
Code: [Select]
=return get_prop(214), get_prop(220), get_prop(284)

Note this should be done with any recent CHDK and chdkptp, does not require remoteshoot related patches up thread.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 12650
Re: Improving support for cameras with Canon raw
« Reply #12 on: Yesterday at 16:15:38 »
The port, however, has problems remote shooting craws. Some files arrive truncated, the missing amount varies a lot (up to ~80% can be lost). This isn't related to your patch, happens with vanilla trunk too. Big jpegs don't seem to cause problems, so there's something special going on when writing native raw files.
I finally got around to looking at this :-[

It seems like MAX_CHUNKS_FOR_JPEG should be 4, rather than 3, based on having 4 cases in the main switch that refer to the write stage call, and the offset of the name field from sub sub_FFA46D70_my. The name field is almost certainly wrong in the current code.

Here's a patch with the define updated and debug logging (for 102a but should be trivial to adapt to to others). I'm guessing 4 chunks is only uses in the raw case.

To use the debug logging with chdkptp, I'd use
Code: [Select]
!require'extras/devutil'.init_cli()
dlstart
shoot
dlgetcam
Even if MAX_CHUNKS_FOR_JPEG fixes the issue, it would be nice to verify the name field is correct because I may use that to identify raw vs jpeg.

edit:
Would probably help if I attached the patch...
Don't forget what the H stands for.

*

Offline koshy

  • *****
  • 1048
Re: Improving support for cameras with Canon raw
« Reply #13 on: Yesterday at 16:35:17 »
Ping @koshy
Pong, good you recall this works :)
Test:

I'd suggest using chdkptp, change camera to rec, make sure shooting mode allows canon raw (like P).
For each of the following settings, set using Canon menus:
1) Raw disabled, by setting resolution to L
2) Raw enabled, raw + jpeg on
3) Raw enabled, raw + jpeg off
run
Code: [Select]
=return get_prop(214), get_prop(220), get_prop(284)

In the order suggested above:

Code: [Select]
> =return get_prop(214), get_prop(220), get_prop(284)
3:return:0
3:return:0
3:return:0
> =return get_prop(214), get_prop(220), get_prop(284)
4:return:0
4:return:5
4:return:1
> =return get_prop(214), get_prop(220), get_prop(284)
5:return:0
5:return:5
5:return:0
« Last Edit: Yesterday at 16:37:06 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)


*

Offline reyalp

  • ******
  • 12650
Re: Improving support for cameras with Canon raw
« Reply #14 on: Yesterday at 17:22:05 »
In the order suggested above:
Thanks. Seems 214 isn't as documented on the wiki.

Can you check if setting 284 allows you to control the raw+jpeg setting?
I'd suggest
Enable RAW and set raw+jpeg off in Canon menus
=set_prop(284,1)
shoot
imls

check if the camera saved both

=set_prop(284,0)
shoot
imls

check if camera saved only raw.
Don't forget what the H stands for.

*

Offline koshy

  • *****
  • 1048
Re: Improving support for cameras with Canon raw
« Reply #15 on: Yesterday at 19:41:25 »
Can you check if setting 284 allows you to control the raw+jpeg setting?
Sure, I did, it does. I had JPEG+RAW off on the Canon menu before starting.

Code: [Select]
> =set_prop(284,1)
> shoot
> imls
01/01/09 02:16:56   10497486 A/DCIM/879___01/IMG_0060.CR2
01/01/09 02:16:56    1312655 A/DCIM/879___01/IMG_0060.JPG
> =set_prop(284,0)
> shoot
> imls
01/01/09 02:16:56   10497486 A/DCIM/879___01/IMG_0060.CR2
01/01/09 02:16:56    1312655 A/DCIM/879___01/IMG_0060.JPG
01/01/09 02:17:26   10938890 A/DCIM/879___01/IMG_0061.CR2
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline reyalp

  • ******
  • 12650
Re: Improving support for cameras with Canon raw
« Reply #16 on: Yesterday at 23:59:22 »
Thanks again. Looks like it behaves exactly like propset 2, which is nice.

With the propset 3 question resolved, here's a patch that adds Lua support for Canon raw control. I plan to check it in, just posting in case anyone has feedback.

get_canon_raw_support()
returns boolean, true if platform has native Canon raw support

get_canon_image_format()
returns current image format as a bitmask, 1 = jpeg, 2 = raw, 3 = both

set_canon_image_format(fmt)
fmt is a bitmask 1 = jpeg, 2 = raw, 3 = both
returns true if the format is valid for the current port, false otherwise

Set has some caveats:
On g7x (and I assume others) changing shooting modes or switching to/from play resets the IMAGE_FORMAT propcase. This makes sense since Canon raw is only available in certain shooting modes, and the actual setting comes from a ui prop / flash param. The reset happens regardless of whether the change is done using physical controls or script, or whether the modes involved support raw.

As discussed earlier in the thread, you can enable Canon raw in some shooting modes the firmware doesn't natively allow it, like monochrome or portrait, but some like HDR crash on shooting. No attempt is made to avoid this. I think this fine, especially since mode switching results in a safe setting.

On propset 2 and 3, raw is controlled by the resolution setting. This means switching from raw to jpeg is not well defined. The code tries deal with this by saving the previous resolution when switching to raw, and restoring it when switching to jpeg. If that's not available, for example because the camera was started in raw mode, L resolution is used. This is pretty hokey, but I think should be OK in practice.
Don't forget what the H stands for.

 

Related Topics