summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaxim_d33 <[email protected]>2017-12-21 21:34:57 +0100
committerScott <[email protected]>2017-12-22 22:27:08 +0000
commitfedd40743ac670daf59e36774a5056cc9b08d2bf (patch)
treee214a4c4d70cd405e0714a4badabeecb51e0ca4a
parent19d4faaa83f8e29373947fb700bcd711fa14f903 (diff)
QSV: adding HEVC10b decode support
-rw-r--r--contrib/ffmpeg/A05-hevc10b-decode.patch50
-rw-r--r--libhb/decavcodec.c8
2 files changed, 55 insertions, 3 deletions
diff --git a/contrib/ffmpeg/A05-hevc10b-decode.patch b/contrib/ffmpeg/A05-hevc10b-decode.patch
new file mode 100644
index 000000000..63b582641
--- /dev/null
+++ b/contrib/ffmpeg/A05-hevc10b-decode.patch
@@ -0,0 +1,50 @@
+diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
+index e19eba5..e9ad86c 100644
+--- a/libavcodec/qsvdec.c
++++ b/libavcodec/qsvdec.c
+@@ -416,6 +416,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
+ uint8_t *dummy_data;
+ int dummy_size;
+ int ret;
++ const AVPixFmtDescriptor *desc;
+
+ if (!q->avctx_internal) {
+ q->avctx_internal = avcodec_alloc_context3(NULL);
+@@ -452,8 +453,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
+
+ /* TODO: flush delayed frames on reinit */
+ if (q->parser->format != q->orig_pix_fmt ||
+- q->parser->coded_width != avctx->coded_width ||
+- q->parser->coded_height != avctx->coded_height) {
++ FFALIGN(q->parser->coded_width, 16) != FFALIGN(avctx->coded_width, 16) ||
++ FFALIGN(q->parser->coded_height, 16) != FFALIGN(avctx->coded_height, 16)) {
+ enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV,
+ AV_PIX_FMT_NONE,
+ AV_PIX_FMT_NONE };
+@@ -472,8 +473,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
+ avctx->pix_fmt = pix_fmts[1] = qsv_format;
+ avctx->width = q->parser->width;
+ avctx->height = q->parser->height;
+- avctx->coded_width = q->parser->coded_width;
+- avctx->coded_height = q->parser->coded_height;
++ avctx->coded_width = FFALIGN(q->parser->coded_width, 16);
++ avctx->coded_height = FFALIGN(q->parser->coded_height, 16);
+ avctx->level = q->avctx_internal->level;
+ avctx->profile = q->avctx_internal->profile;
+
+@@ -483,6 +484,15 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
+
+ avctx->pix_fmt = ret;
+
++ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
++ if (!desc)
++ goto reinit_fail;
++
++ if (desc->comp[0].depth > 8) {
++ avctx->coded_width = FFALIGN(q->parser->coded_width, 32);
++ avctx->coded_height = FFALIGN(q->parser->coded_height, 32);
++ }
++
+ ret = qsv_decode_init(avctx, q);
+ if (ret < 0)
+ goto reinit_fail;
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 8e32064a6..9838a0b51 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1116,7 +1116,7 @@ int reinit_video_filters(hb_work_private_t * pv)
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
{
// Can't use software filters when decoding with QSV opaque memory
- return;
+ return 0;
}
#endif
if (!pv->job)
@@ -1381,6 +1381,7 @@ static int decodeFrame( hb_work_object_t *w, packet_info_t * packet_info )
av_packet_unref(&avp);
if (ret < 0 && ret != AVERROR_EOF)
{
+ ++pv->decode_errors;
return 0;
}
@@ -2067,8 +2068,9 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info )
{
case AV_CODEC_ID_HEVC:
case AV_CODEC_ID_H264:
- if (pv->context->pix_fmt == AV_PIX_FMT_YUV420P ||
- pv->context->pix_fmt == AV_PIX_FMT_YUVJ420P)
+ if (pv->context->pix_fmt == AV_PIX_FMT_YUV420P ||
+ pv->context->pix_fmt == AV_PIX_FMT_YUVJ420P ||
+ pv->context->pix_fmt == AV_PIX_FMT_YUV420P10LE)
{
info->video_decode_support |= HB_DECODE_SUPPORT_QSV;
}