Paul's description

Home
Up

Minolta Dimage 7 .MRW File Format Discoveries v1.1
Paul K. Hansen, (pal.hans@online.no)
==============================================

v1.1	-Included information from Jake 
	 (His notes on .mrw format can be found here: http://jb.club.tip.nl/)
	-Some minor corrections on field descriptions

v1.0	-First release of the reverse engineering results

==============================================
1. Important Data for converting the images
==============================================

-Image Data Dimensions: 2568 x 1928

-Image Data Big Endian 12bit values right aligned in 16 bit words.
 (12bit Value range used by camera 0000-0F7D = 0-3965)

-First Image Data Row Starts with Red Pixel. Odd rows RGRGRG.. Even Rows GBGBGB..

-Image Data offset = (4 byte Offset value at 0x04) + 0x08

-WB Bias candidate offset = (4 byte Offset value at 0x2c) + 0x3c (Two 4-byte values)


-Aternate Image data Offset calculation:
 offset = File Size - (4 byte Data Size found at offset 0x23C)
	= (9945728) - (9902208) = 0xAA00 (43520) for test picture PICT0003.MRW

-Alternate WB Bias Candidate offset calculation:
 offset = ((0x37B3 + (4 byte Thumbnail size found at offset 0x244)) rounded to 1st higher 4 byte multiple) + 0x0C
        = (0x37B3 + 0x7152 = 0xA905 rounded up to..) 0xA908 + 0x0C = 0xA914 for test picture PICT0003.MRW



==============================================
2. Minolta Dimage7 .MRW raw file HEADER Info
==============================================

2.1 First 48 bytes 
==============================================
00 4D 52 4D 00 00 A9 F8 00 50 52 44 00 00 00 18
32 37 36 36 30 30 30 31 07 88 0A 08 07 88 0A 00
10 0C 52 00 00 00 00 01 00 54 54 57 00 00 A8 D8

Notable offsets:
-0x00   4 bytes		00 4D 52 4D (" MRM")		Minolta MRW Magic Number
-0x04   4 bytes		00 00 A9 F8			Image Data Offset
							(Add 0x08 to get the correct offset)
-0x18:	2 bytes		0788 (1928)			Image Data Height
-0x20:	2 bytes		0A08 (2568)			Image Data Width
-0x2c	4 bytes		A8D8				Offset to Minolta proprietary block
							(Add 0x30 to get the correct offset)

2.2 Tiff Tags found (Values in Hex. Other formats in paranthesis)
==============================================
-ADD 0x30 TO ALL OFFSETS REPORTED IN TIFF TAGS!!

2.2.1 TIFF Header
----------------------------------------------

Location	Tag	TagName

30		4D4D	Tiff Big endian
32		0024	Tiff Magic Number
34		8	IFD 0 Offset


2.2.2 IFD0 (Number of entries: 9)
----------------------------------------------
Location	Tag	TagName			Type		Count		Value/Offset		Comments/ Value at Offset + 0x30

3A		0100	Width			LONG		1		A 00 (2560)		Misleading! Raw image width 2568
46		0101	Height			LONG		1		7 80 (1920)		Misleading! Raw image height 1928
52		0103	Compression		SHORT		1		1 (Uncompressed)
5E		010E	Description		ASCII		8		Offset 7A		DCF 1.0
6A		010F	Make			ASCII		12		Offset 82		Minolta Co., Ltd.
76		0110	Model			ASCII		9		Offset 94		DIMAGE 7
82		0131	Software		ASCII		8		Offset A4		A1v021e
8E		0132	DateTime		ASCII		14		Offset B4		2001:10:25 14:14:32
9A		8769	EXIF IFD Offset		LONG		1		Offset C8


2.2.3 IFD1 (EXIF IFD) (Number of entries 15)
----------------------------------------------
Location	Tag	TagName			Type		Count		Value/Offset		Comments/ Value at Offset + 0x30

FA		8822	Exposure Program	SHORT		1		2
106		8827	ISO Speed		SHORT		1		C8 (200)
112		9000	Exif Version		UNDEFINED	4		30 32 31 30
11E		9003	DateTimeOriginal	ASCII		14		Offset 182		2001:10:25 14:14:32
12A		9004	DateTimeDigitized	ASCII		14		Offset 196		2001:10:25 14:14:32
136		9201	Shutter Speed		SRATIONAL	1		Offset 1AA		00 00 00 55 00 00 00 0A (8.5) <Note 1>
142		9020	Aperture		RATIONAL	1		Offset 1B2		00 00 00 32 00 00 00 0A	(5.0)
14E		9204	Exposure Bias Value	SRATIONAL	1		Offset 1BA		FF FF FF FD 00 00 00 0A (-0.3)
15A		9205	Max Aperture		RATIONAL	1		Offset 1C2		00 00 00 23 00 00 00 0A (3.5)
166		9207	Metering Mode		SHORT		1		3
172		9208	Light Source		SHORT		1		1
17E		9209	Flash			SHORT		1		0
18A		920A	Focal Length		RATIONAL	1		Offset 1CA		00 00 01 5D 00 00 00 10 (3.49)
196		927C	Manufacturer Notes	UNDEFINED	34CA (13514)	Offset 1D2
1A2		A001	ColorSpace		SHORT		1		1

Note 1: The Shutter speed is denoted by APEX value. To get shutter speed,
	use the following formula: Shutter Speed = 1 / (2^(Field value))


2.2.4 MLT0 (Manufacturer Notes) (Number of entries 7)
----------------------------------------------
Location	Tag	TagName			Type		Count		Value/Offset		Comments/ Value at Offset + 0x30

204		0000	Block Descriptor	UNDEFINED	4		4D 4C 54 30		"MLT0"
210		0001	Camera Settings		UNDEFINED	9C		Offset 22C		<See 2.2.5>
21C		0010	Autofocus Related	UNDEFINED	32A8		Offset 2C8		<Note 1>
228		0020	???			UNDEFINED	104		Offset 3570		???
234		0040	Image Size		LONG		1		00 97 18 80 (9902208)	Image Data Size
240		0081	Thumbnail		UNDEFINED	7152		Offset 3783		320x240 JPEG encoded Thumbnail
24C		0E00	Epson PIM info?		UNDEFINED	28		Offset 3674		"PrintIM 0100"

Note 1: The first four values in the block are AF if autofocus was used, 0 if not.
	This block might also have exposure metering raw data.


2.2.5 Camera Settings (0x25c-0x2f7, 156 bytes)
----------------------------------------------
-This block doesn't follow the TIFF Tag format.
-Some offsets/values have been discovered, thanks to Jack for this!
-The contrast/wb/saturation values here stays constant when the value is changed in DIVU

Location	Length		Description		Values

28B		1 byte		Macro Mode		Value is 1 if Macro mode was used, 0 else.
2AF		1 byte		Flash			Value is 1 if flash was used, 0 else.
2CA		2 bytes		Picture Number		First picture value 0, incrementing per picture. (Per seesion?)
2D6		2 bytes		White Balance           01F1 = AWB, 0164 = Daylight, 028F = Tungsten, 
							0216 = Fluorescent, 0151 = Cloudy 0164 = Custom Calibration. <Note 1>
2DB		1 byte		Saturation		Subtract 3 from value to get saturation adjustment setting.
2DF		1 byte		Contrast		Subtract 3 from value to get contrast adjustment setting.

Note 1: These values are reported by Jack. I have seen other values here as well, such as 015C.

2.3 Minolta Proprietary block (0xA908)
==============================================
Offset to this block is found at location 0x2c. Add 0x30 to the 4 byte value here to get the offset.

A909		00 57 42 57 (" WBG")	Length: 00 00 00 0c (12)	Contents: 02 02 02 02    01 c3 01 00    01 00 01 5c  (WB Bias?)

A91C		00 52 49 46 (" RIF")	Length: 00 00 00 38 (56)
----------------------------------------------
A924		???			Value: 00
A925		Saturation Setting	Legal Values: FD=-3 FE=-2 FF=-1 00=0 01=+1 02=+2	 (Changes when saved in DIVU with new settings)
A926		Contrast Setting	Legal Values: FD=-3 FE=-2 FF=-1 00=0 01=+1 02=+2 03=+3						(--"--)
A927		Sharpness Setting	Legal Values: FF=Soft 00=Normal 01=Hard								(--"--)
A928		WB Setting		Legal Values: 0=As set on camera, 1=Daylight, 2=Cloudy, 3=Tungsten, 4=Fluorescent		(--"--)
A929-A92B	???			Values: 00 38 00 
A92C-A94B	???			Values: 00 f0 02 84    01 c3 01 5c    01 c9 01 49    01 ca 02 0a
					        01 e5 01 31    02 0f 01 44    00 4c 00 4b    00 1e 00 4b
A94C-A95B	White Balance?		Values: ff db ff c6    00 99 ff c6    00 9a ff b6
----------------------------------------------

A95C		00 50 41 44 (" PAD")	Length: Variable	Variable number of null bytes. Padding for alignment of image data