-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemoAccessLossy.sch
107 lines (85 loc) · 4.86 KB
/
demoAccessLossy.sch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?xml version="1.0"?>
<!--
Schematron jpylyzer schema: verify if JP2 conforms to
a lossily compressed profile for access copies
Johan van der Knijff, KB / National Library of the Netherlands , 3 September 2012.
Based on original schema by Adam Retter, The National Archives
For demonstration purposes only!
-->
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
<s:pattern>
<s:title>Lossy access JP2 check</s:title>
<!-- check that the jpylyzer element exists -->
<s:rule context="/">
<s:assert test="jpylyzer">no jpylyzer element found</s:assert>
</s:rule>
<!-- check that isValidJP2 element exists with the text 'True' -->
<s:rule context="/jpylyzer">
<s:assert test="isValidJP2 = 'True'">no valid JP2</s:assert>
</s:rule>
<!-- Top-level properties checks -->
<s:rule context="/jpylyzer/properties">
<!-- check if XML box exists -->
<s:assert test="xmlBox">no XML box</s:assert>
<!-- check if compression ratio doesn't exceed threshold value (a bit tricky as for images that
don't contain much information very high compression ratios may be obtained without losing quality)
-->
<s:assert test="compressionRatio < 35">Too much compression</s:assert>
</s:rule>
<!-- check if resolution box exists -->
<s:rule context="/jpylyzer/properties/jp2HeaderBox">
<s:assert test="resolutionBox">no resolution box</s:assert>
</s:rule>
<!-- check if resolution box contains capture resolution box -->
<s:rule context="/jpylyzer/properties/jp2HeaderBox/resolutionBox">
<s:assert test="captureResolutionBox">no capture resolution box</s:assert>
</s:rule>
<!-- check that METH equals 'Restricted ICC' -->
<s:rule context="/jpylyzer/properties/jp2HeaderBox/colourSpecificationBox">
<s:assert test="meth = 'Restricted ICC'">METH not 'Restricted ICC'</s:assert>
</s:rule>
<!-- check X- and Y- tile sizes -->
<s:rule context="/jpylyzer/properties/contiguousCodestreamBox/siz">
<s:assert test="xTsiz = '1024'">wrong X Tile size</s:assert>
<s:assert test="yTsiz = '1024'">wrong Y Tile size</s:assert>
</s:rule>
<!-- checks on codestream COD parameters -->
<s:rule context="/jpylyzer/properties/contiguousCodestreamBox/cod">
<!-- Precincts -->
<s:assert test="precincts = 'yes'">no precincts</s:assert>
<!-- Error resilience features: sop, eph and segmentation symbols -->
<s:assert test="sop = 'yes'">no start-of-packet headers</s:assert>
<s:assert test="eph = 'yes'">no end-of-packet headers</s:assert>
<s:assert test="segmentationSymbols = 'yes'">no segmentation symbols</s:assert>
<!-- Progression order -->
<s:assert test="order = 'RPCL'">wrong progression order</s:assert>
<!-- Layers -->
<s:assert test="layers = '8'">wrong number of layers</s:assert>
<!-- Colour transformation (only for RGB images, i.e. number of components = 3)-->
<s:assert test="(multipleComponentTransformation = 'yes') and (../../jp2HeaderBox/imageHeaderBox/nC = '3')
or (multipleComponentTransformation = 'no') and (../../jp2HeaderBox/imageHeaderBox/nC = '1')">
no colour transformation</s:assert>
<!-- Decomposition levels -->
<s:assert test="levels = '5'">wrong number of decomposition levels</s:assert>
<!-- Codeblock size -->
<s:assert test="codeBlockWidth = '64'">wrong codeblock width</s:assert>
<s:assert test="codeBlockHeight = '64'">wrong codeblock height</s:assert>
<!-- Transformation (lossy vs lossless) -->
<s:assert test="transformation = '9-7 irreversible'">wrong transformation</s:assert>
<!-- checks on X- and Y- precinct sizes: 256x256 for 2 highest resolution levels,
128x128 for remaining ones -->
<s:assert test="precinctSizeX[1] = '128'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeX[2] = '128'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeX[3] = '128'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeX[4] = '128'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeX[5] = '256'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeX[6] = '256'">precinctSizeX doesn't match profile</s:assert>
<s:assert test="precinctSizeY[1] = '128'">precinctSizeY doesn't match profile</s:assert>
<s:assert test="precinctSizeY[2] = '128'">precinctSizeY doesn't match profile</s:assert>
<s:assert test="precinctSizeY[3] = '128'">precinctSizeY doesn't match profile</s:assert>
<s:assert test="precinctSizeY[4] = '128'">precinctSizeY doesn't match profile</s:assert>
<s:assert test="precinctSizeY[5] = '256'">precinctSizeY doesn't match profile</s:assert>
<s:assert test="precinctSizeY[6] = '256'">precinctSizeY doesn't match profile</s:assert>
</s:rule>
</s:pattern>
</s:schema>