summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2012-02-29 09:19:23 -0800
committerJim Bankoski <jimbankoski@google.com>2012-03-01 10:39:41 -0800
commit8d07a97acc4c8e5344b6f8adf247d53c3b59ead2 (patch)
tree31da4dadb951f288182930c3641176064965e836 /vp8
parentce328b855f951e5a9fd0d9d92df09d65ea0d8be9 (diff)
downloadlibvpx-8d07a97acc4c8e5344b6f8adf247d53c3b59ead2.tar
libvpx-8d07a97acc4c8e5344b6f8adf247d53c3b59ead2.tar.gz
libvpx-8d07a97acc4c8e5344b6f8adf247d53c3b59ead2.tar.bz2
libvpx-8d07a97acc4c8e5344b6f8adf247d53c3b59ead2.zip
vp8e - static key boost
This seeks to boost the size of the keyframe if the entire section is a single frame clip Change-Id: I3c00268dc155b047dc4b90e514cf403d55a4f8ef
Diffstat (limited to 'vp8')
-rw-r--r--vp8/encoder/firstpass.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index b3b06ee70..c7b0a27af 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2953,10 +2953,26 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
// We do three calculations for kf size.
// The first is based on the error score for the whole kf group.
- // The second (optionaly) on the key frames own error if this is smaller than the average for the group.
- // The final one insures that the frame receives at least the allocation it would have received based on its own error score vs the error score remaining
-
- allocation_chunks = ((cpi->twopass.frames_to_key - 1) * 100) + kf_boost; // cpi->twopass.frames_to_key-1 because key frame itself is taken care of by kf_boost
+ // The second (optionaly) on the key frames own error if this is
+ // smaller than the average for the group.
+ // The final one insures that the frame receives at least the
+ // allocation it would have received based on its own error score vs
+ // the error score remaining
+ // Special case if the sequence appears almost totaly static
+ // as measured by the decay accumulator. In this case we want to
+ // spend almost all of the bits on the key frame.
+ // cpi->twopass.frames_to_key-1 because key frame itself is taken
+ // care of by kf_boost.
+ if ( decay_accumulator >= 0.99 )
+ {
+ allocation_chunks =
+ ((cpi->twopass.frames_to_key - 1) * 10) + kf_boost;
+ }
+ else
+ {
+ allocation_chunks =
+ ((cpi->twopass.frames_to_key - 1) * 100) + kf_boost;
+ }
// Normalize Altboost and allocations chunck down to prevent overflow
while (kf_boost > 1000)