mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavu/hwcontext_qsv: add support for 12bit content on Linux
P012, Y212 and XV36 are used for 12bit content in FFmpeg VAAPI, so these formats should be used in FFmpeg QSV too, however the SDK only declares support for P016, Y216 and Y416. So this commit fudged mappings between AV_PIX_FMT_P012 and MFX_FOURCC_P016, AV_PIX_FMT_Y212 and MFX_FOURCC_Y216, AV_PIX_FMT_XV36 and MFX_FOURCC_Y416. Signed-off-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
This commit is contained in:
parent
1898dbddd5
commit
201cb35061
@ -128,6 +128,20 @@ static const struct {
|
||||
// the SDK only delares support for Y410
|
||||
{ AV_PIX_FMT_XV30,
|
||||
MFX_FOURCC_Y410, 0 },
|
||||
#if QSV_VERSION_ATLEAST(1, 31)
|
||||
// P012 is used for VAAPI child device,
|
||||
// the SDK only delares support for P016
|
||||
{ AV_PIX_FMT_P012,
|
||||
MFX_FOURCC_P016, 1 },
|
||||
// Y212 is used for VAAPI child device,
|
||||
// the SDK only delares support for Y216
|
||||
{ AV_PIX_FMT_Y212,
|
||||
MFX_FOURCC_Y216, 1 },
|
||||
// XV36 is used for VAAPI child device,
|
||||
// the SDK only delares support for Y416
|
||||
{ AV_PIX_FMT_XV36,
|
||||
MFX_FOURCC_Y416, 1 },
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1493,6 +1507,7 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
|
||||
switch (frame->format) {
|
||||
case AV_PIX_FMT_NV12:
|
||||
case AV_PIX_FMT_P010:
|
||||
case AV_PIX_FMT_P012:
|
||||
surface->Data.Y = frame->data[0];
|
||||
surface->Data.UV = frame->data[1];
|
||||
break;
|
||||
@ -1517,6 +1532,7 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
|
||||
break;
|
||||
|
||||
case AV_PIX_FMT_Y210:
|
||||
case AV_PIX_FMT_Y212:
|
||||
surface->Data.Y16 = (mfxU16 *)frame->data[0];
|
||||
surface->Data.U16 = (mfxU16 *)frame->data[0] + 1;
|
||||
surface->Data.V16 = (mfxU16 *)frame->data[0] + 3;
|
||||
@ -1532,6 +1548,14 @@ static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
|
||||
case AV_PIX_FMT_XV30:
|
||||
surface->Data.U = frame->data[0];
|
||||
break;
|
||||
case AV_PIX_FMT_XV36:
|
||||
surface->Data.U = frame->data[0];
|
||||
surface->Data.Y = frame->data[0] + 2;
|
||||
surface->Data.V = frame->data[0] + 4;
|
||||
// Only set Data.A to a valid address, the SDK doesn't
|
||||
// use the value from the frame.
|
||||
surface->Data.A = frame->data[0] + 6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
|
Loading…
Reference in New Issue
Block a user