1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc/qsv: Add support for decoding & encoding 8bit 4:4:4 content

AV_PIX_FMT_VUYX is used in FFmpeg and MFX_FOURCC_AYUV is used in the SDK

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
This commit is contained in:
Haihao Xiang 2022-09-06 12:53:38 +08:00
parent b7dbffe698
commit db85e01fd7
4 changed files with 18 additions and 0 deletions

View File

@ -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);
}

View File

@ -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, \

View File

@ -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,

View File

@ -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,