Permalink
Browse files

vdpau: observe ffmpeg tags for color space

  • Loading branch information...
1 parent 706e10f commit 54aa00c024edfc2ca175bb186f4c5cc728066b4b @FernetMenta committed Dec 12, 2012
Showing with 27 additions and 12 deletions.
  1. +26 −12 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
  2. +1 −0 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
@@ -907,6 +907,7 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame)
memset(&pic.DVDPic, 0, sizeof(pic.DVDPic));
((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&pic.DVDPic);
pic.render = render;
+ pic.DVDPic.color_matrix = avctx->colorspace;
m_bufferStats.IncDecoded();
m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic));
@@ -1513,10 +1514,6 @@ void CMixer::InitCSCMatrix(int Width)
m_Procamp.contrast = 1.0;
m_Procamp.saturation = 1.0;
m_Procamp.hue = 0;
- vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp,
- (Width < 1000)? VDP_COLOR_STANDARD_ITUR_BT_601 : VDP_COLOR_STANDARD_ITUR_BT_709,
- &m_CSCMatrix);
- CheckStatus(vdp_st, __LINE__);
}
void CMixer::CheckFeatures()
@@ -1527,11 +1524,13 @@ void CMixer::CheckFeatures()
m_Upscale = m_config.upscale;
}
if (m_Brightness != g_settings.m_currentVideoSettings.m_Brightness ||
- m_Contrast != g_settings.m_currentVideoSettings.m_Contrast)
+ m_Contrast != g_settings.m_currentVideoSettings.m_Contrast ||
+ m_ColorMatrix != m_mixerInput[1].DVDPic.color_matrix)
{
SetColor();
m_Brightness = g_settings.m_currentVideoSettings.m_Brightness;
m_Contrast = g_settings.m_currentVideoSettings.m_Contrast;
+ m_ColorMatrix = m_mixerInput[1].DVDPic.color_matrix;
}
if (m_NoiseReduction != g_settings.m_currentVideoSettings.m_NoiseReduction)
{
@@ -1615,13 +1614,27 @@ void CMixer::SetColor()
m_Procamp.contrast = (float)((g_settings.m_currentVideoSettings.m_Contrast)+50) / 100;
VdpColorStandard colorStandard;
-// if(vid_height >= 600 || vid_width > 1024)
- if(m_config.surfaceWidth > 1000)
- colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709;
- //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_709, &m_CSCMatrix);
- else
- colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601;
- //vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix);
+ switch(m_mixerInput[1].DVDPic.color_matrix)
+ {
+ case AVCOL_SPC_BT709:
+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709;
+ break;
+ case AVCOL_SPC_BT470BG:
+ case AVCOL_SPC_SMPTE170M:
+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601;
+ break;
+ case AVCOL_SPC_SMPTE240M:
+ colorStandard = VDP_COLOR_STANDARD_SMPTE_240M;
+ break;
+ case AVCOL_SPC_FCC:
+ case AVCOL_SPC_UNSPECIFIED:
+ case AVCOL_SPC_RGB:
+ default:
+ if(m_config.surfaceWidth > 1000)
+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_709;
+ else
+ colorStandard = VDP_COLOR_STANDARD_ITUR_BT_601;
+ }
VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX };
vdp_st = m_config.vdpProcs.vdp_generate_csc_matrix(&m_Procamp, colorStandard, &m_CSCMatrix);
@@ -1952,6 +1965,7 @@ void CMixer::Init()
m_Sharpness = 0.0;
m_DeintMode = 0;
m_Deint = 0;
+ m_ColorMatrix = 0;
m_PostProc = false;
m_vdpError = false;
@@ -334,6 +334,7 @@ class CMixer : private CThread
int m_DeintMode;
int m_Deint;
int m_Upscale;
+ unsigned int m_ColorMatrix : 4;
uint32_t *m_BlackBar;
VdpVideoMixerPictureStructure m_mixerfield;
int m_mixerstep;

0 comments on commit 54aa00c

Please sign in to comment.