head	1.9;
access;
symbols
	netbsd-11-0-RC6:1.8
	netbsd-11-0-RC5:1.8
	FILE5_48:1.1.1.13
	netbsd-11-0-RC4:1.8
	netbsd-11-0-RC3:1.8
	netbsd-11-0-RC2:1.8
	netbsd-11-0-RC1:1.8
	perseant-exfatfs-base-20250801:1.8
	netbsd-11:1.8.0.4
	netbsd-11-base:1.8
	netbsd-10-1-RELEASE:1.7
	perseant-exfatfs-base-20240630:1.8
	perseant-exfatfs:1.8.0.2
	perseant-exfatfs-base:1.8
	netbsd-8-3-RELEASE:1.4
	netbsd-9-4-RELEASE:1.5
	netbsd-10-0-RELEASE:1.7
	netbsd-10-0-RC6:1.7
	netbsd-10-0-RC5:1.7
	netbsd-10-0-RC4:1.7
	netbsd-10-0-RC3:1.7
	netbsd-10-0-RC2:1.7
	netbsd-10-0-RC1:1.7
	FILE5_45:1.1.1.12
	netbsd-10:1.7.0.2
	netbsd-10-base:1.7
	FILE5_43:1.1.1.11
	netbsd-9-3-RELEASE:1.5
	cjep_sun2x-base1:1.6
	cjep_sun2x:1.6.0.4
	cjep_sun2x-base:1.6
	cjep_staticlib_x-base1:1.6
	netbsd-9-2-RELEASE:1.5
	cjep_staticlib_x:1.6.0.2
	cjep_staticlib_x-base:1.6
	FILE5_40:1.1.1.10
	netbsd-9-1-RELEASE:1.5
	FILE5_39:1.1.1.9
	phil-wifi-20200421:1.5
	phil-wifi-20200411:1.5
	is-mlppp:1.5.0.4
	is-mlppp-base:1.5
	phil-wifi-20200406:1.5
	netbsd-8-2-RELEASE:1.4
	netbsd-9-0-RELEASE:1.5
	netbsd-9-0-RC2:1.5
	FILE5_38:1.1.1.9
	netbsd-9-0-RC1:1.5
	phil-wifi-20191119:1.5
	netbsd-9:1.5.0.2
	netbsd-9-base:1.5
	phil-wifi-20190609:1.5
	netbsd-8-1-RELEASE:1.4
	FILE5_37:1.1.1.9
	netbsd-8-1-RC1:1.4
	pgoyette-compat-merge-20190127:1.4.8.1
	pgoyette-compat-20190127:1.5
	pgoyette-compat-20190118:1.5
	pgoyette-compat-1226:1.5
	pgoyette-compat-1126:1.5
	pgoyette-compat-1020:1.5
	FILE5_35:1.1.1.9
	pgoyette-compat-0930:1.4
	pgoyette-compat-0906:1.4
	netbsd-7-2-RELEASE:1.1.1.4
	pgoyette-compat-0728:1.4
	netbsd-8-0-RELEASE:1.4
	phil-wifi:1.4.0.10
	phil-wifi-base:1.4
	pgoyette-compat-0625:1.4
	netbsd-8-0-RC2:1.4
	pgoyette-compat-0521:1.4
	pgoyette-compat-0502:1.4
	pgoyette-compat-0422:1.4
	netbsd-8-0-RC1:1.4
	FILE5_33:1.1.1.8
	pgoyette-compat-0415:1.4
	pgoyette-compat-0407:1.4
	pgoyette-compat-0330:1.4
	pgoyette-compat-0322:1.4
	pgoyette-compat-0315:1.4
	netbsd-7-1-2-RELEASE:1.1.1.4
	pgoyette-compat:1.4.0.8
	pgoyette-compat-base:1.4
	netbsd-7-1-1-RELEASE:1.1.1.4
	matt-nb8-mediatek:1.4.0.6
	matt-nb8-mediatek-base:1.4
	FILE5_32:1.1.1.8
	perseant-stdc-iso10646:1.4.0.4
	perseant-stdc-iso10646-base:1.4
	netbsd-8:1.4.0.2
	netbsd-8-base:1.4
	FILE5_31:1.1.1.8
	prg-localcount2-base3:1.3
	prg-localcount2-base2:1.3
	prg-localcount2-base1:1.3
	prg-localcount2:1.3.0.2
	prg-localcount2-base:1.3
	pgoyette-localcount-20170426:1.3
	bouyer-socketcan-base1:1.3
	pgoyette-localcount-20170320:1.3
	netbsd-7-1:1.1.1.4.0.16
	netbsd-7-1-RELEASE:1.1.1.4
	netbsd-7-1-RC2:1.1.1.4
	FILE5_30:1.1.1.7
	netbsd-7-nhusb-base-20170116:1.1.1.4
	bouyer-socketcan:1.2.0.4
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	netbsd-7-1-RC1:1.1.1.4
	pgoyette-localcount-20161104:1.2
	netbsd-7-0-2-RELEASE:1.1.1.4
	localcount-20160914:1.2
	netbsd-7-nhusb:1.1.1.4.0.14
	netbsd-7-nhusb-base:1.1.1.4
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.2
	pgoyette-localcount-base:1.2
	netbsd-7-0-1-RELEASE:1.1.1.4
	netbsd-7-0:1.1.1.4.0.12
	netbsd-7-0-RELEASE:1.1.1.4
	netbsd-7-0-RC3:1.1.1.4
	netbsd-7-0-RC2:1.1.1.4
	netbsd-7-0-RC1:1.1.1.4
	FILE5_22:1.1.1.6
	FILE5_20:1.1.1.5
	netbsd-6-0-6-RELEASE:1.1.1.2
	netbsd-6-1-5-RELEASE:1.1.1.2
	netbsd-7:1.1.1.4.0.10
	netbsd-7-base:1.1.1.4
	FILE5_19:1.1.1.4
	yamt-pagecache-base9:1.1.1.4
	yamt-pagecache-tag8:1.1.1.2.4.1
	netbsd-6-1-4-RELEASE:1.1.1.2
	netbsd-6-0-5-RELEASE:1.1.1.2
	tls-earlyentropy:1.1.1.4.0.8
	tls-earlyentropy-base:1.1.1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.4
	riastradh-drm2-base3:1.1.1.4
	netbsd-6-1-3-RELEASE:1.1.1.2
	netbsd-6-0-4-RELEASE:1.1.1.2
	FILE5_16:1.1.1.4
	netbsd-6-1-2-RELEASE:1.1.1.2
	netbsd-6-0-3-RELEASE:1.1.1.2
	netbsd-6-1-1-RELEASE:1.1.1.2
	riastradh-drm2-base2:1.1.1.4
	riastradh-drm2-base1:1.1.1.4
	riastradh-drm2:1.1.1.4.0.6
	riastradh-drm2-base:1.1.1.4
	netbsd-6-1:1.1.1.2.0.14
	netbsd-6-0-2-RELEASE:1.1.1.2
	netbsd-6-1-RELEASE:1.1.1.2
	khorben-n900:1.1.1.4.0.4
	netbsd-6-1-RC4:1.1.1.2
	netbsd-6-1-RC3:1.1.1.2
	agc-symver:1.1.1.4.0.2
	agc-symver-base:1.1.1.4
	FILE5_14:1.1.1.4
	netbsd-6-1-RC2:1.1.1.2
	netbsd-6-1-RC1:1.1.1.2
	yamt-pagecache-base8:1.1.1.3
	FILE_5_12:1.1.1.3
	netbsd-6-0-1-RELEASE:1.1.1.2
	yamt-pagecache-base7:1.1.1.2
	matt-nb6-plus-nbase:1.1.1.2
	yamt-pagecache-base6:1.1.1.2
	netbsd-6-0:1.1.1.2.0.12
	netbsd-6-0-RELEASE:1.1.1.2
	netbsd-6-0-RC2:1.1.1.2
	tls-maxphys:1.1.1.2.0.10
	tls-maxphys-base:1.1.1.4
	matt-nb6-plus:1.1.1.2.0.8
	matt-nb6-plus-base:1.1.1.2
	netbsd-6-0-RC1:1.1.1.2
	yamt-pagecache-base5:1.1.1.2
	yamt-pagecache-base4:1.1.1.2
	FILE5_11:1.1.1.2
	netbsd-6:1.1.1.2.0.6
	netbsd-6-base:1.1.1.2
	yamt-pagecache-base3:1.1.1.2
	yamt-pagecache-base2:1.1.1.2
	yamt-pagecache:1.1.1.2.0.4
	yamt-pagecache-base:1.1.1.2
	FILE5_09:1.1.1.2
	cherry-xenmp:1.1.1.2.0.2
	cherry-xenmp-base:1.1.1.2
	FILE5_07:1.1.1.2
	bouyer-quota2-nbase:1.1.1.1
	bouyer-quota2:1.1.1.1.0.4
	bouyer-quota2-base:1.1.1.1
	matt-mips64-premerge-20101231:1.1.1.1
	matt-premerge-20091211:1.1.1.1
	jym-xensuspend-base:1.1.1.1
	jym-xensuspend:1.1.1.1.0.2
	jym-xensuspend-nbase:1.1.1.1
	FILE5_03:1.1.1.1
	CHRISTOS:1.1.1;
locks; strict;
comment	@# @;


1.9
date	2026.06.10.20.54.16;	author christos;	state Exp;
branches;
next	1.8;
commitid	7mUHk6JZASLAkiJG;

