Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-09-18 16:59:59 +0300
committerMark Thompson <sw@jkqxz.net>2016-11-22 01:13:41 +0300
commit478a4b7e6d3ec51ba80e77f6dc3df75d9f6de66b (patch)
tree4026b9badcfc843a2448d49ca9c1577d67e54b7a /libavcodec/vaapi_encode_mjpeg.c
parentc8241e730f116f1c9cfc0b34110aa7f052e05332 (diff)
vaapi_encode: Check packed header capabilities
This improves behaviour with drivers which do not support packed headers, such as AMD VCE on mesa/gallium. (cherry picked from commit 892bbbcdc171ff0d08d69636a240ffb95f54243c)
Diffstat (limited to 'libavcodec/vaapi_encode_mjpeg.c')
-rw-r--r--libavcodec/vaapi_encode_mjpeg.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index 3ca902a6af..3afce28a10 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -345,6 +345,17 @@ static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
+ // Hack: the implementation calls the JPEG image header (which we
+ // will use in the same way as a slice header) generic "raw data".
+ // Therefore, if after the packed header capability check we have
+ // PACKED_HEADER_RAW_DATA available, rewrite it as
+ // PACKED_HEADER_SLICE so that the header-writing code can do the
+ // right thing.
+ if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_RAW_DATA) {
+ ctx->va_packed_headers &= ~VA_ENC_PACKED_HEADER_RAW_DATA;
+ ctx->va_packed_headers |= VA_ENC_PACKED_HEADER_SLICE;
+ }
+
vaapi_encode_mjpeg_init_tables(avctx);
return 0;
@@ -380,6 +391,10 @@ static av_cold int vaapi_encode_mjpeg_init(AVCodecContext *avctx)
ctx->va_rc_mode = VA_RC_CQP;
+ // The JPEG image header - see note above.
+ ctx->va_packed_headers =
+ VA_ENC_PACKED_HEADER_RAW_DATA;
+
ctx->surface_width = FFALIGN(avctx->width, 8);
ctx->surface_height = FFALIGN(avctx->height, 8);