diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2013-12-09 11:32:46 -0800 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2013-12-09 11:32:46 -0800 |
commit | 76b5b1c489f175f5b4643a9c0e5655124312ed20 (patch) | |
tree | c1dd132e401bc725ccc6c67ae33671f5f94c855a | |
parent | dcacc8d955ec0aa967286f261d95f023f54c4130 (diff) | |
parent | b48efa197b30b99eb8d1fe27fdbd70ac0d64d523 (diff) |
Merge pull request #3615 from FernetMenta/vdpau
vdpau: move cropping of top and bottom lines to renderer
-rw-r--r-- | xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 33 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 49 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h | 2 |
3 files changed, 34 insertions, 50 deletions
diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index aa52f721ee..801ecb2919 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/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; } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp index 97dea48df9..277802fc1a 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +++ b/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 { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h index abe8da2590..2dd3c28314 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h @@ -330,8 +330,8 @@ protected: 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; |