1.8
date	2023.08.18.19.00.10;	author christos;	state Exp;
branches;
next	1.7;
commitid	MBLVQLzqzmQ7IiBE;

1.7
date	2022.09.24.20.21.46;	author christos;	state Exp;
branches;
next	1.6;
commitid	zJ5LoIcubBSIH9VD;

1.6
date	2021.04.09.19.11.41;	author christos;	state Exp;
branches;
next	1.5;
commitid	hKe2GL3vw8SVrEOC;

1.5
date	2018.10.19.00.11.48;	author christos;	state Exp;
branches;
next	1.4;
commitid	rS69r6X9WBZwavWA;

1.4
date	2017.05.25.00.11.26;	author christos;	state Exp;
branches
	1.4.8.1
	1.4.10.1;
next	1.3;
commitid	FQJOXzdL3jIJCHSz;

1.3
date	2017.02.10.17.53.24;	author christos;	state Exp;
branches;
next	1.2;
commitid	bl2PZy94aycnQqFz;

1.2
date	2015.01.02.23.27.46;	author christos;	state Exp;
branches
	1.2.2.1
	1.2.4.1;
next	1.1;
commitid	ouHhFNkax9eCrv4y;

1.1
date	2009.05.08.16.35.09;	author christos;	state Exp;
branches
	1.1.1.1;
next	;

1.4.8.1
date	2018.10.20.06.58.20;	author pgoyette;	state Exp;
branches;
next	;
commitid	mTSoqZEZ4arHnFWA;

1.4.10.1
date	2019.06.10.21.44.46;	author christos;	state Exp;
branches;
next	;
commitid	jtc8rnCzWiEEHGqB;

1.2.2.1
date	2017.03.20.06.52.19;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.2.4.1
date	2017.04.21.16.51.24;	author bouyer;	state Exp;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.1.1.1
date	2009.05.08.16.35.09;	author christos;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;

1.1.1.2
date	2011.05.12.20.47.02;	author christos;	state Exp;
branches
	1.1.1.2.4.1
	1.1.1.2.10.1;
next	1.1.1.3;

1.1.1.3
date	2013.01.03.16.27.54;	author christos;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2013.03.23.15.49.18;	author christos;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2014.10.10.20.08.22;	author christos;	state Exp;
branches;
next	1.1.1.6;
commitid	pfOzhE33qnut2HTx;

1.1.1.6
date	2015.01.02.20.34.28;	author christos;	state Exp;
branches;
next	1.1.1.7;
commitid	VjK78yRsQNs8uu4y;

1.1.1.7
date	2017.02.10.17.42.58;	author christos;	state Exp;
branches;
next	1.1.1.8;
commitid	HAP3kn9Hn6ovMqFz;

1.1.1.8
date	2017.05.24.23.59.57;	author christos;	state Exp;
branches;
next	1.1.1.9;
commitid	WbyOU2LBE5qOyHSz;

1.1.1.9
date	2018.10.18.23.54.09;	author christos;	state Exp;
branches;
next	1.1.1.10;
commitid	e8WctwerBeEm4vWA;

1.1.1.10
date	2021.04.09.18.58.02;	author christos;	state Exp;
branches;
next	1.1.1.11;
commitid	W9ddLLbSkHHinEOC;

1.1.1.11
date	2022.09.24.20.07.54;	author christos;	state Exp;
branches;
next	1.1.1.12;
commitid	Nf6F9kcpc0EPC9VD;

1.1.1.12
date	2023.08.18.18.36.50;	author christos;	state Exp;
branches;
next	1.1.1.13;
commitid	IX26ghc1E2S0AiBE;

1.1.1.13
date	2026.06.10.15.59.14;	author christos;	state Exp;
branches;
next	;
commitid	3UWc0DrzTz7bHgJG;

1.1.1.1.2.1
date	2009.05.08.16.35.09;	author jym;	state dead;
branches;
next	1.1.1.1.2.2;

1.1.1.1.2.2
date	2009.05.13.18.51.56;	author jym;	state Exp;
branches;
next	;

1.1.1.2.4.1
date	2013.01.23.00.04.35;	author yamt;	state Exp;
branches;
next	1.1.1.2.4.2;

1.1.1.2.4.2
date	2014.05.22.15.44.59;	author yamt;	state Exp;
branches;
next	;
commitid	tYJXbWAuFvTh7yBx;

1.1.1.2.10.1
date	2013.02.25.00.26.06;	author tls;	state Exp;
branches;
next	1.1.1.2.10.2;

1.1.1.2.10.2
date	2013.06.23.06.26.32;	author tls;	state Exp;
branches;
next	;
commitid	OnlO1cBgtQRcIHUw;


desc
@@


1.9
log
@merge changes between file-5.45 and file-5.48
@
text
@
#------------------------------------------------------------------------------
# $File: jpeg,v 1.40 2024/11/10 00:26:35 christos Exp $
# JPEG images
# SunOS 5.5.1 had
#
#	0	string		\377\330\377\340	JPEG file
#	0	string		\377\330\377\356	JPG file
#
# both of which turn into "JPEG image data" here.
#
0	belong			0xffd8fff7	JPEG-LS image data
!:mime	image/jls
!:ext jls
>0	use			jpeg

0	belong&0xffffff00	0xffd8ff00	JPEG image data
!:mime	image/jpeg
!:apple	8BIMJPEG
!:strength *3
!:ext jpeg/jpg/jpe/jfif
>0	use			jpeg

0	name		jpeg
>6	string		JFIF		\b, JFIF standard
# The following added by Erik Rossen <rossen@@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF.  Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
# impossible to specify in magic(4) format.
# First, a little JFIF version info:
>>11	byte		x		\b %d.
>>12	byte		x		\b%02d
# Next, the resolution or aspect ratio of the image:
>>13	byte		0		\b, aspect ratio
>>13	byte		1		\b, resolution (DPI)
>>13	byte		2		\b, resolution (DPCM)
>>14	ubeshort	x		\b, density %ux
>>16	ubeshort	x		\b%u
>>4	ubeshort	x		\b, segment length %u
# Next, show thumbnail info, if it exists:
>>18	byte		!0		\b, thumbnail %ux
>>>19	byte		x		\b%u
>6	string		Exif		\b, Exif standard: [
>>12	indirect/r	x
>>12	string		x		\b]

# Jump to the first segment
>(4.S+4)	use		jpeg_segment

# This uses recursion...
0		name		jpeg_segment
>0	beshort		0xFFFE
# Recursion handled by FFE0
#>>(2.S+2)	use			jpeg_segment
>>2	pstring/HJ	x		\b, comment: "%s"

>0	beshort		0xFFC0
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, baseline, precision %d
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
>>9	byte		x		\b, components %d

>0	beshort		0xFFC1
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, extended sequential, precision %d
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
>>9	byte		x		\b, components %d

>0	beshort		0xFFC2
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, progressive, precision %d
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
>>9	byte		x		\b, components %d

# Define Huffman Tables
>0	beshort		0xFFC4
>>(2.S+2)	use			jpeg_segment

>0	beshort		0xFFE1
# Recursion handled by FFE0
#>>(2.S+2)	use			jpeg_segment
>>4	string		Exif		\b, Exif Standard: [
>>>10	indirect/r	x
>>>10	string		x		\b]

# Application specific markers
>0	beshort&0xFFE0	=0xFFE0
>>(2.S+2)	use			jpeg_segment

# DB: Define Quantization tables
# DD: Define Restart interval [XXX: wrong here, it is 4 bytes]
# D8: Start of image
# D9: End of image
# Dn: Restart
>0	beshort&0xFFD0	=0xFFD0
>>0	beshort&0xFFE0	!0xFFE0
>>>(2.S+2)	use			jpeg_segment

#>0	beshort		x		unknown %#x
#>>(2.S+2)	use			jpeg_segment

# HSI is Handmade Software's proprietary JPEG encoding scheme
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/HSI_JPEG
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-hsi1.trid.xml
# Note:         called by TrID "HSI JPEG bitmap"
0	string		hsi1		JPEG image data, HSI proprietary
#!:mime	application/octet-stream
!:mime	image/x-hsi
!:ext	hsi/jpg

# From: David Santinoli <david@@santinoli.com>
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
# delete from ./animation (version 1.87) with jP (=6A50h) magic at offset 4
# From: Johan van der Knijff <johan.vanderknijff@@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JP2
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpeg2k.trid.xml
# Note:         called by TrID "JPEG 2000 bitmap"
>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
# aliases	image/jpeg2000, image/jpeg2000-image, image/x-jpeg2000-image
!:mime	image/jp2
!:ext	jp2
# URL:		http://fileformats.archiveteam.org/wiki/JPX
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpx.trid.xml
# Note:         called by TrID "JPEG 2000 eXtended bitmap"
>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
!:mime	image/jpx
!:ext	jpf/jpx
# URL:		http://fileformats.archiveteam.org/wiki/JPM
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpm.trid.xml
# Note:         called by TrID "JPEG 2000 eXtended bitmap"
>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
!:mime	image/jpm
!:ext	jpm
# URL:		http://fileformats.archiveteam.org/wiki/MJ2
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/v/video-mj2.trid.xml
# Note:         called by TrID "Motion JPEG 2000 video"
>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
!:mime	video/mj2
!:ext	mj2/mjp2

