Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -meta option to dump register metadata #11

Merged
merged 2 commits into from May 17, 2018

Conversation

Projects
None yet
2 participants
@tmorley2000
Copy link
Contributor

commented May 16, 2018

Adds -meta (or --metadata) to parse metadata returned from the sensor and dump out register values.

tag=data[c++];
if (c%5==4)
c++;
dta=data[c++];

This comment has been minimized.

Copy link
@6by9

6by9 May 16, 2018

Owner

I've not run this yet, but it looks slightly wrong.
Every 5th byte needs to be ignored, and that could be between the data and the next tag. As I read it your code only handles it if it is between the tag and the data.
It probably just wants another

		if (c%5==4)
				c++;

after line 460. I'll give it a whirl to confirm.

This comment has been minimized.

Copy link
@6by9

6by9 May 16, 2018

Owner

Hmm, you may be OK. I think it does always fall out as:
0x0A Tag Data Tag 0x55
Data Tag Data Tag 0x55
and will then repeat that second line.

Raw 12 appears to fall out in a similar manner as
0x0A Tag 0x55
Data Tag 0x55
and repeat that.

This comment has been minimized.

Copy link
@tmorley2000

tmorley2000 May 17, 2018

Author Contributor

Fromt he sony datasheet it certiainly looked like the padding can only appear in the one place, and it seems to work!

This comment has been minimized.

Copy link
@6by9

6by9 May 17, 2018

Owner

IIRC The embedded data layout is defined in the SMIA camera spec.
In the case of the Sony sensor I think it does fall out. I was looking at it from a generic perspective as this code will be run for all sensors, but even then I think it does match up.

vcos_log_error("First metadata line");
decodemetadataline(buffer->data);
vcos_log_error("Second metadata line");
decodemetadataline(buffer->data+VCOS_ALIGN_UP(5*(port->format->es->video.width/4),16));

This comment has been minimized.

Copy link
@6by9

6by9 May 16, 2018

Owner

To keep things generic, there's already a helper function for this in mmal_encoding_width_to_stride.

This comment has been minimized.

Copy link
@tmorley2000

tmorley2000 May 17, 2018

Author Contributor

Just been trying this, and using the encoding from port->format->encoding it seems to rounding up to the next multiple of 32, not 16. So for some modes its not getting the second batch of registers correctly.

This comment has been minimized.

Copy link
@6by9

6by9 May 17, 2018

Owner

Hmm, OK I need to think about that some more.
The requirements of different parts of the system vary. Whilst the CSI2 receiver is happy with the stride being a multiple of 16 bytes, the ISP hardware docs state that the stride must be a multiple of 32 bytes. So I'm not quite clear as to how that is working if rawcam's allowing a multiple of 16.

raspiraw.c Outdated
@@ -211,6 +212,7 @@ static COMMAND_LIST cmdline_commands[] =
{ CommandWriteHeaderG, "-headerg", "hdg","Sets filename to write the .pgm header to", 0 },
{ CommandWriteTimestamps,"-tstamps", "ts", "Sets filename to write timestamps to", 0 },
{ CommandWriteEmpty, "-empty", "emp","Write empty output files", 0 },
{ CommandDecodeMetadata, "-metadata", "meta","Decode register metadata", 0 },

This comment has been minimized.

Copy link
@6by9

6by9 May 16, 2018

Owner

Personally I'd have gone for -m rather than -meta. The short versions are meant to be as short as practical.

@6by9 6by9 merged commit e9da770 into 6by9:master May 17, 2018

@6by9

This comment has been minimized.

Copy link
Owner

commented May 17, 2018

Whilst there may still be minor tweaks that could be made, I'm happy enough with this to merge.
Many thanks for you input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.