remove deprecated pre-v0.9.0 API

Remove a bunch of compatibility code dating back to before the initial
libvpx release.

Change-Id: Ie50b81e7d665955bec3d692cd6521c9583e85ca3
This commit is contained in:
John Koleszar 2012-05-02 16:37:37 -07:00
parent f039a85fd8
commit 2bf8fb5889
11 changed files with 4 additions and 1209 deletions

View File

@ -21,9 +21,6 @@ CODEC_DOX := mainpage.dox \
usage_dx.dox \
# Other doxy files sourced in Markdown
TXT_DOX-$(CONFIG_VP8) += vp8_api1_migration.dox
vp8_api1_migration.dox.DESC = VP8 API 1.x Migration
TXT_DOX = $(call enabled,TXT_DOX)
%.dox: %.txt

View File

@ -35,9 +35,9 @@ ifeq ($(CONFIG_VP8_ENCODER),yes)
include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h
CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h
CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8cx_arm.mk
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
CODEC_DOC_SECTIONS += vp8 vp8_encoder
@ -115,7 +115,6 @@ INSTALL-LIBS-yes += include/vpx/vpx_integer.h
INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
ifeq ($(CONFIG_MSVS),yes)

View File

@ -13,17 +13,12 @@
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx_version.h"
#include "vp8/encoder/onyx_int.h"
#include "vpx/vp8e.h"
#include "vpx/vp8cx.h"
#include "vp8/encoder/firstpass.h"
#include "vp8/common/onyx.h"
#include <stdlib.h>
#include <string.h>
/* This value is a sentinel for determining whether the user has set a mode
* directly through the deprecated VP8E_SET_ENCODING_MODE control.
*/
#define NO_MODE_SET 255
struct vp8_extracfg
{
struct vpx_codec_pkt_list *pkt_list;
@ -94,7 +89,6 @@ struct vpx_codec_alg_priv
unsigned int next_frame_flag;
vp8_postproc_cfg_t preview_ppcfg;
vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
int deprecated_mode;
unsigned int fixed_kf_cntr;
};
@ -516,7 +510,6 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
switch (ctrl_id)
{
MAP(VP8E_SET_ENCODING_MODE, ctx->deprecated_mode);
MAP(VP8E_SET_CPUUSED, xcfg.cpu_used);
MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref);
MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity);
@ -571,7 +564,7 @@ static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
{
vpx_codec_err_t res = VPX_DEC_OK;
vpx_codec_err_t res = VPX_CODEC_OK;
struct vpx_codec_alg_priv *priv;
vpx_codec_enc_cfg_t *cfg;
unsigned int i;
@ -626,8 +619,6 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
return VPX_CODEC_MEM_ERROR;
}
priv->deprecated_mode = NO_MODE_SET;
res = validate_config(priv, &priv->cfg, &priv->vp8_cfg, 0);
if (!res)
@ -718,19 +709,6 @@ static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
new_qc = MODE_REALTIME;
#endif
switch (ctx->deprecated_mode)
{
case VP8_BEST_QUALITY_ENCODING:
new_qc = MODE_BESTQUALITY;
break;
case VP8_GOOD_QUALITY_ENCODING:
new_qc = MODE_GOODQUALITY;
break;
case VP8_REAL_TIME_ENCODING:
new_qc = MODE_REALTIME;
break;
}
if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
new_qc = MODE_FIRSTPASS;
else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
@ -1207,7 +1185,6 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] =
{VP8E_SET_ROI_MAP, vp8e_set_roi_map},
{VP8E_SET_ACTIVEMAP, vp8e_set_activemap},
{VP8E_SET_SCALEMODE, vp8e_set_scalemode},
{VP8E_SET_ENCODING_MODE, set_param},
{VP8E_SET_CPUUSED, set_param},
{VP8E_SET_NOISE_SENSITIVITY, set_param},
{VP8E_SET_ENABLEAUTOALTREF, set_param},
@ -1318,88 +1295,3 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) =
vp8e_mr_alloc_mem,
} /* encoder functions */
};
/*
* BEGIN BACKWARDS COMPATIBILITY SHIM.
*/
#define FORCE_KEY 2
static vpx_codec_err_t api1_control(vpx_codec_alg_priv_t *ctx,
int ctrl_id,
va_list args)
{
vpx_codec_ctrl_fn_map_t *entry;
switch (ctrl_id)
{
case VP8E_SET_FLUSHFLAG:
/* VP8 sample code did VP8E_SET_FLUSHFLAG followed by
* vpx_codec_get_cx_data() rather than vpx_codec_encode().
*/
return vp8e_encode(ctx, NULL, 0, 0, 0, 0);
case VP8E_SET_FRAMETYPE:
ctx->base.enc.tbd |= FORCE_KEY;
return VPX_CODEC_OK;
}
for (entry = vp8e_ctf_maps; entry && entry->fn; entry++)
{
if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
{
return entry->fn(ctx, ctrl_id, args);
}
}
return VPX_CODEC_ERROR;
}
static vpx_codec_ctrl_fn_map_t api1_ctrl_maps[] =
{
{0, api1_control},
{ -1, NULL}
};
static vpx_codec_err_t api1_encode(vpx_codec_alg_priv_t *ctx,
const vpx_image_t *img,
vpx_codec_pts_t pts,
unsigned long duration,
vpx_enc_frame_flags_t flags,
unsigned long deadline)
{
int force = ctx->base.enc.tbd;
ctx->base.enc.tbd = 0;
return vp8e_encode
(ctx,
img,
pts,
duration,
flags | ((force & FORCE_KEY) ? VPX_EFLAG_FORCE_KF : 0),
deadline);
}
vpx_codec_iface_t vpx_enc_vp8_algo =
{
"WebM Project VP8 Encoder (Deprecated API)" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_ENCODER,
/* vpx_codec_caps_t caps; */
vp8e_init, /* vpx_codec_init_fn_t init; */
vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
api1_ctrl_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}, /* decoder functions */
{
vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
api1_encode, /* vpx_codec_encode_fn_t encode; */
vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
vp8e_set_config,
NOT_IMPLEMENTED,
vp8e_get_preview,
vp8e_mr_alloc_mem,
} /* encoder functions */
};

