aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-09 12:05:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-09 12:05:53 +0100
commitbcb15e66f7c46e036be198ecc9ea5f66dc0a537c (patch)
treea8bc011dd05f8a723a6259d120288bc536be5498
parent55151aa1013b6bf83b82b5535a7d085202fe49b3 (diff)
parentb5b7b75e91e291c810ebd01868a42b53f267a87c (diff)
downloadffmpeg-bcb15e66f7c46e036be198ecc9ea5f66dc0a537c.tar.gz
Merge commit 'b5b7b75e91e291c810ebd01868a42b53f267a87c'
* commit 'b5b7b75e91e291c810ebd01868a42b53f267a87c': dsputil: Move get_penalty_factor() to the only place it is used. Conflicts: libavcodec/dsputil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dsputil.h24
-rw-r--r--libavcodec/motion_est.c24
-rw-r--r--libavcodec/snowenc.c24
3 files changed, 48 insertions, 24 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 47e5b58dc4..4c839859af 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -479,30 +479,6 @@ static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
return (a & b) + (((a ^ b) & ~BYTE_VEC64(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:
- case FF_CMP_DCT264:
- 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;
- }
-}
-
void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 5fafb1bb13..664c6f7708 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -987,6 +987,30 @@ static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int
return d;
}
+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:
+ case FF_CMP_DCT264:
+ 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;
+ }
+}
+
void ff_estimate_p_frame_motion(MpegEncContext * s,
int mb_x, int mb_y)
{
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index a062ac508d..1831cf6245 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -287,6 +287,30 @@ static int pix_norm1(uint8_t * pix, int line_size, int w)
return s;
}
+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:
+ case FF_CMP_DCT264:
+ 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;
+ }
+}
+
//FIXME copy&paste
#define P_LEFT P[1]
#define P_TOP P[2]