summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2016-10-28 16:26:30 -0700
committerMarco <marpan@google.com>2016-11-03 11:18:00 -0700
commit86b0042f44fb7e6f316468c452354127f15e9316 (patch)
treefccf30da4ab479552b61d675115e8530f0b6a65c /vp9
parentf93305aa07859dbcac921c670dda28b046ad87e0 (diff)
downloadlibvpx-86b0042f44fb7e6f316468c452354127f15e9316.tar
libvpx-86b0042f44fb7e6f316468c452354127f15e9316.tar.gz
libvpx-86b0042f44fb7e6f316468c452354127f15e9316.tar.bz2
libvpx-86b0042f44fb7e6f316468c452354127f15e9316.zip
vp9-svc: Add decoder control to decode up to x spatial layers.
Change-Id: I85536473b8722424785c84c5b5520960b4e5744a
Diffstat (limited to 'vp9')
-rw-r--r--vp9/vp9_dx_iface.c14
-rw-r--r--vp9/vp9_dx_iface.h4
2 files changed, 18 insertions, 0 deletions
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index 4a1ebbc8c..0a3e84a0d 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -553,6 +553,9 @@ static vpx_codec_err_t decoder_decode(vpx_codec_alg_priv_t *ctx,
ctx->decrypt_cb, ctx->decrypt_state);
if (res != VPX_CODEC_OK) return res;
+ if (ctx->svc_decoding && ctx->svc_spatial_layer < frame_count - 1)
+ frame_count = ctx->svc_spatial_layer + 1;
+
if (ctx->frame_parallel_decode) {
// Decode in frame parallel mode. When decoding in this mode, the frame
// passed to the decoder must be either a normal frame or a superframe with
@@ -1001,6 +1004,16 @@ static vpx_codec_err_t ctrl_set_skip_loop_filter(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_OK;
}
+static vpx_codec_err_t ctrl_set_spatial_layer_svc(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ ctx->svc_decoding = 1;
+ ctx->svc_spatial_layer = va_arg(args, int);
+ if (ctx->svc_spatial_layer < 0)
+ return VPX_CODEC_INVALID_PARAM;
+ else
+ return VPX_CODEC_OK;
+}
+
static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
{ VP8_COPY_REFERENCE, ctrl_copy_reference },
@@ -1011,6 +1024,7 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
{ VPXD_SET_DECRYPTOR, ctrl_set_decryptor },
{ VP9_SET_BYTE_ALIGNMENT, ctrl_set_byte_alignment },
{ VP9_SET_SKIP_LOOP_FILTER, ctrl_set_skip_loop_filter },
+ { VP9_DECODE_SVC_SPATIAL_LAYER, ctrl_set_spatial_layer_svc },
// Getters
{ VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates },
diff --git a/vp9/vp9_dx_iface.h b/vp9/vp9_dx_iface.h
index cc3d51842..c1559599b 100644
--- a/vp9/vp9_dx_iface.h
+++ b/vp9/vp9_dx_iface.h
@@ -60,6 +60,10 @@ struct vpx_codec_alg_priv {
void *ext_priv; // Private data associated with the external frame buffers.
vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb;
vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb;
+
+ // Allow for decoding up to a given spatial layer for SVC stream.
+ int svc_decoding;
+ int svc_spatial_layer;
};
#endif // VP9_VP9_DX_IFACE_H_