View File

@ -785,33 +785,3 @@ CODEC_INTERFACE(vpx_codec_vp8_dx) =
NOT_IMPLEMENTED
}
};
/*
* BEGIN BACKWARDS COMPATIBILITY SHIM.
*/
vpx_codec_iface_t vpx_codec_vp8_algo =
{
"WebM Project VP8 Decoder (Deprecated API)" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC | VP8_CAP_ERROR_CONCEALMENT,
/* vpx_codec_caps_t caps; */
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; */
vp8_xma_get_mmap, /* vpx_codec_get_mmap_fn_t get_mmap; */
vp8_xma_set_mmap, /* 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; */
vp8_decode, /* vpx_codec_decode_fn_t decode; */
vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
},
{ /* encoder functions */
NOT_IMPLEMENTED,
NOT_IMPLEMENTED,
NOT_IMPLEMENTED,
NOT_IMPLEMENTED,
NOT_IMPLEMENTED,
NOT_IMPLEMENTED
}
};

View File

@ -1,198 +0,0 @@
Version 2.x of this library has deprecated or removed a number of interfaces to
the VP8 codec. Where possible, the old interfaces have been left in place in a
deprecated state, and will generate compiler warnings when they are referenced.
All users are encouraged to update their code to the new interfaces as soon as
possible. To assist in this effort, the `VPX_CODEC_DISABLE_COMPAT` symbol can
be #defined to 1 prior to including vpx headers. This will disable the
backwards compatability workarounds and ensure that you are using only the
latest API.
The *TWO-PASS STATISTICS* sections detail the one section of code which is not
backwards compatable and will require code changes.
HEADER FILES
============
The following header files were renamed:
vp8.h -> vp8dx.h
vp8e.h -> vp8cx.h
INTERFACE SYMBOLS
=================
The following interface symbols were renamed:
vpx_codec_vp8_algo -> vpx_codec_vp8_dx_algo
vpx_enc_vp8_algo -> vpx_codec_vp8_cx_algo
TWO-PASS STATISTICS
===================
Two-pass statistics are handled significantly differently. The version 1 API
stored statistics in a file, and the application passed the name of that file
in the `vpx_codec_enc_cfg` structure. In this version, statistics are returned
though the application though the `vpx_codec_get_cx_data()` interface. The
application must concatenate these packets into a contiguous buffer and then
pass that buffer to the encoder through the `vpx_codec_enc_cfg` structure on
the second pass initialization. The application may choose to keep these packets
in memory or write them to disk. Statistics packets are approximately 112 bytes
per frame. See the example code for more detailed examples.
ENCODER CONTROLS
================
Renames
-------
The following controls are duplicated between the encoder and the decoder, but
the encoder unnecessarily introduced unique identifiers for them. These
identifiers were removed in favor of the ones used by the decoder:
VP8E_SET_REFERENCE -> VP8_SET_REFERENCE
VP8E_COPY_REFERENCE -> VP8_COPY_REFERENCE
VP8E_SET_PREVIEWPP -> VP8_SET_POSTPROC
VP8E_SET_FRAMETYPE
------------------
This control was removed in favor of the `flags` parameter to
`vpx_codec_encode()`. Existing code such as:
~~~
vpx_codec_control(&encoder, VP8E_SET_FRAMETYPE, KEY_FRAME);
...
vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
~~~
becomes:
~~~
vpx_codec_encode(&encoder, img, pts, 1, VPX_EFLAG_FORCE_KF,
VPX_DL_REALTIME);
~~~
VP8E_SET_FLUSHFLAG
------------------
Flush is handled by passing `NULL` to the `img` parameter of
`vpx_codec_encode()`. You must do this at least once, regardless of your encoder
configuration. i.e. it's not specific to g_lag_in_frames. This control was
removed.
~~~
while(...) {
...
vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
...
}
}
vpx_codec_control(&encoder, VP8E_SET_FLUSHFLAG, 1);
while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
...
}
vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
~~~
becomes
~~~
while(new_image && ...) {
...
vpx_codec_encode(&encoder, new_image?img:NULL, pts, 1, 0, 0);
while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
...
}
}
~~~
VP8E_SET_ENCODING_MODE
----------------------
This control was removed in favor of the `deadline` parameter to
`vpx_codec_encode()`. There are three macros that can be used to get the
equivalent behavior: VPX_DL_REALTIME, VPX_DL_GOOD_QUALITY,
VPX_DL_BEST_QUALITY. Existing code such as:
~~~
vpx_codec_control(&encoder, VP8E_SET_ENCODING_MODE, VP8_REAL_TIME_ENCODING);
...
vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
~~~
becomes:
~~~
vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
~~~
VP8E_UPD_ENTROPY
------------------
This control was deprecated in favor of the `flags` parameter to
`vpx_codec_encode()`. Existing code such as:
~~~
vpx_codec_control(&encoder, VP8E_UPD_ENTROPY, 0);
~~~
becomes:
~~~
vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_UPD_ENTROPY,
VPX_DL_REALTIME);
~~~
VP8E_UPD_REFERENCE
------------------
This control was deprecated in favor of the `flags` parameter to
`vpx_codec_encode()`. A set bit on the VP8E_UPD_REFERENCE bitfield is
analogous to setting the VP8_EFLAG_FORCE_* flag. A cleared bit is analogous
to setting the VP8_EFLAG_NO_UPD_* flag. If neither the FORCE or NO_UPD bit
is set, the encoder will make its decision automatically, as usual. Setting
both bits will result in an error being returned. Existing code such as:
~~~
vpx_codec_control(&encoder, VP8E_UPD_REFERENCE,
VP8_LAST_FRAME | VP8_GOLD_FRAME);
vpx_codec_control(&encoder, VP8E_UPD_REFERENCE, 0);
...
vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
~~~
becomes:
~~~
vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_FORCE_GF,
VPX_DL_REALTIME);
vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_UPD_LAST
| VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF,
VPX_DL_REALTIME);
~~~
VP8E_USE_REFERENCE
------------------
This control was deprecated in favor of the `flags` parameter to
`vpx_codec_encode()`. A cleared bit on the VP8E_USE_REFERENCE bitfield is
analogous to setting the VP8_EFLAG_NO_REF* flag. A set bit indicates that
the encoder will make its decision automatically, as usual.
Existing code such as:
~~~
vpx_codec_control(&encoder, VP8E_USE_REFERENCE,
VP8_ALTR_FRAME | VP8_GOLD_FRAME);
...
vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
~~~
becomes
~~~
vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_REF_LAST,
VPX_DL_REALTIME);
~~~

