diff dsputil.h @ 2184:3378d0677903 libavcodec

4x4 SSE compare function wavelet based compare functions make epzs_motion_search() more flexible so it can be used for a wider range of block sizes make get_penalty_factor() independant of MpegEncContext
author michael
date Sun, 22 Aug 2004 17:16:03 +0000
parents 869805505b30
children 784c38a3ffc2
line wrap: on
line diff
--- a/dsputil.h	Sun Aug 22 12:40:57 2004 +0000
+++ b/dsputil.h	Sun Aug 22 17:16:03 2004 +0000
@@ -163,6 +163,8 @@
     me_cmp_func vsad[5];
     me_cmp_func vsse[5];
     me_cmp_func nsse[5];
+    me_cmp_func w53[5];
+    me_cmp_func w97[5];
 
     me_cmp_func me_pre_cmp[5];
     me_cmp_func me_cmp[5];
@@ -351,6 +353,29 @@
     return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
 }
 
+static inline int get_penalty_factor(int lambda, int lambda2, int type){
+    switch(type&0xFF){
+    default:
+    case FF_CMP_SAD:
+        return lambda>>FF_LAMBDA_SHIFT;
+    case FF_CMP_DCT:
+        return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
+    case FF_CMP_W53:
+        return (4*lambda)>>(FF_LAMBDA_SHIFT);
+    case FF_CMP_W97:
+        return (2*lambda)>>(FF_LAMBDA_SHIFT);
+    case FF_CMP_SATD:
+        return (2*lambda)>>FF_LAMBDA_SHIFT;
+    case FF_CMP_RD:
+    case FF_CMP_PSNR:
+    case FF_CMP_SSE:
+    case FF_CMP_NSSE:
+        return lambda2>>FF_LAMBDA_SHIFT;
+    case FF_CMP_BIT:
+        return 1;
+    }
+}
+
 /**
  * Empty mmx state.
  * this must be called between any dsp function and float/double code.