Skip to content

Commit

Permalink
ADD: [imx] Deinterlacing options configurable from gui
Browse files Browse the repository at this point in the history
  • Loading branch information
smallint committed Mar 23, 2014
1 parent dffb67f commit 785313a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
38 changes: 29 additions & 9 deletions xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
Expand Up @@ -2723,7 +2723,7 @@ void CLinuxRendererGLES::SetTextureFilter(GLenum method)
void CLinuxRendererGLES::UploadIMXMAPTexture(int index)
{
#ifdef HAS_IMXVPU
YUVBUFFER& buf = m_buffers[index];
YUVBUFFER& buf = m_buffers[index];
CDVDVideoCodecBuffer* codecinfo = buf.codecinfo;

if(codecinfo)
Expand All @@ -2738,18 +2738,27 @@ void CLinuxRendererGLES::UploadIMXMAPTexture(int index)

YUVPLANE &plane = m_buffers[index].fields[0][0];
CDVDVideoCodecIPUBuffers *deinterlacer = (CDVDVideoCodecIPUBuffers*)codecinfo->data[2];
EDEINTERLACEMODE deinterlacemode = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode;
EINTERLACEMETHOD interlacemethod = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod;

if (deinterlacer)
{
CDVDVideoCodecBuffer *deint;
deint = deinterlacer->Process(codecinfo, (VpuFieldType)(int)codecinfo->data[3], false);
if (deint)
if (deinterlacemode != VS_DEINTERLACEMODE_OFF)
{
SAFE_RELEASE(buf.codecinfo);
buf.codecinfo = deint;
buf.codecinfo->Lock();
codecinfo = buf.codecinfo;
deinterlacer->SetEnabled(true);
CDVDVideoCodecBuffer *deint;
deint = deinterlacer->Process(codecinfo, (VpuFieldType)(int)codecinfo->data[3],
interlacemethod == VS_INTERLACEMETHOD_DEINTERLACE);
if (deint)
{
SAFE_RELEASE(buf.codecinfo);
buf.codecinfo = deint;
buf.codecinfo->Lock();
codecinfo = buf.codecinfo;
}
}
else
deinterlacer->SetEnabled(false);
}

glActiveTexture(GL_TEXTURE0);
Expand Down Expand Up @@ -2884,9 +2893,14 @@ bool CLinuxRendererGLES::Supports(EDEINTERLACEMODE mode)
if(m_renderMethod & RENDER_CVREF)
return false;

#ifdef HAS_IMXVPU
if(mode == VS_DEINTERLACEMODE_AUTO)
return true;
#else
if(mode == VS_DEINTERLACEMODE_AUTO
|| mode == VS_DEINTERLACEMODE_FORCE)
return true;
#endif

return false;
}
Expand Down Expand Up @@ -2915,6 +2929,7 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method)
if(method == VS_INTERLACEMETHOD_AUTO)
return true;

#ifndef HAS_IMXVPU
#if defined(__i386__) || defined(__x86_64__)
if(method == VS_INTERLACEMETHOD_DEINTERLACE
|| method == VS_INTERLACEMETHOD_DEINTERLACE_HALF
Expand All @@ -2923,6 +2938,11 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method)
if(method == VS_INTERLACEMETHOD_SW_BLEND)
#endif
return true;
#else
if(method == VS_INTERLACEMETHOD_DEINTERLACE
|| method == VS_INTERLACEMETHOD_DEINTERLACE_HALF)
return true;
#endif

return false;
}
Expand Down Expand Up @@ -2963,7 +2983,7 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod()
if(m_renderMethod & RENDER_CVREF)
return VS_INTERLACEMETHOD_NONE;

#if defined(__i386__) || defined(__x86_64__)
#if defined(__i386__) || defined(__x86_64__) || defined(HAS_IMXVPU)
return VS_INTERLACEMETHOD_DEINTERLACE_HALF;
#else
return VS_INTERLACEMETHOD_SW_BLEND;
Expand Down
15 changes: 12 additions & 3 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.cpp
Expand Up @@ -890,6 +890,15 @@ bool CDVDVideoCodecIMX::ClearPicture(DVDVideoPicture* pDvdVideoPicture)

bool CDVDVideoCodecIMX::GetPicture(DVDVideoPicture* pDvdVideoPicture)
{
#ifdef IMX_PROFILE
static unsigned int previous = 0;
unsigned int current;

current = XbmcThreads::SystemClockMillis();
CLog::Log(LOGDEBUG, "%s tm:%03d\n", __FUNCTION__, current - previous);
previous = current;
#endif

m_frameCounter++;

pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED;
Expand Down Expand Up @@ -1028,8 +1037,8 @@ bool CDVDVideoCodecIMXBuffer::Rendered() const

void CDVDVideoCodecIMXBuffer::Queue(VpuDecOutFrameInfo *frameInfo)
{
// No lock necessary because at the time Queue there is definitely no
// thread that is still holding a reference
// No lock necessary because at this time there is definitely no
// thread still holding a reference
m_frameBuffer = frameInfo->pDisplayFrameBuf;
m_rendered = false;

Expand Down Expand Up @@ -1363,7 +1372,7 @@ bool CDVDVideoCodecIPUBuffers::Reset()
m_buffers[i]->ReleaseFrameBuffer();
}

bool CDVDVideoCodecIPUBuffers::SetEnabled(bool enabled)
void CDVDVideoCodecIPUBuffers::SetEnabled(bool enabled)
{
m_bEnabled = enabled;
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecIMX.h
Expand Up @@ -137,7 +137,7 @@ class CDVDVideoCodecIPUBuffers

bool Init(int width, int height, int numBuffers, int nAlign);
bool Reset();
bool SetEnabled(bool);
void SetEnabled(bool);
bool Close();

CDVDVideoCodecIPUBuffer *Process(CDVDVideoCodecBuffer *sourceBuffer,
Expand Down

0 comments on commit 785313a

Please sign in to comment.