Class VPX


  • public class VPX
    extends Object
    A wrapper for the libvpx native library. See WebM Project Docs
    Author:
    Boris Grozev
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CODEC_CX_FRAME_PKT
      Compressed video frame packet type.
      static int CODEC_LIST_END
      An iterator reached the end of list.
      static int CODEC_OK
      Operation completed without error.
      static int CODEC_USE_OUTPUT_PARTITION
      Output one partition at a time.
      static int CODEC_USE_XMA
      Use eXternal Memory Allocation mode flag Corresponds to VPX_CODEC_USE_XMA from vpx/vpx_codec.h
      static int DL_REALTIME
      Process and return as soon as possible ('realtime' deadline) Corresponds to VPX_DL_REALTIME from vpx/vpx_encoder.h
      static int ERROR_RESILIENT_DEFAULT
      Improve resiliency against losses of whole frames.
      static int ERROR_RESILIENT_PARTITIONS
      The frame partitions are independently decodable by the bool decoder, meaning that partitions can be decoded even though earlier partitions have been lost.
      static int IMG_FMT_I420
      I420 format constant Corresponds to VPX_IMG_FMT_I420 from vpx/vpx_image.h
      static int INTEFACE_VP8_DEC
      Constant for VP8 decoder interface
      static int INTERFACE_VP8_ENC
      Constant for VP8 encoder interface
      static int KF_MODE_AUTO
      Encoder determines optimal placement automatically.
      static int KF_MODE_DISABLED
      Encoder does not place keyframes.
      static int RC_MODE_CBR
      Constant Bitrate mode.
      static int RC_MODE_CQ
      Constant Quality mode.
      static int RC_MODE_VBR
      Variable Bitrate mode.
    • Constructor Summary

      Constructors 
      Constructor Description
      VPX()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long codec_ctx_malloc()
      Allocates memory for a vpx_codec_ctx_t on the heap.
      static long codec_cx_pkt_get_data​(long pkt)
      Returns a pointer to the data in the vpx_codec_cx_pkt_t pointed to bypkt.
      static int codec_cx_pkt_get_kind​(long pkt)
      Returns the kind of the vpx_codec_cx_pkt_t pointed to by pkt.
      static int codec_cx_pkt_get_size​(long pkt)
      Returns the size of the data in the vpx_codec_cx_pkt_t pointed to by pkt.
      static long codec_dec_cfg_malloc()
      Allocates memory for a vpx_codec_dec_cfg_t on the heap.
      static void codec_dec_cfg_set_h​(long cfg, int value)
      Sets the h field of a vpx_codec_dec_cfg_t.
      static void codec_dec_cfg_set_w​(long cfg, int value)
      Sets the w field of a vpx_codec_dec_cfg_t.
      static int codec_dec_init​(long context, int iface, long cfg, long flags)
      Initializes a vpx decoder context.
      static int codec_decode​(long context, byte[] buf, int buf_offset, int buf_size, long user_priv, long deadline)
      Decodes the frame in buf, at offset buf_offset.
      static int codec_destroy​(long context)
      Destroys a codec context, freeing any associated memory buffers.
      static long codec_enc_cfg_malloc()
      Allocates memory for a vpx_codec_enc_cfg_t on the heap.
      static void codec_enc_cfg_set_error_resilient​(long cfg, int value)
      Sets the g_error_resilient field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_h​(long cfg, int value)
      Sets the g_h field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_kf_max_dist​(long cfg, int value)
      Sets the kf_max_dist field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_kf_min_dist​(long cfg, int value)
      Sets the kf_min_dist field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_kf_mode​(long cfg, int value)
      Sets the kf_mode field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_profile​(long cfg, int value)
      Sets the g_profile field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_buf_initial_sz​(long cfg, int value)
      Sets the rc_buf_initial_sz field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_buf_optimal_sz​(long cfg, int value)
      Sets the rc_buf_optimal_sz field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_buf_sz​(long cfg, int value)
      Sets the rc_buf_sz field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_dropframe_thresh​(long cfg, int value)
      Sets the rc_dropframe_thresh field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_end_usage​(long cfg, int value)
      Sets the rc_end_usage field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_max_quantizer​(long cfg, int value)
      Sets the rc_max_quantizer field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_min_quantizer​(long cfg, int value)
      Sets the rc_min_quantizer field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_overshoot_pct​(long cfg, int value)
      Sets the rc_overshoot_pct field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_resize_allowed​(long cfg, int value)
      Sets the rc_resize_allowed field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_resize_down_thresh​(long cfg, int value)
      Sets the rc_resize_down_thresh field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_resize_up_thresh​(long cfg, int value)
      Sets the rc_resize_up_thresh field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_target_bitrate​(long cfg, int value)
      Sets the rc_target_bitrate field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_rc_undershoot_pct​(long cfg, int value)
      Sets the rc_undershoot_pct field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_threads​(long cfg, int value)
      Sets the g_threads field of a vpx_codec_enc_cfg_t.
      static void codec_enc_cfg_set_w​(long cfg, int value)
      Sets the g_w field of a vpx_codec_enc_cfg_t.
      static int codec_enc_config_default​(int iface, long cfg, int usage)
      Initializes a encoder configuration structure with default values.
      static int codec_enc_config_set​(long context, long cfg)  
      static int codec_enc_init​(long context, int iface, long cfg, long flags)
      Initializes a vpx encoder context.
      static int codec_encode​(long context, long img, byte[] buf, int offset0, int offset1, int offset2, long pts, long duration, long flags, long deadline)
      Encodes the frame described by img, buf, offset0, offset1 and offset2.
      static String codec_err_to_string​(int err)
      Returns a String describing the error code err.
      static int codec_err_to_string​(int err, byte[] buf, int buf_size)
      Fills in buf with a string description of the error code err.
      static long codec_get_cx_data​(long context, long[] iter)
      Encoded data iterator.
      static long codec_get_frame​(long context, long[] iter)
      Gets the next frame available to display from the decoder context context.
      static int codec_peek_stream_info​(int iface, byte[] buf, int buf_offset, int buf_size, long si_ptr)
      Performs high level parsing of the bitstream.
      static void free​(long ptr)
      Frees memory, which has been allocated with malloc(long) or one of the *_malloc() functions.
      static int img_get_d_h​(long img)
      Returns the value of the d_h (displayed height) field of a vpx_image_t.
      static int img_get_d_w​(long img)
      Returns the value of the d_w (displayed width) field of a vpx_image_t.
      static int img_get_fmt​(long img)
      Returns the value of the fmt field of a vpx_image_t.
      static int img_get_h​(long img)
      Returns the value of the h (height) field of a vpx_image_t.
      static long img_get_plane0​(long img)
      Returns the value of the planes[0] field of a vpx_image_t.
      static long img_get_plane1​(long img)
      Returns the value of the planes[1] field of a vpx_image_t.
      static long img_get_plane2​(long img)
      Returns the value of the planes[2] field of a vpx_image_t.
      static int img_get_stride0​(long img)
      Returns the value of the stride[0] field of a vpx_image_t.
      static int img_get_stride1​(long img)
      Returns the value of the stride[1] field of a vpx_image_t.
      static int img_get_stride2​(long img)
      Returns the value of the stride[2] field of a vpx_image_t.
      static int img_get_w​(long img)
      Returns the value of the w (width) field of a vpx_image_t.
      static long img_malloc()
      Allocates memory for a vpx_image_t on the heap.
      static void img_set_bps​(long img, int value)
      Sets the bps (bits per sample) field of a vpx_image_t.
      static void img_set_d_h​(long img, int value)
      Sets the d_h (displayed height) field of a vpx_image_t.
      static void img_set_d_w​(long img, int value)
      Sets the d_w (displayed width) field of a vpx_image_t.
      static void img_set_fmt​(long img, int value)
      Sets the fmt (format) field of a vpx_image_t.
      static void img_set_h​(long img, int value)
      Sets the h (height) field of a vpx_image_t.
      static void img_set_stride0​(long img, int value)
      Sets the stride[0] field of a vpx_image_t.
      static void img_set_stride1​(long img, int value)
      Sets the stride[1] field of a vpx_image_t.
      static void img_set_stride2​(long img, int value)
      Sets the stride[2] field of a vpx_image_t.
      static void img_set_stride3​(long img, int value)
      Sets the stride[3] field of a vpx_image_t.
      static void img_set_w​(long img, int value)
      Sets the w (width) field of a vpx_image_t.
      static void img_wrap​(long img, int fmt, int d_w, int d_h, int align, long data)
      Open a descriptor, using existing storage for the underlying image.
      static long malloc​(long s)
      Allocates memorry on the heap (a simple wrapped around the native malloc())
      static void memcpy​(byte[] dst, long src, int n)
      Copies n bytes from src to dst.
      static int stream_info_get_h​(long stream_info)
      Returns the h field of a vpx_codec_stream_info_t.
      static int stream_info_get_is_kf​(long stream_info)
      Returns the is_kf field of a vpx_codec_stream_info_t.
      static int stream_info_get_w​(long stream_info)
      Returns the w field of a vpx_codec_stream_info_t.
      static long stream_info_malloc()
      Allocates memory for a vpx_codec_stream_info_t on the heap.
    • Field Detail

      • CODEC_OK

        public static final int CODEC_OK
        Operation completed without error. Corresponds to VPX_CODEC_OK from vpx/vpx_codec.h
        See Also:
        Constant Field Values
      • CODEC_LIST_END

        public static final int CODEC_LIST_END
        An iterator reached the end of list. Corresponds to VPX_CODEC_LIST_END from vpx/vpx_codec.h
        See Also:
        Constant Field Values
      • CODEC_USE_XMA

        public static final int CODEC_USE_XMA
        Use eXternal Memory Allocation mode flag Corresponds to VPX_CODEC_USE_XMA from vpx/vpx_codec.h
        See Also:
        Constant Field Values
      • CODEC_USE_OUTPUT_PARTITION

        public static final int CODEC_USE_OUTPUT_PARTITION
        Output one partition at a time. Each partition is returned in its own VPX_CODEC_CX_FRAME_PKT.
        See Also:
        Constant Field Values
      • ERROR_RESILIENT_DEFAULT

        public static final int ERROR_RESILIENT_DEFAULT
        Improve resiliency against losses of whole frames. To set this option for an encoder, enable this bit in the value passed to vpx_enc_cft_set_error_resilient for the encoder's configuration. Corresponds to VPX_ERROR_RESILIENT_DEFAULT from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • ERROR_RESILIENT_PARTITIONS

        public static final int ERROR_RESILIENT_PARTITIONS
        The frame partitions are independently decodable by the bool decoder, meaning that partitions can be decoded even though earlier partitions have been lost. Note that intra predicition is still done over the partition boundary. To set this option for Coan encoder, enable this bit in the value passed to vpx_enc_cft_set_error_resilient for the encoder's configuration. Corresponds to VPX_ERROR_RESILIENT_PARTITIONS from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • IMG_FMT_I420

        public static final int IMG_FMT_I420
        I420 format constant Corresponds to VPX_IMG_FMT_I420 from vpx/vpx_image.h
        See Also:
        Constant Field Values
      • RC_MODE_VBR

        public static final int RC_MODE_VBR
        Variable Bitrate mode. Corresponds to VPX_VBR from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • RC_MODE_CBR

        public static final int RC_MODE_CBR
        Constant Bitrate mode. Corresponds to VPX_CBR from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • RC_MODE_CQ

        public static final int RC_MODE_CQ
        Constant Quality mode. Corresponds to VPX_CQ from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • KF_MODE_AUTO

        public static final int KF_MODE_AUTO
        Encoder determines optimal placement automatically. Corresponds to VPX_KF_AUTO from in vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • KF_MODE_DISABLED

        public static final int KF_MODE_DISABLED
        Encoder does not place keyframes. Corresponds to VPX_KF_DISABLED from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • DL_REALTIME

        public static final int DL_REALTIME
        Process and return as soon as possible ('realtime' deadline) Corresponds to VPX_DL_REALTIME from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • CODEC_CX_FRAME_PKT

        public static final int CODEC_CX_FRAME_PKT
        Compressed video frame packet type. Corresponds to VPX_CODEC_CX_FRAME_PKT from vpx/vpx_encoder.h
        See Also:
        Constant Field Values
      • INTEFACE_VP8_DEC

        public static final int INTEFACE_VP8_DEC
        Constant for VP8 decoder interface
        See Also:
        Constant Field Values
      • INTERFACE_VP8_ENC

        public static final int INTERFACE_VP8_ENC
        Constant for VP8 encoder interface
        See Also:
        Constant Field Values
    • Constructor Detail

      • VPX

        public VPX()
    • Method Detail

      • codec_ctx_malloc

        public static long codec_ctx_malloc()
        Allocates memory for a vpx_codec_ctx_t on the heap.
        Returns:
        A pointer to the allocated memory.
      • codec_dec_init

        public static int codec_dec_init​(long context,
                                         int iface,
                                         long cfg,
                                         long flags)
        Initializes a vpx decoder context.
        Parameters:
        context - Pointer to a pre-allocated vpx_codec_ctx_t.
        iface - Interface to be used. Has to be one of the VPX.INTERFACE_* constants.
        cfg - Pointer to a pre-allocated vpx_codec_dec_cfg_t, may be 0.
        flags - Flags.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_decode

        public static int codec_decode​(long context,
                                       byte[] buf,
                                       int buf_offset,
                                       int buf_size,
                                       long user_priv,
                                       long deadline)
        Decodes the frame in buf, at offset buf_offset.
        Parameters:
        context - The context to use.
        buf - Encoded frame buffer.
        buf_offset - Offset into buf where the encoded frame begins.
        buf_size - Size of the encoded frame.
        user_priv - Application specific data to associate with this frame.
        deadline - Soft deadline the decoder should attempt to meet, in microseconds. Set to zero for unlimited.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_get_frame

        public static long codec_get_frame​(long context,
                                           long[] iter)
        Gets the next frame available to display from the decoder context context. The list of available frames becomes valid upon completion of the codec_decode call, and remains valid until the next call to codec_decode.
        Parameters:
        context - The decoder context to use.
        iter - Iterator storage, initialized by setting its first element to 0.
        Returns:
        Pointer to a vpx_image_t describing the decoded frame, or 0 if no more frames are available
      • codec_destroy

        public static int codec_destroy​(long context)
        Destroys a codec context, freeing any associated memory buffers.
        Parameters:
        context - Pointer to the vpx_codec_ctx_t context to destroy.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_enc_init

        public static int codec_enc_init​(long context,
                                         int iface,
                                         long cfg,
                                         long flags)
        Initializes a vpx encoder context.
        Parameters:
        context - Pointer to a pre-allocated vpx_codec_ctx_t.
        iface - Interface to be used. Has to be one of the VPX.INTERFACE_* constants.
        cfg - Pointer to a pre-allocated vpx_codec_enc_cfg_t, may be 0.
        flags - Flags.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_enc_config_set

        public static int codec_enc_config_set​(long context,
                                               long cfg)
        Parameters:
        context - Pointer to the codec context on which to set the confirutation
        cfg - Pointer to a vpx_codec_enc_cfg_t to set.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_encode

        public static int codec_encode​(long context,
                                       long img,
                                       byte[] buf,
                                       int offset0,
                                       int offset1,
                                       int offset2,
                                       long pts,
                                       long duration,
                                       long flags,
                                       long deadline)
        Encodes the frame described by img, buf, offset0, offset1 and offset2. Note that buf and the offsets describe where the frames is stored, but img has to have all of its other parameters (format, dimensions, strides) already set. The reason buf and the offsets are treated differently is to allow for the encoder to operate on java memory and avoid copying the raw frame to native memory.
        Parameters:
        context - Pointer to the codec context to use.
        img - Pointer to a vpx_image_t describing the raw frame
        buf - Contains the raw frame
        offset0 - Offset of the first plane
        offset1 - Offset of the second plane
        offset2 - Offset of the third plane
        pts - Presentation time stamp, in timebase units.
        duration - Duration to show frame, in timebase units.
        flags - Flags to use for encoding this frame.
        deadline - Time to spend encoding, in microseconds. (0=infinite)
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_get_cx_data

        public static long codec_get_cx_data​(long context,
                                             long[] iter)
        Encoded data iterator. Iterates over a list of data packets to be passed from the encoder to the application. The kind of a packet can be determined using codec_cx_pkt_get_kind(long) Packets of kind CODEC_CX_FRAME_PKT should be passed to the application's muxer.
        Parameters:
        context - The codec context to use.
        iter - Iterator storage, initialized by setting its first element to 0.
        Returns:
        Pointer to a vpx_codec_cx_pkt_t containing the output data packet, or 0 to indicate the end of available packets
      • codec_cx_pkt_get_kind

        public static int codec_cx_pkt_get_kind​(long pkt)
        Returns the kind of the vpx_codec_cx_pkt_t pointed to by pkt.
        Parameters:
        pkt - Pointer to the vpx_codec_cx_pkt_t to return the kind of.
        Returns:
        The kind of pkt.
      • codec_cx_pkt_get_size

        public static int codec_cx_pkt_get_size​(long pkt)
        Returns the size of the data in the vpx_codec_cx_pkt_t pointed to by pkt. Can only be used for packets of kind CODEC_CX_FRAME_PKT.
        Parameters:
        pkt - Pointer to a vpx_codec_cx_pkt_t.
        Returns:
        The size of the data of pkt.
      • codec_cx_pkt_get_data

        public static long codec_cx_pkt_get_data​(long pkt)
        Returns a pointer to the data in the vpx_codec_cx_pkt_t pointed to bypkt. Can only be used for packets of kind CODEC_CX_FRAME_PKT.
        Parameters:
        pkt - Pointer to the vpx_codec_cx_pkt_t.
        Returns:
        Pointer to the data of pkt.
      • img_malloc

        public static long img_malloc()
        Allocates memory for a vpx_image_t on the heap.
        Returns:
        A pointer to the allocated memory.
      • img_get_w

        public static int img_get_w​(long img)
        Returns the value of the w (width) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The w (width) field of img.
      • img_get_h

        public static int img_get_h​(long img)
        Returns the value of the h (height) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The h (height) field of img.
      • img_get_d_w

        public static int img_get_d_w​(long img)
        Returns the value of the d_w (displayed width) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The d_w (displayed width) field of img.
      • img_get_d_h

        public static int img_get_d_h​(long img)
        Returns the value of the d_h (displayed height) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The d_h (displayed height) field of img.
      • img_get_plane0

        public static long img_get_plane0​(long img)
        Returns the value of the planes[0] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The planes[0] field of img.
      • img_get_plane1

        public static long img_get_plane1​(long img)
        Returns the value of the planes[1] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The planes[1] field of img.
      • img_get_plane2

        public static long img_get_plane2​(long img)
        Returns the value of the planes[2] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The planes[2] field of img.
      • img_get_stride0

        public static int img_get_stride0​(long img)
        Returns the value of the stride[0] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The stride[0] field of img.
      • img_get_stride1

        public static int img_get_stride1​(long img)
        Returns the value of the stride[1] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The stride[1] field of img.
      • img_get_stride2

        public static int img_get_stride2​(long img)
        Returns the value of the stride[2] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The stride[2] field of img.
      • img_get_fmt

        public static int img_get_fmt​(long img)
        Returns the value of the fmt field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        Returns:
        The fmt field of img.
      • img_set_w

        public static void img_set_w​(long img,
                                     int value)
        Sets the w (width) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_h

        public static void img_set_h​(long img,
                                     int value)
        Sets the h (height) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_d_w

        public static void img_set_d_w​(long img,
                                       int value)
        Sets the d_w (displayed width) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_d_h

        public static void img_set_d_h​(long img,
                                       int value)
        Sets the d_h (displayed height) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_stride0

        public static void img_set_stride0​(long img,
                                           int value)
        Sets the stride[0] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_stride1

        public static void img_set_stride1​(long img,
                                           int value)
        Sets the stride[1] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_stride2

        public static void img_set_stride2​(long img,
                                           int value)
        Sets the stride[2] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_stride3

        public static void img_set_stride3​(long img,
                                           int value)
        Sets the stride[3] field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_fmt

        public static void img_set_fmt​(long img,
                                       int value)
        Sets the fmt (format) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_set_bps

        public static void img_set_bps​(long img,
                                       int value)
        Sets the bps (bits per sample) field of a vpx_image_t.
        Parameters:
        img - Pointer to a vpx_image_t.
        value - The value to set.
      • img_wrap

        public static void img_wrap​(long img,
                                    int fmt,
                                    int d_w,
                                    int d_h,
                                    int align,
                                    long data)
        Open a descriptor, using existing storage for the underlying image. Returns a descriptor for storing an image of the given format. The storage for descriptor has been allocated elsewhere, and a descriptor is desired to "wrap" that storage.
        Parameters:
        img - Pointer to a vpx_image_t.
        fmt - Format of the image.
        d_w - Width of the image.
        d_h - Height of the image.
        align - Alignment, in bytes, of each row in the image.
        data - Storage to use for the image
      • codec_dec_cfg_malloc

        public static long codec_dec_cfg_malloc()
        Allocates memory for a vpx_codec_dec_cfg_t on the heap.
        Returns:
        A pointer to the allocated memory.
      • codec_dec_cfg_set_w

        public static void codec_dec_cfg_set_w​(long cfg,
                                               int value)
        Sets the w field of a vpx_codec_dec_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_dec_cfg_t.
        value - The value to set.
      • codec_dec_cfg_set_h

        public static void codec_dec_cfg_set_h​(long cfg,
                                               int value)
        Sets the h field of a vpx_codec_dec_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_dec_cfg_t.
        value - The value to set.
      • codec_enc_cfg_malloc

        public static long codec_enc_cfg_malloc()
        Allocates memory for a vpx_codec_enc_cfg_t on the heap.
        Returns:
        A pointer to the allocated memory.
      • codec_enc_config_default

        public static int codec_enc_config_default​(int iface,
                                                   long cfg,
                                                   int usage)
        Initializes a encoder configuration structure with default values.
        Parameters:
        iface - Interface. Should be one of the INTERFACE_* constants
        cfg - Pointer to the vpx_codec_enc_cfg_t to initialize
        usage - End usage. Set to 0 or use codec specific values.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • codec_enc_cfg_set_profile

        public static void codec_enc_cfg_set_profile​(long cfg,
                                                     int value)
        Sets the g_profile field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t
        value - The value to set.
      • codec_enc_cfg_set_threads

        public static void codec_enc_cfg_set_threads​(long cfg,
                                                     int value)
        Sets the g_threads field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_w

        public static void codec_enc_cfg_set_w​(long cfg,
                                               int value)
        Sets the g_w field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_h

        public static void codec_enc_cfg_set_h​(long cfg,
                                               int value)
        Sets the g_h field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_error_resilient

        public static void codec_enc_cfg_set_error_resilient​(long cfg,
                                                             int value)
        Sets the g_error_resilient field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_target_bitrate

        public static void codec_enc_cfg_set_rc_target_bitrate​(long cfg,
                                                               int value)
        Sets the rc_target_bitrate field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_dropframe_thresh

        public static void codec_enc_cfg_set_rc_dropframe_thresh​(long cfg,
                                                                 int value)
        Sets the rc_dropframe_thresh field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_resize_allowed

        public static void codec_enc_cfg_set_rc_resize_allowed​(long cfg,
                                                               int value)
        Sets the rc_resize_allowed field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_resize_up_thresh

        public static void codec_enc_cfg_set_rc_resize_up_thresh​(long cfg,
                                                                 int value)
        Sets the rc_resize_up_thresh field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_resize_down_thresh

        public static void codec_enc_cfg_set_rc_resize_down_thresh​(long cfg,
                                                                   int value)
        Sets the rc_resize_down_thresh field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_end_usage

        public static void codec_enc_cfg_set_rc_end_usage​(long cfg,
                                                          int value)
        Sets the rc_end_usage field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_min_quantizer

        public static void codec_enc_cfg_set_rc_min_quantizer​(long cfg,
                                                              int value)
        Sets the rc_min_quantizer field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_max_quantizer

        public static void codec_enc_cfg_set_rc_max_quantizer​(long cfg,
                                                              int value)
        Sets the rc_max_quantizer field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_undershoot_pct

        public static void codec_enc_cfg_set_rc_undershoot_pct​(long cfg,
                                                               int value)
        Sets the rc_undershoot_pct field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_overshoot_pct

        public static void codec_enc_cfg_set_rc_overshoot_pct​(long cfg,
                                                              int value)
        Sets the rc_overshoot_pct field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_buf_sz

        public static void codec_enc_cfg_set_rc_buf_sz​(long cfg,
                                                       int value)
        Sets the rc_buf_sz field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_buf_initial_sz

        public static void codec_enc_cfg_set_rc_buf_initial_sz​(long cfg,
                                                               int value)
        Sets the rc_buf_initial_sz field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_rc_buf_optimal_sz

        public static void codec_enc_cfg_set_rc_buf_optimal_sz​(long cfg,
                                                               int value)
        Sets the rc_buf_optimal_sz field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_kf_mode

        public static void codec_enc_cfg_set_kf_mode​(long cfg,
                                                     int value)
        Sets the kf_mode field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_kf_min_dist

        public static void codec_enc_cfg_set_kf_min_dist​(long cfg,
                                                         int value)
        Sets the kf_min_dist field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • codec_enc_cfg_set_kf_max_dist

        public static void codec_enc_cfg_set_kf_max_dist​(long cfg,
                                                         int value)
        Sets the kf_max_dist field of a vpx_codec_enc_cfg_t.
        Parameters:
        cfg - Pointer to a vpx_codec_enc_cfg_t.
        value - The value to set.
      • stream_info_malloc

        public static long stream_info_malloc()
        Allocates memory for a vpx_codec_stream_info_t on the heap.
        Returns:
        A pointer to the allocated memory.
      • stream_info_get_w

        public static int stream_info_get_w​(long stream_info)
        Returns the w field of a vpx_codec_stream_info_t.
        Parameters:
        stream_info - Pointer to a vpx_codec_stream_info_t.
        Returns:
        The w field of a stream_info.
      • stream_info_get_h

        public static int stream_info_get_h​(long stream_info)
        Returns the h field of a vpx_codec_stream_info_t.
        Parameters:
        stream_info - Pointer to a vpx_codec_stream_info_t.
        Returns:
        The h field of a stream_info.
      • stream_info_get_is_kf

        public static int stream_info_get_is_kf​(long stream_info)
        Returns the is_kf field of a vpx_codec_stream_info_t.
        Parameters:
        stream_info - Pointer to a vpx_codec_stream_info_t.
        Returns:
        The w field of a stream_info.
      • codec_peek_stream_info

        public static int codec_peek_stream_info​(int iface,
                                                 byte[] buf,
                                                 int buf_offset,
                                                 int buf_size,
                                                 long si_ptr)
        Performs high level parsing of the bitstream. Construction of a decoder context is not necessary. Can be used to determine if the bitstream is of the proper format, and to extract information from the stream.
        Parameters:
        iface - Interface, should be one of the INTERFACE_* constants.
        buf - Buffer containing a compressed frame.
        buf_offset - Offset into buf where the compressed frame begins.
        buf_size - Size of the compressed frame.
        si_ptr - Pointer to a vpx_codec_stream_info_t which will be filled with information about the compressed frame.
        Returns:
        CODEC_OK on success, or an error code otherwise. The error code can be converted to a String with codec_err_to_string(int)
      • malloc

        public static long malloc​(long s)
        Allocates memorry on the heap (a simple wrapped around the native malloc())
        Parameters:
        s - Number of bytes to allocate
        Returns:
        Pointer to the memory allocated.
      • free

        public static void free​(long ptr)
        Frees memory, which has been allocated with malloc(long) or one of the *_malloc() functions.
        Parameters:
        ptr - Pointer to the memory to free.
      • memcpy

        public static void memcpy​(byte[] dst,
                                  long src,
                                  int n)
        Copies n bytes from src to dst. Simple wrapper around the native memcpy() funciton.
        Parameters:
        dst - Destination.
        src - Source.
        n - Number of bytes to copy.
      • codec_err_to_string

        public static int codec_err_to_string​(int err,
                                              byte[] buf,
                                              int buf_size)
        Fills in buf with a string description of the error code err. Fills at most buf_size bytes of buf
        Parameters:
        err - Error code
        buf - Buffer to copy the string into
        buf_size - Buffer size
        Returns:
        The number of bytes written to buf
      • codec_err_to_string

        public static String codec_err_to_string​(int err)
        Returns a String describing the error code err.
        Parameters:
        err - Error code
        Returns:
        A String describing the error code err.