Provide access to data offset in WritableRaster in Java 9

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Provide access to data offset in WritableRaster in Java 9

Peter A
Apologies since this probably not the correct list, but I was referenced
here from another Java list.

Background:
The high level API in a BufferedImage is very very very slow.  To get
around that problem, in previous versions of Java, the internal rasters
which were defined in sun.awt.image were accessed.   Doing so enabled
real-time computer vision in Java.

Problem:
Accessing the low level Rasters is no longer practical in Java 9.  After
this problem was reported by one of my users I looked into it and found a
work around, for most situations.  Unfortunately the higher level
WritableRaster does not provide access to the offset inside its internal
data array.   This makes processing of subimages impossible.  My suspicion
is that it is most likely an oversight because it provides access to every
other piece of information needed and the raw data.    It would be great
if getDataOffset() could be moved into WritableRaster or one of its parents
instead of being hidden in children of WritableRaster.

Just to clarify the raw arrays are stored inside of a DataBuffer and that
data structure contains an offset. This offset is always set to zero and
the offset inside of WritableRaster is what is needed,
e.g. IntegerInterleavedRaster.getDataOffsets().

Thanks,
- Peter

--
"Now, now my good man, this is no time for making enemies."    — Voltaire
(1694-1778), on his deathbed in response to a priest asking that he
renounce Satan.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Provide access to data offset in WritableRaster in Java 9

Alan Bateman
The 2d-dev or awt-dev mailing lists may be a better place to bring this up.

-Alan

On 13/07/2017 17:21, Peter A wrote:

> Apologies since this probably not the correct list, but I was referenced
> here from another Java list.
>
> Background:
> The high level API in a BufferedImage is very very very slow.  To get
> around that problem, in previous versions of Java, the internal rasters
> which were defined in sun.awt.image were accessed.   Doing so enabled
> real-time computer vision in Java.
>
> Problem:
> Accessing the low level Rasters is no longer practical in Java 9.  After
> this problem was reported by one of my users I looked into it and found a
> work around, for most situations.  Unfortunately the higher level
> WritableRaster does not provide access to the offset inside its internal
> data array.   This makes processing of subimages impossible.  My suspicion
> is that it is most likely an oversight because it provides access to every
> other piece of information needed and the raw data.    It would be great
> if getDataOffset() could be moved into WritableRaster or one of its parents
> instead of being hidden in children of WritableRaster.
>
> Just to clarify the raw arrays are stored inside of a DataBuffer and that
> data structure contains an offset. This offset is always set to zero and
> the offset inside of WritableRaster is what is needed,
> e.g. IntegerInterleavedRaster.getDataOffsets().
>
> Thanks,
> - Peter
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Provide access to data offset in WritableRaster in Java 9

Phil Race
Hi Peter,

2d-dev would be the right list.

Sounds like you were accessing jdk internals and found that you
mostly can do away with that except for sub-images.

What you should really do is file an issue at bugs.java.com as
client-libs/2d for cat/subcat.

If this had been raised earlier in JDK 9 development - we could have
looked into
it in time. Now it will have to wait for a follow on release.

-phil.

On 07/13/2017 10:47 AM, Alan Bateman wrote:

> The 2d-dev or awt-dev mailing lists may be a better place to bring
> this up.
>
> -Alan
>
> On 13/07/2017 17:21, Peter A wrote:
>> Apologies since this probably not the correct list, but I was referenced
>> here from another Java list.
>>
>> Background:
>> The high level API in a BufferedImage is very very very slow. To get
>> around that problem, in previous versions of Java, the internal rasters
>> which were defined in sun.awt.image were accessed.   Doing so enabled
>> real-time computer vision in Java.
>>
>> Problem:
>> Accessing the low level Rasters is no longer practical in Java 9.  After
>> this problem was reported by one of my users I looked into it and
>> found a
>> work around, for most situations.  Unfortunately the higher level
>> WritableRaster does not provide access to the offset inside its internal
>> data array.   This makes processing of subimages impossible.  My
>> suspicion
>> is that it is most likely an oversight because it provides access to
>> every
>> other piece of information needed and the raw data.    It would be great
>> if getDataOffset() could be moved into WritableRaster or one of its
>> parents
>> instead of being hidden in children of WritableRaster.
>>
>> Just to clarify the raw arrays are stored inside of a DataBuffer and
>> that
>> data structure contains an offset. This offset is always set to zero and
>> the offset inside of WritableRaster is what is needed,
>> e.g. IntegerInterleavedRaster.getDataOffsets().
>>
>> Thanks,
>> - Peter
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Provide access to data offset in WritableRaster in Java 9

Peter A
Thanks! I've posted a message to that mailing list and will create a bug
report after a short discussion with them.

- Peter

On Thu, Jul 13, 2017 at 11:22 AM, Phil Race <[hidden email]> wrote:

> Hi Peter,
>
> 2d-dev would be the right list.
>
> Sounds like you were accessing jdk internals and found that you
> mostly can do away with that except for sub-images.
>
> What you should really do is file an issue at bugs.java.com as
> client-libs/2d for cat/subcat.
>
> If this had been raised earlier in JDK 9 development - we could have
> looked into
> it in time. Now it will have to wait for a follow on release.
>
> -phil.
>
>
> On 07/13/2017 10:47 AM, Alan Bateman wrote:
>
>> The 2d-dev or awt-dev mailing lists may be a better place to bring this
>> up.
>>
>> -Alan
>>
>> On 13/07/2017 17:21, Peter A wrote:
>>
>>> Apologies since this probably not the correct list, but I was referenced
>>> here from another Java list.
>>>
>>> Background:
>>> The high level API in a BufferedImage is very very very slow. To get
>>> around that problem, in previous versions of Java, the internal rasters
>>> which were defined in sun.awt.image were accessed.   Doing so enabled
>>> real-time computer vision in Java.
>>>
>>> Problem:
>>> Accessing the low level Rasters is no longer practical in Java 9.  After
>>> this problem was reported by one of my users I looked into it and found a
>>> work around, for most situations.  Unfortunately the higher level
>>> WritableRaster does not provide access to the offset inside its internal
>>> data array.   This makes processing of subimages impossible.  My
>>> suspicion
>>> is that it is most likely an oversight because it provides access to
>>> every
>>> other piece of information needed and the raw data.    It would be great
>>> if getDataOffset() could be moved into WritableRaster or one of its
>>> parents
>>> instead of being hidden in children of WritableRaster.
>>>
>>> Just to clarify the raw arrays are stored inside of a DataBuffer and that
>>> data structure contains an offset. This offset is always set to zero and
>>> the offset inside of WritableRaster is what is needed,
>>> e.g. IntegerInterleavedRaster.getDataOffsets().
>>>
>>> Thanks,
>>> - Peter
>>>
>>>
>>
>


--
"Now, now my good man, this is no time for making enemies."    — Voltaire
(1694-1778), on his deathbed in response to a priest asking that he
renounce Satan.
Loading...