Browse files

xvba: fix deinterlacing after 818b4b5

  • Loading branch information...
1 parent f669df5 commit bf725cfea8387e893fc7b12184b39a6dd54260a7 @FernetMenta committed Dec 16, 2011
Showing with 33 additions and 16 deletions.
  1. +30 −16 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
  2. +3 −0 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
View
46 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -281,7 +281,6 @@ bool CLinuxRendererGL::Configure(unsigned int width, unsigned int height, unsign
// Ensure that textures are recreated and rendering starts only after the 1st
// frame is loaded after every call to Configure().
- Flush();
m_bValidated = false;
for (int i = 0 ; i<m_NumYV12Buffers ; i++)
@@ -2495,11 +2494,13 @@ bool CLinuxRendererGL::CreateXVBATexture(int index)
im.height = m_sourceHeight;
im.width = m_sourceWidth;
- plane.texwidth = im.width;
- plane.texheight = im.height;
-
- plane.pixpertex_x = 1;
- plane.pixpertex_y = 1;
+ for(int f = 0;f<MAX_FIELDS;f++)
+ {
+ fields[f][0].texwidth = im.width;
+ fields[f][0].texheight = im.height;
+ fields[f][0].pixpertex_x = 1;
+ fields[f][0].pixpertex_y = 1;
+ }
glGenTextures(1, &planeFallback.id);
plane.id = planeFallback.id;
@@ -2515,13 +2516,14 @@ void CLinuxRendererGL::UploadXVBATexture(int index)
XVBA::CDecoder *xvba = m_buffers[index].xvba;
YUVFIELDS &fields = m_buffers[index].fields;
- YUVPLANE &plane = fields[0][1];
+ YUVPLANE &planeFallback = fields[0][1];
+ YUVPLANE &plane = fields[m_currentField][0];
if (!xvba)
{
- fields[0][0].id = plane.id;
- fields[1][0].id = plane.id;
- fields[2][0].id = plane.id;
+ fields[0][0].id = planeFallback.id;
+ fields[1][0].id = planeFallback.id;
+ fields[2][0].id = planeFallback.id;
m_eventTexturesDone[index]->Set();
return;
}
@@ -2536,14 +2538,26 @@ void CLinuxRendererGL::UploadXVBATexture(int index)
glEnable(m_textureTarget);
if (xvba->UploadTexture(index, field, m_textureTarget) == 1)
- fields[m_currentField][0].id = xvba->GetTexture(index, field);
+ plane.id = xvba->GetTexture(index, field);
+ // crop texture
CRect crop = xvba->GetCropRect();
- m_sourceRect.x1 += crop.x1;
- m_sourceRect.x2 -= m_sourceWidth - crop.x2;
- m_sourceRect.y1 += crop.y1;
- m_sourceRect.y2 -= m_sourceHeight - crop.y2;
- CalculateTextureSourceRects(index, 1);
+ plane.rect = m_sourceRect;
+ plane.rect.x1 += crop.x1;
+ plane.rect.x2 -= m_sourceWidth - crop.x2;
+ plane.rect.y1 += crop.y1;
+ plane.rect.y2 -= m_sourceHeight - crop.y2;
+ plane.rect.y1 /= plane.pixpertex_y;
+ plane.rect.y2 /= plane.pixpertex_y;
+ plane.rect.x1 /= plane.pixpertex_x;
+ plane.rect.x2 /= plane.pixpertex_x;
+ if (m_textureTarget == GL_TEXTURE_2D)
+ {
+ plane.rect.y1 /= plane.texheight;
+ plane.rect.y2 /= plane.texheight;
+ plane.rect.x1 /= plane.texwidth;
+ plane.rect.x2 /= plane.texwidth;
+ }
glDisable(m_textureTarget);
View
3 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
@@ -1257,6 +1257,7 @@ int CDecoder::UploadTexture(int index, XVBA_SURFACE_FLAG field, GLenum textureTa
return -1;
}
m_flipBuffer[index].glSurface[i] = surfOutput.surface;
+ CLog::Log(LOGDEBUG, "XVBA::GetTexture - created shared surface");
}
XVBA_Transfer_Surface_Input transInput;
@@ -1326,11 +1327,13 @@ void CDecoder::FinishGL()
{
glDeleteTextures(1, &m_flipBuffer[i].glTexture[j]);
m_flipBuffer[i].glTexture[j] = 0;
+ CLog::Log(LOGDEBUG, "XVBA::FinishGL - destroyed texture, index: %d, field %d", i, j);
}
if (m_flipBuffer[i].glSurface[j] && m_xvbaSession)
{
g_XVBA_vtable.DestroySurface(m_flipBuffer[i].glSurface[j]);
m_flipBuffer[i].glSurface[j] = 0;
+ CLog::Log(LOGDEBUG, "XVBA::FinishGL - destroyed shared surface");
}
}
}

0 comments on commit bf725cf

Please sign in to comment.