Package javax.media.format

Examples of javax.media.format.RGBFormat


          // TODO: test on bigendian box
            red = 1;
            green = 2;
            blue = 3;
          bitsPerPixel = 24;
            result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_BGR24:     ///< Packed RGB 8:8:8, 24bpp, BGRBGR...
          // TODO: test on bigendian box
            red = 3;
            green = 2;
            blue = 1;
          bitsPerPixel = 24;
            result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_RGB32:     ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness
          // TODO: test on bigendian box
          red = 0xFF0000;
          green = 0xFF00;
          blue = 0xFF;
          bitsPerPixel = 32;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.intArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_RGB565:    ///< Packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), in cpu endianness
          // TODO: test on bigendian box
          red = 0x1F;
          green = 0x7E0;
          blue = 0xF800;
          bitsPerPixel = 16;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.shortArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_RGB555:    ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 0
          // TODO: test on bigendian box
          red = 0x1F;
          green = 0x3E0;
          blue = 0x7C00;
          bitsPerPixel = 16;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.shortArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_GRAY8:     ///<        Y        ,  8bpp
          // TODO: GrayFormat
          break;
        case AVCodecLibrary.PIX_FMT_MONOWHITE: ///<        Y        ,  1bpp, 0 is white, 1 is black
          // TODO: BinaryFormat
          break;
        case AVCodecLibrary.PIX_FMT_MONOBLACK: ///<        Y        ,  1bpp, 0 is black, 1 is white
          // TODO: BinaryFormat
          break;
        case AVCodecLibrary.PIX_FMT_BGR32:     ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness
          // TODO: test on bigendian box
          red = 0xFF;
          green = 0xFF00;
          blue = 0xFF0000;
          bitsPerPixel = 32;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.intArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_BGR565:    ///< Packed RGB 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), in cpu endianness
          // TODO: test on bigendian box
          red = 0xF800;
          green = 0x7E0;
          blue = 0x1F;
          bitsPerPixel = 16;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.shortArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_BGR555:    ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1
          // TODO: test on bigendian box
          red = 0x7C00;
          green = 0x3E0;
          blue = 0x1F;
          bitsPerPixel = 16;
          pixelStride = 1;
          lineStride = width*pixelStride;
          result = new RGBFormat(new Dimension(width, height), -1, Format.shortArray, frameRate, bitsPerPixel, red, green, blue, pixelStride, lineStride, Format.FALSE, endianess);
          break;
        case AVCodecLibrary.PIX_FMT_BGR8:      ///< Packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
          // TODO: test on bigendian box
          red = 0xE0;
          green = 0x1C;
          blue = 0x3;
          bitsPerPixel = 8;
          result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_BGR4:      ///< Packed RGB 1:2:1,  4bpp, (msb)1B 2G 1R(lsb)
          // TODO: BinaryFormat
          break;
        case AVCodecLibrary.PIX_FMT_BGR4_BYTE: ///< Packed RGB 1:2:1,  8bpp, (msb)1B 2G 1R(lsb)
          // TODO: test on bigendian box
          red = 0x8;
          green = 0x6;
          blue = 0x1;
          bitsPerPixel = 8;
          result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_RGB8:      ///< Packed RGB 3:3:2,  8bpp, (msb)2R 3G 3B(lsb)
          // TODO: test on bigendian box
          red = 0x7;
          green = 0x38;
          blue = 0xC0;
          bitsPerPixel = 8;
          result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_RGB4:      ///< Packed RGB 1:2:1,  4bpp, (msb)2R 3G 3B(lsb)
          // TODO: BinaryFormat
          break;
        case AVCodecLibrary.PIX_FMT_RGB4_BYTE: ///< Packed RGB 1:2:1,  8bpp, (msb)2R 3G 3B(lsb)
          // TODO: test on bigendian box
          red = 0x1;
          green = 0x6;
          blue = 0x8;
          bitsPerPixel = 8;
          result = new RGBFormat(new Dimension(width, height), -1, Format.byteArray, frameRate, bitsPerPixel, red, green, blue);
          break;
        case AVCodecLibrary.PIX_FMT_RGB32_1:   ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness
          // not supported as outputformat by ffmpeg
          break;
        case AVCodecLibrary.PIX_FMT_BGR32_1:   ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness
View Full Code Here


  if (videoData) {
      int x, y, pos, revpos;
     
      size = new Dimension(320, 240);
      maxDataLength = size.width * size.height * 3;
      rgbFormat = new RGBFormat(size, maxDataLength,
              Format.byteArray,
              frameRate,
              24,
              3, 2, 1,
              3, size.width * 3,
 
View Full Code Here

  }
  static Hashtable imageTable = new Hashtable();
  protected int processRGBtoJPEG(Buffer input,Buffer output) {
    synchronized(imageTable) {
      try {
        RGBFormat inputFormat = (RGBFormat)input.getFormat();
        VideoFormat outputFormat = (VideoFormat)output.getFormat();
       
        if(outputFormat==null) {
          int width = inputFormat.getSize().width;
          int height = inputFormat.getSize().height;
          outputFormat = new JPEGFormat(
              new Dimension(width,height),
              width*height+200, //surely this is the max size, right?
              Format.byteArray,
              inputFormat.getFrameRate(),
              -1// TODO: specify quality
              -1); // TODO: specify decimation
          output.setFormat(outputFormat);
        }
       
        int[] data = (int[])input.getData();
       
        Dimension d = inputFormat.getSize();
        BufferedImage dest = (BufferedImage)imageTable.get(d);
        if(dest==null) {
          dest = new BufferedImage(d.width,d.height,BufferedImage.TYPE_INT_RGB);
        }
        RGBConverter.populateImage(data, input.getOffset(), dest, inputFormat);
View Full Code Here

      return new VideoFormat[] { rgbFormat };
   
    if(input.relax().matches(jpegFormat)) {
      final VideoFormat inputVideoFormat = (VideoFormat) input;
      // TODO:
      return new VideoFormat[] { new RGBFormat(inputVideoFormat.getSize(), -1, Format.intArray, inputVideoFormat.getFrameRate(), 32, 0xff0000, 0xff00, 0xff)};
    }
    return new Format[] {};
  }
View Full Code Here

  static Hashtable imageTable = new Hashtable();
  protected int processJPEGtoRGB(Buffer input,Buffer output) {
    synchronized(imageTable) {
      try {
        VideoFormat inputFormat = (VideoFormat)input.getFormat();
        RGBFormat outputFormat = (RGBFormat)output.getFormat();
       
        if(outputFormat==null) {
          int width = inputFormat.getSize().width;
          int height = inputFormat.getSize().height;
          outputFormat = new RGBFormat(
              new Dimension(width,height),
              width*height,
              Format.intArray,
              inputFormat.getFrameRate(), 32,
              0xff0000, 0xff00, 0xff, //RGB masks
View Full Code Here

      // just ignore alpha
    }
    else
      throw new IllegalArgumentException("Unsupported buffered image type: " + bufferedImageType);
     
    return new RGBFormat(size, maxDataLength, dataType, frameRate, bitsPerPixel, red, green, blue);
     
    }
View Full Code Here

      // just ignore alpha
    }
    else
      throw new IllegalArgumentException("Unsupported buffered image type: " + bufferedImageType);
     
    return new RGBFormat(size, maxDataLength, dataType, frameRate, bitsPerPixel, red, green, blue);
     
    }
View Full Code Here

    int gMask = 0x0000FF00;
    int bMask = 0x000000FF;

    supportedFormats = new VideoFormat[] {
        // 24bit BGR format
        new RGBFormat(null,
            Format.NOT_SPECIFIED,
            Format.byteArray,
            Format.NOT_SPECIFIED,
            24,
            3, 2, 1,
            3,
            Format.NOT_SPECIFIED,
            Format.TRUE,
            Format.NOT_SPECIFIED
        ),

        // 32bit RGB format
        new RGBFormat(null, // size
            Format.NOT_SPECIFIED, // maxDataLength
            Format.intArray, // buffer type
            Format.NOT_SPECIFIED, // frame rate
            32, // bitsPerPixel
            rMask, gMask, bMask, // component masks
            1, // pixel stride
            Format.NOT_SPECIFIED, // line stride
            Format.FALSE, // flipped
            Format.NOT_SPECIFIED // endian
        ),

        // 32 bit BGR format
        new RGBFormat(null, // size
            Format.NOT_SPECIFIED, // maxDataLength
            Format.intArray, // buffer type
            Format.NOT_SPECIFIED, // frame rate
            32, // bitsPerPixel
            bMask, gMask, rMask, // component masks
View Full Code Here

            final Format[] formats = getFormats(system, civilInfo.getDeviceID());
            jmfInfo = new CaptureDeviceInfo("civil:" + civilInfo.getDescription() + ":" + i, new MediaLocator("civil:" + civilInfo.getDeviceID()), formats);
          }
          else
          {
            jmfInfo = new CaptureDeviceInfo("civil:" + civilInfo.getDescription() + ":" + i, new MediaLocator("civil:" + civilInfo.getDeviceID()), new Format[] {new RGBFormat()});
          }
         
          if (CaptureDeviceManager.getDevice(jmfInfo.getName()) == null)
          {
            CaptureDeviceManager.addDevice(jmfInfo);
View Full Code Here

           float effectRatio) {
  //System.err.println("Doing effect at " + effectRatio);
  // Assume wipe
  byte[] destData = (byte[]) dest.getData();
  byte[] srcData = (byte[]) source.getData();
  RGBFormat rgb = (RGBFormat) dest.getFormat();
  int videoHeight = rgb.getSize().height;
  int stride = rgb.getLineStride();
  if (effectRatio > 1.0f)
      effectRatio = 1.0f;
  if (effectRatio <= 0.0f)
      return;
  if (effectVideo[currentLocator].equalsIgnoreCase("Scroll")) {
View Full Code Here

TOP

Related Classes of javax.media.format.RGBFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.