View File

@ -1,201 +0,0 @@
/*
* Copyright (c) 2010 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.
*/
/*!\file
* \brief Provides the high level interface to wrap decoder algorithms.
*
*/
#include <stdlib.h>
#include <string.h>
#include "vpx/vpx_decoder.h"
#include "vpx/internal/vpx_codec_internal.h"
#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
{
return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
}
const char *vpx_dec_err_to_string(vpx_dec_err_t err)
{
return vpx_codec_err_to_string(err);
}
const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
{
return vpx_codec_error((vpx_codec_ctx_t *)ctx);
}
const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
{
return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
}
vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
vpx_dec_iface_t *iface,
int ver)
{
return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
(vpx_codec_iface_t *)iface,
NULL,
0,
ver);
}
vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
{
return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
}
vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
{
return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
}
vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
const uint8_t *data,
unsigned int data_sz,
vpx_dec_stream_info_t *si)
{
return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
(vpx_codec_stream_info_t *)si);
}
vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
vpx_dec_stream_info_t *si)
{
return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
(vpx_codec_stream_info_t *)si);
}
vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
int ctrl_id,
void *data)
{
return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
}
vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
uint8_t *data,
unsigned int data_sz,
void *user_priv,
int rel_pts)
{
(void)rel_pts;
return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
0);
}
vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
vpx_dec_iter_t *iter)
{
return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
}
vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
vpx_dec_put_frame_cb_fn_t cb,
void *user_priv)
{
return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
user_priv);
}
vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
vpx_dec_put_slice_cb_fn_t cb,
void *user_priv)
{
return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
user_priv);
}
vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
vpx_dec_iface_t *iface,
int ver)
{
return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
(vpx_codec_iface_t *)iface,
NULL,
VPX_CODEC_USE_XMA,
ver);
}
vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
vpx_dec_mmap_t *mmap,
const vpx_dec_stream_info_t *si,
vpx_dec_iter_t *iter)
{
vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
vpx_dec_err_t res = VPX_DEC_OK;
if (!ctx || !mmap || !si || !iter || !ctx->iface)
res = VPX_DEC_INVALID_PARAM;
else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
res = VPX_DEC_ERROR;
else
{
if (!ctx->config.dec)
{
ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
ctx->config.dec->w = si->w;
ctx->config.dec->h = si->h;
}
res = ctx->iface->get_mmap(ctx, mmap, iter);
}
return SAVE_STATUS(ctx, res);
}
vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
vpx_dec_mmap_t *mmap,
unsigned int num_maps)
{
vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
if (!ctx || !mmap || !ctx->iface)
res = VPX_DEC_INVALID_PARAM;
else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
res = VPX_DEC_ERROR;
else
{
void *save = (ctx->priv) ? NULL : ctx->config.dec;
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;
}
if (save) free(save);
}
return SAVE_STATUS(ctx, res);
}

