[2364] in java-interest

home help back first fref pref prev next nref lref last post

Re: MPEG question

daemon@ATHENA.MIT.EDU (Jim Graham)
Fri Sep 29 20:49:44 1995

Date: Fri, 29 Sep 1995 15:05:02 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, rob@comp.lancs.ac.uk

Hi Robert,

Thank you for evaluating the image code for video applications.  While
I have created the APIs for doing video streams, I haven't had the time
to create a video decoder to test the APIs so you will be running on
untested ground here.  Please keep me informed of your progress so that
I can fix whatever problems you find.

> Initially I thought about using the ImageConsumer, Producer interfaces.  The
> ImageProducer interface supports the notion of "dynamic" images such as live
> video feeds.  However, after playing about with writing a MPEG producer
> I found that the Image class removes itself from the list of consumers
> after the first frame, ignoring the status.  I could write an ImageConsumer
> but I'd still need an Image to display the frame...

This should not happen if you pass the right status to the imageComplete
method.  You should be using SINGLEFRAMEDONE in which case the consumer
should not remove itself.  Is that what you are doing?  If it is still
removing itself then it could be a bug, or it could be that the ImageObserver
objects are all returning false (thereby removing their interest in
further updates to your video stream) which would also cause the Consumer
to remove itself.  Could that be happening?  If not, you may have found
a bug...

> I'm currently using a MemoryImageSource on an array which is filled by the
> C code.  To display each frame I have to create a new image from the
> MemoryImageSource.  Although this works, the performance is not very high.
> (Due to the overhead of creating the Image and the asynchronous image
> updates?) 

This will perform poorly mainly due to the overhead of creating lots of
MemoryImageSource objects and brand new Image objects.  It will also
have performance problems due to the fact that the prebeta image code
has a single multi-purpose scaling function that scales all input depths
to all output depths and handles all possible types of ColorModel object
and handles scaling and dithering and ...  In other words, I still have
to do a lot of performance work on optimal paths through the image conversion
code...

> There obviously is a better way to do this (I'm probably being very stupid
> about something here).  Ideally I'd like to draw the frame directly on the
> screen using X (i.e. XPutImage).  However, I don't know anything about
> getting the details from Java to do this.  Has anybody done anything like
> this?  Has anybody already implemented MPEG?

I'm actually happily surprised that you got so far and were at least
going down the intended path at first with so little documentation!

The problem with doing an XPutImage directly to the screen is that it
will be very Solaris or Unix specific.  I would rather provide the kind
of hooks to get the performance you need using the existing ImageProducer
interface.  I'd like to work with you to achieve that goal.  In particular,
I eventually want to have everything set up so that if you query the
ColorModel object for the component you are going to put the video
stream on and you calculate your video updates in that color space
then all I will have to do on my end of things is XPutImage - which is
what you want...

Feel free to correspond with me directly on this since it might get a
little too involved in details for the list...

				...jim

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post