How pixel values are stored in CHDK raw? - General Discussion and Assistance - CHDK Forum

How pixel values are stored in CHDK raw?

  • 5 Replies
  • 4042 Views
*

Offline PS

  • ***
  • 157
  • A610 1.00f
How pixel values are stored in CHDK raw?
« on: 22 / January / 2010, 18:40:33 »
Advertisements

Re: How pixel values are stored in CHDK raw?
« Reply #1 on: 22 / January / 2010, 18:55:02 »
« Last Edit: 23 / January / 2010, 08:32:53 by Microfunguy »

*

Offline reyalp

  • ******
  • 14082
Re: How pixel values are stored in CHDK raw?
« Reply #2 on: 22 / January / 2010, 23:49:31 »
This is how I got my head around how they are packed:
bytes is left to right, pixels is down, numbers are bits in the pixel value
Code: [Select]
0      |1      |2      |3      |4      |5      |6      |7      |8      |9      |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
0   10      98765432                                                                
1     987654                3210                                                  
2   543210      9876                                              
3    98                76543210                                
4   98765432                10                      
5   3210      987654                
6   9876                543210  
7   76543210      98

If you reverse the bytes, it makes more sense ;) EDIT: I.e. this is how it would be arranged in memory if it was big endian, which it isn't!
Code: [Select]
0      |1      |2      |3      |4      |5      |6      |7      |8      |9      |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
0   9876543210                                                                      
1             9876543210                                                            
2      9876543210                                                  
3            9876543210                                        
4          9876543210                              
5    9876543210                    
6           9876543210          
7        9876543210

Edit:
Newer cameras are 12 bpp
Code: [Select]
0      |1      |2      |3      |4      |5      |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
0   3210    BA987654                                
1       BA98                76543210                
2   BA987654                3210    
3                  76543210    BA98
« Last Edit: 23 / January / 2010, 16:53:37 by reyalp »
Don't forget what the H stands for.

*

Offline PS

  • ***
  • 157
  • A610 1.00f
Re: How pixel values are stored in CHDK raw?
« Reply #3 on: 23 / January / 2010, 14:36:21 »
So, is it 5B/4p or 10B/8p? Is this pattern correct?

00111111 00000000 11112222 22222233 33333333 44555555 44444444 55556666 66666677 77777777 ...


*

Offline reyalp

  • ******
  • 14082
Re: How pixel values are stored in CHDK raw?
« Reply #4 on: 23 / January / 2010, 17:00:26 »
So, is it 5B/4p or 10B/8p? Is this pattern correct?
As above, on ten bit cameras it's 10 bytes / 8 pixels. On 12 bit cameras, it's 6 bytes / 4 pixels.
Quote
00111111 00000000 11112222 22222233 33333333 44555555 44444444 55556666 66666677 77777777 ...
This doesn't look right, see first diagram (past into something with a fixed font if it isn't showing up that way here). Or step through the read_pixel code.
Don't forget what the H stands for.

Re: How pixel values are stored in CHDK raw?
« Reply #5 on: 23 / January / 2010, 18:25:07 »
I worked this out some time ago but cannot guarantee it is correct :-

00111111 00000000 22222233 11112222 44444444 33333333 55556666 44555555 77777777 66666677

 

Related Topics