mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Add vaapi color space conversion.
This commit is contained in:
parent
d3b98b90f4
commit
92bb00c410
16
video.c
16
video.c
@ -918,7 +918,6 @@ struct _vaapi_decoder_
|
|||||||
|
|
||||||
/// flags for put surface for different resolutions groups
|
/// flags for put surface for different resolutions groups
|
||||||
unsigned SurfaceFlagsTable[VideoResolutionMax];
|
unsigned SurfaceFlagsTable[VideoResolutionMax];
|
||||||
unsigned SurfaceFlags; ///< current flags for put surface
|
|
||||||
|
|
||||||
enum PixelFormat PixFmt; ///< ffmpeg frame pixfmt
|
enum PixelFormat PixFmt; ///< ffmpeg frame pixfmt
|
||||||
int WrongInterlacedWarned; ///< warning about interlace flag issued
|
int WrongInterlacedWarned; ///< warning about interlace flag issued
|
||||||
@ -1169,8 +1168,12 @@ static void VaapiInitSurfaceFlags(VaapiDecoder * decoder)
|
|||||||
|
|
||||||
for (i = 0; i < VideoResolutionMax; ++i) {
|
for (i = 0; i < VideoResolutionMax; ++i) {
|
||||||
decoder->SurfaceFlagsTable[i] = VA_CLEAR_DRAWABLE;
|
decoder->SurfaceFlagsTable[i] = VA_CLEAR_DRAWABLE;
|
||||||
// FIXME: color space conversion none, ITU-R BT.601, ITU-R BT.709
|
// color space conversion none, ITU-R BT.601, ITU-R BT.709
|
||||||
|
if (i > VideoResolution567i) {
|
||||||
|
decoder->SurfaceFlagsTable[i] |= VA_SRC_BT709;
|
||||||
|
} else {
|
||||||
decoder->SurfaceFlagsTable[i] |= VA_SRC_BT601;
|
decoder->SurfaceFlagsTable[i] |= VA_SRC_BT601;
|
||||||
|
}
|
||||||
|
|
||||||
// scaling flags FAST, HQ, NL_ANAMORPHIC
|
// scaling flags FAST, HQ, NL_ANAMORPHIC
|
||||||
// FIXME: need to detect the backend to choose the parameter
|
// FIXME: need to detect the backend to choose the parameter
|
||||||
@ -1236,7 +1239,6 @@ static VaapiDecoder *VaapiNewDecoder(void)
|
|||||||
decoder->Window = VideoWindow;
|
decoder->Window = VideoWindow;
|
||||||
|
|
||||||
VaapiInitSurfaceFlags(decoder);
|
VaapiInitSurfaceFlags(decoder);
|
||||||
decoder->SurfaceFlags = decoder->SurfaceFlagsTable[0];
|
|
||||||
|
|
||||||
decoder->DeintImages[0].image_id = VA_INVALID_ID;
|
decoder->DeintImages[0].image_id = VA_INVALID_ID;
|
||||||
decoder->DeintImages[1].image_id = VA_INVALID_ID;
|
decoder->DeintImages[1].image_id = VA_INVALID_ID;
|
||||||
@ -1776,7 +1778,6 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
|
|||||||
decoder->Resolution =
|
decoder->Resolution =
|
||||||
VideoResolutionGroup(video_ctx->width, video_ctx->height,
|
VideoResolutionGroup(video_ctx->width, video_ctx->height,
|
||||||
decoder->Interlaced);
|
decoder->Interlaced);
|
||||||
decoder->SurfaceFlags = decoder->SurfaceFlagsTable[decoder->Resolution];
|
|
||||||
// FIXME: need only to create and destroy surfaces for size changes
|
// FIXME: need only to create and destroy surfaces for size changes
|
||||||
// or when number of needed surfaces changed!
|
// or when number of needed surfaces changed!
|
||||||
VaapiCreateSurfaces(decoder, video_ctx->width, video_ctx->height);
|
VaapiCreateSurfaces(decoder, video_ctx->width, video_ctx->height);
|
||||||
@ -1875,7 +1876,8 @@ static void VaapiPutSurfaceX11(VaapiDecoder * decoder, VASurfaceID surface,
|
|||||||
// video dst
|
// video dst
|
||||||
decoder->OutputX, decoder->OutputY, decoder->OutputWidth,
|
decoder->OutputX, decoder->OutputY, decoder->OutputWidth,
|
||||||
decoder->OutputHeight, NULL, 0,
|
decoder->OutputHeight, NULL, 0,
|
||||||
type | decoder->SurfaceFlags)) != VA_STATUS_SUCCESS) {
|
type | decoder->SurfaceFlagsTable[decoder->Resolution])) !=
|
||||||
|
VA_STATUS_SUCCESS) {
|
||||||
// switching video kills VdpPresentationQueueBlockUntilSurfaceIdle
|
// switching video kills VdpPresentationQueueBlockUntilSurfaceIdle
|
||||||
Error(_("video/vaapi: vaPutSurface failed %d\n"), status);
|
Error(_("video/vaapi: vaPutSurface failed %d\n"), status);
|
||||||
}
|
}
|
||||||
@ -1994,7 +1996,8 @@ static void VaapiPutSurfaceGLX(VaapiDecoder * decoder, VASurfaceID surface,
|
|||||||
}
|
}
|
||||||
start = GetMsTicks();
|
start = GetMsTicks();
|
||||||
if (vaCopySurfaceGLX(decoder->VaDisplay, decoder->GlxSurface[0], surface,
|
if (vaCopySurfaceGLX(decoder->VaDisplay, decoder->GlxSurface[0], surface,
|
||||||
type | decoder->SurfaceFlags) != VA_STATUS_SUCCESS) {
|
type | decoder->SurfaceFlagsTable[decoder->Resolution]) !=
|
||||||
|
VA_STATUS_SUCCESS) {
|
||||||
Error(_("video/glx: vaCopySurfaceGLX failed\n"));
|
Error(_("video/glx: vaCopySurfaceGLX failed\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2116,7 +2119,6 @@ static void VaapiSetup(VaapiDecoder * decoder,
|
|||||||
// FIXME: interlaced not valid here?
|
// FIXME: interlaced not valid here?
|
||||||
decoder->Resolution =
|
decoder->Resolution =
|
||||||
VideoResolutionGroup(width, height, decoder->Interlaced);
|
VideoResolutionGroup(width, height, decoder->Interlaced);
|
||||||
decoder->SurfaceFlags = decoder->SurfaceFlagsTable[decoder->Resolution];
|
|
||||||
VaapiCreateSurfaces(decoder, width, height);
|
VaapiCreateSurfaces(decoder, width, height);
|
||||||
|
|
||||||
#ifdef USE_GLX
|
#ifdef USE_GLX
|
||||||
|
Loading…
Reference in New Issue
Block a user