View File

@ -119,13 +119,5 @@ VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int)
/*! @} - end defgroup vp8 */
#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
/* The following definitions are provided for backward compatibility with
* the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
*/
DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
#endif
#include "vpx_codec_impl_bottom.h"
#endif

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2010 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.
*/
/* This file contains backwards compatibility stubs for applications using
* the VP8 version 1.0 API.
*/
#ifndef VP8E_H
#define VP8E_H
#include "vpx_codec_impl_top.h"
#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
#error "Backwards compatibility disabled: don't include vp8e.h"
#endif
#include "vp8cx.h"
DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
enum
{
VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
VP8E_SET_FLUSHFLAG = 4,
VP8E_SET_FRAMETYPE = 10,
VP8E_SET_ENCODING_MODE = 12
};
#define NORMAL_FRAME (0)
#define KEY_FRAME (1)
/* Change VP8E to VP8 to get the undeprecated version of these (defined in
* vp8.h)
*/
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
/* Flush is done by calling vpx_codec_encode with a NULL input image. */
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
*/
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
/* This control has been deprecated in favor of the duration parameter to
* vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
* #VPX_DL_BEST_QUALITY constants to that parameter instead.
*/
VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
#include "vpx_codec_impl_bottom.h"
#endif

View File

@ -12,9 +12,7 @@
API_EXPORTS += exports
API_SRCS-yes += src/vpx_decoder.c
API_SRCS-yes += src/vpx_decoder_compat.c
API_SRCS-yes += vpx_decoder.h
API_SRCS-yes += vpx_decoder_compat.h
API_SRCS-yes += src/vpx_encoder.c
API_SRCS-yes += vpx_encoder.h
API_SRCS-yes += internal/vpx_codec_internal.h

