diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index b4ae866ab2b87036283148ac523ff67ae8eef2a4..c403298cabff94147f4ab42b61dbe0621aa748af 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -586,11 +586,11 @@ static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[]
 #if CONFIG_RUNTIME_CPUDETECT
 #if ARCH_X86 && HAVE_INLINE_ASM
         // ordered per speed fastest first
-        if      (c->cpuCaps & PP_CPU_CAPS_MMX2)     pp = postProcess_MMX2;
-        else if (c->cpuCaps & PP_CPU_CAPS_3DNOW)    pp = postProcess_3DNow;
-        else if (c->cpuCaps & PP_CPU_CAPS_MMX)      pp = postProcess_MMX;
+        if      (c->cpuCaps & AV_CPU_FLAG_MMXEXT)   pp = postProcess_MMX2;
+        else if (c->cpuCaps & AV_CPU_FLAG_3DNOW)    pp = postProcess_3DNow;
+        else if (c->cpuCaps & AV_CPU_FLAG_MMX)      pp = postProcess_MMX;
 #elif HAVE_ALTIVEC
-        if      (c->cpuCaps & PP_CPU_CAPS_ALTIVEC)  pp = postProcess_altivec;
+        if      (c->cpuCaps & AV_CPU_FLAG_ALTIVEC)  pp = postProcess_altivec;
 #endif
 #else /* CONFIG_RUNTIME_CPUDETECT */
 #if   HAVE_MMXEXT_INLINE
@@ -896,7 +896,6 @@ pp_context *pp_get_context(int width, int height, int cpuCaps){
 
     memset(c, 0, sizeof(PPContext));
     c->av_class = &av_codec_context_class;
-    c->cpuCaps= cpuCaps;
     if(cpuCaps&PP_FORMAT){
         c->hChromaSubSample= cpuCaps&0x3;
         c->vChromaSubSample= (cpuCaps>>4)&0x3;
@@ -904,6 +903,15 @@ pp_context *pp_get_context(int width, int height, int cpuCaps){
         c->hChromaSubSample= 1;
         c->vChromaSubSample= 1;
     }
+    if (cpuCaps & PP_CPU_CAPS_AUTO) {
+        c->cpuCaps = av_get_cpu_flags();
+    } else {
+        c->cpuCaps = 0;
+        if (cpuCaps & PP_CPU_CAPS_MMX)      c->cpuCaps |= AV_CPU_FLAG_MMX;
+        if (cpuCaps & PP_CPU_CAPS_MMX2)     c->cpuCaps |= AV_CPU_FLAG_MMXEXT;
+        if (cpuCaps & PP_CPU_CAPS_3DNOW)    c->cpuCaps |= AV_CPU_FLAG_3DNOW;
+        if (cpuCaps & PP_CPU_CAPS_ALTIVEC)  c->cpuCaps |= AV_CPU_FLAG_ALTIVEC;
+    }
 
     reallocBuffers(c, width, height, stride, qpStride);
 
diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h
index 623b3b5a730a40e54a4d66d298fcd3dc1309a0d9..b1a357a15ddb32b8b18a2b4a924a9e9bb645ae7b 100644
--- a/libpostproc/postprocess.h
+++ b/libpostproc/postprocess.h
@@ -84,6 +84,7 @@ void pp_free_context(pp_context *ppContext);
 #define PP_CPU_CAPS_MMX2  0x20000000
 #define PP_CPU_CAPS_3DNOW 0x40000000
 #define PP_CPU_CAPS_ALTIVEC 0x10000000
+#define PP_CPU_CAPS_AUTO  0x00080000
 
 #define PP_FORMAT         0x00000008
 #define PP_FORMAT_420    (0x00000011|PP_FORMAT)
diff --git a/libpostproc/version.h b/libpostproc/version.h
index f634630856218e293096af4c4501ddf7d2b2eca3..35e1772400181c521b5ea3826e72e9d1805b2b9a 100644
--- a/libpostproc/version.h
+++ b/libpostproc/version.h
@@ -30,7 +30,7 @@
 
 #ifndef LIBPOSTPROC_VERSION_MAJOR
 #define LIBPOSTPROC_VERSION_MAJOR 52
-#define LIBPOSTPROC_VERSION_MINOR  1
+#define LIBPOSTPROC_VERSION_MINOR  2
 #define LIBPOSTPROC_VERSION_MICRO 100
 #endif