[x264-devel] Re: bit allocation algorithms among frames

Tuukka Toivonen tuukkat at ee.oulu.fi
Wed Jul 19 10:16:54 CEST 2006


On Mon, 17 Jul 2006, Loren Merritt wrote:

> http://students.washington.edu/lorenm/src/x264/x264_sdrc.0.pl
> is an implementation of the first paper, except even more brute-force: I didn't
> want to deal with a deep copy of the encoder state, so I just encode the whole
> movie for each candidate.

I see here a lot of optimizations, such as

- Using QPs from first pass with --crf 24 and adding a constant
  $search_qp + int(log($bbytes / $target_bytes) * 6/log(2))
  for initialization (and not the maximum QP value)
- Caching QPs so that for same vector no new encode is needed
  (or so I understand what $memo_rd does)
- Recalculating dD/dR only for 5 frames around the frame whose
  QP has been decreased most recently,
  and recalculating for all frames after each $nframes * $reset_rate

Especially I'm grateful about the --qpfile option, it will make a lot of my 
experiments much easier.

However, I was quite suspicious about the initialization vector: looks like 
many QPs won't get decreased at all which indicates they were too small to 
begin with. I changed the code to begin with larger QP values (from fixed 
43), but the results got much worse. I don't understand why.
I'm now doing some more tests. My modifications:
http://www.ee.oulu.fi/%7Etuukkat/tmp/x264_sdrc.tt0.pl

I used the tennis sequence 
(from http://media.xiph.org/video/derf/y4m/tennis_sif.y4m)
here are my results
x264 Revision: 537 + x264_rdrc.1.diff

===> First pass: 35.290 dB @ 536.88 kb/s

CMD="/video/std-video/tennis-352x240.yuv --frames 150 --scenecut -1 -m3 -b1 -8"
./x264 $CMD -p1 --crf 25 -o /dev/null
x264 [info]: PSNR Mean Y:34.364 U:39.294 V:38.377 Avg:35.389 Global:35.290 kb/s:536.88
encoded 150 frames, 69.49 fps, 535.90 kb/s

===> Second pass, standard rc: 35.189 dB

$CMD -p2 -B496 -o /dev/null
x264 [info]: PSNR Mean Y:34.372 U:39.439 V:38.527 Avg:35.415 Global:35.189 kb/s:502.38
encoded 150 frames, 80.29 fps, 501.40 kb/s

===> sdrc.0.pl: 35.7365 dB

time ./x264_sdrc.0.pl -B 500 -x "$CMD --ipratio 1"
388.471, 34.0328 : ....
....
499.981, 35.7365 : ....
final: 374986/375000, psnr=35.7365, encodes=1389
real    41m33.940s
user    39m20.470s
sys     1m5.820s

===> Small sliding window -> 35.223 dB

./x264 $CMD -p2 --rdrc-range 3 --rdrc-lambda 608 -o /dev/null 
x264 [info]: file name gives 352x240
x264 [info]: PSNR Mean Y:34.277 U:39.152 V:38.186 Avg:35.294 Global:35.223 kb/s:504.13
encoded 150 frames, 10.19 fps, 503.15 kb/s

===> Large sliding window -> 35.754 dB

./x264 $CMD -p2 --rdrc-range 32 --rdrc-lambda 950 -o /dev/null 
x264 [info]: file name gives 352x240
x264 [info]: PSNR Mean Y:35.067 U:40.295 V:39.280 Avg:36.128 Global:35.754 kb/s:500.62
encoded 150 frames, 1.33 fps, 499.64 kb/s

===> sdrc.tt0.pl: 34.2982 dB

Rtot   70.536
Dtot   27.5930
...
Rtot   499.977
Dtot   34.2982

final: 374983/375000, psnr=34.2982, encodes=10727

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list