On Fri, Jul 1, 2016 at 3:18 PM, Christoph Biedl
<[email protected]> wrote:
> tags 771303 confirmed upstream moreinfo
> thanks
>
> Mathieu Malaterre wrote...
>
>> It would be nice to add support for JPEG-XR file. For instance:
>>
>> $ wget -O test.jxr http://phpied.com/files/jpeg-xr/sunset-paint.wdp
>> $ file test.jxr
>> test.jxr: data
>
> Sorry for not getting back to you earlier. So ...
>
>> According to:
>> http://www.itu.int/rec/T-REC-T.832-201201-I/en
>>
>> the header is defined with:
>>
>> A.5.2 FIXED_FILE_HEADER_II_2BYTES
>> FIXED_FILE_HEADER_II_2BYTES shall be equal to 0x4949.
>> A.5.3 FIXED_FILE_HEADER_0XBC_BYTE
>> FIXED_FILE_HEADER_0XBC_BYTE shall be equal to 0xBC.
>
> ... I'm a bit reluctant here since 24 Bits of information is pretty
> small and might lead to false detections. Assuming you have a bigger
> collection of these files at hand: Can you confirm the version numer
> (byte at offset 3) is always 0x01? Also it seems the 32bit
> little-endian value at offset 4 has a very limited set of legal
> values, too ("multiple of two"); which values are around in the wild?

Indeed:

A.5.2 FIXED_FILE_HEADER_II_2BYTES
FIXED_FILE_HEADER_II_2BYTES shall be equal to 0x4949.
A.5.3 FIXED_FILE_HEADER_0XBC_BYTE
FIXED_FILE_HEADER_0XBC_BYTE shall be equal to 0xBC.
A.5.4 FILE_VERSION_ID
FILE_VERSION_ID shall be equal to 1. Other values of FILE_VERSION_ID
are reserved for future use, as modified
in additional parts or amendments, by ITU-T | ISO/IEC.
A.5.5 FIRST_IFD_OFFSET
FIRST_IFD_OFFSET specifies the byte position, relative to the
beginning of the file, of the first
IMAGE_FILE_DIRECTORY( ) syntax structure (subclause A.6) in the file.
The value of FIRST_IFD_OFFSET shall
be an integer multiple of 2.


So I would enforce FILE_VERSION_ID = 1 and FIRST_IFD_OFFSET % 2 == 0.

Tested with:

$ convert -size 512x512 -depth 8 xc:white -colorspace YCbCr test.jxr
$ convert -size 512x512 -depth 8 xc:white test8.jxr
$ convert -size 512x512 -depth 16 xc:white test16.jxr

-M

Reply via email to