diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-08-25 21:19:50 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-08-25 21:19:50 +0000 |
commit | 3aa102be84e4fe0bd8fc8be1fc62a3e498388a10 (patch) | |
tree | 34c9621e808b165f60eda646fe9c25eb01d7a7a8 /libavcodec/motion_est.c | |
parent | 7806197db2ffb9024d0550ab02b28fe9963e8d4b (diff) | |
download | ffmpeg-3aa102be84e4fe0bd8fc8be1fc62a3e498388a10.tar.gz |
new ratecontrol code
Originally committed as revision 862 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r-- | libavcodec/motion_est.c | 57 |
1 files changed, 8 insertions, 49 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 612c22cf9f..d672642fd8 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -41,28 +41,6 @@ #define P_MV1 P[9] -static int pix_sum(UINT8 * pix, int line_size) -{ - int s, i, j; - - s = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j += 8) { - s += pix[0]; - s += pix[1]; - s += pix[2]; - s += pix[3]; - s += pix[4]; - s += pix[5]; - s += pix[6]; - s += pix[7]; - pix += 8; - } - pix += line_size - 16; - } - return s; -} - static int pix_dev(UINT8 * pix, int line_size, int mean) { int s, i, j; @@ -85,29 +63,6 @@ static int pix_dev(UINT8 * pix, int line_size, int mean) return s; } -static int pix_norm1(UINT8 * pix, int line_size) -{ - int s, i, j; - UINT32 *sq = squareTbl + 256; - - s = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j += 8) { - s += sq[pix[0]]; - s += sq[pix[1]]; - s += sq[pix[2]]; - s += sq[pix[3]]; - s += sq[pix[4]]; - s += sq[pix[5]]; - s += sq[pix[6]]; - s += sq[pix[7]]; - pix += 8; - } - pix += line_size - 16; - } - return s; -} - static int pix_norm(UINT8 * pix1, UINT8 * pix2, int line_size) { int s, i, j; @@ -1578,9 +1533,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, fbmin= bidir_refine(s, mb_x, mb_y); - if(s->flags&CODEC_FLAG_HQ){ - type= MB_TYPE_FORWARD | MB_TYPE_BACKWARD | MB_TYPE_BIDIR | MB_TYPE_DIRECT; - }else{ + { int score= dmin; type=MB_TYPE_DIRECT; @@ -1596,9 +1549,15 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, score=fbmin; type= MB_TYPE_BIDIR; } + score= (score*score)>>8; s->mc_mb_var_sum += score; - s->mc_mb_var[mb_y*s->mb_width + mb_x] = score; + s->mc_mb_var[mb_y*s->mb_width + mb_x] = score; //FIXME use SSD } + + if(s->flags&CODEC_FLAG_HQ){ + type= MB_TYPE_FORWARD | MB_TYPE_BACKWARD | MB_TYPE_BIDIR | MB_TYPE_DIRECT; //FIXME something smarter + } + /* { static int count=0; |