summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_refs.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-01-25 12:58:48 +0100
committerAnton Khirnov <anton@khirnov.net>2015-01-27 09:05:08 +0100
commite72e8c5a1df61447ac7af750531e96e8b62d02ba (patch)
tree23575c79d3e9fcf6dfb9b798e59d20ab8f106445 /libavcodec/hevc_refs.c
parent4b95e95dbae58c9b60891284bf8b5bbd83e5293a (diff)
hevc: add hwaccel hooks
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r--libavcodec/hevc_refs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index ccb441bb75..94bd0f48c8 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
@@ -46,6 +47,9 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
frame->refPicList = NULL;
frame->collocated_ref = NULL;
+
+ av_buffer_unref(&frame->hwaccel_priv_buf);
+ frame->hwaccel_picture_private = NULL;
}
}
@@ -105,6 +109,17 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
for (j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data;
+ if (s->avctx->hwaccel) {
+ const AVHWAccel *hwaccel = s->avctx->hwaccel;
+ av_assert0(!frame->hwaccel_picture_private);
+ if (hwaccel->frame_priv_data_size) {
+ frame->hwaccel_priv_buf = av_buffer_allocz(hwaccel->frame_priv_data_size);
+ if (!frame->hwaccel_priv_buf)
+ goto fail;
+ frame->hwaccel_picture_private = frame->hwaccel_priv_buf->data;
+ }
+ }
+
return frame;
fail:
@@ -340,6 +355,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
if (!frame)
return NULL;
+ if (!s->avctx->hwaccel) {
if (!s->sps->pixel_shift) {
for (i = 0; frame->frame->buf[i]; i++)
memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 1),
@@ -352,6 +368,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
1 << (s->sps->bit_depth - 1));
}
}
+ }
frame->poc = poc;
frame->sequence = s->seq_decode;