Hello, I am using JMF (Java Media Framework) to video stream, and then i am taking a snap shot of that video stream at every 5 seconds. there is a class called FrameGrabber in JMF that grabs a frame and return that frame as java.awt.Image. Then i took that image and deinterlace it. Deinterlacing is separating the odd line and eve line from that image. Here is more expalanation of deinterlacing : http://en.wikipedia.org/wiki/Deinterlacing The separation is done by extracting the pixels from the Image using pixels grabber, which returns the int[] array, but i converted to a byte[] array to save memory because i am video streaming the gray-scale and I am calling this method several time in the while loop. Then after that i called this method that i posted in the previous message, again this is also called several time in the while loop:
public BufferedImage produceRenderedImage(byte[] dataBuffer, int width, int height) { DataBuffer dBuffer = new DataBufferByte(dataBuffer, width * height); WritableRaster wr = Raster.createInterleavedRaster(dBuffer,width,height,width,1,new int[]{0},null); ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); ColorModel cm = new ComponentColorModel(cs,false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BufferedImage bi = new BufferedImage(cm, wr, false, null); return bi; } there are two lines of code i am worry the most, which might cause OUT OF HEAP MEMORY issue because in my method above i called the >> new DataBufferByte(dataBuffer, width * height) >> new BufferedImage(cm,wr,false,null). The other two lines can be put outside of the method becasue they don't change through out during the several called in while loop. they are: >>ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); >>ColorModel cm = new ComponentColorModel(cs,false, false, Transparency.OPAQUE, >>DataBuffer.TYPE_BYTE); The only thing change in the above method is the dataBuffer, the byte[] data changes in every loop from the images from the video. The dimension is the same. Is there a way to reset the dataBuffer without the recalling new DataBufferByte(dataBuffer, width * height)? i saw a data buffer that reset the int (setInt() )in the DataBuffer class, but not a setByte method? thanks Francis [Message sent by forum member 'cohodetector' (cohodetector)] http://forums.java.net/jive/thread.jspa?messageID=289563 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".