diff --git a/polymer/eduke32/platform/Windows/include/vpx/vp8.h b/polymer/eduke32/platform/Windows/include/vpx/vp8.h index 2a31af6d1..8a035f977 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vp8.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vp8.h @@ -116,19 +116,29 @@ typedef struct vp9_ref_frame { vpx_image_t img; /**< img structure to populate (output) */ } vp9_ref_frame_t; +/*!\cond */ /*!\brief vp8 decoder control function parameter type * * defines the data type for each of VP8 decoder control function requires */ VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *) +#define VPX_CTRL_VP8_SET_REFERENCE VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *) +#define VPX_CTRL_VP8_COPY_REFERENCE VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *) +#define VPX_CTRL_VP8_SET_POSTPROC VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_REF_FRAME, int) +#define VPX_CTRL_VP8_SET_DBG_COLOR_REF_FRAME VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_MB_MODES, int) +#define VPX_CTRL_VP8_SET_DBG_COLOR_MB_MODES VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_B_MODES, int) +#define VPX_CTRL_VP8_SET_DBG_COLOR_B_MODES VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int) +#define VPX_CTRL_VP8_SET_DBG_DISPLAY_MV VPX_CTRL_USE_TYPE(VP9_GET_REFERENCE, vp9_ref_frame_t *) +#define VPX_CTRL_VP9_GET_REFERENCE +/*!\endcond */ /*! @} - end defgroup vp8 */ #ifdef __cplusplus diff --git a/polymer/eduke32/platform/Windows/include/vpx/vp8dx.h b/polymer/eduke32/platform/Windows/include/vpx/vp8dx.h index bde77c24d..67c97bb6c 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vp8dx.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vp8dx.h @@ -9,13 +9,13 @@ */ -/*!\defgroup vp8_decoder WebM VP8 Decoder +/*!\defgroup vp8_decoder WebM VP8/VP9 Decoder * \ingroup vp8 * * @{ */ /*!\file - * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder + * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder * interface. */ #ifndef VPX_VP8DX_H_ @@ -30,19 +30,22 @@ extern "C" { /*!\name Algorithm interface for VP8 * - * This interface provides the capability to decode raw VP8 streams, as would - * be found in AVI files and other non-Flash uses. + * This interface provides the capability to decode VP8 streams. * @{ */ extern vpx_codec_iface_t vpx_codec_vp8_dx_algo; extern vpx_codec_iface_t *vpx_codec_vp8_dx(void); +/*!@} - end algorithm interface member group*/ -/* TODO(jkoleszar): These move to VP9 in a later patch set. */ +/*!\name Algorithm interface for VP9 + * + * This interface provides the capability to decode VP9 streams. + * @{ + */ extern vpx_codec_iface_t vpx_codec_vp9_dx_algo; extern vpx_codec_iface_t *vpx_codec_vp9_dx(void); /*!@} - end algorithm interface member group*/ - /*!\enum vp8_dec_control_id * \brief VP8 decoder control functions * @@ -66,34 +69,76 @@ enum vp8_dec_control_id { VP8D_GET_LAST_REF_USED, /** decryption function to decrypt encoded buffer data immediately - * before decoding. Takes a vp8_decrypt_init, which contains + * before decoding. Takes a vpx_decrypt_init, which contains * a callback function and opaque context pointer. */ - VP8D_SET_DECRYPTOR, + VPXD_SET_DECRYPTOR, + VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR, - /** control function to get the display dimensions for the current frame. */ + /** control function to get the dimensions that the current frame is decoded + * at. This may be different to the intended display size for the frame as + * specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */ + VP9D_GET_FRAME_SIZE, + + /** control function to get the current frame's intended display dimensions + * (as specified in the wrapper or frame header). This may be different to + * the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */ VP9D_GET_DISPLAY_SIZE, - /** For testing. */ + /** control function to get the bit depth of the stream. */ + VP9D_GET_BIT_DEPTH, + + /** control function to set the byte alignment of the planes in the reference + * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets + * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly + * follows Y plane, and V plane directly follows U plane. Default value is 0. + */ + VP9_SET_BYTE_ALIGNMENT, + + /** control function to invert the decoding order to from right to left. The + * function is used in a test to confirm the decoding independence of tile + * columns. The function may be used in application where this order + * of decoding is desired. + * + * TODO(yaowu): Rework the unit test that uses this control, and in a future + * release, this test-only control shall be removed. + */ VP9_INVERT_TILE_DECODE_ORDER, + /** control function to set the skip loop filter flag. Valid values are + * integers. The decoder will skip the loop filter when its value is set to + * nonzero. If the loop filter is skipped the decoder may accumulate decode + * artifacts. The default value is 0. + */ + VP9_SET_SKIP_LOOP_FILTER, + VP8_DECODER_CTRL_ID_MAX }; +/** Decrypt n bytes of data from input -> output, using the decrypt_state + * passed in VPXD_SET_DECRYPTOR. + */ +typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input, + unsigned char *output, int count); + /*!\brief Structure to hold decryption state * * Defines a structure to hold the decryption state and access function. */ -typedef struct vp8_decrypt_init { - /** Decrypt n bytes of data from input -> output, using the decrypt_state - * passed in VP8D_SET_DECRYPTOR. - */ - void (*decrypt_cb)(void *decrypt_state, const unsigned char *input, - unsigned char *output, int count); +typedef struct vpx_decrypt_init { + /*! Decrypt callback. */ + vpx_decrypt_cb decrypt_cb; + /*! Decryption state. */ void *decrypt_state; -} vp8_decrypt_init; +} vpx_decrypt_init; +/*!\brief A deprecated alias for vpx_decrypt_init. + */ +typedef vpx_decrypt_init vp8_decrypt_init; + + +/*!\cond */ /*!\brief VP8 decoder control function parameter type * * Defines the data types that VP8D control functions take. Note that @@ -102,13 +147,26 @@ typedef struct vp8_decrypt_init { */ -VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *) -VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *) -VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *) -VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vp8_decrypt_init *) -VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *) +VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *) +#define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES +VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *) +#define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED +VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *) +#define VPX_CTRL_VP8D_GET_LAST_REF_USED +VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *) +#define VPX_CTRL_VPXD_SET_DECRYPTOR +VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *) +#define VPX_CTRL_VP8D_SET_DECRYPTOR +VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *) +#define VPX_CTRL_VP9D_GET_DISPLAY_SIZE +VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *) +#define VPX_CTRL_VP9D_GET_BIT_DEPTH +VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *) +#define VPX_CTRL_VP9D_GET_FRAME_SIZE VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int) +#define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER +/*!\endcond */ /*! @} - end defgroup vp8_decoder */ #ifdef __cplusplus diff --git a/polymer/eduke32/platform/Windows/include/vpx/vpx_codec.h b/polymer/eduke32/platform/Windows/include/vpx/vpx_codec.h index 03d2dec92..b6037bb4d 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vpx_codec.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vpx_codec.h @@ -69,7 +69,7 @@ extern "C" { /*!\brief Decorator indicating a function is potentially unused */ #ifdef UNUSED -#elif __GNUC__ +#elif defined(__GNUC__) || defined(__clang__) #define UNUSED __attribute__ ((unused)) #else #define UNUSED @@ -83,7 +83,7 @@ extern "C" { * types, removing or reassigning enums, adding/removing/rearranging * fields to structures */ -#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/ +#define VPX_CODEC_ABI_VERSION (3 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/ /*!\brief Algorithm return codes */ typedef enum { @@ -153,7 +153,6 @@ extern "C" { typedef long vpx_codec_caps_t; #define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */ #define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */ -#define VPX_CODEC_CAP_XMA 0x4 /**< Supports eXternal Memory Allocation */ /*! \brief Initialization-time Feature Enabling @@ -164,7 +163,6 @@ extern "C" { * The available flags are specified by VPX_CODEC_USE_* defines. */ typedef long vpx_codec_flags_t; -#define VPX_CODEC_USE_XMA 0x00000001 /**< Use eXternal Memory Allocation mode */ /*!\brief Codec interface structure. @@ -205,13 +203,24 @@ extern "C" { const char *err_detail; /**< Detailed info, if available */ vpx_codec_flags_t init_flags; /**< Flags passed at init time */ union { - struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */ - struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */ - void *raw; + /**< Decoder Configuration Pointer */ + const struct vpx_codec_dec_cfg *dec; + /**< Encoder Configuration Pointer */ + const struct vpx_codec_enc_cfg *enc; + const void *raw; } config; /**< Configuration pointer aliasing union */ vpx_codec_priv_t *priv; /**< Algorithm private storage */ } vpx_codec_ctx_t; + /*!\brief Bit depth for codec + * * + * This enumeration determines the bit depth of the codec. + */ + typedef enum vpx_bit_depth { + VPX_BITS_8 = 8, /**< 8 bits */ + VPX_BITS_10 = 10, /**< 10 bits */ + VPX_BITS_12 = 12, /**< 12 bits */ + } vpx_bit_depth_t; /* * Library Version Number Interface @@ -462,94 +471,6 @@ extern "C" { #endif - - /*!\defgroup cap_xma External Memory Allocation Functions - * - * The following functions are required to be implemented for all codecs - * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions - * for codecs that don't advertise this capability will result in an error - * code being returned, usually VPX_CODEC_INCAPABLE - * @{ - */ - - - /*!\brief Memory Map Entry - * - * This structure is used to contain the properties of a memory segment. It - * is populated by the codec in the request phase, and by the calling - * application once the requested allocation has been performed. - */ - typedef struct vpx_codec_mmap { - /* - * The following members are set by the codec when requesting a segment - */ - unsigned int id; /**< identifier for the segment's contents */ - unsigned long sz; /**< size of the segment, in bytes */ - unsigned int align; /**< required alignment of the segment, in bytes */ - unsigned int flags; /**< bitfield containing segment properties */ -#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */ -#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */ -#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */ - - /* The following members are to be filled in by the allocation function */ - void *base; /**< pointer to the allocated segment */ - void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */ - void *priv; /**< allocator private storage */ - } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */ - - - /*!\brief Iterate over the list of segments to allocate. - * - * Iterates over a list of the segments to allocate. The iterator storage - * should be initialized to NULL to start the iteration. Iteration is complete - * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to - * allocate is dependent upon the size of the encoded stream. In cases where the - * stream is not available at allocation time, a fixed size must be requested. - * The codec will not be able to operate on streams larger than the size used at - * allocation time. - * - * \param[in] ctx Pointer to this instance's context. - * \param[out] mmap Pointer to the memory map entry to populate. - * \param[in,out] iter Iterator storage, initialized to NULL - * - * \retval #VPX_CODEC_OK - * The memory map entry was populated. - * \retval #VPX_CODEC_ERROR - * Codec does not support XMA mode. - * \retval #VPX_CODEC_MEM_ERROR - * Unable to determine segment size from stream info. - */ - vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx, - vpx_codec_mmap_t *mmap, - vpx_codec_iter_t *iter); - - - /*!\brief Identify allocated segments to codec instance - * - * Stores a list of allocated segments in the codec. Segments \ref MUST be - * passed in the order they are read from vpx_codec_get_mem_map(), but may be - * passed in groups of any size. Segments \ref MUST be set only once. The - * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member - * is non-NULL. If the segment requires cleanup handling (e.g., calling free() - * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated. - * - * \param[in] ctx Pointer to this instance's context. - * \param[in] mmaps Pointer to the first memory map entry in the list. - * \param[in] num_maps Number of entries being set at this time - * - * \retval #VPX_CODEC_OK - * The segment was stored in the codec context. - * \retval #VPX_CODEC_INCAPABLE - * Codec does not support XMA mode. - * \retval #VPX_CODEC_MEM_ERROR - * Segment base address was not set, or segment was already stored. - - */ - vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx, - vpx_codec_mmap_t *mmaps, - unsigned int num_maps); - - /*!@} - end defgroup cap_xma*/ /*!@} - end defgroup codec*/ #ifdef __cplusplus } diff --git a/polymer/eduke32/platform/Windows/include/vpx/vpx_decoder.h b/polymer/eduke32/platform/Windows/include/vpx/vpx_decoder.h index 7356baea3..62fd91975 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vpx_decoder.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vpx_decoder.h @@ -30,6 +30,7 @@ extern "C" { #endif #include "./vpx_codec.h" +#include "./vpx_frame_buffer.h" /*!\brief Current ABI version number * @@ -39,7 +40,7 @@ extern "C" { * types, removing or reassigning enums, adding/removing/rearranging * fields to structures */ -#define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/ +#define VPX_DECODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/ /*! \brief Decoder capabilities bitfield * @@ -66,6 +67,8 @@ extern "C" { */ #define VPX_CODEC_CAP_FRAME_THREADING 0x200000 /**< Can support frame-based multi-threading */ +#define VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x400000 /**< Can support external + frame buffers */ #define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */ #define VPX_CODEC_USE_ERROR_CONCEALMENT 0x20000 /**< Conceal errors in decoded @@ -119,10 +122,6 @@ extern "C" { * is not thread safe and should be guarded with a lock if being used * in a multithreaded context. * - * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags - * parameter), the storage pointed to by the cfg parameter must be - * kept readable and stable until all memory maps have been set. - * * \param[in] ctx Pointer to this instance's context. * \param[in] iface Pointer to the algorithm interface to use. * \param[in] cfg Configuration to use, if known. May be NULL. @@ -136,7 +135,7 @@ extern "C" { */ vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx, vpx_codec_iface_t *iface, - vpx_codec_dec_cfg_t *cfg, + const vpx_codec_dec_cfg_t *cfg, vpx_codec_flags_t flags, int ver); @@ -326,6 +325,51 @@ extern "C" { /*!@} - end defgroup cap_put_slice*/ + /*!\defgroup cap_external_frame_buffer External Frame Buffer Functions + * + * The following section is required to be implemented for all decoders + * that advertise the VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER capability. + * Calling this function for codecs that don't advertise this capability + * will result in an error code being returned, usually VPX_CODEC_ERROR. + * + * \note + * Currently this only works with VP9. + * @{ + */ + + /*!\brief Pass in external frame buffers for the decoder to use. + * + * Registers functions to be called when libvpx needs a frame buffer + * to decode the current frame and a function to be called when libvpx does + * not internally reference the frame buffer. This set function must + * be called before the first call to decode or libvpx will assume the + * default behavior of allocating frame buffers internally. + * + * \param[in] ctx Pointer to this instance's context + * \param[in] cb_get Pointer to the get callback function + * \param[in] cb_release Pointer to the release callback function + * \param[in] cb_priv Callback's private data + * + * \retval #VPX_CODEC_OK + * External frame buffers will be used by libvpx. + * \retval #VPX_CODEC_INVALID_PARAM + * One or more of the callbacks were NULL. + * \retval #VPX_CODEC_ERROR + * Decoder context not initialized, or algorithm not capable of + * using external frame buffers. + * + * \note + * When decoding VP9, the application may be required to pass in at least + * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame + * buffers. + */ + vpx_codec_err_t vpx_codec_set_frame_buffer_functions( + vpx_codec_ctx_t *ctx, + vpx_get_frame_buffer_cb_fn_t cb_get, + vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv); + + /*!@} - end defgroup cap_external_frame_buffer */ + /*!@} - end defgroup decoder*/ #ifdef __cplusplus } diff --git a/polymer/eduke32/platform/Windows/include/vpx/vpx_frame_buffer.h b/polymer/eduke32/platform/Windows/include/vpx/vpx_frame_buffer.h new file mode 100644 index 000000000..9036459af --- /dev/null +++ b/polymer/eduke32/platform/Windows/include/vpx/vpx_frame_buffer.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2014 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef VPX_VPX_FRAME_BUFFER_H_ +#define VPX_VPX_FRAME_BUFFER_H_ + +/*!\file + * \brief Describes the decoder external frame buffer interface. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./vpx_integer.h" + +/*!\brief The maximum number of work buffers used by libvpx. + * Support maximum 4 threads to decode video in parallel. + * Each thread will use one work buffer. + * TODO(hkuang): Add support to set number of worker threads dynamically. + */ +#define VPX_MAXIMUM_WORK_BUFFERS 8 + +/*!\brief The maximum number of reference buffers that a VP9 encoder may use. + */ +#define VP9_MAXIMUM_REF_BUFFERS 8 + +/*!\brief External frame buffer + * + * This structure holds allocated frame buffers used by the decoder. + */ +typedef struct vpx_codec_frame_buffer { + uint8_t *data; /**< Pointer to the data buffer */ + size_t size; /**< Size of data in bytes */ + void *priv; /**< Frame's private data */ +} vpx_codec_frame_buffer_t; + +/*!\brief get frame buffer callback prototype + * + * This callback is invoked by the decoder to retrieve data for the frame + * buffer in order for the decode call to complete. The callback must + * allocate at least min_size in bytes and assign it to fb->data. The callback + * must zero out all the data allocated. Then the callback must set fb->size + * to the allocated size. The application does not need to align the allocated + * data. The callback is triggered when the decoder needs a frame buffer to + * decode a compressed image into. This function may be called more than once + * for every call to vpx_codec_decode. The application may set fb->priv to + * some data which will be passed back in the ximage and the release function + * call. |fb| is guaranteed to not be NULL. On success the callback must + * return 0. Any failure the callback must return a value less than 0. + * + * \param[in] priv Callback's private data + * \param[in] new_size Size in bytes needed by the buffer + * \param[in,out] fb Pointer to vpx_codec_frame_buffer_t + */ +typedef int (*vpx_get_frame_buffer_cb_fn_t)( + void *priv, size_t min_size, vpx_codec_frame_buffer_t *fb); + +/*!\brief release frame buffer callback prototype + * + * This callback is invoked by the decoder when the frame buffer is not + * referenced by any other buffers. |fb| is guaranteed to not be NULL. On + * success the callback must return 0. Any failure the callback must return + * a value less than 0. + * + * \param[in] priv Callback's private data + * \param[in] fb Pointer to vpx_codec_frame_buffer_t + */ +typedef int (*vpx_release_frame_buffer_cb_fn_t)( + void *priv, vpx_codec_frame_buffer_t *fb); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // VPX_VPX_FRAME_BUFFER_H_ diff --git a/polymer/eduke32/platform/Windows/include/vpx/vpx_image.h b/polymer/eduke32/platform/Windows/include/vpx/vpx_image.h index d27325cad..7958c6980 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vpx_image.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vpx_image.h @@ -28,13 +28,13 @@ extern "C" { * types, removing or reassigning enums, adding/removing/rearranging * fields to structures */ -#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/ +#define VPX_IMAGE_ABI_VERSION (4) /**<\hideinitializer*/ -#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format */ -#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */ -#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel component */ - +#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format. */ +#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U in memory. */ +#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel. */ +#define VPX_IMG_FMT_HIGHBITDEPTH 0x800 /**< Image uses 16bit framebuffer. */ /*!\brief List of supported image formats */ typedef enum vpx_img_fmt { @@ -58,55 +58,51 @@ extern "C" { VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4, VPX_IMG_FMT_I422 = VPX_IMG_FMT_PLANAR | 5, VPX_IMG_FMT_I444 = VPX_IMG_FMT_PLANAR | 6, - VPX_IMG_FMT_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 7 + VPX_IMG_FMT_I440 = VPX_IMG_FMT_PLANAR | 7, + VPX_IMG_FMT_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 6, + VPX_IMG_FMT_I42016 = VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH, + VPX_IMG_FMT_I42216 = VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH, + VPX_IMG_FMT_I44416 = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH, + VPX_IMG_FMT_I44016 = VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH } vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */ -#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT -#define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR /**< \deprecated Use #VPX_IMG_FMT_PLANAR */ -#define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP /**< \deprecated Use #VPX_IMG_FMT_UV_FLIP */ -#define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA /**< \deprecated Use #VPX_IMG_FMT_HAS_ALPHA */ + /*!\brief List of supported color spaces */ + typedef enum vpx_color_space { + VPX_CS_UNKNOWN = 0, /**< Unknown */ + VPX_CS_BT_601 = 1, /**< BT.601 */ + VPX_CS_BT_709 = 2, /**< BT.709 */ + VPX_CS_SMPTE_170 = 3, /**< SMPTE.170 */ + VPX_CS_SMPTE_240 = 4, /**< SMPTE.240 */ + VPX_CS_BT_2020 = 5, /**< BT.2020 */ + VPX_CS_RESERVED = 6, /**< Reserved */ + VPX_CS_SRGB = 7 /**< sRGB */ + } vpx_color_space_t; /**< alias for enum vpx_color_space */ - /*!\brief Deprecated list of supported image formats - * \deprecated New code should use #vpx_img_fmt - */ -#define img_fmt vpx_img_fmt - /*!\brief alias for enum img_fmt. - * \deprecated New code should use #vpx_img_fmt_t - */ -#define img_fmt_t vpx_img_fmt_t - -#define IMG_FMT_NONE VPX_IMG_FMT_NONE /**< \deprecated Use #VPX_IMG_FMT_NONE */ -#define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24 /**< \deprecated Use #VPX_IMG_FMT_RGB24 */ -#define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32 /**< \deprecated Use #VPX_IMG_FMT_RGB32 */ -#define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565 /**< \deprecated Use #VPX_IMG_FMT_RGB565 */ -#define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555 /**< \deprecated Use #VPX_IMG_FMT_RGB555 */ -#define IMG_FMT_UYVY VPX_IMG_FMT_UYVY /**< \deprecated Use #VPX_IMG_FMT_UYVY */ -#define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2 /**< \deprecated Use #VPX_IMG_FMT_YUY2 */ -#define IMG_FMT_YVYU VPX_IMG_FMT_YVYU /**< \deprecated Use #VPX_IMG_FMT_YVYU */ -#define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24 /**< \deprecated Use #VPX_IMG_FMT_BGR24 */ -#define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE /**< \deprecated Use #VPX_IMG_FMT_RGB32_LE */ -#define IMG_FMT_ARGB VPX_IMG_FMT_ARGB /**< \deprecated Use #VPX_IMG_FMT_ARGB */ -#define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE /**< \deprecated Use #VPX_IMG_FMT_ARGB_LE */ -#define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE /**< \deprecated Use #VPX_IMG_FMT_RGB565_LE */ -#define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE /**< \deprecated Use #VPX_IMG_FMT_RGB555_LE */ -#define IMG_FMT_YV12 VPX_IMG_FMT_YV12 /**< \deprecated Use #VPX_IMG_FMT_YV12 */ -#define IMG_FMT_I420 VPX_IMG_FMT_I420 /**< \deprecated Use #VPX_IMG_FMT_I420 */ -#define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12 /**< \deprecated Use #VPX_IMG_FMT_VPXYV12 */ -#define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420 /**< \deprecated Use #VPX_IMG_FMT_VPXI420 */ -#endif /* VPX_CODEC_DISABLE_COMPAT */ + /*!\brief List of supported color range */ + typedef enum vpx_color_range { + VPX_CR_STUDIO_RANGE = 0, /**< Y [16..235], UV [16..240] */ + VPX_CR_FULL_RANGE = 1 /**< YUV/RGB [0..255] */ + } vpx_color_range_t; /**< alias for enum vpx_color_range */ /**\brief Image Descriptor */ typedef struct vpx_image { vpx_img_fmt_t fmt; /**< Image Format */ + vpx_color_space_t cs; /**< Color Space */ + vpx_color_range_t range; /**< Color Range */ /* Image storage dimensions */ - unsigned int w; /**< Stored image width */ - unsigned int h; /**< Stored image height */ + unsigned int w; /**< Stored image width */ + unsigned int h; /**< Stored image height */ + unsigned int bit_depth; /**< Stored image bit-depth */ /* Image display dimensions */ unsigned int d_w; /**< Displayed image width */ unsigned int d_h; /**< Displayed image height */ + /* Image intended rendering dimensions */ + unsigned int r_w; /**< Intended rendering image width */ + unsigned int r_h; /**< Intended rendering image height */ + /* Chroma subsampling info */ unsigned int x_chroma_shift; /**< subsampling order, X */ unsigned int y_chroma_shift; /**< subsampling order, Y */ @@ -117,13 +113,6 @@ extern "C" { #define VPX_PLANE_U 1 /**< U (Chroma) plane */ #define VPX_PLANE_V 2 /**< V (Chroma) plane */ #define VPX_PLANE_ALPHA 3 /**< A (Transparency) plane */ -#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT -#define PLANE_PACKED VPX_PLANE_PACKED -#define PLANE_Y VPX_PLANE_Y -#define PLANE_U VPX_PLANE_U -#define PLANE_V VPX_PLANE_V -#define PLANE_ALPHA VPX_PLANE_ALPHA -#endif unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */ int stride[4]; /**< stride between rows for each plane */ @@ -139,6 +128,8 @@ extern "C" { unsigned char *img_data; /**< private */ int img_data_owner; /**< private */ int self_allocd; /**< private */ + + void *fb_priv; /**< Frame buffer data associated with the image. */ } vpx_image_t; /**< alias for struct vpx_image */ /**\brief Representation of a rectangle on a surface */ diff --git a/polymer/eduke32/platform/Windows/include/vpx/vpx_integer.h b/polymer/eduke32/platform/Windows/include/vpx/vpx_integer.h index dfa361ba3..829c9d132 100644 --- a/polymer/eduke32/platform/Windows/include/vpx/vpx_integer.h +++ b/polymer/eduke32/platform/Windows/include/vpx/vpx_integer.h @@ -15,6 +15,15 @@ /* get ptrdiff_t, size_t, wchar_t, NULL */ #include +#if defined(_MSC_VER) +#define VPX_FORCE_INLINE __forceinline +#define VPX_INLINE __inline +#else +#define VPX_FORCE_INLINE __inline__ __attribute__(always_inline) +// TODO(jbb): Allow a way to force inline off for older compilers. +#define VPX_INLINE inline +#endif + #if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES) typedef signed char int8_t; typedef signed short int16_t; @@ -28,6 +37,8 @@ typedef unsigned int uint32_t; typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; #define INT64_MAX _I64_MAX +#define INT32_MAX _I32_MAX +#define INT32_MIN _I32_MIN #define INT16_MAX _I16_MAX #define INT16_MIN _I16_MIN #endif @@ -40,15 +51,21 @@ typedef size_t uintptr_t; /* Most platforms have the C99 standard integer types. */ -#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif +#if defined(__cplusplus) +# if !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +# if !defined(__STDC_LIMIT_MACROS) +# define __STDC_LIMIT_MACROS +# endif +#endif // __cplusplus + #include #endif /* VS2010 defines stdint.h, but not inttypes.h */ -#if defined(_MSC_VER) +#if defined(_MSC_VER) && _MSC_VER < 1800 #define PRId64 "I64d" #else #include diff --git a/polymer/eduke32/platform/Windows/lib/32/libvpx.a b/polymer/eduke32/platform/Windows/lib/32/libvpx.a index 27f8aa32e..1a9753e32 100644 Binary files a/polymer/eduke32/platform/Windows/lib/32/libvpx.a and b/polymer/eduke32/platform/Windows/lib/32/libvpx.a differ diff --git a/polymer/eduke32/platform/Windows/lib/64/libvpx.a b/polymer/eduke32/platform/Windows/lib/64/libvpx.a index 11ec3be2c..3b552c027 100644 Binary files a/polymer/eduke32/platform/Windows/lib/64/libvpx.a and b/polymer/eduke32/platform/Windows/lib/64/libvpx.a differ diff --git a/polymer/eduke32/platform/Windows/lib/instructions.txt b/polymer/eduke32/platform/Windows/lib/instructions.txt index da7337bf3..8c4b4a295 100644 --- a/polymer/eduke32/platform/Windows/lib/instructions.txt +++ b/polymer/eduke32/platform/Windows/lib/instructions.txt @@ -113,15 +113,13 @@ Download the binary of yasm (http://yasm.tortall.net/) for your host system arch The build environment needs pr.exe (https://mingw-lib.googlecode.com/files/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2). ### Download ### * Instructions: http://www.webmproject.org/code/ + * Stable: http://downloads.webmproject.org/releases/webm/ * Git: https://chromium.googlesource.com/webm/libvpx -### Modifications ### -If the configure scripts do not recognize your 64-bit compiler, you may need to run the following: - git apply "libvpx with MinGW-w64.patch" ### Build ### - sh ./configure --disable-vp8-encoder --disable-vp9-encoder --disable-multithread --disable-spatial-resampling --as=yasm && make + sh ./configure --disable-vp8-encoder --disable-vp9-encoder --disable-multithread --disable-spatial-resampling --as=yasm && make libvpx.a ### Desired Results ### - * headers: vpx/vp8.h vpx/vp8dx.h vpx/vpx_codec.h vpx/vpx_codec_impl_bottom.h vpx/vpx_codec_impl_top.h vpx/vpx_decoder.h vpx/vpx_decoder_compat.h vpx/vpx_image.h vpx/vpx_integer.h - * libraries: libvpx.a libvpx_g.a + * headers: vpx/vp8.h vpx/vp8dx.h vpx/vpx_codec.h vpx/vpx_decoder.h vpx/vpx_frame_buffer.h vpx/vpx_image.h vpx/vpx_integer.h + * libraries: libvpx.a SDL diff --git a/polymer/eduke32/platform/Windows/lib/libvpx with MinGW-w64.patch b/polymer/eduke32/platform/Windows/lib/libvpx with MinGW-w64.patch deleted file mode 100644 index 8cd025947..000000000 --- a/polymer/eduke32/platform/Windows/lib/libvpx with MinGW-w64.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/build/make/configure.sh b/build/make/configure.sh -index b5151da..a739468 100755 ---- a/build/make/configure.sh -+++ b/build/make/configure.sh -@@ -661,9 +661,14 @@ process_common_toolchain() { - x86_64*mingw32*) - tgt_os=win64 - ;; -- *mingw32*|*cygwin*) -+ *mingw32*|*cygwin*|*win32-gcc*) - [ -z "$tgt_isa" ] && tgt_isa=x86 - tgt_os=win32 -+ [ "$tgt_isa" == "x86_64" ] && tgt_os=win64 -+ ;; -+ *win64-gcc*) -+ [ -z "$tgt_isa" ] && tgt_isa=x86_64 -+ tgt_os=win64 - ;; - *linux*|*bsd*) - tgt_os=linux -diff --git a/configure b/configure -index 9f5a435..93f3d30 100755 ---- a/configure -+++ b/configure -@@ -137,6 +137,7 @@ all_platforms="${all_platforms} x86_64-darwin13-gcc" - all_platforms="${all_platforms} x86_64-linux-gcc" - all_platforms="${all_platforms} x86_64-linux-icc" - all_platforms="${all_platforms} x86_64-solaris-gcc" -+all_platforms="${all_platforms} x86_64-win32-gcc" - all_platforms="${all_platforms} x86_64-win64-gcc" - all_platforms="${all_platforms} x86_64-win64-vs8" - all_platforms="${all_platforms} x86_64-win64-vs9"