# Type: JPEG 2000 codesream
# From: Mathieu Malaterre <mathieu.malaterre@@gmail.com>
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_2000_codestream
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpc.trid.xml
# Note:         called by TrID "JPEG-2000 Code Stream bitmap"
0	belong		0xff4fff51						JPEG 2000 codestream
# value like: 0701h FF50h
#>45	ubeshort	x	\b, at 45 %#4.4x
#!:mime	application/octet-stream
# https://reposcope.com/mimetype/image/x-jp2-codestream
!:mime	image/x-jp2-codestream
!:ext	jpc/j2c/j2k
# MAYBE also JHC like in byte_causal.jhc ?
# WHAT IS THAT? DEAD ENTRY?
#45	beshort		0xff52

# JPEG extended range
# Update:	Joerg Jenderek 2023
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XR
# Reference:	https://www.itu.int/rec/T-REC-T.832
#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wmp.trid.xml
#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxr.trid.xml
# Note:         called by TrID "JPEG XR bitmap" and "JPEG XR bitmap (WMPHOTO)"
#		verified as "JPEG XR" by XnView `nconvert -fullinfo *.jxr *.wdp`
#		partly by ImageMagick command `identify -verbose *.wdp`
#		and libjxr-tools `JxrDecApp -v -i example.wdp -o example.tif`
0	string		\x49\x49\xbc
# FILE_VERSION_ID; shall be equal to 1; other values are reserved for future use and are unlike to appear
>3	byte		1
# FIRST_IFD_OFFSET; shall be an integer multiple of 2; so skip DROID fmt-590-signature-id-931.wdp
>>4	lelong%2	0	JPEG-XR Image
#!:mime	image/vnd.ms-photo
!:mime	image/jxr
# NO example for HDP !
!:ext	jxr/wdp/hdp
# MAYBE also WMP ?
#!:ext	jxr/wdp/hdp/wmp
# moved from ./images (version 1.243 ) and merged
# example:
# http://shikino.co.jp/solution/upfile/FLOWER.wdp.zip
# often GDI_SIGNATURE "WMPHOTO\0" at offset 90 like: FLOWER.wdp abydos.jxr SMALLTOMATO.wdp
>90	bequad		0x574D50484F544F00
>>0	use	jxr-info
# seldom no GDI_SIGNATURE WMPHOTO\0 at offset 90 like: example.wdp MARKET-3361-ipm-bg-DE-treat[1].wdp
>90	bequad		!0x574D50484F544F00
# look for GDI_SIGNATURE WMPHOTO\0 at other offset
>>4	search/3267/sb	WMPHOTO\0
>>>&-90	use	jxr-info
#
0	name	jxr-info
# check for GDI_SIGNATURE that corresponds to "WMPHOTO\0"
>90	bequad		0x574D50484F544F00
>>98	byte&0x08	=0x08			\b, hard tiling
>>99	byte&0x80	=0x80			\b, tiling present
>>99	byte&0x40	=0x40			\b, codestream present
>>99	byte&0x38	x			\b, spatial xform=
>>99	byte&0x38	0x00			\bTL
>>99	byte&0x38	0x08			\bBL
>>99	byte&0x38	0x10			\bTR
>>99	byte&0x38	0x18			\bBR
>>99	byte&0x38	0x20			\bBT
>>99	byte&0x38	0x28			\bRB
>>99	byte&0x38	0x30			\bLT
>>99	byte&0x38	0x38			\bLB
>>100	byte&0x80	=0x80			\b, short header
>>>102	beshort+1	x			\b, %u
>>>104	beshort+1	x			\bx%u
>>100	byte&0x80	=0x00			\b, long header
>>>102	belong+1	x			\b, %x
>>>106	belong+1	x			\bx%x
>>101	beshort&0xf	x			\b, bitdepth=
>>>101	beshort&0xf	0x0			\b1-WHITE=1
>>>101	beshort&0xf	0x1			\b8
>>>101	beshort&0xf	0x2			\b16
>>>101	beshort&0xf	0x3			\b16-SIGNED
>>>101	beshort&0xf	0x4			\b16-FLOAT
>>>101	beshort&0xf	0x5			\b(reserved 5)
>>>101	beshort&0xf	0x6			\b32-SIGNED
>>>101	beshort&0xf	0x7			\b32-FLOAT
>>>101	beshort&0xf	0x8			\b5
>>>101	beshort&0xf	0x9			\b10
>>>101	beshort&0xf	0xa			\b5-6-5
>>>101	beshort&0xf	0xb			\b(reserved %d)
>>>101	beshort&0xf	0xc			\b(reserved %d)
>>>101	beshort&0xf	0xd			\b(reserved %d)
>>>101	beshort&0xf	0xe			\b(reserved %d)
>>>101	beshort&0xf	0xf			\b1-BLACK=1
>>101	beshort&0xf0	x			\b, colorfmt=
>>>101	beshort&0xf0	0x00			\bYONLY
>>>101	beshort&0xf0	0x10			\bYUV240
>>>101	beshort&0xf0	0x20			\bYWV422
>>>101	beshort&0xf0	0x30			\bYWV444
>>>101	beshort&0xf0	0x40			\bCMYK
>>>101	beshort&0xf0	0x50			\bCMYKDIRECT
>>>101	beshort&0xf0	0x60			\bNCOMPONENT
>>>101	beshort&0xf0	0x70			\bRGB
>>>101	beshort&0xf0	0x80			\bRGBE
>>>101	beshort&0xf0	>0x80			\b(reserved %#x)

# JPEG XL
# From: Ian Tester
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl.trid.xml
# Note:         called by TrID "JPEG XL bitmap"
0	string	\xff\x0a				JPEG XL codestream
!:mime	image/jxl
!:ext jxl

# JPEG XL (transcoded JPEG file)
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl-iso.trid.xml 
# Note:         called by TrID "JPEG XL bitmap (ISOBMFF)"
0	string	\x00\x00\x00\x0cJXL\x20\x0d\x0a\x87\x0a	JPEG XL container
!:mime	image/jxl
!:ext jxl
@


1.8
log
@merge conflicts between file-5.43 and file-5.45
@
text
@d3 1
a3 1
# $File: jpeg,v 1.38 2022/12/02 17:42:04 christos Exp $
d37 3
a39 3
>>14	beshort		x		\b, density %dx
>>16	beshort		x		\b%d
>>4	beshort		x		\b, segment length %d
d41 2
a42 2
>>18	byte		!0		\b, thumbnail %dx
>>>19	byte		x		\b%d
d60 2
a61 2
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
d67 2
a68 2
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
d74 2
a75 2
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
d168 1
d172 5
a176 1
# Note:         called by TrID "JPEG XR bitmap"
d178 1
a178 1
# FILE_VERSION_ID; shall be equal to 1; other values are reserved for future use
d181 1
a181 1
>>4	lelong%2	0	JPEG-XR
d188 2
a189 3
# moved from ./images (version 1.205 ), merged and
# partly verified by XnView `nconvert -info abydos.jxr FLOWER.wdp`
# example: https://web.archive.org/web/20160403012904/
d191 11
d216 2
a217 2
>>>102	beshort+1	x			\b, %d
>>>104	beshort+1	x			\bx%d
@


1.7
log
@merge changes between 5.40 and 5.43
@
text
@d3 1
a3 1
# $File: jpeg,v 1.37 2022/06/17 18:03:35 christos Exp $
d242 1
a242 2
#!:mime  image/jxl
!:mime	image/x-jxl
d251 1
a251 2
#!:mime  image/jxl
!:mime	image/x-jxl
@


1.6
log
@merge local changes between 5.39 and 5.40 and add magic entries from HEAD.
@
text
@d3 1
a3 1
# $File: jpeg,v 1.33 2021/03/21 15:04:50 christos Exp $
d12 6
a17 1
0	beshort		0xffd8		JPEG image data
d22 3
d102 1
a102 1
#>0	beshort		x		unknown 0x%x
d106 4
d111 3
d117 1
d123 4
d128 1
d130 4
d136 4
d142 4
d148 1
d152 4
d157 9
a165 1
45	beshort		0xff52
d168 4
d173 1
d175 1
d177 1
d179 55
a233 1
!:ext	jxr
d237 4
d242 2
a243 1
!:mime  image/jxl
d247 4
d252 2
a253 1
!:mime  image/jxl
@


1.5
log
@Merge conflicts
@
text
@d3 1
a3 1
# $File: jpeg,v 1.32 2018/10/01 18:58:29 christos Exp $
d127 11
@


1.4
log
@merge 5.31
@
text
@d3 1
a3 1
# $File: jpeg,v 1.31 2017/03/17 21:35:28 christos Exp $
d54 1
a54 1
>>9	byte		x		\b, frames %d
d61 1
a61 1
>>9	byte		x		\b, frames %d
d68 1
a68 1
>>9	byte		x		\b, frames %d
@


1.4.10.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $File: jpeg,v 1.32 2018/10/01 18:58:29 christos Exp $
d54 1
a54 1
>>9	byte		x		\b, components %d
d61 1
a61 1
>>9	byte		x		\b, components %d
d68 1
a68 1
>>9	byte		x		\b, components %d
@


1.4.8.1
log
@Sync with head
@
text
@d3 1
a3 1
# $File: jpeg,v 1.32 2018/10/01 18:58:29 christos Exp $
d54 1
a54 1
>>9	byte		x		\b, components %d
d61 1
a61 1
>>9	byte		x		\b, components %d
d68 1
a68 1
>>9	byte		x		\b, components %d
@


1.3
log
@merge conflicts
@
text
@d3 1
a3 1
# $File: jpeg,v 1.30 2016/07/04 15:18:23 christos Exp $
d56 1
a56 1
>0	beshort		0xFFC1		
d63 1
a63 1
>0	beshort		0xFFC2		
d74 1
a74 1
>0	beshort		0xFFE1		
d78 1
a78 1
>>>10	indirect/r	x		
@


1.2
log
@fix recursion
@
text
@d3 1
a3 1
# $File: jpeg,v 1.26 2015/01/02 22:40:27 christos Exp $
d15 2
a16 1
!:strength +2
d120 7
@


1.2.4.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $File: jpeg,v 1.30 2016/07/04 15:18:23 christos Exp $
d15 1
a15 2
!:strength *3
!:ext jpeg/jpg/jpe/jfif
a118 7

# JPEG extended range
0	string		\x49\x49\xbc
>3	byte		1
>>4	lelong%2	0	JPEG-XR
!:mime	image/jxr
!:ext	jxr
@


1.2.2.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $File: jpeg,v 1.30 2016/07/04 15:18:23 christos Exp $
d15 1
a15 2
!:strength *3
!:ext jpeg/jpg/jpe/jfif
a118 7

# JPEG extended range
0	string		\x49\x49\xbc
>3	byte		1
>>4	lelong%2	0	JPEG-XR
!:mime	image/jxr
!:ext	jxr
@


1.1
log
@Initial revision
@
text
@d3 1
d15 1
a15 1
!:strength +1
d25 6
a30 4
#>>13	byte		0		\b, aspect ratio
#>>13	byte		1		\b, resolution (DPI)
#>>13	byte		2		\b, resolution (DPCM)
#>>4	beshort		x		\b, segment length %d
d34 3
d38 57
a94 123
# EXIF moved down here to avoid reporting a bogus version number,
# and EXIF version number printing added.
#   - Patrik R=E5dman <patrik+file-magic@@iki.fi>
>6	string		Exif		\b, EXIF standard
# Look for EXIF IFD offset in IFD 0, and then look for EXIF version tag in EXIF IFD.
# All possible combinations of entries have to be enumerated, since no looping
# is possible. And both endians are possible...
# The combinations included below are from real-world JPEGs.
# Little-endian
>>12	string		II		
# IFD 0 Entry #5:
>>>70	leshort		0x8769          
# EXIF IFD Entry #1:
>>>>(78.l+14)	leshort	0x9000		
>>>>>(78.l+23)	byte	x		%c
>>>>>(78.l+24)	byte	x		\b.%c
>>>>>(78.l+25)	byte	!0x30		\b%c
# IFD 0 Entry #9:
>>>118	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(126.l+38)	leshort	0x9000		
>>>>>(126.l+47)	byte	x		%c
>>>>>(126.l+48)	byte	x		\b.%c
>>>>>(126.l+49)	byte	!0x30		\b%c
# IFD 0 Entry #10
>>>130	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(138.l+38)	leshort	0x9000		
>>>>>(138.l+47)	byte	x		%c
>>>>>(138.l+48)	byte	x		\b.%c
>>>>>(138.l+49)	byte	!0x30		\b%c
# EXIF IFD Entry #4:
>>>>(138.l+50)	leshort	0x9000		
>>>>>(138.l+59)	byte	x		%c
>>>>>(138.l+60)	byte	x		\b.%c
>>>>>(138.l+61)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(138.l+62)	leshort	0x9000		
>>>>>(138.l+71)	byte	x		%c
>>>>>(138.l+72)	byte	x		\b.%c
>>>>>(138.l+73)	byte	!0x30		\b%c
# IFD 0 Entry #11
>>>142	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(150.l+38)	leshort	0x9000		
>>>>>(150.l+47)	byte	x		%c
>>>>>(150.l+48)	byte	x		\b.%c
>>>>>(150.l+49)	byte	!0x30		\b%c
# EXIF IFD Entry #4:
>>>>(150.l+50)	leshort	0x9000		
>>>>>(150.l+59)	byte	x		%c
>>>>>(150.l+60)	byte	x		\b.%c
>>>>>(150.l+61)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(150.l+62)	leshort	0x9000		
>>>>>(150.l+71)	byte	x		%c
>>>>>(150.l+72)	byte	x		\b.%c
>>>>>(150.l+73)	byte	!0x30		\b%c
# Big-endian
>>12	string		MM		
# IFD 0 Entry #9:
>>>118	beshort		0x8769          
# EXIF IFD Entry #1:
>>>>(126.L+14)	beshort	0x9000		
>>>>>(126.L+23)	byte	x		%c
>>>>>(126.L+24)	byte	x		\b.%c
>>>>>(126.L+25)	byte	!0x30		\b%c
# EXIF IFD Entry #3:
>>>>(126.L+38)	beshort	0x9000		
>>>>>(126.L+47)	byte	x		%c
>>>>>(126.L+48)	byte	x		\b.%c
>>>>>(126.L+49)	byte	!0x30		\b%c
# IFD 0 Entry #10
>>>130	beshort		0x8769          
# EXIF IFD Entry #3:
>>>>(138.L+38)	beshort	0x9000		
>>>>>(138.L+47)	byte	x		%c
>>>>>(138.L+48)	byte	x		\b.%c
>>>>>(138.L+49)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(138.L+62)	beshort	0x9000		
>>>>>(138.L+71)	byte	x		%c
>>>>>(138.L+72)	byte	x		\b.%c
>>>>>(138.L+73)	byte	!0x30		\b%c
# IFD 0 Entry #11
>>>142	beshort		0x8769          
# EXIF IFD Entry #4:
>>>>(150.L+50)	beshort	0x9000		
>>>>>(150.L+59)	byte	x		%c
>>>>>(150.L+60)	byte	x		\b.%c
>>>>>(150.L+61)	byte	!0x30		\b%c
# Here things get sticky.  We can do ONE MORE marker segment with
# indirect addressing, and that's all.  It would be great if we could
# do pointer arithemetic like in an assembler language.  Christos?
# And if there was some sort of looping construct to do searches, plus a few
# named accumulators, it would be even more effective...
# At least we can show a comment if no other segments got inserted before:
>(4.S+5)	byte		0xFE
>>(4.S+8)	string		>\0		\b, comment: "%s"
# FIXME: When we can do non-byte counted strings, we can use that to get
# the string's count, and fix Debian bug #283760
#>(4.S+5)	byte		0xFE		\b, comment
#>>(4.S+6)	beshort		x		\b length=%d
#>>(4.S+8)	string		>\0		\b, "%s"
# Or, we can show the encoding type (I've included only the three most common)
# and image dimensions if we are lucky and the SOFn (image segment) is here:
>(4.S+5)	byte		0xC0		\b, baseline
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
>(4.S+5)	byte		0xC1		\b, extended sequential
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
>(4.S+5)	byte		0xC2		\b, progressive
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
# I've commented-out quantisation table reporting.  I doubt anyone cares yet.
#>(4.S+5)	byte		0xDB		\b, quantisation table
#>>(4.S+6)	beshort		x		\b length=%d
#>14	beshort		x		\b, %d x
#>16	beshort		x		\b %d
d100 14
a113 1
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000 image data
@


1.1.1.1
log
@from ftp.astron.com
@
text
@@


1.1.1.2
log
@from ftp.astron.com.
- many security related fixes
- no MAXPATHLEN limits
- fixed missing text specification on ascii magic
- new ``pascal'' style string formats
- whitespace comparison fix
- more magic
@
text
@a2 1
# $File: jpeg,v 1.16 2011/01/04 19:29:32 rrt Exp $
d129 7
a135 2
>(4.S+5)	byte		0xFE		\b, comment:
>>(4.S+6)	pstring/HJ	x		"%s"
@


1.1.1.2.10.1
log
@resync with head
@
text
@d3 1
a3 1
# $File: jpeg,v 1.18 2012/08/01 12:12:36 christos Exp $
d156 1
a156 14
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
# From: Johan van der Knijff <johan.vanderknijff@@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
!:mime	image/jp2
>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
!:mime	image/jpx
>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
!:mime	image/jpm
>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
!:mime	video/mj2
@


1.1.1.2.10.2
log
@resync from head
@
text
@d3 1
a3 1
# $File: jpeg,v 1.19 2013/02/04 15:50:03 christos Exp $
d15 1
a15 1
!:strength +2
@


1.1.1.2.4.1
log
@sync with head
@
text
@d3 1
a3 1
# $File: jpeg,v 1.18 2012/08/01 12:12:36 christos Exp $
d156 1
a156 14
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
# From: Johan van der Knijff <johan.vanderknijff@@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
!:mime	image/jp2
>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
!:mime	image/jpx
>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
!:mime	image/jpm
>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
!:mime	video/mj2
@


1.1.1.2.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d3 1
a3 1
# $File: jpeg,v 1.19 2013/02/04 15:50:03 christos Exp $
d15 1
a15 1
!:strength +2
@


1.1.1.3
log
@from ftp.astron.com
@
text
@d3 1
a3 1
# $File: jpeg,v 1.18 2012/08/01 12:12:36 christos Exp $
d156 1
a156 14
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000
# From: Johan van der Knijff <johan.vanderknijff@@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
>20	string		\x6a\x70\x32\x20	Part 1 (JP2)
!:mime	image/jp2
>20	string		\x6a\x70\x78\x20	Part 2 (JPX)
!:mime	image/jpx
>20	string		\x6a\x70\x6d\x20	Part 6 (JPM)
!:mime	image/jpm
>20	string		\x6d\x6a\x70\x32	Part 3 (MJ2)
!:mime	video/mj2
@


1.1.1.4
log
@import file-5.14
changes are "name" + "use" keyword features, bug fixes
@
text
@d3 1
a3 1
# $File: jpeg,v 1.19 2013/02/04 15:50:03 christos Exp $
d15 1
a15 1
!:strength +2
@


1.1.1.5
log
@import file-5.20; bug fixes and better image magic descriptions.
@
text
@d3 1
a3 1
# $File: jpeg,v 1.21 2014/09/12 20:47:00 christos Exp $
d25 4
a28 6
>>13	byte		0		\b, aspect ratio
>>13	byte		1		\b, resolution (DPI)
>>13	byte		2		\b, resolution (DPCM)
>>14	beshort		x		\b, density %dx
>>16	beshort		x		\b%d
>>4	beshort		x		\b, segment length %d
d124 27
a150 46

# Jump to the first segment
>(4.S+4)	use		jpeg_segment

# This uses recursion...
0		name		jpeg_segment
>0	beshort		0xFFFE
>>(2.S+2)	use			jpeg_segment
>>2	pstring/HJ	x		\b, comment: "%s"

>0	beshort		0xFFC0
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, baseline, precision %d
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
>>9	byte		x		\b, frames %d

>0	beshort		0xFFC1		
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, extended sequential, precision %d
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
>>9	byte		x		\b, frames %d

>0	beshort		0xFFC2		
>>(2.S+2)	use			jpeg_segment
>>4	byte		x		\b, progressive, precision %d
>>7	beshort		x		\b, %dx
>>5	beshort		x		\b%d
>>9	byte		x		\b, frames %d

# Define Huffman Tables
>0	beshort		0xFFC4
>>(2.S+2)	use			jpeg_segment

# Application specific markers
>0	beshort&0xFFE0	=0xFFE0
>>(2.S+2)	use			jpeg_segment

# DB: Define Quantization tables
# DD: Define Restart interval [XXX: wrong here, it is 4 bytes]
# D8: Start of image
# D9: End of image
# Dn: Restart
>0	beshort&0xFFD0	=0xFFD0
>>(2.S+2)	use			jpeg_segment
@


1.1.1.6
log
@Import file-5.22
@
text
@d3 1
a3 1
# $File: jpeg,v 1.25 2015/01/02 16:56:50 christos Exp $
d34 92
a125 3
>6	string		Exif		\b, Exif standard: [
>>12	indirect/r	x
>>12	string		x		\b]
a160 6
>0	beshort		0xFFE1		
#>>(2.S+2)	use			jpeg_segment
>>4	string		Exif		\b, Exif Standard: [
>>>10	indirect/r	x		
>>>10	string		x		\b]

a172 3
#>0	beshort		x		unknown 0x%x
#>>(2.S+2)	use			jpeg_segment

@


1.1.1.7
log
@2017-02-10  12:24  Christos Zoulas <christos@@zoulas.com>

	* release 5.30

2017-02-07  23:27  Christos Zoulas <christos@@zoulas.com>

	* If we exceeded the offset in a search return no match
	  (Christoph Biedl)
	* Be more lenient on corrupt CDF files (Christoph Biedl)

2017-02-04  16:46  Christos Zoulas <christos@@zoulas.com>

	* pacify ubsan sign extension (oss-fuzz/524)

2017-02-01  12:42  Christos Zoulas <christos@@zoulas.com>

	* off by one in cdf parsing (PR/593)
	* report debugging sections in elf (PR/591)

2016-11-06  10:52  Christos Zoulas <christos@@zoulas.com>

	* Allow @@@@@@ in extensions
	* Add missing overflow check in der magic (Jonas Wagner)

2016-10-25  10:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.29

2016-10-24  11:20  Christos Zoulas <christos@@zoulas.com>

	* der getlength overflow (Jonas Wagner)
	* multiple magic file load failure (Christoph Biedl)

2016-10-17  11:26  Christos Zoulas <christos@@zoulas.com>

	* CDF parsing improvements (Guy Helmer)

2016-07-20   7:26  Christos Zoulas <christos@@zoulas.com>

	* Add support for signed indirect offsets

2016-07-18   7:41  Christos Zoulas <christos@@zoulas.com>

	* cat /dev/null | file - should print empty (Christoph Biedl)

2016-07-05  15:20  Christos Zoulas <christos@@zoulas.com>

	* Bump string size from 64 to 96.

2016-06-13  20:20  Christos Zoulas <christos@@zoulas.com>

	* PR/556: Fix separators on annotations.

2016-06-13  19:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.28
	* fix leak on allocation failure

2016-06-01   1:20  Christos Zoulas <christos@@zoulas.com>

	* PR/555: Avoid overflow for offset > nbytes
	* PR/550: Segv on DER parsing:
	    - use the correct variable for length
	    - set offset to 0 on failure.

2016-05-13  12:00  Christos Zoulas <christos@@zoulas.com>

	* release 5.27

2016-04-18   9:35  Christos Zoulas <christos@@zoulas.com>

	* Errors comparing DER entries or computing offsets
	  are just indications of malformed non-DER files.
	  Don't print them.
	* Offset comparison was off-by-one.
	* Fix compression code (Werner Fink)
	* Put new bytes constant in the right file (not the generated one)

2016-04-16  18:34  Christos Zoulas <christos@@zoulas.com>

	* release 5.26

2016-03-31  13:50  Christos Zoulas <christos@@zoulas.com>

	* make the number of bytes read from files configurable.

2016-03-21  13:40  Christos Zoulas <christos@@zoulas.com>

	* Add bounds checks for DER code (discovered by Thomas Jarosch)
	* Change indirect recursion limit to indirect use count and
	  bump from 15 to 50 to prevent abuse.

2016-03-13  20:39  Christos Zoulas <christos@@zoulas.com>

	* Add -00 which prints filename\0description\0

2016-03-01  13:28  Christos Zoulas <christos@@zoulas.com>

	* Fix ID3 indirect parsing

2016-01-19  10:18  Christos Zoulas <christos@@zoulas.com>

	* add DER parsing capability

2015-11-13  10:35  Christos Zoulas <christos@@zoulas.com>

	* provide dprintf(3) for the OS's that don't have it.

2015-11-11  16:25  Christos Zoulas <christos@@zoulas.com>

	* redo the compression code report decompression errors

2015-11-10  23:25  Christos Zoulas <christos@@zoulas.com>

	* REG_STARTEND code is not working as expected, delete it.

2015-11-09  16:05  Christos Zoulas <christos@@zoulas.com>

	* Add zlib support if we have it.

2015-11-05  11:22  Christos Zoulas <christos@@zoulas.com>

	* PR/492: compression forking was broken with magic_buffer.

2015-09-16   9:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.25

2015-09-11  13:25  Christos Zoulas <christos@@zoulas.com>

	* add a limit to the length of regex searches

2015-09-08   9:50  Christos Zoulas <christos@@zoulas.com>

	* fix problems with --parameter (Christoph Biedl)

2015-07-11  10:35  Christos Zoulas <christos@@zoulas.com>

	* Windows fixes PR/466 (Jason Hood)

2015-07-09  10:35  Christos Zoulas <christos@@zoulas.com>

	* release 5.24

2015-06-11   8:52  Christos Zoulas <christos@@zoulas.com>

	* redo long option encoding to fix off-by-one in 5.23

2015-06-10  13:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.23

2015-06-09  16:10  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with regex range for magic with offset
	* Always return true from mget with USE (success to mget not match
	  indication). Fixes mime evaluation after USE magic
	* PR/459: Don't insert magic entries to the list if there are parsing
	  errors for them.

2015-06-03  16:00  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Add utf-7 encoding

2015-06-03  14:30  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Implement -Z, look inside, but don't report on compression
	* PR/454: Fix allocation error on bad magic.

2015-05-29  10:30  Christos Zoulas <christos@@zoulas.com>

	* handle MAGIC_CONTINUE everywhere, not just in softmagic

2015-05-21  14:30  Christos Zoulas <christos@@zoulas.com>

	* don't print descriptions for NAME types when mime.

2015-04-09  15:59  Christos Zoulas <christos@@zoulas.com>

	* Add --extension to list the known extensions for this file type
	  Idea by Andrew J Roazen

2015-02-14  12:23  Christos Zoulas <christos@@zoulas.com>

	* Bump file search buffer size to 1M.

2015-01-09  14:35  Christos Zoulas <christos@@zoulas.com>

	* Fix multiple issues with date formats reported by Christoph Biedl:
		- T_LOCAL meaning was reversed
		- Arithmetic did not work
	  Also stop adjusting daylight savings for gmt printing.

2015-01-05  13:00  Christos Zoulas <christos@@zoulas.com>

	* PR/411: Fix memory corruption from corrupt cdf file.
@
text
@d3 1
a3 1
# $File: jpeg,v 1.30 2016/07/04 15:18:23 christos Exp $
d15 1
a15 2
!:strength *3
!:ext jpeg/jpg/jpe/jfif
d44 1
a44 2
# Recursion handled by FFE0
#>>(2.S+2)	use			jpeg_segment
a72 1
# Recursion handled by FFE0
d88 1
a88 2
>>0	beshort&0xFFE0	!0xFFE0
>>>(2.S+2)	use			jpeg_segment
a115 7

# JPEG extended range
0	string		\x49\x49\xbc
>3	byte		1
>>4	lelong%2	0	JPEG-XR
!:mime	image/jxr
!:ext	jxr
@


1.1.1.8
log
@Import file-5.31; mostly oss-fuzz found bugs.
@
text
@d3 1
a3 1
# $File: jpeg,v 1.31 2017/03/17 21:35:28 christos Exp $
d56 1
a56 1
>0	beshort		0xFFC1
d63 1
a63 1
>0	beshort		0xFFC2
d74 1
a74 1
>0	beshort		0xFFE1
d78 1
a78 1
>>>10	indirect/r	x
@


1.1.1.9
log
@2018-10-18  19:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.35

2018-09-10  20:38  Christos Zoulas <christos@@zoulas.com>

	* Add FreeBSD ELF core file support (John Baldwin)

2018-08-20  18:40  Christos Zoulas <christos@@zoulas.com>

	* PR/30: Allow all parameter values to be set (don't treat 0 specially)
	* handle default annotations on the softmagic match instead at the
	  end.

2018-07-25  10:17  Christos Zoulas <christos@@zoulas.com>

	* PR/23: Recognize JSON files

2018-07-25  10:17  Christos Zoulas <christos@@zoulas.com>

	* PR/18: file --mime-encoding should not print mime-type

2018-07-25   8:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.34

2018-06-22  16:38  Christos Zoulas <christos@@zoulas.com>

	* Add Quad indirect offsets

2018-05-24  14:10  Christos Zoulas <christos@@zoulas.com>

	* Enable parsing of ELF dynamic sections to handle PIE better
@
text
@d3 1
a3 1
# $File: jpeg,v 1.32 2018/10/01 18:58:29 christos Exp $
d54 1
a54 1
>>9	byte		x		\b, components %d
d61 1
a61 1
>>9	byte		x		\b, components %d
d68 1
a68 1
>>9	byte		x		\b, components %d
@


1.1.1.10
log
@2021-03-30  20:21  Christos Zoulas <christos@@zoulas.com>

	* release 5.40

2021-02-05  16:31  Christos Zoulas <christos@@zoulas.com>

	* PR/234: Add limit to the number of bytes to scan for encoding
	* PR/230: Fix /T (trim flag) for regex

2021-02-01  12:31  Christos Zoulas <christos@@zoulas.com>
	* PR/77: Trim trailing separator.

2020-12-17  15:44  Christos Zoulas <christos@@zoulas.com>

	* PR/211: Convert system read errors from corrupt ELF
	  files into human readable error messages

2020-12-08  16:24  Christos Zoulas <christos@@zoulas.com>

	* fix multithreaded decompression file descriptor issue
	  by using close-on-exec (Denys Vlasenko)

2020-06-27  11:58  Christos Zoulas <christos@@zoulas.com>

	* Exclude surrogate pairs from utf-8 detection (Michael Liu)

2020-06-25  12:53  Christos Zoulas <christos@@zoulas.com>

	* Include # to the list of ignored format chars (Werner Fink)
@
text
@d3 1
a3 1
# $File: jpeg,v 1.33 2021/03/21 15:04:50 christos Exp $
a126 11

# JPEG XL
# From: Ian Tester
0	string	\xff\x0a				JPEG XL codestream
!:mime  image/jxl
!:ext jxl

# JPEG XL (transcoded JPEG file)
0	string	\x00\x00\x00\x0cJXL\x20\x0d\x0a\x87\x0a	JPEG XL container
!:mime  image/jxl
!:ext jxl
@


1.1.1.11
log
@Import file-5.43+; last was file-5.40

2022-09-20  17:12  Christos Zoulas <christos@@zoulas.com>

	* fixed various clustefuzz issues

2022-09-19  15:54  Christos Zoulas <christos@@zoulas.com>

	* Fix error detection for decompression code (Vincent Mihalkovic)

2022-09-15  13:50  Christos Zoulas <christos@@zoulas.com>

	* Add MAGIC_NO_COMPRESS_FORK and use it to produce a more
	  meaningful error message if we are sandboxing.

2022-09-15  10:45  Christos Zoulas <christos@@zoulas.com>

	* Add built-in lzip decompression support (Michal Gorny)

2022-09-14  10:35  Christos Zoulas <christos@@zoulas.com>

	* Add built-in zstd decompression support (Martin Rodriguez Reboredo)

2022-09-13  14:55  Christos Zoulas <christos@@zoulas.com>

	* release 5.43

2022-09-10   9:17  Christos Zoulas <christos@@zoulas.com>

	* Add octal indirect magic (Michal Gorny)

2022-08-17  11:43  Christos Zoulas <christos@@zoulas.com>

	* PR/374: avoid infinite loop in non-wide code (piru)
	* PR/373: Obey MAGIC_CONTINUE with multiple magic files (vismarli)

2022-07-26  11:10  Christos Zoulas <christos@@zoulas.com>

	* Fix bug with large flist (Florian Weimer)

2022-07-07  13:21  Christos Zoulas <christos@@zoulas.com>

        * PR/364: Detect non-nul-terminated core filenames from QEMU
	  (mam-ableton)

2022-07-04  15:45  Christos Zoulas <christos@@zoulas.com>

	* PR/359: Add support for http://ndjson.org/ (darose)
	* PR/362: Fix wide printing (ro-ee)
	* PR/358: Fix width for -f - (jpalus)
	* PR/356: Fix JSON constant parsing (davewhite)

2022-06-10   9:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.42

2022-05-31  14:50   Christos Zoulas <christos@@zoulas.com>

	* PR/348: add missing cases to prevent file from aborting on
	  random magic files.

2022-05-27  21:05   Christos Zoulas <christos@@zoulas.com>

	* PR/351: octalify filenames when not raw before printing.

2022-04-18  17:51   Christos Zoulas <christos@@zoulas.com>

	* fix regex cacheing bug (Dirk Mueller)
	* merge file_regcomp and file_regerror() to simplify the code
	  and reduce memory requirements for storing regexes (Dirk Mueller)

2022-03-19  12:56   Christos Zoulas <christos@@zoulas.com>

	* cache regex (Dirk Mueller)
	* detect filesystem full by flushing output (Dirk Mueller)

2021-11-19  12:36   Christos Zoulas <christos@@zoulas.com>

	* implement running decompressor programs using
	  posix_spawnp(2) instead of vfork(2)

2021-10-24  11:51   Christos Zoulas <christos@@zoulas.com>

	* Add support for msdos dates and times

2021-10-20   9:55   Christos Zoulas <christos@@zoulas.com>

	* use the system byte swapping functions if available (Werner Fink)

2021-10-18  11:57  Christos Zoulas <christos@@zoulas.com>

	* release 5.41

2021-09-23  03:51  Christos Zoulas <christos@@zoulas.com>

	* Avinash Sonawane: Fix tzname detection

2021-09-03  09:17  Christos Zoulas <christos@@zoulas.com>

	* Fix relationship tests with "search" magic, don't short circuit
	  logic

2021-07-13  01:06  Christos Zoulas <christos@@zoulas.com>

	* Fix memory leak in compile mode

2021-07-01  03:51  Christos Zoulas <christos@@zoulas.com>

	* PR/272: kiefermat: Only set returnval = 1 when we printed something
	  (in all cases print or !print). This simplifies the logic and fixes
	  the issue in the PR with -k and --mime-type there was no continuation
	  printed before the default case.

2021-06-30  13:07  Christos Zoulas <christos@@zoulas.com>

	* PR/270: Don't translate unprintable characters in %s magic formats
	  when -r
	* PR/269: Avoid undefined behavior with clang (adding offset to NULL)

2021-05-09  18:38  Christos Zoulas <christos@@zoulas.com>

	* Add a new flag (f) that requires that the match is a full word,
	   not a partial word match.
	* Add varint types (unused)

2021-04-19  17:17  Christos Zoulas <christos@@zoulas.com>

	* PR/256: mutableVoid: If the file is less than 3 bytes, use the file
	  length to determine type
	* PR/259: aleksandr.v.novichkov: mime printing through indirect magic
	  is not taken into account, use match directly so that it does.

2021-04-04  17:02  Christos Zoulas <christos@@zoulas.com>

	* count the total bytes found not the total byte positions
	  in order to determine encoding (Anatol Belski)
@
text
@d3 1
a3 1
# $File: jpeg,v 1.37 2022/06/17 18:03:35 christos Exp $
d12 1
a12 6
0	belong			0xffd8fff7	JPEG-LS image data
!:mime	image/jls
!:ext jls
>0	use			jpeg

0	belong&0xffffff00	0xffd8ff00	JPEG image data
a16 3
>0	use			jpeg

0	name		jpeg
d94 1
a94 1
#>0	beshort		x		unknown %#x
a97 4
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/HSI_JPEG
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-hsi1.trid.xml
# Note:         called by TrID "HSI JPEG bitmap"
a98 3
#!:mime	application/octet-stream
!:mime	image/x-hsi
!:ext	hsi/jpg
a101 1
# delete from ./animation (version 1.87) with jP (=6A50h) magic at offset 4
a106 4
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JP2
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpeg2k.trid.xml
# Note:         called by TrID "JPEG 2000 bitmap"
a107 1
# aliases	image/jpeg2000, image/jpeg2000-image, image/x-jpeg2000-image
a108 4
!:ext	jp2
# URL:		http://fileformats.archiveteam.org/wiki/JPX
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpx.trid.xml
# Note:         called by TrID "JPEG 2000 eXtended bitmap"
a110 4
!:ext	jpf/jpx
# URL:		http://fileformats.archiveteam.org/wiki/JPM
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpm.trid.xml
# Note:         called by TrID "JPEG 2000 eXtended bitmap"
a112 4
!:ext	jpm
# URL:		http://fileformats.archiveteam.org/wiki/MJ2
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/v/video-mj2.trid.xml
# Note:         called by TrID "Motion JPEG 2000 video"
a114 1
!:ext	mj2/mjp2
a117 4
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_2000_codestream
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jpc.trid.xml
# Note:         called by TrID "JPEG-2000 Code Stream bitmap"
d119 1
a119 9
# value like: 0701h FF50h
#>45	ubeshort	x	\b, at 45 %#4.4x
#!:mime	application/octet-stream
# https://reposcope.com/mimetype/image/x-jp2-codestream
!:mime	image/x-jp2-codestream
!:ext	jpc/j2c/j2k
# MAYBE also JHC like in byte_causal.jhc ?
# WHAT IS THAT? DEAD ENTRY?
#45	beshort		0xff52
a121 4
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XR
# Reference:	https://www.itu.int/rec/T-REC-T.832
#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-wmp.trid.xml
# Note:         called by TrID "JPEG XR bitmap"
a122 1
# FILE_VERSION_ID; shall be equal to 1; other values are reserved for future use
a123 1
# FIRST_IFD_OFFSET; shall be an integer multiple of 2; so skip DROID fmt-590-signature-id-931.wdp
a124 1
#!:mime	image/vnd.ms-photo
d126 1
a126 55
# NO example for HDP !
!:ext	jxr/wdp/hdp
# MAYBE also WMP ?
#!:ext	jxr/wdp/hdp/wmp
# moved from ./images (version 1.205 ), merged and
# partly verified by XnView `nconvert -info abydos.jxr FLOWER.wdp`
# example: https://web.archive.org/web/20160403012904/
# http://shikino.co.jp/solution/upfile/FLOWER.wdp.zip
>90	bequad		0x574D50484F544F00
>>98	byte&0x08	=0x08			\b, hard tiling
>>99	byte&0x80	=0x80			\b, tiling present
>>99	byte&0x40	=0x40			\b, codestream present
>>99	byte&0x38	x			\b, spatial xform=
>>99	byte&0x38	0x00			\bTL
>>99	byte&0x38	0x08			\bBL
>>99	byte&0x38	0x10			\bTR
>>99	byte&0x38	0x18			\bBR
>>99	byte&0x38	0x20			\bBT
>>99	byte&0x38	0x28			\bRB
>>99	byte&0x38	0x30			\bLT
>>99	byte&0x38	0x38			\bLB
>>100	byte&0x80	=0x80			\b, short header
>>>102	beshort+1	x			\b, %d
>>>104	beshort+1	x			\bx%d
>>100	byte&0x80	=0x00			\b, long header
>>>102	belong+1	x			\b, %x
>>>106	belong+1	x			\bx%x
>>101	beshort&0xf	x			\b, bitdepth=
>>>101	beshort&0xf	0x0			\b1-WHITE=1
>>>101	beshort&0xf	0x1			\b8
>>>101	beshort&0xf	0x2			\b16
>>>101	beshort&0xf	0x3			\b16-SIGNED
>>>101	beshort&0xf	0x4			\b16-FLOAT
>>>101	beshort&0xf	0x5			\b(reserved 5)
>>>101	beshort&0xf	0x6			\b32-SIGNED
>>>101	beshort&0xf	0x7			\b32-FLOAT
>>>101	beshort&0xf	0x8			\b5
>>>101	beshort&0xf	0x9			\b10
>>>101	beshort&0xf	0xa			\b5-6-5
>>>101	beshort&0xf	0xb			\b(reserved %d)
>>>101	beshort&0xf	0xc			\b(reserved %d)
>>>101	beshort&0xf	0xd			\b(reserved %d)
>>>101	beshort&0xf	0xe			\b(reserved %d)
>>>101	beshort&0xf	0xf			\b1-BLACK=1
>>101	beshort&0xf0	x			\b, colorfmt=
>>>101	beshort&0xf0	0x00			\bYONLY
>>>101	beshort&0xf0	0x10			\bYUV240
>>>101	beshort&0xf0	0x20			\bYWV422
>>>101	beshort&0xf0	0x30			\bYWV444
>>>101	beshort&0xf0	0x40			\bCMYK
>>>101	beshort&0xf0	0x50			\bCMYKDIRECT
>>>101	beshort&0xf0	0x60			\bNCOMPONENT
>>>101	beshort&0xf0	0x70			\bRGB
>>>101	beshort&0xf0	0x80			\bRGBE
>>>101	beshort&0xf0	>0x80			\b(reserved %#x)
a129 4
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl.trid.xml
# Note:         called by TrID "JPEG XL bitmap"
d131 1
a131 2
#!:mime  image/jxl
!:mime	image/x-jxl
a134 4
# Update:	Joerg Jenderek
# URL:		http://fileformats.archiveteam.org/wiki/JPEG_XL
# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxl-iso.trid.xml 
# Note:         called by TrID "JPEG XL bitmap (ISOBMFF)"
d136 1
a136 2
#!:mime  image/jxl
!:mime	image/x-jxl
@


1.1.1.12
log
@Update to file-5.45 (Last was file-5.44)

2023-07-27  15:45  Christos Zoulas <christos@@zoulas.com>

	* release 5.45

2023-07-17  11:53  Christos Zoulas <christos@@zoulas.com>

	* PR/465: psrok1: Avoid muslc asctime_r crash

2023-05-21  13:05  Christos Zoulas <christos@@zoulas.com>

	* add SIMH tape format support

2023-02-09  12:50  Christos Zoulas <christos@@zoulas.com>

	* bump the max size of the elf section notes to be read to 128K
	  and make it configurable

2023-01-08   1:08  Christos Zoulas <christos@@zoulas.com>

	* PR/415: Fix decompression with program returning empty

2022-12-26   1:47  Christos Zoulas <christos@@zoulas.com>

	* PR/408: fix -p with seccomp
	* PR/412: fix MinGW compilation
@
text
@d3 1
a3 1
# $File: jpeg,v 1.38 2022/12/02 17:42:04 christos Exp $
d242 2
a243 1
!:mime	image/jxl
d252 2
a253 1
!:mime	image/jxl
@


1.1.1.13
log
@Import file-5.48 (previous was file-5.45)

2026-05-07  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.48

2026-05-11  15:55 Christos Zoulas <christos@@zoulas.com>

	* add landlock support (valoq)

2026-04-19  15:55 Christos Zoulas <christos@@zoulas.com>

	* add BE/LE GUID

2026-04-17  11:05 Christos Zoulas <christos@@zoulas.com>

	* multiple fixes to prevent integer overflow in 32 bits (kerwin)

2026-04-15  12:40 Christos Zoulas <christos@@zoulas.com>

	* PR/745: streamout: Don't flush when trying to set negative offsets
	          on pipes, just continue, fixes 'cat file.zip | file -'
	* PR/753: vmihalko: Fix race is magic_getpath()

2026-03-11  15:14 Christos Zoulas <christos@@zoulas.com>

	* PR/728: Anton Monroe: Reinstate regex/c

2026-02-26  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.47

2026-02-04  09:54  Christos Zoulas <christos@@zoulas.com>
	* Better multi-compound document identification by following the
	  order of the directories entries. (Thomas Ledoux)

2026-01-19  14:00  Christos Zoulas <christos@@zoulas.com>
	* if stat fails, don't attempt to restore times (Steven Grubb)

2025-05-28  15:20  Christos Zoulas <christos@@zoulas.com>

	* PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
	  when fd is not available.

2025-05-28  12:50  Christos Zoulas <christos@@zoulas.com>

	* PR/655: jsummers: Obey str_flags in strings like we do for search
	  and regex
	* PR/659: Pitzl: Apply MAGIC_CONTINUE to annotations; i.e. print
	  only the first, unless -k is specified.

2024-12-19  14:44  Christos Zoulas <christos@@zoulas.com>

	* PR/592: allow + in format strings
	* PR/592: signed operations should be done in signed context

2024-12-05  13:50 Christos Zoulas <christos@@zoulas.com>

	* PR/578: jsummers: Don't crash on cygwin when tm_mon == -1
	* PR/579: net147: Fix stack overrun.

2024-11-27  14:44  Christos Zoulas <christos@@zoulas.com>

	* release 5.46
	* Add OFFPOSITIVE

2024-11-25  13:56  Christos Zoulas <christos@@zoulas.com>

	* avoid leaking symbols in libmagic

2024-11-10  13:56  Christos Zoulas <christos@@zoulas.com>

	* PR/562: jsummers: Search/regex offsets are absolute to the
	  beginning of the file, so adjust them by subtracting the
	  offset that the "use" starts so that we don't double-count it.


2024-11-09  19:30  Christos Zoulas <christos@@zoulas.com>
 	* PR/543: matshch: bump nbuf so we can get the flags into the buffer.


2024-11-02  14:34  Christos Zoulas <christos@@zoulas.com>

 	* Add Android elf notes (enh)

2023-12-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* Add limit for number of magic warnings allowed

2023-07-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* check regex bounds (found by clusterfuzz)
@
text
@d3 1
a3 1
# $File: jpeg,v 1.40 2024/11/10 00:26:35 christos Exp $
d37 3
a39 3
>>14	ubeshort	x		\b, density %ux
>>16	ubeshort	x		\b%u
>>4	ubeshort	x		\b, segment length %u
d41 2
a42 2
>>18	byte		!0		\b, thumbnail %ux
>>>19	byte		x		\b%u
d60 2
a61 2
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
d67 2
a68 2
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
d74 2
a75 2
>>7	ubeshort	x		\b, %ux
>>5	ubeshort	x		\b%u
a167 1
# Update:	Joerg Jenderek 2023
d171 1
a171 5
#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jxr.trid.xml
# Note:         called by TrID "JPEG XR bitmap" and "JPEG XR bitmap (WMPHOTO)"
#		verified as "JPEG XR" by XnView `nconvert -fullinfo *.jxr *.wdp`
#		partly by ImageMagick command `identify -verbose *.wdp`
#		and libjxr-tools `JxrDecApp -v -i example.wdp -o example.tif`
d173 1
a173 1
# FILE_VERSION_ID; shall be equal to 1; other values are reserved for future use and are unlike to appear
d176 1
a176 1
>>4	lelong%2	0	JPEG-XR Image
d183 3
a185 2
# moved from ./images (version 1.243 ) and merged
# example:
a186 11
# often GDI_SIGNATURE "WMPHOTO\0" at offset 90 like: FLOWER.wdp abydos.jxr SMALLTOMATO.wdp
>90	bequad		0x574D50484F544F00
>>0	use	jxr-info
# seldom no GDI_SIGNATURE WMPHOTO\0 at offset 90 like: example.wdp MARKET-3361-ipm-bg-DE-treat[1].wdp
>90	bequad		!0x574D50484F544F00
# look for GDI_SIGNATURE WMPHOTO\0 at other offset
>>4	search/3267/sb	WMPHOTO\0
>>>&-90	use	jxr-info
#
0	name	jxr-info
# check for GDI_SIGNATURE that corresponds to "WMPHOTO\0"
d201 2
a202 2
>>>102	beshort+1	x			\b, %u
>>>104	beshort+1	x			\bx%u
@


1.1.1.1.2.1
log
@file jpeg was added on branch jym-xensuspend on 2009-05-13 18:51:56 +0000
@
text
@d1 165
@


1.1.1.1.2.2
log
@Sync with HEAD.

Second commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
@
text
@a0 165

#------------------------------------------------------------------------------
# JPEG images
# SunOS 5.5.1 had
#
#	0	string		\377\330\377\340	JPEG file
#	0	string		\377\330\377\356	JPG file
#
# both of which turn into "JPEG image data" here.
#
0	beshort		0xffd8		JPEG image data
!:mime	image/jpeg
!:apple	8BIMJPEG
!:strength +1
>6	string		JFIF		\b, JFIF standard
# The following added by Erik Rossen <rossen@@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF.  Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
# impossible to specify in magic(4) format.
# First, a little JFIF version info:
>>11	byte		x		\b %d.
>>12	byte		x		\b%02d
# Next, the resolution or aspect ratio of the image:
#>>13	byte		0		\b, aspect ratio
#>>13	byte		1		\b, resolution (DPI)
#>>13	byte		2		\b, resolution (DPCM)
#>>4	beshort		x		\b, segment length %d
# Next, show thumbnail info, if it exists:
>>18	byte		!0		\b, thumbnail %dx
>>>19	byte		x		\b%d

# EXIF moved down here to avoid reporting a bogus version number,
# and EXIF version number printing added.
#   - Patrik R=E5dman <patrik+file-magic@@iki.fi>
>6	string		Exif		\b, EXIF standard
# Look for EXIF IFD offset in IFD 0, and then look for EXIF version tag in EXIF IFD.
# All possible combinations of entries have to be enumerated, since no looping
# is possible. And both endians are possible...
# The combinations included below are from real-world JPEGs.
# Little-endian
>>12	string		II		
# IFD 0 Entry #5:
>>>70	leshort		0x8769          
# EXIF IFD Entry #1:
>>>>(78.l+14)	leshort	0x9000		
>>>>>(78.l+23)	byte	x		%c
>>>>>(78.l+24)	byte	x		\b.%c
>>>>>(78.l+25)	byte	!0x30		\b%c
# IFD 0 Entry #9:
>>>118	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(126.l+38)	leshort	0x9000		
>>>>>(126.l+47)	byte	x		%c
>>>>>(126.l+48)	byte	x		\b.%c
>>>>>(126.l+49)	byte	!0x30		\b%c
# IFD 0 Entry #10
>>>130	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(138.l+38)	leshort	0x9000		
>>>>>(138.l+47)	byte	x		%c
>>>>>(138.l+48)	byte	x		\b.%c
>>>>>(138.l+49)	byte	!0x30		\b%c
# EXIF IFD Entry #4:
>>>>(138.l+50)	leshort	0x9000		
>>>>>(138.l+59)	byte	x		%c
>>>>>(138.l+60)	byte	x		\b.%c
>>>>>(138.l+61)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(138.l+62)	leshort	0x9000		
>>>>>(138.l+71)	byte	x		%c
>>>>>(138.l+72)	byte	x		\b.%c
>>>>>(138.l+73)	byte	!0x30		\b%c
# IFD 0 Entry #11
>>>142	leshort		0x8769          
# EXIF IFD Entry #3:
>>>>(150.l+38)	leshort	0x9000		
>>>>>(150.l+47)	byte	x		%c
>>>>>(150.l+48)	byte	x		\b.%c
>>>>>(150.l+49)	byte	!0x30		\b%c
# EXIF IFD Entry #4:
>>>>(150.l+50)	leshort	0x9000		
>>>>>(150.l+59)	byte	x		%c
>>>>>(150.l+60)	byte	x		\b.%c
>>>>>(150.l+61)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(150.l+62)	leshort	0x9000		
>>>>>(150.l+71)	byte	x		%c
>>>>>(150.l+72)	byte	x		\b.%c
>>>>>(150.l+73)	byte	!0x30		\b%c
# Big-endian
>>12	string		MM		
# IFD 0 Entry #9:
>>>118	beshort		0x8769          
# EXIF IFD Entry #1:
>>>>(126.L+14)	beshort	0x9000		
>>>>>(126.L+23)	byte	x		%c
>>>>>(126.L+24)	byte	x		\b.%c
>>>>>(126.L+25)	byte	!0x30		\b%c
# EXIF IFD Entry #3:
>>>>(126.L+38)	beshort	0x9000		
>>>>>(126.L+47)	byte	x		%c
>>>>>(126.L+48)	byte	x		\b.%c
>>>>>(126.L+49)	byte	!0x30		\b%c
# IFD 0 Entry #10
>>>130	beshort		0x8769          
# EXIF IFD Entry #3:
>>>>(138.L+38)	beshort	0x9000		
>>>>>(138.L+47)	byte	x		%c
>>>>>(138.L+48)	byte	x		\b.%c
>>>>>(138.L+49)	byte	!0x30		\b%c
# EXIF IFD Entry #5:
>>>>(138.L+62)	beshort	0x9000		
>>>>>(138.L+71)	byte	x		%c
>>>>>(138.L+72)	byte	x		\b.%c
>>>>>(138.L+73)	byte	!0x30		\b%c
# IFD 0 Entry #11
>>>142	beshort		0x8769          
# EXIF IFD Entry #4:
>>>>(150.L+50)	beshort	0x9000		
>>>>>(150.L+59)	byte	x		%c
>>>>>(150.L+60)	byte	x		\b.%c
>>>>>(150.L+61)	byte	!0x30		\b%c
# Here things get sticky.  We can do ONE MORE marker segment with
# indirect addressing, and that's all.  It would be great if we could
# do pointer arithemetic like in an assembler language.  Christos?
# And if there was some sort of looping construct to do searches, plus a few
# named accumulators, it would be even more effective...
# At least we can show a comment if no other segments got inserted before:
>(4.S+5)	byte		0xFE
>>(4.S+8)	string		>\0		\b, comment: "%s"
# FIXME: When we can do non-byte counted strings, we can use that to get
# the string's count, and fix Debian bug #283760
#>(4.S+5)	byte		0xFE		\b, comment
#>>(4.S+6)	beshort		x		\b length=%d
#>>(4.S+8)	string		>\0		\b, "%s"
# Or, we can show the encoding type (I've included only the three most common)
# and image dimensions if we are lucky and the SOFn (image segment) is here:
>(4.S+5)	byte		0xC0		\b, baseline
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
>(4.S+5)	byte		0xC1		\b, extended sequential
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
>(4.S+5)	byte		0xC2		\b, progressive
>>(4.S+6)	byte		x		\b, precision %d
>>(4.S+7)	beshort		x		\b, %dx
>>(4.S+9)	beshort		x		\b%d
# I've commented-out quantisation table reporting.  I doubt anyone cares yet.
#>(4.S+5)	byte		0xDB		\b, quantisation table
#>>(4.S+6)	beshort		x		\b length=%d
#>14	beshort		x		\b, %d x
#>16	beshort		x		\b %d

# HSI is Handmade Software's proprietary JPEG encoding scheme
0	string		hsi1		JPEG image data, HSI proprietary

# From: David Santinoli <david@@santinoli.com>
0	string		\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A	JPEG 2000 image data

# Type: JPEG 2000 codesream
# From: Mathieu Malaterre <mathieu.malaterre@@gmail.com>
0	belong		0xff4fff51						JPEG 2000 codestream
45	beshort		0xff52
@


