Class IPixelFormat


  • public class IPixelFormat
    extends RefCounted
    Information about how video data is formatted in an {IVideoPicture} object.

    This specifies the color space and how many bits pixel data takes. It also
    includes some utility methods for dealing with {Type#YUV420P} data; the
    most common type of encoding used in video files I've run across.
    • Constructor Detail

      • IPixelFormat

        protected IPixelFormat​(long cPtr,
                               boolean cMemoryOwn)
        Internal Only.
      • IPixelFormat

        protected IPixelFormat​(long cPtr,
                               boolean cMemoryOwn,
                               java.util.concurrent.atomic.AtomicLong ref)
        Internal Only.
    • Method Detail

      • getCPtr

        public static long getCPtr​(IPixelFormat obj)
        Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.
        Parameters:
        obj - The java proxy object for a native object.
        Returns:
        The raw pointer obj is proxying for.
      • getMyCPtr

        public long getMyCPtr()
        Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.
        Overrides:
        getMyCPtr in class RefCounted
        Returns:
        The raw pointer we're proxying for.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.
        Overrides:
        equals in class java.lang.Object
        Returns:
        True if the underlying native object is the same. False otherwise.
      • hashCode

        public int hashCode()
        Get a hashable value for this object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashable value.
      • getYUV420PPixel

        public static short getYUV420PPixel​(IVideoPicture frame,
                                            int x,
                                            int y,
                                            IPixelFormat.YUVColorComponent c)
        Returns the byte for the coordinates at x and y for the color component c.

        Parameters:
        frame - The frame to get the byte from
        x - X coordinate in pixels, where 0 is the left hand edge of the image.
        y - Y coordinate in pixels, where 0 is the top edge of the image.
        c - YUVColor component

        Returns:
        the pixel byte for that x, y, c combination
      • setYUV420PPixel

        public static void setYUV420PPixel​(IVideoPicture frame,
                                           int x,
                                           int y,
                                           IPixelFormat.YUVColorComponent c,
                                           short value)
        Sets the value of the color component c at the coordinates x and y in the given frame.

        Parameters:
        frame - The frame to set the byte in
        x - X coordinate in pixels, where 0 is the left hand edge of the image.
        y - Y coordinate in pixels, where 0 is the top edge of the image.
        c - YUVColor component to set
        value - The new value of that pixel color component

      • getYUV420PPixelOffset

        public static int getYUV420PPixelOffset​(IVideoPicture frame,
                                                int x,
                                                int y,
                                                IPixelFormat.YUVColorComponent c)
        For a given x and y in a frame, and a given color components, this method
        tells you how far into the actual data you'd have to go to find the byte that
        represents that color/coordinate combination.

        Parameters:
        frame - The frame to get the byte from
        x - X coordinate in pixels, where 0 is the left hand edge of the image.
        y - Y coordinate in pixels, where 0 is the top edge of the image.
        c - YUVColor component

        Returns:
        the offset in bytes, starting from the start of the frame data, where
        the data for this pixel resides.