1 /*
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
76 }
77 startSpectralSelection = buffer.buf[buffer.bufPtr++];
78 endSpectralSelection = buffer.buf[buffer.bufPtr++];
79 approxHigh = buffer.buf[buffer.bufPtr] >> 4;
80 approxLow = buffer.buf[buffer.bufPtr++] &0xf;
81 buffer.bufAvail -= length;
82 }
83
84 SOSMarkerSegment(Node node) throws IIOInvalidTreeException {
85 super(JPEG.SOS);
86 startSpectralSelection = 0;
87 endSpectralSelection = 63;
88 approxHigh = 0;
89 approxLow = 0;
90 updateFromNativeNode(node, true);
91 }
92
93 protected Object clone () {
94 SOSMarkerSegment newGuy = (SOSMarkerSegment) super.clone();
95 if (componentSpecs != null) {
96 newGuy.componentSpecs =
97 (ScanComponentSpec []) componentSpecs.clone();
98 for (int i = 0; i < componentSpecs.length; i++) {
99 newGuy.componentSpecs[i] =
100 (ScanComponentSpec) componentSpecs[i].clone();
101 }
102 }
103 return newGuy;
104 }
105
106 IIOMetadataNode getNativeNode() {
107 IIOMetadataNode node = new IIOMetadataNode("sos");
108 node.setAttribute("numScanComponents",
109 Integer.toString(componentSpecs.length));
110 node.setAttribute("startSpectralSelection",
111 Integer.toString(startSpectralSelection));
112 node.setAttribute("endSpectralSelection",
113 Integer.toString(endSpectralSelection));
114 node.setAttribute("approxHigh",
115 Integer.toString(approxHigh));
116 node.setAttribute("approxLow",
117 Integer.toString(approxLow));
|
1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
76 }
77 startSpectralSelection = buffer.buf[buffer.bufPtr++];
78 endSpectralSelection = buffer.buf[buffer.bufPtr++];
79 approxHigh = buffer.buf[buffer.bufPtr] >> 4;
80 approxLow = buffer.buf[buffer.bufPtr++] &0xf;
81 buffer.bufAvail -= length;
82 }
83
84 SOSMarkerSegment(Node node) throws IIOInvalidTreeException {
85 super(JPEG.SOS);
86 startSpectralSelection = 0;
87 endSpectralSelection = 63;
88 approxHigh = 0;
89 approxLow = 0;
90 updateFromNativeNode(node, true);
91 }
92
93 protected Object clone () {
94 SOSMarkerSegment newGuy = (SOSMarkerSegment) super.clone();
95 if (componentSpecs != null) {
96 newGuy.componentSpecs = componentSpecs.clone();
97 for (int i = 0; i < componentSpecs.length; i++) {
98 newGuy.componentSpecs[i] =
99 (ScanComponentSpec) componentSpecs[i].clone();
100 }
101 }
102 return newGuy;
103 }
104
105 IIOMetadataNode getNativeNode() {
106 IIOMetadataNode node = new IIOMetadataNode("sos");
107 node.setAttribute("numScanComponents",
108 Integer.toString(componentSpecs.length));
109 node.setAttribute("startSpectralSelection",
110 Integer.toString(startSpectralSelection));
111 node.setAttribute("endSpectralSelection",
112 Integer.toString(endSpectralSelection));
113 node.setAttribute("approxHigh",
114 Integer.toString(approxHigh));
115 node.setAttribute("approxLow",
116 Integer.toString(approxLow));
|