Permalink
Browse files

Dynamic evaluation of the processor flags passed to libpostproc.

Similar to the work done for swscale. Benefits 3DNow and Altivec users, as the optimizations were not turned on for them.
  • Loading branch information...
1 parent 019acfa commit 470c8661bfede244669c97f95b61c9b1e892d7e2 @CrystalP CrystalP committed Jul 31, 2011
Showing with 20 additions and 1 deletion.
  1. +19 −0 lib/DllPostProc.h
  2. +1 −1 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
View
@@ -55,6 +55,25 @@ extern "C" {
#endif
}
+#include "utils/CPUInfo.h"
+
+inline int PPCPUFlags()
+{
+ unsigned int cpuFeatures = g_cpuInfo.GetCPUFeatures();
+ int flags = 0;
+
+ if (cpuFeatures & CPU_FEATURE_MMX)
+ flags |= PP_CPU_CAPS_MMX;
+ if (cpuFeatures & CPU_FEATURE_MMX2)
+ flags |= PP_CPU_CAPS_MMX2;
+ if (cpuFeatures & CPU_FEATURE_3DNOW)
+ flags |= PP_CPU_CAPS_3DNOW;
+ if (cpuFeatures & CPU_FEATURE_ALTIVEC)
+ flags |= PP_CPU_CAPS_ALTIVEC;
+
+ return flags;
+}
+
class DllPostProcInterface
{
public:
@@ -78,7 +78,7 @@ bool CDVDVideoPPFFmpeg::CheckInit(int iWidth, int iHeight)
Dispose();
}
- m_pContext = m_dll.pp_get_context(m_pSource->iWidth, m_pSource->iHeight, PP_CPU_CAPS_MMX | PP_CPU_CAPS_MMX2 | PP_FORMAT_420);
+ m_pContext = m_dll.pp_get_context(m_pSource->iWidth, m_pSource->iHeight, PPCPUFlags() | PP_FORMAT_420);
m_iInitWidth = m_pSource->iWidth;
m_iInitHeight = m_pSource->iHeight;

0 comments on commit 470c866

Please sign in to comment.