History

remove deprecated pre-v0.9.0 API

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

John Koleszar committed 14 years ago

Commit 2bf8fb51 parent f039a8511 files · +4 −1209Browse files

Unified · Split

11 files
  1. docs.mk +0 −3
  2. libs.mk +2 −3
  3. vp8/vp8_cx_iface.c +2 −110
  4. vp8/vp8_dx_iface.c +0 −30
  5. vp8_api1_migration.txt +0 −198
  6. vpx/src/vpx_decoder_compat.c +0 −201
  7. vpx/vp8.h +0 −8
  8. vpx/vp8e.h +0 −63
  9. vpx/vpx_codec.mk +0 −2
  10. vpx/vpx_decoder.h +0 −4
  11. vpx/vpx_decoder_compat.h +0 −587
docs.mk+0−3
@@ -21,9 +21,6 @@ CODEC_DOX := mainpage.dox \ · 20 unmodified lines
21 usage_dx.dox \21 usage_dx.dox \
22 22
23# Other doxy files sourced in Markdown23# Other doxy files sourced in Markdown
24TXT_DOX-$(CONFIG_VP8) += vp8_api1_migration.dox
25vp8_api1_migration.dox.DESC = VP8 API 1.x Migration
26
27TXT_DOX = $(call enabled,TXT_DOX)24TXT_DOX = $(call enabled,TXT_DOX)
28 25
29%.dox: %.txt26%.dox: %.txt
libs.mk+2−3
@@ -35,9 +35,9 @@ ifeq ($(CONFIG_VP8_ENCODER),yes) · 34 unmodified lines
35 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk35 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
36 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))36 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
37 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))37 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
38 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h38 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h
39 CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8cx_arm.mk39 CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8cx_arm.mk
40 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h40 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
41 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%41 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
42 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h42 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
43 CODEC_DOC_SECTIONS += vp8 vp8_encoder43 CODEC_DOC_SECTIONS += vp8 vp8_encoder
@@ -115,7 +115,6 @@ INSTALL-LIBS-yes += include/vpx/vpx_integer.h · 71 unmodified lines
115INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h115INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
116INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h116INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
117INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h117INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
118INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
119INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h118INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
120ifeq ($(CONFIG_EXTERNAL_BUILD),yes)119ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
121ifeq ($(CONFIG_MSVS),yes)120ifeq ($(CONFIG_MSVS),yes)
vp8/vp8_cx_iface.c+2−110
@@ -13,17 +13,12 @@ · 12 unmodified lines
13#include "vpx/internal/vpx_codec_internal.h"13#include "vpx/internal/vpx_codec_internal.h"
14#include "vpx_version.h"14#include "vpx_version.h"
15#include "vp8/encoder/onyx_int.h"15#include "vp8/encoder/onyx_int.h"
16#include "vpx/vp8e.h"16#include "vpx/vp8cx.h"
17#include "vp8/encoder/firstpass.h"17#include "vp8/encoder/firstpass.h"
18#include "vp8/common/onyx.h"18#include "vp8/common/onyx.h"
19#include <stdlib.h>19#include <stdlib.h>
20#include <string.h>20#include <string.h>
21 21
22/* This value is a sentinel for determining whether the user has set a mode
23 * directly through the deprecated VP8E_SET_ENCODING_MODE control.
24 */
25#define NO_MODE_SET 255
26
27struct vp8_extracfg22struct vp8_extracfg
28{23{
29 struct vpx_codec_pkt_list *pkt_list;24 struct vpx_codec_pkt_list *pkt_list;
@@ -94,7 +89,6 @@ struct vpx_codec_alg_priv · 64 unmodified lines
94 unsigned int next_frame_flag;89 unsigned int next_frame_flag;
95 vp8_postproc_cfg_t preview_ppcfg;90 vp8_postproc_cfg_t preview_ppcfg;
96 vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed91 vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
97 int deprecated_mode;
98 unsigned int fixed_kf_cntr;92 unsigned int fixed_kf_cntr;
99};93};
100 94
@@ -516,7 +510,6 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, · 415 unmodified lines
516 510
517 switch (ctrl_id)511 switch (ctrl_id)
518 {512 {
519 MAP(VP8E_SET_ENCODING_MODE, ctx->deprecated_mode);
520 MAP(VP8E_SET_CPUUSED, xcfg.cpu_used);513 MAP(VP8E_SET_CPUUSED, xcfg.cpu_used);
521 MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref);514 MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref);
522 MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity);515 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, · 48 unmodified lines
571static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,564static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
572 vpx_codec_priv_enc_mr_cfg_t *mr_cfg)565 vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
573{566{
574 vpx_codec_err_t res = VPX_DEC_OK;567 vpx_codec_err_t res = VPX_CODEC_OK;
575 struct vpx_codec_alg_priv *priv;568 struct vpx_codec_alg_priv *priv;
576 vpx_codec_enc_cfg_t *cfg;569 vpx_codec_enc_cfg_t *cfg;
577 unsigned int i;570 unsigned int i;
@@ -626,8 +619,6 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx, · 48 unmodified lines
626 return VPX_CODEC_MEM_ERROR;619 return VPX_CODEC_MEM_ERROR;
627 }620 }
628 621
629 priv->deprecated_mode = NO_MODE_SET;
630
631 res = validate_config(priv, &priv->cfg, &priv->vp8_cfg, 0);622 res = validate_config(priv, &priv->cfg, &priv->vp8_cfg, 0);
632 623
633 if (!res)624 if (!res)
@@ -718,19 +709,6 @@ static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx, · 84 unmodified lines
718 new_qc = MODE_REALTIME;709 new_qc = MODE_REALTIME;
719#endif710#endif
720 711
721 switch (ctx->deprecated_mode)
722 {
723 case VP8_BEST_QUALITY_ENCODING:
724 new_qc = MODE_BESTQUALITY;
725 break;
726 case VP8_GOOD_QUALITY_ENCODING:
727 new_qc = MODE_GOODQUALITY;
728 break;
729 case VP8_REAL_TIME_ENCODING:
730 new_qc = MODE_REALTIME;
731 break;
732 }
733
734 if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)712 if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
735 new_qc = MODE_FIRSTPASS;713 new_qc = MODE_FIRSTPASS;
736 else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)714 else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
@@ -1207,7 +1185,6 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] = · 470 unmodified lines
1207 {VP8E_SET_ROI_MAP, vp8e_set_roi_map},1185 {VP8E_SET_ROI_MAP, vp8e_set_roi_map},
1208 {VP8E_SET_ACTIVEMAP, vp8e_set_activemap},1186 {VP8E_SET_ACTIVEMAP, vp8e_set_activemap},
1209 {VP8E_SET_SCALEMODE, vp8e_set_scalemode},1187 {VP8E_SET_SCALEMODE, vp8e_set_scalemode},
1210 {VP8E_SET_ENCODING_MODE, set_param},
1211 {VP8E_SET_CPUUSED, set_param},1188 {VP8E_SET_CPUUSED, set_param},
1212 {VP8E_SET_NOISE_SENSITIVITY, set_param},1189 {VP8E_SET_NOISE_SENSITIVITY, set_param},
1213 {VP8E_SET_ENABLEAUTOALTREF, set_param},1190 {VP8E_SET_ENABLEAUTOALTREF, set_param},
@@ -1318,88 +1295,3 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) = · 104 unmodified lines
1318 vp8e_mr_alloc_mem,1295 vp8e_mr_alloc_mem,
1319 } /* encoder functions */1296 } /* encoder functions */
1320};1297};
1321
1322
1323/*
1324 * BEGIN BACKWARDS COMPATIBILITY SHIM.
1325 */
1326#define FORCE_KEY 2
1327static vpx_codec_err_t api1_control(vpx_codec_alg_priv_t *ctx,
1328 int ctrl_id,
1329 va_list args)
1330{
1331 vpx_codec_ctrl_fn_map_t *entry;
1332
1333 switch (ctrl_id)
1334 {
1335 case VP8E_SET_FLUSHFLAG:
1336 /* VP8 sample code did VP8E_SET_FLUSHFLAG followed by
1337 * vpx_codec_get_cx_data() rather than vpx_codec_encode().
1338 */
1339 return vp8e_encode(ctx, NULL, 0, 0, 0, 0);
1340 case VP8E_SET_FRAMETYPE:
1341 ctx->base.enc.tbd |= FORCE_KEY;
1342 return VPX_CODEC_OK;
1343 }
1344
1345 for (entry = vp8e_ctf_maps; entry && entry->fn; entry++)
1346 {
1347 if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
1348 {
1349 return entry->fn(ctx, ctrl_id, args);
1350 }
1351 }
1352
1353 return VPX_CODEC_ERROR;
1354}
1355
1356
1357static vpx_codec_ctrl_fn_map_t api1_ctrl_maps[] =
1358{
1359 {0, api1_control},
1360 { -1, NULL}
1361};
1362
1363
1364static vpx_codec_err_t api1_encode(vpx_codec_alg_priv_t *ctx,
1365 const vpx_image_t *img,
1366 vpx_codec_pts_t pts,
1367 unsigned long duration,
1368 vpx_enc_frame_flags_t flags,
1369 unsigned long deadline)
1370{
1371 int force = ctx->base.enc.tbd;
1372
1373 ctx->base.enc.tbd = 0;
1374 return vp8e_encode
1375 (ctx,
1376 img,
1377 pts,
1378 duration,
1379 flags | ((force & FORCE_KEY) ? VPX_EFLAG_FORCE_KF : 0),
1380 deadline);
1381}
1382
1383
1384vpx_codec_iface_t vpx_enc_vp8_algo =
1385{
1386 "WebM Project VP8 Encoder (Deprecated API)" VERSION_STRING,
1387 VPX_CODEC_INTERNAL_ABI_VERSION,
1388 VPX_CODEC_CAP_ENCODER,
1389 /* vpx_codec_caps_t caps; */
1390 vp8e_init, /* vpx_codec_init_fn_t init; */
1391 vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
1392 api1_ctrl_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
1393 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
1394 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
1395 {NOT_IMPLEMENTED}, /* decoder functions */
1396 {
1397 vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
1398 api1_encode, /* vpx_codec_encode_fn_t encode; */
1399 vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
1400 vp8e_set_config,
1401 NOT_IMPLEMENTED,
1402 vp8e_get_preview,
1403 vp8e_mr_alloc_mem,
1404 } /* encoder functions */
1405};
vp8/vp8_dx_iface.c+0−30
@@ -785,33 +785,3 @@ CODEC_INTERFACE(vpx_codec_vp8_dx) = · 784 unmodified lines
785 NOT_IMPLEMENTED785 NOT_IMPLEMENTED
786 }786 }
787};787};
788
789/*
790 * BEGIN BACKWARDS COMPATIBILITY SHIM.
791 */
792vpx_codec_iface_t vpx_codec_vp8_algo =
793{
794 "WebM Project VP8 Decoder (Deprecated API)" VERSION_STRING,
795 VPX_CODEC_INTERNAL_ABI_VERSION,
796 VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC | VP8_CAP_ERROR_CONCEALMENT,
797 /* vpx_codec_caps_t caps; */
798 vp8_init, /* vpx_codec_init_fn_t init; */
799 vp8_destroy, /* vpx_codec_destroy_fn_t destroy; */
800 vp8_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
801 vp8_xma_get_mmap, /* vpx_codec_get_mmap_fn_t get_mmap; */
802 vp8_xma_set_mmap, /* vpx_codec_set_mmap_fn_t set_mmap; */
803 {
804 vp8_peek_si, /* vpx_codec_peek_si_fn_t peek_si; */
805 vp8_get_si, /* vpx_codec_get_si_fn_t get_si; */
806 vp8_decode, /* vpx_codec_decode_fn_t decode; */
807 vp8_get_frame, /* vpx_codec_frame_get_fn_t frame_get; */
808 },
809 { /* encoder functions */
810 NOT_IMPLEMENTED,
811 NOT_IMPLEMENTED,
812 NOT_IMPLEMENTED,
813 NOT_IMPLEMENTED,
814 NOT_IMPLEMENTED,
815 NOT_IMPLEMENTED
816 }
817};
vp8_api1_migration.txt+0−198
@@ -1,198 +0,0 @@
1Version 2.x of this library has deprecated or removed a number of interfaces to
2the VP8 codec. Where possible, the old interfaces have been left in place in a
3deprecated state, and will generate compiler warnings when they are referenced.
4All users are encouraged to update their code to the new interfaces as soon as
5possible. To assist in this effort, the `VPX_CODEC_DISABLE_COMPAT` symbol can
6be #defined to 1 prior to including vpx headers. This will disable the
7backwards compatability workarounds and ensure that you are using only the
8latest API.
9
10The *TWO-PASS STATISTICS* sections detail the one section of code which is not
11backwards compatable and will require code changes.
12
13
14HEADER FILES
15============
16The following header files were renamed:
17
18 vp8.h -> vp8dx.h
19 vp8e.h -> vp8cx.h
20
21
22INTERFACE SYMBOLS
23=================
24The following interface symbols were renamed:
25
26 vpx_codec_vp8_algo -> vpx_codec_vp8_dx_algo
27 vpx_enc_vp8_algo -> vpx_codec_vp8_cx_algo
28
29
30TWO-PASS STATISTICS
31===================
32Two-pass statistics are handled significantly differently. The version 1 API
33stored statistics in a file, and the application passed the name of that file
34in the `vpx_codec_enc_cfg` structure. In this version, statistics are returned
35though the application though the `vpx_codec_get_cx_data()` interface. The
36application must concatenate these packets into a contiguous buffer and then
37pass that buffer to the encoder through the `vpx_codec_enc_cfg` structure on
38the second pass initialization. The application may choose to keep these packets
39in memory or write them to disk. Statistics packets are approximately 112 bytes
40per frame. See the example code for more detailed examples.
41
42
43ENCODER CONTROLS
44================
45
46Renames
47-------
48The following controls are duplicated between the encoder and the decoder, but
49the encoder unnecessarily introduced unique identifiers for them. These
50identifiers were removed in favor of the ones used by the decoder:
51
52 VP8E_SET_REFERENCE -> VP8_SET_REFERENCE
53 VP8E_COPY_REFERENCE -> VP8_COPY_REFERENCE
54 VP8E_SET_PREVIEWPP -> VP8_SET_POSTPROC
55
56
57VP8E_SET_FRAMETYPE
58------------------
59This control was removed in favor of the `flags` parameter to
60`vpx_codec_encode()`. Existing code such as:
61
62~~~
63 vpx_codec_control(&encoder, VP8E_SET_FRAMETYPE, KEY_FRAME);
64 ...
65 vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
66~~~
67
68becomes:
69
70~~~
71 vpx_codec_encode(&encoder, img, pts, 1, VPX_EFLAG_FORCE_KF,
72 VPX_DL_REALTIME);
73~~~
74
75
76
77VP8E_SET_FLUSHFLAG
78------------------
79Flush is handled by passing `NULL` to the `img` parameter of
80`vpx_codec_encode()`. You must do this at least once, regardless of your encoder
81configuration. i.e. it's not specific to g_lag_in_frames. This control was
82removed.
83
84~~~
85 while(...) {
86 ...
87 vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
88 while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
89 ...
90 }
91 }
92 vpx_codec_control(&encoder, VP8E_SET_FLUSHFLAG, 1);
93 while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
94 ...
95 }
96 vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
97~~~
98
99becomes
100
101~~~
102 while(new_image && ...) {
103 ...
104 vpx_codec_encode(&encoder, new_image?img:NULL, pts, 1, 0, 0);
105 while( (pkt = vpx_codec_get_cx_data(&encoder, &iter)) ) {
106 ...
107 }
108 }
109~~~
110
111
112
113VP8E_SET_ENCODING_MODE
114----------------------
115This control was removed in favor of the `deadline` parameter to
116`vpx_codec_encode()`. There are three macros that can be used to get the
117equivalent behavior: VPX_DL_REALTIME, VPX_DL_GOOD_QUALITY,
118VPX_DL_BEST_QUALITY. Existing code such as:
119
120~~~
121 vpx_codec_control(&encoder, VP8E_SET_ENCODING_MODE, VP8_REAL_TIME_ENCODING);
122 ...
123 vpx_codec_encode(&encoder, img, pts, 1, 0, 0);
124~~~
125
126becomes:
127
128~~~
129 vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
130~~~
131
132
133VP8E_UPD_ENTROPY
134------------------
135This control was deprecated in favor of the `flags` parameter to
136`vpx_codec_encode()`. Existing code such as:
137
138~~~
139 vpx_codec_control(&encoder, VP8E_UPD_ENTROPY, 0);
140~~~
141
142becomes:
143
144~~~
145 vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_UPD_ENTROPY,
146 VPX_DL_REALTIME);
147~~~
148
149
150VP8E_UPD_REFERENCE
151------------------
152This control was deprecated in favor of the `flags` parameter to
153`vpx_codec_encode()`. A set bit on the VP8E_UPD_REFERENCE bitfield is
154analogous to setting the VP8_EFLAG_FORCE_* flag. A cleared bit is analogous
155to setting the VP8_EFLAG_NO_UPD_* flag. If neither the FORCE or NO_UPD bit
156is set, the encoder will make its decision automatically, as usual. Setting
157both bits will result in an error being returned. Existing code such as:
158
159~~~
160 vpx_codec_control(&encoder, VP8E_UPD_REFERENCE,
161 VP8_LAST_FRAME | VP8_GOLD_FRAME);
162 vpx_codec_control(&encoder, VP8E_UPD_REFERENCE, 0);
163 ...
164 vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
165~~~
166
167becomes:
168
169~~~
170 vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_FORCE_GF,
171 VPX_DL_REALTIME);
172 vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_UPD_LAST
173 | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF,
174 VPX_DL_REALTIME);
175~~~
176
177
178VP8E_USE_REFERENCE
179------------------
180This control was deprecated in favor of the `flags` parameter to
181`vpx_codec_encode()`. A cleared bit on the VP8E_USE_REFERENCE bitfield is
182analogous to setting the VP8_EFLAG_NO_REF* flag. A set bit indicates that
183the encoder will make its decision automatically, as usual.
184Existing code such as:
185
186~~~
187 vpx_codec_control(&encoder, VP8E_USE_REFERENCE,
188 VP8_ALTR_FRAME | VP8_GOLD_FRAME);
189 ...
190 vpx_codec_encode(&encoder, img, pts, 1, 0, VPX_DL_REALTIME);
191~~~
192
193becomes
194
195~~~
196 vpx_codec_encode(&encoder, img, pts, 1, VP8_EFLAG_NO_REF_LAST,
197 VPX_DL_REALTIME);
198~~~
vpx/src/vpx_decoder_compat.c+0−201
@@ -1,201 +0,0 @@
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12/*!\file
13 * \brief Provides the high level interface to wrap decoder algorithms.
14 *
15 */
16#include <stdlib.h>
17#include <string.h>
18#include "vpx/vpx_decoder.h"
19#include "vpx/internal/vpx_codec_internal.h"
20
21#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
22
23const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
24{
25 return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
26}
27
28const char *vpx_dec_err_to_string(vpx_dec_err_t err)
29{
30 return vpx_codec_err_to_string(err);
31}
32
33const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
34{
35 return vpx_codec_error((vpx_codec_ctx_t *)ctx);
36}
37
38const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
39{
40 return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
41}
42
43
44vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
45 vpx_dec_iface_t *iface,
46 int ver)
47{
48 return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
49 (vpx_codec_iface_t *)iface,
50 NULL,
51 0,
52 ver);
53}
54
55
56vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
57{
58 return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
59}
60
61
62vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
63{
64 return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
65}
66
67
68vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
69 const uint8_t *data,
70 unsigned int data_sz,
71 vpx_dec_stream_info_t *si)
72{
73 return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
74 (vpx_codec_stream_info_t *)si);
75}
76
77
78vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
79 vpx_dec_stream_info_t *si)
80{
81 return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
82 (vpx_codec_stream_info_t *)si);
83}
84
85
86vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
87 int ctrl_id,
88 void *data)
89{
90 return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
91}
92
93
94vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
95 uint8_t *data,
96 unsigned int data_sz,
97 void *user_priv,
98 int rel_pts)
99{
100 (void)rel_pts;
101 return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
102 0);
103}
104
105vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
106 vpx_dec_iter_t *iter)
107{
108 return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
109}
110
111
112vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
113 vpx_dec_put_frame_cb_fn_t cb,
114 void *user_priv)
115{
116 return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
117 user_priv);
118}
119
120
121vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
122 vpx_dec_put_slice_cb_fn_t cb,
123 void *user_priv)
124{
125 return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
126 user_priv);
127}
128
129
130vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
131 vpx_dec_iface_t *iface,
132 int ver)
133{
134 return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
135 (vpx_codec_iface_t *)iface,
136 NULL,
137 VPX_CODEC_USE_XMA,
138 ver);
139}
140
141vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
142 vpx_dec_mmap_t *mmap,
143 const vpx_dec_stream_info_t *si,
144 vpx_dec_iter_t *iter)
145{
146 vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
147 vpx_dec_err_t res = VPX_DEC_OK;
148
149 if (!ctx || !mmap || !si || !iter || !ctx->iface)
150 res = VPX_DEC_INVALID_PARAM;
151 else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
152 res = VPX_DEC_ERROR;
153 else
154 {
155 if (!ctx->config.dec)
156 {
157 ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
158 ctx->config.dec->w = si->w;
159 ctx->config.dec->h = si->h;
160 }
161
162 res = ctx->iface->get_mmap(ctx, mmap, iter);
163 }
164
165 return SAVE_STATUS(ctx, res);
166}
167
168
169vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
170 vpx_dec_mmap_t *mmap,
171 unsigned int num_maps)
172{
173 vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
174 vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
175
176 if (!ctx || !mmap || !ctx->iface)
177 res = VPX_DEC_INVALID_PARAM;
178 else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
179 res = VPX_DEC_ERROR;
180 else
181 {
182 void *save = (ctx->priv) ? NULL : ctx->config.dec;
183 unsigned int i;
184
185 for (i = 0; i < num_maps; i++, mmap++)
186 {
187 if (!mmap->base)
188 break;
189
190 /* Everything look ok, set the mmap in the decoder */
191 res = ctx->iface->set_mmap(ctx, mmap);
192
193 if (res)
194 break;
195 }
196
197 if (save) free(save);
198 }
199
200 return SAVE_STATUS(ctx, res);
201}
vpx/vp8.h+0−8
@@ -119,13 +119,5 @@ VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int) · 118 unmodified lines
119 119
120/*! @} - end defgroup vp8 */120/*! @} - end defgroup vp8 */
121 121
122#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
123/* The following definitions are provided for backward compatibility with
124 * the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
125 */
126
127DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
128#endif
129
130#include "vpx_codec_impl_bottom.h"122#include "vpx_codec_impl_bottom.h"
131#endif123#endif
vpx/vp8e.h+0−63
@@ -1,63 +0,0 @@
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12/* This file contains backwards compatibility stubs for applications using
13 * the VP8 version 1.0 API.
14 */
15#ifndef VP8E_H
16#define VP8E_H
17#include "vpx_codec_impl_top.h"
18
19#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
20#error "Backwards compatibility disabled: don't include vp8e.h"
21#endif
22
23#include "vp8cx.h"
24DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
25
26
27enum
28{
29 VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
30 VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
31 VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
32 VP8E_SET_FLUSHFLAG = 4,
33 VP8E_SET_FRAMETYPE = 10,
34 VP8E_SET_ENCODING_MODE = 12
35};
36
37#define NORMAL_FRAME (0)
38#define KEY_FRAME (1)
39
40/* Change VP8E to VP8 to get the undeprecated version of these (defined in
41 * vp8.h)
42 */
43VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
44VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
45VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
46
47
48/* Flush is done by calling vpx_codec_encode with a NULL input image. */
49VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
50
51
52/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
53 */
54VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
55
56
57/* This control has been deprecated in favor of the duration parameter to
58 * vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
59 * #VPX_DL_BEST_QUALITY constants to that parameter instead.
60 */
61VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
62#include "vpx_codec_impl_bottom.h"
63#endif
vpx/vpx_codec.mk+0−2
@@ -12,9 +12,7 @@ · 11 unmodified lines
12API_EXPORTS += exports12API_EXPORTS += exports
13 13
14API_SRCS-yes += src/vpx_decoder.c14API_SRCS-yes += src/vpx_decoder.c
15API_SRCS-yes += src/vpx_decoder_compat.c
16API_SRCS-yes += vpx_decoder.h15API_SRCS-yes += vpx_decoder.h
17API_SRCS-yes += vpx_decoder_compat.h
18API_SRCS-yes += src/vpx_encoder.c16API_SRCS-yes += src/vpx_encoder.c
19API_SRCS-yes += vpx_encoder.h17API_SRCS-yes += vpx_encoder.h
20API_SRCS-yes += internal/vpx_codec_internal.h18API_SRCS-yes += internal/vpx_codec_internal.h
vpx/vpx_decoder.h+0−4
@@ -327,7 +327,3 @@ extern "C" { · 326 unmodified lines
327#ifdef __cplusplus327#ifdef __cplusplus
328}328}
329#endif329#endif
330
331#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
332#include "vpx_decoder_compat.h"
333#endif
vpx/vpx_decoder_compat.h+0−587
@@ -1,587 +0,0 @@
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
12/*!\defgroup decoder Common Decoder Algorithm Interface
13 * This abstraction allows applications using this decoder to easily support
14 * multiple video formats with minimal code duplication. This section describes
15 * the interface common to all codecs.
16 * @{
17 */
18
19/*!\file
20 * \brief Provides a compatibility layer between version 1 and 2 of this API.
21 *
22 * This interface has been deprecated. Only existing code should make use
23 * of this interface, and therefore, it is only thinly documented. Existing
24 * code should be ported to the vpx_codec_* API.
25 */
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#ifndef VPX_DECODER_COMPAT_H
31#define VPX_DECODER_COMPAT_H
32
33 /*!\brief Decoder algorithm return codes */
34 typedef enum {
35 /*!\brief Operation completed without error */
36 VPX_DEC_OK = VPX_CODEC_OK,
37
38 /*!\brief Unspecified error */
39 VPX_DEC_ERROR = VPX_CODEC_ERROR,
40
41 /*!\brief Memory operation failed */
42 VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
43
44 /*!\brief ABI version mismatch */
45 VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
46
47 /*!\brief The given bitstream is not supported.
48 *
49 * The bitstream was unable to be parsed at the highest level. The decoder
50 * is unable to proceed. This error \ref SHOULD be treated as fatal to the
51 * stream. */
52 VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
53
54 /*!\brief Encoded bitstream uses an unsupported feature
55 *
56 * The decoder does not implement a feature required by the encoder. This
57 * return code should only be used for features that prevent future
58 * pictures from being properly decoded. This error \ref MAY be treated as
59 * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
60 */
61 VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
62
63 /*!\brief The coded data for this stream is corrupt or incomplete
64 *
65 * There was a problem decoding the current frame. This return code
66 * should only be used for failures that prevent future pictures from
67 * being properly decoded. This error \ref MAY be treated as fatal to the
68 * stream or \ref MAY be treated as fatal to the current GOP. If decoding
69 * is continued for the current GOP, artifacts may be present.
70 */
71 VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
72
73 /*!\brief An application-supplied parameter is not valid.
74 *
75 */
76 VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
77
78 /*!\brief An iterator reached the end of list.
79 *
80 */
81 VPX_DEC_LIST_END = VPX_CODEC_LIST_END
82
83 }
84 vpx_dec_err_t;
85
86 /*! \brief Decoder capabilities bitfield
87 *
88 * Each decoder advertises the capabilities it supports as part of its
89 * ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
90 * or functionality, and are not required to be supported by a decoder.
91 *
92 * The available flags are specified by VPX_DEC_CAP_* defines.
93 */
94 typedef int vpx_dec_caps_t;
95#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
96#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
97#define VPX_DEC_CAP_XMA 0x0004 /**< Supports eXternal Memory Allocation */
98
99 /*!\brief Stream properties
100 *
101 * This structure is used to query or set properties of the decoded
102 * stream. Algorithms may extend this structure with data specific
103 * to their bitstream by setting the sz member appropriately.
104 */
105#if 1
106 typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
107#else
108 typedef struct
109 {
110 unsigned int sz; /**< Size of this structure */
111 unsigned int w; /**< Width (or 0 for unknown/default) */
112 unsigned int h; /**< Height (or 0 for unknown/default) */
113 unsigned int is_kf; /**< Current frame is a keyframe */
114 } vpx_dec_stream_info_t;
115#endif
116
117
118 /*!\brief Decoder interface structure.
119 *
120 * Contains function pointers and other data private to the decoder
121 * implementation. This structure is opaque to the application.
122 */
123 typedef const struct vpx_codec_iface vpx_dec_iface_t;
124 typedef struct vpx_codec_priv vpx_dec_priv_t;
125
126 /*!\brief Iterator
127 *
128 * Opaque storage used for iterating over lists.
129 */
130 typedef vpx_codec_iter_t vpx_dec_iter_t;
131
132 /*!\brief Decoder context structure
133 *
134 * All decoders \ref MUST support this context structure fully. In general,
135 * this data should be considered private to the decoder algorithm, and
136 * not be manipulated or examined by the calling application. Applications
137 * may reference the 'name' member to get a printable description of the
138 * algorithm.
139 */
140#if 1
141 typedef vpx_codec_ctx_t vpx_dec_ctx_t;
142#else
143 typedef struct
144 {
145 const char *name; /**< Printable interface name */
146 vpx_dec_iface_t *iface; /**< Interface pointers */
147 vpx_dec_err_t err; /**< Last returned error */
148 vpx_dec_priv_t *priv; /**< Algorithm private storage */
149 } vpx_dec_ctx_t;
150#endif
151
152
153 /*!\brief Return the build configuration
154 *
155 * Returns a printable string containing an encoded version of the build
156 * configuration. This may be useful to vpx support.
157 *
158 */
159 const char *vpx_dec_build_config(void) DEPRECATED;
160
161 /*!\brief Return the name for a given interface
162 *
163 * Returns a human readable string for name of the given decoder interface.
164 *
165 * \param[in] iface Interface pointer
166 *
167 */
168 const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
169
170
171 /*!\brief Convert error number to printable string
172 *
173 * Returns a human readable string for the last error returned by the
174 * algorithm. The returned error will be one line and will not contain
175 * any newline characters.
176 *
177 *
178 * \param[in] err Error number.
179 *
180 */
181 const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
182
183
184 /*!\brief Retrieve error synopsis for decoder context
185 *
186 * Returns a human readable string for the last error returned by the
187 * algorithm. The returned error will be one line and will not contain
188 * any newline characters.
189 *
190 *
191 * \param[in] ctx Pointer to this instance's context.
192 *
193 */
194 const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
195
196
197 /*!\brief Retrieve detailed error information for decoder context
198 *
199 * Returns a human readable string providing detailed information about
200 * the last error.
201 *
202 * \param[in] ctx Pointer to this instance's context.
203 *
204 * \retval NULL
205 * No detailed information is available.
206 */
207 const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
208
209
210 /* REQUIRED FUNCTIONS
211 *
212 * The following functions are required to be implemented for all decoders.
213 * They represent the base case functionality expected of all decoders.
214 */
215
216
217 /*!\brief Initialize a decoder instance
218 *
219 * Initializes a decoder context using the given interface. Applications
220 * should call the vpx_dec_init convenience macro instead of this
221 * function directly, to ensure that the ABI version number parameter
222 * is properly initialized.
223 *
224 * \param[in] ctx Pointer to this instance's context.
225 * \param[in] iface Pointer to the algorithm interface to use.
226 * \param[in] ver ABI version number. Must be set to
227 * VPX_DECODER_ABI_VERSION
228 * \retval #VPX_DEC_OK
229 * The decoder algorithm initialized.
230 * \retval #VPX_DEC_MEM_ERROR
231 * Memory allocation failed.
232 */
233 vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
234 vpx_dec_iface_t *iface,
235 int ver) DEPRECATED;
236#define vpx_dec_init(ctx, iface) \
237 vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
238
239
240 /*!\brief Destroy a decoder instance
241 *
242 * Destroys a decoder context, freeing any associated memory buffers.
243 *
244 * \param[in] ctx Pointer to this instance's context
245 *
246 * \retval #VPX_DEC_OK
247 * The decoder algorithm initialized.
248 * \retval #VPX_DEC_MEM_ERROR
249 * Memory allocation failed.
250 */
251 vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
252
253
254 /*!\brief Get the capabilities of an algorithm.
255 *
256 * Retrieves the capabilities bitfield from the algorithm's interface.
257 *
258 * \param[in] iface Pointer to the algorithm interface
259 *
260 */
261 vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
262
263
264 /*!\brief Parse stream info from a buffer
265 *
266 * Performs high level parsing of the bitstream. Construction of a decoder
267 * context is not necessary. Can be used to determine if the bitstream is
268 * of the proper format, and to extract information from the stream.
269 *
270 * \param[in] iface Pointer to the algorithm interface
271 * \param[in] data Pointer to a block of data to parse
272 * \param[in] data_sz Size of the data buffer
273 * \param[in,out] si Pointer to stream info to update. The size member
274 * \ref MUST be properly initialized, but \ref MAY be
275 * clobbered by the algorithm. This parameter \ref MAY
276 * be NULL.
277 *
278 * \retval #VPX_DEC_OK
279 * Bitstream is parsable and stream information updated
280 */
281 vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
282 const uint8_t *data,
283 unsigned int data_sz,
284 vpx_dec_stream_info_t *si) DEPRECATED;
285
286
287 /*!\brief Return information about the current stream.
288 *
289 * Returns information about the stream that has been parsed during decoding.
290 *
291 * \param[in] ctx Pointer to this instance's context
292 * \param[in,out] si Pointer to stream info to update. The size member
293 * \ref MUST be properly initialized, but \ref MAY be
294 * clobbered by the algorithm. This parameter \ref MAY
295 * be NULL.
296 *
297 * \retval #VPX_DEC_OK
298 * Bitstream is parsable and stream information updated
299 */
300 vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
301 vpx_dec_stream_info_t *si) DEPRECATED;
302
303
304 /*!\brief Control algorithm
305 *
306 * This function is used to exchange algorithm specific data with the decoder
307 * instance. This can be used to implement features specific to a particular
308 * algorithm.
309 *
310 * This wrapper function dispatches the request to the helper function
311 * associated with the given ctrl_id. It tries to call this function
312 * transparently, but will return #VPX_DEC_ERROR if the request could not
313 * be dispatched.
314 *
315 * \param[in] ctx Pointer to this instance's context
316 * \param[in] ctrl_id Algorithm specific control identifier
317 * \param[in,out] data Data to exchange with algorithm instance.
318 *
319 * \retval #VPX_DEC_OK
320 * The control request was processed.
321 * \retval #VPX_DEC_ERROR
322 * The control request was not processed.
323 * \retval #VPX_DEC_INVALID_PARAM
324 * The data was not valid.
325 */
326 vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
327 int ctrl_id,
328 void *data) DEPRECATED;
329
330 /*!\brief Decode data
331 *
332 * Processes a buffer of coded data. If the processing results in a new
333 * decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
334 * #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
335 * \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
336 * always be in PTS (presentation time stamp) order.
337 *
338 * \param[in] ctx Pointer to this instance's context
339 * \param[in] data Pointer to this block of new coded data. If
340 * NULL, a VPX_DEC_CB_PUT_FRAME event is posted
341 * for the previously decoded frame.
342 * \param[in] data_sz Size of the coded data, in bytes.
343 * \param[in] user_priv Application specific data to associate with
344 * this frame.
345 * \param[in] rel_pts PTS relative to the previous frame, in us. If
346 * unknown or unavailable, set to zero.
347 *
348 * \return Returns #VPX_DEC_OK if the coded data was processed completely
349 * and future pictures can be decoded without error. Otherwise,
350 * see the descriptions of the other error codes in ::vpx_dec_err_t
351 * for recoverability capabilities.
352 */
353 vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
354 uint8_t *data,
355 unsigned int data_sz,
356 void *user_priv,
357 int rel_pts) DEPRECATED;
358
359
360 /*!\brief Decoded frames iterator
361 *
362 * Iterates over a list of the frames available for display. The iterator
363 * storage should be initialized to NULL to start the iteration. Iteration is
364 * complete when this function returns NULL.
365 *
366 * The list of available frames becomes valid upon completion of the
367 * vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
368 *
369 * \param[in] ctx Pointer to this instance's context
370 * \param[in out] iter Iterator storage, initialized to NULL
371 *
372 * \return Returns a pointer to an image, if one is ready for display. Frames
373 * produced will always be in PTS (presentation time stamp) order.
374 */
375 vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
376 vpx_dec_iter_t *iter) DEPRECATED;
377
378
379 /*!\defgroup cap_put_frame Frame-Based Decoding Functions
380 *
381 * The following functions are required to be implemented for all decoders
382 * that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
383 * for codecs that don't advertise this capability will result in an error
384 * code being returned, usually VPX_DEC_ERROR
385 * @{
386 */
387
388 /*!\brief put frame callback prototype
389 *
390 * This callback is invoked by the decoder to notify the application of
391 * the availability of decoded image data.
392 */
393 typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
394 const vpx_image_t *img);
395
396
397 /*!\brief Register for notification of frame completion.
398 *
399 * Registers a given function to be called when a decoded frame is
400 * available.
401 *
402 * \param[in] ctx Pointer to this instance's context
403 * \param[in] cb Pointer to the callback function
404 * \param[in] user_priv User's private data
405 *
406 * \retval #VPX_DEC_OK
407 * Callback successfully registered.
408 * \retval #VPX_DEC_ERROR
409 * Decoder context not initialized, or algorithm not capable of
410 * posting slice completion.
411 */
412 vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
413 vpx_dec_put_frame_cb_fn_t cb,
414 void *user_priv) DEPRECATED;
415
416
417 /*!@} - end defgroup cap_put_frame */
418
419 /*!\defgroup cap_put_slice Slice-Based Decoding Functions
420 *
421 * The following functions are required to be implemented for all decoders
422 * that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
423 * for codecs that don't advertise this capability will result in an error
424 * code being returned, usually VPX_DEC_ERROR
425 * @{
426 */
427
428 /*!\brief put slice callback prototype
429 *
430 * This callback is invoked by the decoder to notify the application of
431 * the availability of partially decoded image data. The
432 */
433 typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
434 const vpx_image_t *img,
435 const vpx_image_rect_t *valid,
436 const vpx_image_rect_t *update);
437
438
439 /*!\brief Register for notification of slice completion.
440 *
441 * Registers a given function to be called when a decoded slice is
442 * available.
443 *
444 * \param[in] ctx Pointer to this instance's context
445 * \param[in] cb Pointer to the callback function
446 * \param[in] user_priv User's private data
447 *
448 * \retval #VPX_DEC_OK
449 * Callback successfully registered.
450 * \retval #VPX_DEC_ERROR
451 * Decoder context not initialized, or algorithm not capable of
452 * posting slice completion.
453 */
454 vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
455 vpx_dec_put_slice_cb_fn_t cb,
456 void *user_priv) DEPRECATED;
457
458
459 /*!@} - end defgroup cap_put_slice*/
460
461 /*!\defgroup cap_xma External Memory Allocation Functions
462 *
463 * The following functions are required to be implemented for all decoders
464 * that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
465 * for codecs that don't advertise this capability will result in an error
466 * code being returned, usually VPX_DEC_ERROR
467 * @{
468 */
469
470 /*!\brief Memory Map Entry
471 *
472 * This structure is used to contain the properties of a memory segment. It
473 * is populated by the decoder in the request phase, and by the calling
474 * application once the requested allocation has been performed.
475 */
476#if 1
477#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
478#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
479#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
480 typedef struct vpx_codec_mmap vpx_dec_mmap_t;
481#else
482 typedef struct vpx_dec_mmap
483 {
484 /*
485 * The following members are set by the codec when requesting a segment
486 */
487 unsigned int id; /**< identifier for the segment's contents */
488 unsigned long sz; /**< size of the segment, in bytes */
489 unsigned int align; /**< required alignment of the segment, in bytes */
490 unsigned int flags; /**< bitfield containing segment properties */
491#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
492#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
493#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
494
495 /* The following members are to be filled in by the allocation function */
496 void *base; /**< pointer to the allocated segment */
497 void (*dtor)(struct vpx_dec_mmap *map); /**< destructor to call */
498 void *priv; /**< allocator private storage */
499 } vpx_dec_mmap_t;
500#endif
501
502 /*!\brief Initialize a decoder instance in external allocation mode
503 *
504 * Initializes a decoder context using the given interface. Applications
505 * should call the vpx_dec_xma_init convenience macro instead of this
506 * function directly, to ensure that the ABI version number parameter
507 * is properly initialized.
508 *
509 * \param[in] ctx Pointer to this instance's context.
510 * \param[in] iface Pointer to the algorithm interface to use.
511 * \param[in] ver ABI version number. Must be set to
512 * VPX_DECODER_ABI_VERSION
513 * \retval #VPX_DEC_OK
514 * The decoder algorithm initialized.
515 * \retval #VPX_DEC_ERROR
516 * Decoder does not support XMA mode.
517 */
518 vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
519 vpx_dec_iface_t *iface,
520 int ver) DEPRECATED;
521#define vpx_dec_xma_init(ctx, iface) \
522 vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
523
524
525 /*!\brief Iterate over the list of segments to allocate.
526 *
527 * Iterates over a list of the segments to allocate. The iterator storage
528 * should be initialized to NULL to start the iteration. Iteration is complete
529 * when this function returns VPX_DEC_LIST_END. The amount of memory needed to
530 * allocate is dependent upon the size of the encoded stream. This means that
531 * the stream info structure must be known at allocation time. It can be
532 * populated with the vpx_dec_peek_stream_info() function. In cases where the
533 * stream to be decoded is not available at allocation time, a fixed size must
534 * be requested. The decoder will not be able to decode streams larger than
535 * the size used at allocation time.
536 *
537 * \param[in] ctx Pointer to this instance's context.
538 * \param[out] mmap Pointer to the memory map entry to populate.
539 * \param[in] si Pointer to the stream info.
540 * \param[in out] iter Iterator storage, initialized to NULL
541 *
542 * \retval #VPX_DEC_OK
543 * The memory map entry was populated.
544 * \retval #VPX_DEC_ERROR
545 * Decoder does not support XMA mode.
546 * \retval #VPX_DEC_MEM_ERROR
547 * Unable to determine segment size from stream info.
548 */
549 vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
550 vpx_dec_mmap_t *mmap,
551 const vpx_dec_stream_info_t *si,
552 vpx_dec_iter_t *iter) DEPRECATED;
553
554
555 /*!\brief Identify allocated segments to decoder instance
556 *
557 * Stores a list of allocated segments in the decoder. Segments \ref MUST be
558 * passed in the order they are read from vpx_dec_get_mem_map(), but may be
559 * passed in groups of any size. Segments \ref MUST be set only once. The
560 * allocation function \ref MUST ensure that the vpx_dec_mmap_t::base member
561 * is non-NULL. If the segment requires cleanup handling (e.g., calling free()
562 * or close()) then the vpx_dec_mmap_t::dtor member \ref MUST be populated.
563 *
564 * \param[in] ctx Pointer to this instance's context.
565 * \param[in] mmaps Pointer to the first memory map entry in the list.
566 * \param[in] num_maps Number of entries being set at this time
567 *
568 * \retval #VPX_DEC_OK
569 * The segment was stored in the decoder context.
570 * \retval #VPX_DEC_ERROR
571 * Decoder does not support XMA mode.
572 * \retval #VPX_DEC_MEM_ERROR
573 * Segment base address was not set, or segment was already stored.
574
575 */
576 vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
577 vpx_dec_mmap_t *mmaps,
578 unsigned int num_maps) DEPRECATED;
579
580 /*!@} - end defgroup cap_xma*/
581 /*!@} - end defgroup decoder*/
582
583
584#endif
585#ifdef __cplusplus
586}
587#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t