Merge "Removing legacy XMA features from libvpx."
This commit is contained in:
Коммит
9a4cd41793
|
@ -1342,8 +1342,6 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) =
|
|||
vp8e_init, /* vpx_codec_init_fn_t init; */
|
||||
vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
|
||||
vp8e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
|
||||
NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
|
||||
NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
|
||||
{
|
||||
NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */
|
||||
NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */
|
||||
|
|
|
@ -803,8 +803,6 @@ CODEC_INTERFACE(vpx_codec_vp8_dx) =
|
|||
vp8_init, /* vpx_codec_init_fn_t init; */
|
||||
vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */
|
||||
vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
|
||||
NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
|
||||
NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
|
||||
{
|
||||
vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */
|
||||
vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */
|
||||
|
|
|
@ -1348,8 +1348,6 @@ CODEC_INTERFACE(vpx_codec_vp9_cx) = {
|
|||
encoder_init, // vpx_codec_init_fn_t
|
||||
encoder_destroy, // vpx_codec_destroy_fn_t
|
||||
encoder_ctrl_maps, // vpx_codec_ctrl_fn_map_t
|
||||
NOT_IMPLEMENTED, // vpx_codec_get_mmap_fn_t
|
||||
NOT_IMPLEMENTED, // vpx_codec_set_mmap_fn_t
|
||||
{ // NOLINT
|
||||
NOT_IMPLEMENTED, // vpx_codec_peek_si_fn_t
|
||||
NOT_IMPLEMENTED, // vpx_codec_get_si_fn_t
|
||||
|
|
|
@ -715,8 +715,6 @@ CODEC_INTERFACE(vpx_codec_vp9_dx) = {
|
|||
decoder_init, // vpx_codec_init_fn_t
|
||||
decoder_destroy, // vpx_codec_destroy_fn_t
|
||||
decoder_ctrl_maps, // vpx_codec_ctrl_fn_map_t
|
||||
NOT_IMPLEMENTED, // vpx_codec_get_mmap_fn_t
|
||||
NOT_IMPLEMENTED, // vpx_codec_set_mmap_fn_t
|
||||
{ // NOLINT
|
||||
decoder_peek_si, // vpx_codec_peek_si_fn_t
|
||||
decoder_get_si, // vpx_codec_get_si_fn_t
|
||||
|
|
|
@ -248,37 +248,6 @@ typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
|
|||
vpx_get_frame_buffer_cb_fn_t cb_get,
|
||||
vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
|
||||
|
||||
/*\brief eXternal Memory Allocation memory map get iterator
|
||||
*
|
||||
* Iterates over a list of the memory maps requested by the decoder. The
|
||||
* iterator storage should be initialized to NULL to start the iteration.
|
||||
* Iteration is complete when this function returns NULL.
|
||||
*
|
||||
* \param[in out] iter Iterator storage, initialized to NULL
|
||||
*
|
||||
* \return Returns a pointer to an memory segment descriptor, or NULL to
|
||||
* indicate end-of-list.
|
||||
*/
|
||||
typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
|
||||
vpx_codec_mmap_t *mmap,
|
||||
vpx_codec_iter_t *iter);
|
||||
|
||||
|
||||
/*\brief eXternal Memory Allocation memory map set iterator
|
||||
*
|
||||
* Sets a memory descriptor inside the decoder instance.
|
||||
*
|
||||
* \param[in] ctx Pointer to this instance's context
|
||||
* \param[in] mmap Memory map to store.
|
||||
*
|
||||
* \retval #VPX_CODEC_OK
|
||||
* The memory map was accepted and stored.
|
||||
* \retval #VPX_CODEC_MEM_ERROR
|
||||
* The memory map was rejected.
|
||||
*/
|
||||
typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
|
||||
const vpx_codec_mmap_t *mmap);
|
||||
|
||||
|
||||
typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
|
||||
const vpx_image_t *img,
|
||||
|
@ -330,8 +299,6 @@ struct vpx_codec_iface {
|
|||
vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
|
||||
vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
|
||||
vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
|
||||
vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
|
||||
vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
|
||||
struct vpx_codec_dec_iface {
|
||||
vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
|
||||
vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_get_si_fn_t */
|
||||
|
@ -487,31 +454,6 @@ static void vpx_internal_error(struct vpx_internal_error_info *info,
|
|||
longjmp(info->jmp, info->error_code);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// mmap interface
|
||||
|
||||
typedef struct {
|
||||
unsigned int id;
|
||||
unsigned long sz;
|
||||
unsigned int align;
|
||||
unsigned int flags;
|
||||
unsigned long (*calc_sz)(const vpx_codec_dec_cfg_t *, vpx_codec_flags_t);
|
||||
} mem_req_t;
|
||||
|
||||
// Allocates mmap.priv and sets mmap.base based on mmap.sz/align/flags
|
||||
// requirements.
|
||||
// Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
|
||||
vpx_codec_err_t vpx_mmap_alloc(vpx_codec_mmap_t *mmap);
|
||||
|
||||
// Frees mmap.base allocated by a call to vpx_mmap_alloc().
|
||||
void vpx_mmap_dtor(vpx_codec_mmap_t *mmap);
|
||||
|
||||
// Checks each mmap has the size requirement specificied by mem_reqs.
|
||||
// Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
|
||||
vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
|
||||
const vpx_codec_mmap_t *mmaps,
|
||||
const mem_req_t *mem_reqs, int nreqs,
|
||||
vpx_codec_flags_t init_flags);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
@ -134,51 +134,3 @@ vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
|
|||
|
||||
return SAVE_STATUS(ctx, res);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// mmap interface
|
||||
|
||||
vpx_codec_err_t vpx_mmap_alloc(vpx_codec_mmap_t *mmap) {
|
||||
unsigned int align = mmap->align ? mmap->align - 1 : 0;
|
||||
|
||||
if (mmap->flags & VPX_CODEC_MEM_ZERO)
|
||||
mmap->priv = calloc(1, mmap->sz + align);
|
||||
else
|
||||
mmap->priv = malloc(mmap->sz + align);
|
||||
|
||||
if (mmap->priv == NULL) return VPX_CODEC_MEM_ERROR;
|
||||
mmap->base = (void *)((((uintptr_t)mmap->priv) + align) & ~(uintptr_t)align);
|
||||
mmap->dtor = vpx_mmap_dtor;
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
||||
void vpx_mmap_dtor(vpx_codec_mmap_t *mmap) {
|
||||
free(mmap->priv);
|
||||
}
|
||||
|
||||
vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
|
||||
const vpx_codec_mmap_t *mmaps,
|
||||
const mem_req_t *mem_reqs, int nreqs,
|
||||
vpx_codec_flags_t init_flags) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nreqs - 1; ++i) {
|
||||
/* Ensure the segment has been allocated */
|
||||
if (mmaps[i].base == NULL) {
|
||||
return VPX_CODEC_MEM_ERROR;
|
||||
}
|
||||
|
||||
/* Verify variable size segment is big enough for the current si. */
|
||||
if (mem_reqs[i].calc_sz != NULL) {
|
||||
vpx_codec_dec_cfg_t cfg;
|
||||
|
||||
cfg.w = si->w;
|
||||
cfg.h = si->h;
|
||||
|
||||
if (mmaps[i].sz < mem_reqs[i].calc_sz(&cfg, init_flags)) {
|
||||
return VPX_CODEC_MEM_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
}
|
||||
|
|
|
@ -183,50 +183,6 @@ vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx
|
|||
return SAVE_STATUS(ctx, res);
|
||||
}
|
||||
|
||||
|
||||
vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
|
||||
vpx_codec_mmap_t *mmap,
|
||||
vpx_codec_iter_t *iter) {
|
||||
vpx_codec_err_t res = VPX_CODEC_OK;
|
||||
|
||||
if (!ctx || !mmap || !iter || !ctx->iface)
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
|
||||
res = VPX_CODEC_ERROR;
|
||||
else
|
||||
res = ctx->iface->get_mmap(ctx, mmap, iter);
|
||||
|
||||
return SAVE_STATUS(ctx, res);
|
||||
}
|
||||
|
||||
|
||||
vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
|
||||
vpx_codec_mmap_t *mmap,
|
||||
unsigned int num_maps) {
|
||||
vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
|
||||
|
||||
if (!ctx || !mmap || !ctx->iface)
|
||||
res = VPX_CODEC_INVALID_PARAM;
|
||||
else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
|
||||
res = VPX_CODEC_ERROR;
|
||||
else {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < num_maps; i++, mmap++) {
|
||||
if (!mmap->base)
|
||||
break;
|
||||
|
||||
/* Everything look ok, set the mmap in the decoder */
|
||||
res = ctx->iface->set_mmap(ctx, mmap);
|
||||
|
||||
if (res)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return SAVE_STATUS(ctx, res);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -471,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
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче