1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

second try of improved lambda/qp guessing for motion estimation RD in first pass

Originally committed as revision 4785 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2005-12-29 15:46:23 +00:00
parent 58f7833e8e
commit 88e51e1fb5
4 changed files with 21 additions and 21 deletions

View File

@ -1594,6 +1594,7 @@ void MPV_frame_end(MpegEncContext *s)
emms_c();
s->last_pict_type = s->pict_type;
s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality;
if(s->pict_type!=B_TYPE){
s->last_non_b_pict_type= s->pict_type;
}
@ -2204,7 +2205,7 @@ static int estimate_best_b_count(MpegEncContext *s){
int is_p= i % (j+1) == j || i==s->max_b_frames;
input[i+1].pict_type= is_p ? P_TYPE : B_TYPE;
input[i+1].quality= s->rc_context.last_qscale_for[input[i+1].pict_type];
input[i+1].quality= s->last_lambda_for[input[i+1].pict_type];
out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]);
rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
}
@ -5398,12 +5399,10 @@ static void encode_picture(MpegEncContext *s, int picture_number)
estimate_qp(s, 1);
ff_get_2pass_fcode(s);
}else if(!(s->flags & CODEC_FLAG_QSCALE)){
RateControlContext *rcc= &s->rc_context;
if(s->pict_type==B_TYPE)
s->lambda= rcc->last_qscale_for[s->pict_type];
s->lambda= s->last_lambda_for[s->pict_type];
else
s->lambda= rcc->last_qscale_for[rcc->last_non_b_pict_type];
s->lambda= s->last_lambda_for[s->last_non_b_pict_type];
update_qscale(s);
}

View File

@ -374,6 +374,7 @@ typedef struct MpegEncContext {
int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol
int dropable;
int frame_rate_index;
int last_lambda_for[5]; ///< last lambda for a specific pict type
/* motion compensation */
int unrestricted_mv; ///< mv can point outside of the coded picture

View File

@ -59,18 +59,18 @@ stddev: 7.99 PSNR:30.06 bytes:7602176
7932708 ./data/a-huffyuv.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
cc4a9bf5046d4f471174800135867831 *./data/a-mpeg4-rc.avi
824318 ./data/a-mpeg4-rc.avi
df7de6d3ce1faf92393985485cdf287a *./data/out.yuv
stddev: 10.41 PSNR:27.77 bytes:7602176
d37d4d4b5acfffe3a01a72f51c162a82 *./data/a-mpeg4-rc.avi
822270 ./data/a-mpeg4-rc.avi
3ecd1afdaf2d691d01628737326dda35 *./data/out.yuv
stddev: 10.41 PSNR:27.76 bytes:7602176
81078d7852dfd6041ff17b5dc8ed0ffc *./data/a-mpeg4-adv.avi
600240 ./data/a-mpeg4-adv.avi
0b7935cee2070f3b838478cea6dc4b3c *./data/out.yuv
stddev: 10.25 PSNR:27.90 bytes:7602176
b0235e9bf3cf3867064b9ff21cda76de *./data/a-mpeg4-thread.avi
764896 ./data/a-mpeg4-thread.avi
d10f9ee6af493233f46a2ff2b178940a *./data/out.yuv
stddev: 12.32 PSNR:26.30 bytes:7602176
052f9e98112011ddc302b521e34d6385 *./data/a-mpeg4-thread.avi
764686 ./data/a-mpeg4-thread.avi
252d1e8cc1ee88eea693cebd6b4e7e53 *./data/out.yuv
stddev: 12.32 PSNR:26.31 bytes:7602176
88cfdda74f0488cf4a8324667a1ec9e8 *./data/a-mpeg4-Q.avi
899452 ./data/a-mpeg4-Q.avi
af59c063ed644c7dc4151a0a2debbddd *./data/out.yuv

View File

@ -59,18 +59,18 @@ stddev: 5.34 PSNR:33.56 bytes:7602176
6454196 ./data/a-huffyuv.avi
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
95e95dfe42fce9cdbe72688e821022ca *./data/a-mpeg4-rc.avi
227834 ./data/a-mpeg4-rc.avi
2e02fa0261c21268d568ddde74f9431e *./data/out.yuv
stddev: 4.26 PSNR:35.51 bytes:7602176
8375752d50a0a11c85370eebfb601d5d *./data/a-mpeg4-rc.avi
227618 ./data/a-mpeg4-rc.avi
addcb0b8e42d71c25a0590d10e8e41c6 *./data/out.yuv
stddev: 4.27 PSNR:35.51 bytes:7602176
49bb293a098ebf88870f663d590a02d9 *./data/a-mpeg4-adv.avi
172526 ./data/a-mpeg4-adv.avi
e3445dab9a3fa83a0f86457e24cb0cea *./data/out.yuv
stddev: 4.84 PSNR:34.42 bytes:7602176
66de0faff3660a0893996b39742a4c02 *./data/a-mpeg4-thread.avi
253428 ./data/a-mpeg4-thread.avi
0f23dbeb37f14b71cfae86dfe6c0b0e4 *./data/out.yuv
stddev: 4.05 PSNR:35.96 bytes:7602176
4b88839dd9696ff5500bea89b9ca66be *./data/a-mpeg4-thread.avi
253268 ./data/a-mpeg4-thread.avi
d6f1714d6fe1f969fc4ca416c6f8ba6c *./data/out.yuv
stddev: 4.04 PSNR:35.98 bytes:7602176
bb7f7889f0694a1c499041f3ee5e234d *./data/a-mpeg4-Q.avi
164998 ./data/a-mpeg4-Q.avi
b078f22c66083f0537bd3581509684d8 *./data/out.yuv