diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 3449789a2c..51aac16695 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -211,6 +211,7 @@ enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc) #if CONFIG_VAAPI case MFX_FOURCC_YUY2: return AV_PIX_FMT_YUYV422; case MFX_FOURCC_Y210: return AV_PIX_FMT_Y210; + case MFX_FOURCC_AYUV: return AV_PIX_FMT_VUYX; #endif } return AV_PIX_FMT_NONE; @@ -243,6 +244,9 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) case AV_PIX_FMT_Y210: *fourcc = MFX_FOURCC_Y210; return AV_PIX_FMT_Y210; + case AV_PIX_FMT_VUYX: + *fourcc = MFX_FOURCC_AYUV; + return AV_PIX_FMT_VUYX; #endif default: return AVERROR(ENOSYS); @@ -277,6 +281,16 @@ int ff_qsv_map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface) surface->Data.U16 = (mfxU16 *)frame->data[0] + 1; surface->Data.V16 = (mfxU16 *)frame->data[0] + 3; break; + + case AV_PIX_FMT_VUYX: + surface->Data.V = frame->data[0]; + surface->Data.U = frame->data[0] + 1; + surface->Data.Y = frame->data[0] + 2; + // Only set Data.A to a valid address, the SDK doesn't + // use the value from the frame. + surface->Data.A = frame->data[0] + 3; + break; + default: return AVERROR(ENOSYS); } diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 0f0d719e23..0254a394bd 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -141,6 +141,7 @@ static int qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame, frame->linesize[0] = 2 * FFALIGN(avctx->width, 128); break; case AV_PIX_FMT_Y210: + case AV_PIX_FMT_VUYX: frame->linesize[0] = 4 * FFALIGN(avctx->width, 128); break; default: @@ -1041,6 +1042,7 @@ const FFCodec ff_##x##_qsv_decoder = { \ AV_PIX_FMT_P010, \ AV_PIX_FMT_YUYV422, \ AV_PIX_FMT_Y210, \ + AV_PIX_FMT_VUYX, \ AV_PIX_FMT_QSV, \ AV_PIX_FMT_NONE }, \ .hw_configs = qsv_hw_configs, \ diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 98e002a305..45b373d643 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -315,6 +315,7 @@ const FFCodec ff_hevc_qsv_encoder = { AV_PIX_FMT_QSV, AV_PIX_FMT_BGRA, AV_PIX_FMT_X2RGB10, + AV_PIX_FMT_VUYX, AV_PIX_FMT_NONE }, .p.priv_class = &class, .defaults = qsv_enc_defaults, diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c index 61d50156d3..044a882d1a 100644 --- a/libavcodec/qsvenc_vp9.c +++ b/libavcodec/qsvenc_vp9.c @@ -113,6 +113,7 @@ const FFCodec ff_vp9_qsv_encoder = { .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HYBRID, .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_P010, + AV_PIX_FMT_VUYX, AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .p.priv_class = &class,