kleopatra999 / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

vp9 bad Qp decision for Intra only mode in constant quality mode #849

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
* What is the expected behavior? What do you see instead?
In vp9 encoder, setting constant quality mode (--end-usage=q) in intra only 
(--kf-max-dist=1) for a particular Qp (--cq-level=x), does not respect the 
constraints. Instead, the Qp is decreased at each frame (eg when starting with 
Qp=50, after a few frame Qp=1), so the quality is set to maximum after only a 
few frames.

* What version are you using? On what operating system?
Last trunk libvps (Sep 2nd 2014)
commit b94a475d7b6c387e440dbf4c47cd07f2c074aeb0
ubuntu 12.04, gcc 4.8
windows 7, msvc 2010

* Can you reproduce using the vpxdec or vpxenc tools? What command line are
you using?
yes, for example:
vpxenc video.yuv -o rec.webm --codec=vp9 --i420 -w 1280 -h 720 --passes=2 
--good --end-usage=q --fps=50000/1001 -v --kf-min-dist=0 --kf-max-dist=1 
--drop-frame=0  --cpu-used=2 --cq-level=40

* Please provide any additional information below.
Tracing the problem, it seems to come from:
- file: vp9_ratectrl.c: 
- function: rc_pick_q_and_bounds_two_pass
- line 803: int delta_qindex = vp9_compute_qdelta(rc, 
last_boosted_q, last_boosted_q * 0.75);
The Qp is decreased by a factor 0.75 compare to last_boosted_q.
The problem is that in constant quality mode with intra only, the 
last_boosted_q is always equal to the Qp of the previous frame. In this case, 
the behavior is to decrease the Qp at each frame, until it reachs 1.
A possible patch (working in this particular mode but not tested for all 
possible mode) is to keep the Qp constant as required by the mode:

 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q,  last_boosted_q * 0.75);
 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
+if (cpi->oxcf.key_freq==1) active_best_quality=qindex;

Original issue reported on code.google.com by galpin.f...@gmail.com on 3 Sep 2014 at 7:39

GoogleCodeExporter commented 9 years ago

Original comment by ya...@google.com on 3 Sep 2014 at 3:47

GoogleCodeExporter commented 9 years ago

Original comment by renganat...@google.com on 9 Oct 2014 at 10:07

GoogleCodeExporter commented 9 years ago

Original comment by renganat...@google.com on 9 Oct 2014 at 10:07