diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-03-02 10:15:30 +0000 |
---|---|---|
committer | Anton Fedchin <afedchin@ruswizards.com> | 2014-03-07 21:18:49 +0400 |
commit | 97395962c2fa0f20bec2ed2668e4d0af57e01d74 (patch) | |
tree | 00214e5fd993bc1bdf738afdbfc9a3e63b00603f /lib | |
parent | e7b64acb3a7947d77e50d5bd89c1d5ec1bc396f0 (diff) |
ffmpeg: dxva2_h264: add a workaround for old intel GPUs
Old Intel GPUs expect the reference frame index to the actual surface,
instead of the index into RefFrameList as specified by the spec.
This workaround should be set when using one of the "ClearVideo" decoder
devices.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ffmpeg/libavcodec/dxva2.h | 1 | ||||
-rw-r--r-- | lib/ffmpeg/libavcodec/dxva2_h264.c | 8 | ||||
-rw-r--r-- | lib/ffmpeg/patches/0070-dxva2_h264-add-a-workaround-for-old-intel-GPUs.patch | 60 |
3 files changed, 68 insertions, 1 deletions
diff --git a/lib/ffmpeg/libavcodec/dxva2.h b/lib/ffmpeg/libavcodec/dxva2.h index ac39e06917..2639d89d90 100644 --- a/lib/ffmpeg/libavcodec/dxva2.h +++ b/lib/ffmpeg/libavcodec/dxva2.h @@ -49,6 +49,7 @@ */ #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface /** * This structure is used to provides the necessary configurations and data diff --git a/lib/ffmpeg/libavcodec/dxva2_h264.c b/lib/ffmpeg/libavcodec/dxva2_h264.c index cc6d8307bc..cbb05e2dd0 100644 --- a/lib/ffmpeg/libavcodec/dxva2_h264.c +++ b/lib/ffmpeg/libavcodec/dxva2_h264.c @@ -115,6 +115,8 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context pp->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; if (ctx->workaround & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) pp->Reserved16Bits = 0; + else if (ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) + pp->Reserved16Bits = 0x34c; else pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */ pp->StatusReportFeedbackNumber = 1 + ctx->report_id++; @@ -238,7 +240,11 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, if (list < h->list_count && i < h->ref_count[list]) { const Picture *r = &h->ref_list[list][i]; unsigned plane; - unsigned index = get_refpic_index(pp, ff_dxva2_get_surface_index(ctx, r)); + unsigned index; + if (ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) + index = ff_dxva2_get_surface_index(ctx, r); + else + index = get_refpic_index(pp, ff_dxva2_get_surface_index(ctx, r)); fill_picture_entry(&slice->RefPicList[list][i], index, r->f.reference == PICT_BOTTOM_FIELD); for (plane = 0; plane < 3; plane++) { diff --git a/lib/ffmpeg/patches/0070-dxva2_h264-add-a-workaround-for-old-intel-GPUs.patch b/lib/ffmpeg/patches/0070-dxva2_h264-add-a-workaround-for-old-intel-GPUs.patch new file mode 100644 index 0000000000..d87b19f433 --- /dev/null +++ b/lib/ffmpeg/patches/0070-dxva2_h264-add-a-workaround-for-old-intel-GPUs.patch @@ -0,0 +1,60 @@ +From patchwork Sat Mar 2 11:15:30 2013 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [2/2] dxva2_h264: add a workaround for old intel GPUs +Date: Sat, 02 Mar 2013 10:15:30 -0000 +From: Hendrik Leppkes <h.leppkes@gmail.com> +X-Patchwork-Id: 35321 +Message-Id: <1362222930-4764-3-git-send-email-h.leppkes@gmail.com> +To: libav-devel@libav.org + +Old Intel GPUs expect the reference frame index to the actual surface, +instead of the index into RefFrameList as specified by the spec. + +This workaround should be set when using one of the "ClearVideo" decoder +devices. + +--- +libavcodec/dxva2.h | 1 + + libavcodec/dxva2_h264.c | 8 +++++++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h +index d161eb9..78939be 100644 +--- a/libavcodec/dxva2.h ++++ b/libavcodec/dxva2.h +@@ -42,6 +42,7 @@ + */ + + #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards ++#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + + /** + * This structure is used to provides the necessary configurations and data +diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c +index 9dcb005..4b3f83c 100644 +--- a/libavcodec/dxva2_h264.c ++++ b/libavcodec/dxva2_h264.c +@@ -115,6 +115,8 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context + pp->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; + if (ctx->workaround & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) + pp->Reserved16Bits = 0; ++ else if (ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) ++ pp->Reserved16Bits = 0x34c; + else + pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */ + pp->StatusReportFeedbackNumber = 1 + ctx->report_id++; +@@ -238,7 +240,11 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, + if (list < h->list_count && i < h->ref_count[list]) { + const Picture *r = &h->ref_list[list][i]; + unsigned plane; +- unsigned index = get_refpic_index(pp, ff_dxva2_get_surface_index(ctx, r)); ++ unsigned index; ++ if (ctx->workaround & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) ++ index = ff_dxva2_get_surface_index(ctx, r); ++ else ++ index = get_refpic_index(pp, ff_dxva2_get_surface_index(ctx, r)); + fill_picture_entry(&slice->RefPicList[list][i], index, + r->f.reference == PICT_BOTTOM_FIELD); + for (plane = 0; plane < 3; plane++) { |