summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-01-13 12:28:56 +0100
committerJohns <johns98@gmx.net>2012-01-13 12:28:56 +0100
commit92bb00c410726a203849137fd13cf8e10ed75861 (patch)
tree60b25c138217000db1719a47b9326fffcad179f6
parentd3b98b90f47846a788d11f4bebb5a30a544926e9 (diff)
downloadvdr-plugin-softhddevice-92bb00c410726a203849137fd13cf8e10ed75861.tar.gz
vdr-plugin-softhddevice-92bb00c410726a203849137fd13cf8e10ed75861.tar.bz2
Add vaapi color space conversion.
-rw-r--r--video.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/video.c b/video.c
index a48222e..02ecde1 100644
--- a/video.c
+++ b/video.c
@@ -918,7 +918,6 @@ struct _vaapi_decoder_
/// flags for put surface for different resolutions groups
unsigned SurfaceFlagsTable[VideoResolutionMax];
- unsigned SurfaceFlags; ///< current flags for put surface
enum PixelFormat PixFmt; ///< ffmpeg frame pixfmt
int WrongInterlacedWarned; ///< warning about interlace flag issued
@@ -1169,8 +1168,12 @@ static void VaapiInitSurfaceFlags(VaapiDecoder * decoder)
for (i = 0; i < VideoResolutionMax; ++i) {
decoder->SurfaceFlagsTable[i] = VA_CLEAR_DRAWABLE;
- // FIXME: color space conversion none, ITU-R BT.601, ITU-R BT.709
- decoder->SurfaceFlagsTable[i] |= VA_SRC_BT601;
+ // 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;
+ }
// scaling flags FAST, HQ, NL_ANAMORPHIC
// FIXME: need to detect the backend to choose the parameter
@@ -1236,7 +1239,6 @@ static VaapiDecoder *VaapiNewDecoder(void)
decoder->Window = VideoWindow;
VaapiInitSurfaceFlags(decoder);
- decoder->SurfaceFlags = decoder->SurfaceFlagsTable[0];
decoder->DeintImages[0].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 =
VideoResolutionGroup(video_ctx->width, video_ctx->height,
decoder->Interlaced);
- decoder->SurfaceFlags = decoder->SurfaceFlagsTable[decoder->Resolution];
// FIXME: need only to create and destroy surfaces for size changes
// or when number of needed surfaces changed!
VaapiCreateSurfaces(decoder, video_ctx->width, video_ctx->height);
@@ -1875,7 +1876,8 @@ static void VaapiPutSurfaceX11(VaapiDecoder * decoder, VASurfaceID surface,
// video dst
decoder->OutputX, decoder->OutputY, decoder->OutputWidth,
decoder->OutputHeight, NULL, 0,
- type | decoder->SurfaceFlags)) != VA_STATUS_SUCCESS) {
+ type | decoder->SurfaceFlagsTable[decoder->Resolution])) !=
+ VA_STATUS_SUCCESS) {
// switching video kills VdpPresentationQueueBlockUntilSurfaceIdle
Error(_("video/vaapi: vaPutSurface failed %d\n"), status);
}
@@ -1994,7 +1996,8 @@ static void VaapiPutSurfaceGLX(VaapiDecoder * decoder, VASurfaceID surface,
}
start = GetMsTicks();
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"));
return;
}
@@ -2116,7 +2119,6 @@ static void VaapiSetup(VaapiDecoder * decoder,
// FIXME: interlaced not valid here?
decoder->Resolution =
VideoResolutionGroup(width, height, decoder->Interlaced);
- decoder->SurfaceFlags = decoder->SurfaceFlagsTable[decoder->Resolution];
VaapiCreateSurfaces(decoder, width, height);
#ifdef USE_GLX