View File

@ -327,7 +327,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
#include "vpx_decoder_compat.h"
#endif

View File

@ -1,587 +0,0 @@
/*
* Copyright (c) 2010 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.
*/
/*!\defgroup decoder Common Decoder Algorithm Interface
* This abstraction allows applications using this decoder to easily support
* multiple video formats with minimal code duplication. This section describes
* the interface common to all codecs.
* @{
*/
/*!\file
* \brief Provides a compatibility layer between version 1 and 2 of this API.
*
* This interface has been deprecated. Only existing code should make use
* of this interface, and therefore, it is only thinly documented. Existing
* code should be ported to the vpx_codec_* API.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef VPX_DECODER_COMPAT_H
#define VPX_DECODER_COMPAT_H
/*!\brief Decoder algorithm return codes */
typedef enum {
/*!\brief Operation completed without error */
VPX_DEC_OK = VPX_CODEC_OK,
/*!\brief Unspecified error */
VPX_DEC_ERROR = VPX_CODEC_ERROR,
/*!\brief Memory operation failed */
VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
/*!\brief ABI version mismatch */
VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
/*!\brief The given bitstream is not supported.
*
* The bitstream was unable to be parsed at the highest level. The decoder
* is unable to proceed. This error \ref SHOULD be treated as fatal to the
* stream. */
VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
/*!\brief Encoded bitstream uses an unsupported feature
*
* The decoder does not implement a feature required by the encoder. This
* return code should only be used for features that prevent future
* pictures from being properly decoded. This error \ref MAY be treated as
* fatal to the stream or \ref MAY be treated as fatal to the current GOP.
*/
VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
/*!\brief The coded data for this stream is corrupt or incomplete
*
* There was a problem decoding the current frame. This return code
* should only be used for failures that prevent future pictures from
* being properly decoded. This error \ref MAY be treated as fatal to the
* stream or \ref MAY be treated as fatal to the current GOP. If decoding
* is continued for the current GOP, artifacts may be present.
*/
VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
/*!\brief An application-supplied parameter is not valid.
*
*/
VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
/*!\brief An iterator reached the end of list.
*
*/
VPX_DEC_LIST_END = VPX_CODEC_LIST_END
}
vpx_dec_err_t;
/*! \brief Decoder capabilities bitfield
*
* Each decoder advertises the capabilities it supports as part of its
* ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
* or functionality, and are not required to be supported by a decoder.
*
* The available flags are specified by VPX_DEC_CAP_* defines.
*/
typedef int vpx_dec_caps_t;
#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
#define VPX_DEC_CAP_XMA 0x0004 /**< Supports eXternal Memory Allocation */
/*!\brief Stream properties
*
* This structure is used to query or set properties of the decoded
* stream. Algorithms may extend this structure with data specific
* to their bitstream by setting the sz member appropriately.
*/
#if 1
typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
#else
typedef struct
{
unsigned int sz; /**< Size of this structure */
unsigned int w; /**< Width (or 0 for unknown/default) */
unsigned int h; /**< Height (or 0 for unknown/default) */
unsigned int is_kf; /**< Current frame is a keyframe */
} vpx_dec_stream_info_t;
#endif
/*!\brief Decoder interface structure.
*
* Contains function pointers and other data private to the decoder
* implementation. This structure is opaque to the application.
*/
typedef const struct vpx_codec_iface vpx_dec_iface_t;
typedef struct vpx_codec_priv vpx_dec_priv_t;
/*!\brief Iterator
*
* Opaque storage used for iterating over lists.
*/
typedef vpx_codec_iter_t vpx_dec_iter_t;
/*!\brief Decoder context structure
*
* All decoders \ref MUST support this context structure fully. In general,
* this data should be considered private to the decoder algorithm, and
* not be manipulated or examined by the calling application. Applications
* may reference the 'name' member to get a printable description of the
* algorithm.
*/
#if 1
typedef vpx_codec_ctx_t vpx_dec_ctx_t;
#else
typedef struct
{
const char *name; /**< Printable interface name */
vpx_dec_iface_t *iface; /**< Interface pointers */
vpx_dec_err_t err; /**< Last returned error */
vpx_dec_priv_t *priv; /**< Algorithm private storage */
} vpx_dec_ctx_t;
#endif
/*!\brief Return the build configuration
*
* Returns a printable string containing an encoded version of the build
* configuration. This may be useful to vpx support.
*
*/
const char *vpx_dec_build_config(void) DEPRECATED;
/*!\brief Return the name for a given interface
*
* Returns a human readable string for name of the given decoder interface.
*
* \param[in] iface Interface pointer
*
*/
const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
/*!\brief Convert error number to printable string
*
* Returns a human readable string for the last error returned by the
* algorithm. The returned error will be one line and will not contain
* any newline characters.
*
*
* \param[in] err Error number.
*
*/
const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
/*!\brief Retrieve error synopsis for decoder context
*
* Returns a human readable string for the last error returned by the
* algorithm. The returned error will be one line and will not contain
* any newline characters.
*
*
* \param[in] ctx Pointer to this instance's context.
*
*/
const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
/*!\brief Retrieve detailed error information for decoder context
*
* Returns a human readable string providing detailed information about
* the last error.
*
* \param[in] ctx Pointer to this instance's context.
*
* \retval NULL
* No detailed information is available.
*/
const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
/* REQUIRED FUNCTIONS
*
* The following functions are required to be implemented for all decoders.
* They represent the base case functionality expected of all decoders.
*/
/*!\brief Initialize a decoder instance
*
* Initializes a decoder context using the given interface. Applications
* should call the vpx_dec_init convenience macro instead of this
* function directly, to ensure that the ABI version number parameter
* is properly initialized.
*
* \param[in] ctx Pointer to this instance's context.
* \param[in] iface Pointer to the algorithm interface to use.
* \param[in] ver ABI version number. Must be set to
* VPX_DECODER_ABI_VERSION
* \retval #VPX_DEC_OK
* The decoder algorithm initialized.
* \retval #VPX_DEC_MEM_ERROR
* Memory allocation failed.
*/
vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
vpx_dec_iface_t *iface,
int ver) DEPRECATED;
#define vpx_dec_init(ctx, iface) \
vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
/*!\brief Destroy a decoder instance
*
* Destroys a decoder context, freeing any associated memory buffers.
*
* \param[in] ctx Pointer to this instance's context
*
* \retval #VPX_DEC_OK
* The decoder algorithm initialized.
* \retval #VPX_DEC_MEM_ERROR
* Memory allocation failed.
*/
vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
/*!\brief Get the capabilities of an algorithm.
*
* Retrieves the capabilities bitfield from the algorithm's interface.
*
* \param[in] iface Pointer to the algorithm interface
*
*/
vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
/*!\brief Parse stream info from a buffer
*
* 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.
*
* \param[in] iface Pointer to the algorithm interface
* \param[in] data Pointer to a block of data to parse
* \param[in] data_sz Size of the data buffer
* \param[in,out] si Pointer to stream info to update. The size member
* \ref MUST be properly initialized, but \ref MAY be
* clobbered by the algorithm. This parameter \ref MAY
* be NULL.
*
* \retval #VPX_DEC_OK
* Bitstream is parsable and stream information updated
*/
vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
const uint8_t *data,
unsigned int data_sz,
vpx_dec_stream_info_t *si) DEPRECATED;
/*!\brief Return information about the current stream.
*
* Returns information about the stream that has been parsed during decoding.
*
* \param[in] ctx Pointer to this instance's context
* \param[in,out] si Pointer to stream info to update. The size member
* \ref MUST be properly initialized, but \ref MAY be
* clobbered by the algorithm. This parameter \ref MAY
* be NULL.
*
* \retval #VPX_DEC_OK
* Bitstream is parsable and stream information updated
*/
vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
vpx_dec_stream_info_t *si) DEPRECATED;
/*!\brief Control algorithm
*
* This function is used to exchange algorithm specific data with the decoder
* instance. This can be used to implement features specific to a particular
* algorithm.
*
* This wrapper function dispatches the request to the helper function
* associated with the given ctrl_id. It tries to call this function
* transparently, but will return #VPX_DEC_ERROR if the request could not
* be dispatched.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] ctrl_id Algorithm specific control identifier
* \param[in,out] data Data to exchange with algorithm instance.
*
* \retval #VPX_DEC_OK
* The control request was processed.
* \retval #VPX_DEC_ERROR
* The control request was not processed.
* \retval #VPX_DEC_INVALID_PARAM
* The data was not valid.
*/
vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
int ctrl_id,
void *data) DEPRECATED;
/*!\brief Decode data
*
* Processes a buffer of coded data. If the processing results in a new
* decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
* #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
* \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
* always be in PTS (presentation time stamp) order.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] data Pointer to this block of new coded data. If
* NULL, a VPX_DEC_CB_PUT_FRAME event is posted
* for the previously decoded frame.
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
* \param[in] rel_pts PTS relative to the previous frame, in us. If
* unknown or unavailable, set to zero.
*
* \return Returns #VPX_DEC_OK if the coded data was processed completely
* and future pictures can be decoded without error. Otherwise,
* see the descriptions of the other error codes in ::vpx_dec_err_t
* for recoverability capabilities.
*/
vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
uint8_t *data,
unsigned int data_sz,
void *user_priv,
int rel_pts) DEPRECATED;
/*!\brief Decoded frames iterator
*
* Iterates over a list of the frames available for display. The iterator
* storage should be initialized to NULL to start the iteration. Iteration is
* complete when this function returns NULL.
*
* The list of available frames becomes valid upon completion of the
* vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
*
* \param[in] ctx Pointer to this instance's context
* \param[in out] iter Iterator storage, initialized to NULL
*
* \return Returns a pointer to an image, if one is ready for display. Frames
* produced will always be in PTS (presentation time stamp) order.
*/
vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
vpx_dec_iter_t *iter) DEPRECATED;
/*!\defgroup cap_put_frame Frame-Based Decoding Functions
*
* The following functions are required to be implemented for all decoders
* that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
* for codecs that don't advertise this capability will result in an error
* code being returned, usually VPX_DEC_ERROR
* @{
*/
/*!\brief put frame callback prototype
*
* This callback is invoked by the decoder to notify the application of
* the availability of decoded image data.
*/
typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
const vpx_image_t *img);
/*!\brief Register for notification of frame completion.
*
* Registers a given function to be called when a decoded frame is
* available.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] cb Pointer to the callback function
* \param[in] user_priv User's private data
*
* \retval #VPX_DEC_OK
* Callback successfully registered.
* \retval #VPX_DEC_ERROR
* Decoder context not initialized, or algorithm not capable of
* posting slice completion.
*/
vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
vpx_dec_put_frame_cb_fn_t cb,
void *user_priv) DEPRECATED;
/*!@} - end defgroup cap_put_frame */
/*!\defgroup cap_put_slice Slice-Based Decoding Functions
*
* The following functions are required to be implemented for all decoders
* that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
* for codecs that don't advertise this capability will result in an error
* code being returned, usually VPX_DEC_ERROR
* @{
*/
/*!\brief put slice callback prototype
*
* This callback is invoked by the decoder to notify the application of
* the availability of partially decoded image data. The
*/
typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
const vpx_image_t *img,
const vpx_image_rect_t *valid,
const vpx_image_rect_t *update);
/*!\brief Register for notification of slice completion.
*
* Registers a given function to be called when a decoded slice is
* available.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] cb Pointer to the callback function
* \param[in] user_priv User's private data
*
* \retval #VPX_DEC_OK
* Callback successfully registered.
* \retval #VPX_DEC_ERROR
* Decoder context not initialized, or algorithm not capable of
* posting slice completion.
*/
vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
vpx_dec_put_slice_cb_fn_t cb,
void *user_priv) DEPRECATED;
/*!@} - end defgroup cap_put_slice*/
/*!\defgroup cap_xma External Memory Allocation Functions
*
* The following functions are required to be implemented for all decoders
* that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
* for codecs that don't advertise this capability will result in an error
* code being returned, usually VPX_DEC_ERROR
* @{
*/
/*!\brief Memory Map Entry
*
* This structure is used to contain the properties of a memory segment. It
* is populated by the decoder in the request phase, and by the calling
* application once the requested allocation has been performed.
*/
#if 1
#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
typedef struct vpx_codec_mmap vpx_dec_mmap_t;
#else
typedef struct vpx_dec_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_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
#define VPX_DEC_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_dec_mmap *map); /**< destructor to call */
void *priv; /**< allocator private storage */
} vpx_dec_mmap_t;
#endif
/*!\brief Initialize a decoder instance in external allocation mode
*
* Initializes a decoder context using the given interface. Applications
* should call the vpx_dec_xma_init convenience macro instead of this
* function directly, to ensure that the ABI version number parameter
* is properly initialized.
*
* \param[in] ctx Pointer to this instance's context.
* \param[in] iface Pointer to the algorithm interface to use.
* \param[in] ver ABI version number. Must be set to
* VPX_DECODER_ABI_VERSION
* \retval #VPX_DEC_OK
* The decoder algorithm initialized.
* \retval #VPX_DEC_ERROR
* Decoder does not support XMA mode.
*/
vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
vpx_dec_iface_t *iface,
int ver) DEPRECATED;
#define vpx_dec_xma_init(ctx, iface) \
vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
/*!\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_DEC_LIST_END. The amount of memory needed to
* allocate is dependent upon the size of the encoded stream. This means that
* the stream info structure must be known at allocation time. It can be
* populated with the vpx_dec_peek_stream_info() function. In cases where the
* stream to be decoded is not available at allocation time, a fixed size must
* be requested. The decoder will not be able to decode 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] si Pointer to the stream info.
* \param[in out] iter Iterator storage, initialized to NULL
*
* \retval #VPX_DEC_OK
* The memory map entry was populated.
* \retval #VPX_DEC_ERROR
* Decoder does not support XMA mode.
* \retval #VPX_DEC_MEM_ERROR
* Unable to determine segment size from stream info.
*/
vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
vpx_dec_mmap_t *mmap,
const vpx_dec_stream_info_t *si,
vpx_dec_iter_t *iter) DEPRECATED;
/*!\brief Identify allocated segments to decoder instance
*
* Stores a list of allocated segments in the decoder. Segments \ref MUST be
* passed in the order they are read from vpx_dec_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_dec_mmap_t::base member
* is non-NULL. If the segment requires cleanup handling (e.g., calling free()
* or close()) then the vpx_dec_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_DEC_OK
* The segment was stored in the decoder context.
* \retval #VPX_DEC_ERROR
* Decoder does not support XMA mode.
* \retval #VPX_DEC_MEM_ERROR
* Segment base address was not set, or segment was already stored.
*/
vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
vpx_dec_mmap_t *mmaps,
unsigned int num_maps) DEPRECATED;
/*!@} - end defgroup cap_xma*/
/*!@} - end defgroup decoder*/
#endif
#ifdef __cplusplus
}
#endif