diff options
author | Frank Galligan <fgalligan@google.com> | 2014-02-05 17:44:42 -0800 |
---|---|---|
committer | Frank Galligan <fgalligan@google.com> | 2014-02-10 14:08:11 -0800 |
commit | e8e152799be60b5bc070c6b115df12a6c1e3b176 (patch) | |
tree | 9db288604a35db4ed7aa6cdfef1dec40c3653774 /vp9/vp9_dx_iface.c | |
parent | 5f5c262766e6705732869c295bf2b2cba14ed363 (diff) | |
download | libvpx-e8e152799be60b5bc070c6b115df12a6c1e3b176.tar libvpx-e8e152799be60b5bc070c6b115df12a6c1e3b176.tar.gz libvpx-e8e152799be60b5bc070c6b115df12a6c1e3b176.tar.bz2 libvpx-e8e152799be60b5bc070c6b115df12a6c1e3b176.zip |
Add get release decoder frame buffer functions.
This CL changes libvpx to call a function when a frame buffer
is needed for decode. Libvpx will call a release callback when
no other frames reference the frame buffer. This CL adds a
default implementation of the frame buffer callbacks. Currently
only VP9 is supported. A future CL will add support for
applications to supply their own frame buffer callbacks.
Change-Id: I1405a320118f1cdd95f80c670d52b085a62cb10d
Diffstat (limited to 'vp9/vp9_dx_iface.c')
-rw-r--r-- | vp9/vp9_dx_iface.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c index 92c6cd20c..daff37a4f 100644 --- a/vp9/vp9_dx_iface.c +++ b/vp9/vp9_dx_iface.c @@ -15,6 +15,7 @@ #include "vpx/vp8dx.h" #include "vpx/internal/vpx_codec_internal.h" #include "./vpx_version.h" +#include "vp9/common/vp9_frame_buffers.h" #include "vp9/decoder/vp9_onyxd.h" #include "vp9/decoder/vp9_onyxd_int.h" #include "vp9/decoder/vp9_read_bit_buffer.h" @@ -291,10 +292,22 @@ static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx, ctx->postproc_cfg.noise_level = 0; } - if (!optr) + if (!optr) { res = VPX_CODEC_ERROR; - else + } else { + VP9D_COMP *const pbi = (VP9D_COMP*)optr; + VP9_COMMON *const cm = &pbi->common; + + cm->get_fb_cb = vp9_get_frame_buffer; + cm->release_fb_cb = vp9_release_frame_buffer; + + if (vp9_alloc_internal_frame_buffers(&cm->int_frame_buffers)) + vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, + "Failed to initialize internal frame buffers"); + cm->cb_priv = &cm->int_frame_buffers; + ctx->pbi = optr; + } } ctx->decoder_init = 1; |