diff options
author | Mark Thompson <sw@jkqxz.net> | 2016-10-21 18:57:12 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2016-10-31 19:23:40 +0000 |
commit | 1f26a231bb065276cd80ce02957c759f3197edfa (patch) | |
tree | af9b071bab766b804e7b989b03873a01d3ed05fc /libavcodec/qsvdec_h2645.c | |
parent | 309fe16a126c6c00cc60070de3190cf23f5570fb (diff) |
qsv: Merge libav implementation
Merged as-at libav 398f015, and therefore includes outstanding
skipped merges 04b17ff and 130e1f1.
All features not in libav are preserved, and no options change.
Diffstat (limited to 'libavcodec/qsvdec_h2645.c')
-rw-r--r-- | libavcodec/qsvdec_h2645.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c index 98a19520b6..df86eea746 100644 --- a/libavcodec/qsvdec_h2645.c +++ b/libavcodec/qsvdec_h2645.c @@ -33,11 +33,14 @@ #include "avcodec.h" #include "internal.h" +#include "qsv_internal.h" #include "qsvdec.h" +#include "qsv.h" enum LoadPlugin { LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_SW, + LOAD_PLUGIN_HEVC_HW, }; typedef struct QSVH2645Context { @@ -86,7 +89,8 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) int ret; if (avctx->codec_id == AV_CODEC_ID_HEVC && s->load_plugin != LOAD_PLUGIN_NONE) { - static const char *uid_hevcenc_sw = "15dd936825ad475ea34e35f3f54217a6"; + static const char *uid_hevcdec_sw = "15dd936825ad475ea34e35f3f54217a6"; + static const char *uid_hevcdec_hw = "33a61c0b4c27454ca8d85dde757c6f8e"; if (s->qsv.load_plugins[0]) { av_log(avctx, AV_LOG_WARNING, @@ -94,22 +98,22 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) "The load_plugin value will be ignored.\n"); } else { av_freep(&s->qsv.load_plugins); - s->qsv.load_plugins = av_strdup(uid_hevcenc_sw); + + if (s->load_plugin == LOAD_PLUGIN_HEVC_SW) + s->qsv.load_plugins = av_strdup(uid_hevcdec_sw); + else + s->qsv.load_plugins = av_strdup(uid_hevcdec_hw); if (!s->qsv.load_plugins) return AVERROR(ENOMEM); } } + s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); if (!s->packet_fifo) { ret = AVERROR(ENOMEM); goto fail; } - if (avctx->codec_id == AV_CODEC_ID_H264) { - //regarding ticks_per_frame description, should be 2 for h.264: - avctx->ticks_per_frame = 2; - } - return 0; fail: qsv_decode_close(avctx); @@ -184,7 +188,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, /* no more data */ if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) - return avpkt->size ? avpkt->size : ff_qsv_decode(avctx, &s->qsv, frame, got_frame, avpkt); + return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); av_packet_unref(&s->pkt_filtered); @@ -202,7 +206,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, av_packet_unref(&input_ref); } - ret = ff_qsv_decode(avctx, &s->qsv, frame, got_frame, &s->pkt_filtered); + ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->pkt_filtered); if (ret < 0) return ret; @@ -216,7 +220,9 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, static void qsv_decode_flush(AVCodecContext *avctx) { QSVH2645Context *s = avctx->priv_data; - ff_qsv_decode_reset(avctx, &s->qsv); + + qsv_clear_buffers(s); + ff_qsv_decode_flush(avctx, &s->qsv); } #define OFFSET(x) offsetof(QSVH2645Context, x) @@ -233,9 +239,10 @@ AVHWAccel ff_hevc_qsv_hwaccel = { static const AVOption hevc_options[] = { { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 0, INT_MAX, VD }, - { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_SW, VD, "load_plugin" }, + { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VD, "load_plugin" }, { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE }, 0, 0, VD, "load_plugin" }, { "hevc_sw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VD, "load_plugin" }, + { "hevc_hw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_HW }, 0, 0, VD, "load_plugin" }, { "load_plugins", "A :-separate list of hexadecimal plugin UIDs to load in an internal session", OFFSET(qsv.load_plugins), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD }, |