Issue Details (XML | Word | Printable)

Key: BEAM-1147
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Olga Faber
Reporter: Norman Fomferra
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
BEAM

Signed byte data type interpreted as unsigned byte

Created: 27/May/10 01:11 PM   Updated: 08/Jun/10 01:00 PM  Due: 28/May/10
Component/s: Architecture, VISAT
Affects Version/s: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1
Fix Version/s: 4.8


 Description  « Hide
EO data products having the raw sample type signed 8-bit integer (value range -128...127) are wrongly interpreted as unsigned byte values values (0 ... 255).

Most of the sensors supported by BEAM such as MERIS, AATSR, CHRIS and SMOS are not concerned by this issue.


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Norman Fomferra added a comment - 27/May/10 01:17 PM
Cause: The bug has obviously been introduced in BEAM 4.5 from where on we use JAI images (RenderedImage/PlanarImage) as primary raster data source. A RenderedImage interface provides sample data through the Raster class, which again holds a DataBuffer, whose only 8-bit data is unsigned byte.

Norman Fomferra added a comment - 27/May/10 01:35 PM
Here are a number of locations in BEAM code, where the bug has an imapact and/or where the fix shall be applied:

(1) ImageManager.createRescaleOp() - perfoms a scaling from raw to geophysical image
(2) TileImpl.getSampleInt() / setSample(...., int s) - also converts to and from raw and geophysical sample values
(3) BandOpImageTest.testThatAwtRastersAreWrittenCorrectly() - commented out assertion that fails because of this bug

Actually, the issue becomes a bug only when raw sample data is converted to geo-physical samples. It is fully ok to store signed data types in unsigned data buffers. Only when the data needs to be interpreted, the unsigned byte type needs a special treatment.

Norman Fomferra added a comment - 03/Jun/10 09:21 AM
Fixed
   Tile.getSample<T>(int x, int y):T
   Tile.setSample(int x, int y, T s):void
   Tile.getSamples<T>():T[]
   Tile.setSamples<T>(T[] s):void


Ralf Quast added a comment - 04/Jun/10 12:11 PM
Fixed (1) computation of geophysical image

Ralf Quast added a comment - 08/Jun/10 12:59 PM
Fixed (3) and computation of statistics