| @@ -1,5 +1,5 @@ |
| 1 | /* | 1 | /* |
| 2 | * Intel MediaSDK QSV based MPEG-2, VC-1, VP8 and MJPEG decoders | 2 | * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG and VP9 decoders |
| 3 | * | 3 | * |
| 4 | * copyright (c) 2015 Anton Khirnov | 4 | * copyright (c) 2015 Anton Khirnov |
| 5 | * | 5 | * |
| @@ -60,8 +60,8 @@ static av_cold int qsv_decode_close(AVCodecContext *avctx) · 54 unmodified lines |
| 60 | { | 60 | { |
| 61 | QSVOtherContext *s = avctx->priv_data; | 61 | QSVOtherContext *s = avctx->priv_data; |
| 62 | | 62 | |
| 63 | #if CONFIG_VP8_QSV_DECODER | 63 | #if CONFIG_VP8_QSV_DECODER || CONFIG_VP9_QSV_DECODER |
| 64 | if (avctx->codec_id == AV_CODEC_ID_VP8) | 64 | if (avctx->codec_id == AV_CODEC_ID_VP8 || avctx->codec_id == AV_CODEC_ID_VP9) |
| 65 | av_freep(&s->qsv.load_plugins); | 65 | av_freep(&s->qsv.load_plugins); |
| 66 | #endif | 66 | #endif |
| 67 | | 67 | |
| @@ -90,6 +90,17 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) · 22 unmodified lines |
| 90 | } | 90 | } |
| 91 | #endif | 91 | #endif |
| 92 | | 92 | |
| | 93 | #if CONFIG_VP9_QSV_DECODER |
| | 94 | if (avctx->codec_id == AV_CODEC_ID_VP9) { |
| | 95 | static const char *uid_vp9dec_hw = "a922394d8d87452f878c51f2fc9b4131"; |
| | 96 | |
| | 97 | av_freep(&s->qsv.load_plugins); |
| | 98 | s->qsv.load_plugins = av_strdup(uid_vp9dec_hw); |
| | 99 | if (!s->qsv.load_plugins) |
| | 100 | return AVERROR(ENOMEM); |
| | 101 | } |
| | 102 | #endif |
| | 103 | |
| 93 | s->qsv.orig_pix_fmt = AV_PIX_FMT_NV12; | 104 | s->qsv.orig_pix_fmt = AV_PIX_FMT_NV12; |
| 94 | s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); | 105 | s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); |
| 95 | if (!s->packet_fifo) { | 106 | if (!s->packet_fifo) { |
| @@ -282,3 +293,32 @@ AVCodec ff_mjpeg_qsv_decoder = { · 186 unmodified lines |
| 282 | AV_PIX_FMT_NONE }, | 293 | AV_PIX_FMT_NONE }, |
| 283 | }; | 294 | }; |
| 284 | #endif | 295 | #endif |
| | 296 | |
| | 297 | #if CONFIG_VP9_QSV_DECODER |
| | 298 | static const AVClass vp9_qsv_class = { |
| | 299 | .class_name = "vp9_qsv", |
| | 300 | .item_name = av_default_item_name, |
| | 301 | .option = options, |
| | 302 | .version = LIBAVUTIL_VERSION_INT, |
| | 303 | }; |
| | 304 | |
| | 305 | AVCodec ff_vp9_qsv_decoder = { |
| | 306 | .name = "vp9_qsv", |
| | 307 | .long_name = NULL_IF_CONFIG_SMALL("VP9 video (Intel Quick Sync Video acceleration)"), |
| | 308 | .priv_data_size = sizeof(QSVOtherContext), |
| | 309 | .type = AVMEDIA_TYPE_VIDEO, |
| | 310 | .id = AV_CODEC_ID_VP9, |
| | 311 | .init = qsv_decode_init, |
| | 312 | .decode = qsv_decode_frame, |
| | 313 | .flush = qsv_decode_flush, |
| | 314 | .close = qsv_decode_close, |
| | 315 | .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID, |
| | 316 | .priv_class = &vp9_qsv_class, |
| | 317 | .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, |
| | 318 | AV_PIX_FMT_P010, |
| | 319 | AV_PIX_FMT_QSV, |
| | 320 | AV_PIX_FMT_NONE }, |
| | 321 | .hw_configs = ff_qsv_hw_configs, |
| | 322 | .wrapper_name = "qsv", |
| | 323 | }; |
| | 324 | #endif |