Skip to content
Browse files

Merge pull request #3615 from FernetMenta/vdpau

vdpau: move cropping of top and bottom lines to renderer
  • Loading branch information...
2 parents dcacc8d + b48efa1 commit 76b5b1c489f175f5b4643a9c0e5655124312ed20 @FernetMenta FernetMenta committed Dec 9, 2013
View
33 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -1536,7 +1536,6 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field)
// make sure we know the correct texture size
GetPlaneTextureSize(plane);
- CalculateTextureSourceRects(index, 1);
// Try some clamping or wrapping
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -1583,10 +1582,10 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field)
}
else
{
- glTexCoord2f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y); glVertex4f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y, 0.0f, 0.0f);
- glTexCoord2f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y); glVertex4f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y, 1.0f, 0.0f);
- glTexCoord2f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y); glVertex4f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y, 1.0f, 1.0f);
- glTexCoord2f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y); glVertex4f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y, 0.0f, 1.0f);
+ glTexCoord2f(plane.rect.x1, plane.rect.y1); glVertex4f(m_rotatedDestCoords[0].x, m_rotatedDestCoords[0].y, 0.0f, 0.0f);
+ glTexCoord2f(plane.rect.x2, plane.rect.y1); glVertex4f(m_rotatedDestCoords[1].x, m_rotatedDestCoords[1].y, 1.0f, 0.0f);
+ glTexCoord2f(plane.rect.x2, plane.rect.y2); glVertex4f(m_rotatedDestCoords[2].x, m_rotatedDestCoords[2].y, 1.0f, 1.0f);
+ glTexCoord2f(plane.rect.x1, plane.rect.y2); glVertex4f(m_rotatedDestCoords[3].x, m_rotatedDestCoords[3].y, 0.0f, 1.0f);
}
glEnd();
VerifyGLState();
@@ -2407,23 +2406,27 @@ bool CLinuxRendererGL::UploadVDPAUTexture(int index)
plane.id = vdpau->texture[0];
+ // in stereoscopic mode sourceRect may only
+ // be a part of the source video surface
plane.rect = m_sourceRect;
- plane.width = im.width;
- plane.height = im.height;
- plane.height /= plane.pixpertex_y;
- plane.rect.y1 /= plane.pixpertex_y;
- plane.rect.y2 /= plane.pixpertex_y;
- plane.width /= plane.pixpertex_x;
- plane.rect.x1 /= plane.pixpertex_x;
- plane.rect.x2 /= plane.pixpertex_x;
+ // clip rect
+ if (vdpau->crop.x1 > plane.rect.x1)
+ plane.rect.x1 = vdpau->crop.x1;
+ if (vdpau->crop.x2 < plane.rect.x2)
+ plane.rect.x2 = vdpau->crop.x2;
+ if (vdpau->crop.y1 > plane.rect.y1)
+ plane.rect.y1 = vdpau->crop.y1;
+ if (vdpau->crop.y2 < plane.rect.y2)
+ plane.rect.y2 = vdpau->crop.y2;
+
+ plane.texheight = vdpau->texHeight;
+ plane.texwidth = vdpau->texWidth;
if (m_textureTarget == GL_TEXTURE_2D)
{
- plane.height /= plane.texheight;
plane.rect.y1 /= plane.texheight;
plane.rect.y2 /= plane.texheight;
- plane.width /= plane.texwidth;
plane.rect.x1 /= plane.texwidth;
plane.rect.x2 /= plane.texwidth;
}
View
49 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -1682,11 +1682,6 @@ void CMixer::CreateVdpauMixer()
&m_videoMixer);
CheckStatus(vdp_st, __LINE__);
- // create 3 pitches of black lines needed for clipping top
- // and bottom lines when de-interlacing
- m_BlackBar = new uint32_t[3*m_config.outWidth];
- memset(m_BlackBar, 0, 3*m_config.outWidth*sizeof(uint32_t));
-
}
void CMixer::InitCSCMatrix(int Width)
@@ -2223,6 +2218,8 @@ void CMixer::Init()
m_Sharpness = 0.0;
m_DeintMode = 0;
m_Deint = 0;
+ m_Upscale = 0;
+ m_SeenInterlaceFlag = false;
m_ColorMatrix = 0;
m_PostProc = false;
m_vdpError = false;
@@ -2241,8 +2238,6 @@ void CMixer::Uninit()
m_outputSurfaces.pop();
}
m_config.context->GetProcs().vdp_video_mixer_destroy(m_videoMixer);
-
- delete [] m_BlackBar;
}
void CMixer::Flush()
@@ -2294,6 +2289,7 @@ void CMixer::InitCycle()
EDEINTERLACEMODE mode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode;
EINTERLACEMETHOD method = GetDeinterlacingMethod();
bool interlaced = m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_INTERLACED;
+ m_SeenInterlaceFlag |= interlaced;
// TODO
if (//!(flags & DVP_FLAG_NO_POSTPROC) &&
@@ -2377,6 +2373,12 @@ void CMixer::InitCycle()
m_processPicture.outputSurface = m_outputSurfaces.front();
m_mixerInput[1].DVDPic.iWidth = m_config.outWidth;
m_mixerInput[1].DVDPic.iHeight = m_config.outHeight;
+ if (m_SeenInterlaceFlag)
+ {
+ double ratio = (double)m_mixerInput[1].DVDPic.iDisplayHeight / m_mixerInput[1].DVDPic.iHeight;
+ m_mixerInput[1].DVDPic.iHeight -= 6;
+ m_mixerInput[1].DVDPic.iDisplayHeight = lrint(ratio*m_mixerInput[1].DVDPic.iHeight);
+ }
}
else
{
@@ -2511,32 +2513,6 @@ void CMixer::ProcessPicture()
0,
NULL);
CheckStatus(vdp_st, __LINE__);
-
- if (m_mixerfield != VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME)
- {
- // in order to clip top and bottom lines when de-interlacing
- // we black those lines as a work around for not working
- // background colour using the mixer
- // pixel perfect is preferred over overscanning or zooming
-
- VdpRect clipRect = destRect;
- clipRect.y1 = clipRect.y0 + 2;
- uint32_t *data[] = {m_BlackBar};
- uint32_t pitches[] = {destRect.x1};
- vdp_st = m_config.context->GetProcs().vdp_output_surface_put_bits_native(m_processPicture.outputSurface,
- (void**)data,
- pitches,
- &clipRect);
- CheckStatus(vdp_st, __LINE__);
-
- clipRect = destRect;
- clipRect.y0 = clipRect.y1 - 2;
- vdp_st = m_config.context->GetProcs().vdp_output_surface_put_bits_native(m_processPicture.outputSurface,
- (void**)data,
- pitches,
- &clipRect);
- CheckStatus(vdp_st, __LINE__);
- }
}
@@ -3067,7 +3043,12 @@ CVdpauRenderPicture* COutput::ProcessMixerPicture()
GLMapSurfaces();
retPic->sourceIdx = procPic.outputSurface;
retPic->texture[0] = m_bufferPool.glOutputSurfaceMap[procPic.outputSurface].texture[0];
- retPic->crop = CRect(0,0,0,0);
+ retPic->texWidth = m_config.outWidth;
+ retPic->texHeight = m_config.outHeight;
+ retPic->crop.x1 = 0;
+ retPic->crop.y1 = (m_config.outHeight - retPic->DVDPic.iHeight) / 2;
+ retPic->crop.x2 = m_config.outWidth;
+ retPic->crop.y2 = m_config.outHeight - retPic->crop.y1;
}
else
{
View
2 xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
@@ -330,8 +330,8 @@ class CMixer : private CThread
int m_DeintMode;
int m_Deint;
int m_Upscale;
+ bool m_SeenInterlaceFlag;
unsigned int m_ColorMatrix : 4;
- uint32_t *m_BlackBar;
VdpVideoMixerPictureStructure m_mixerfield;
int m_mixerstep;
int m_mixersteps;

0 comments on commit 76b5b1c

Please sign in to comment.
Something went wrong with that request. Please try again.