summaryrefslogtreecommitdiff
path: root/vp8/encoder/firstpass.c
AgeCommit message (Collapse)Author
2014-02-14Cleanup some comments.Adrian Grange
Change-Id: I568861ba1d43620865ad9a98a97eef37a51fd856
2014-02-06vp8/encoder: Silence MSVC warnings in firstpass.c.Tom Finegan
Added some casts to int to silence MSVC warnings. Change-Id: I72481ec2abd12110cf87a3d0da7a1cbe9ef2f47c
2013-09-23change to prevent computatio of log(0.0)Yaowu Xu
Change-Id: I5759f309f94a2b5c1297e6db3735c52986d3ecb2
2013-09-23fix integer overflow in vp8Yaowu Xu
Change-Id: I62550a7a883115f3ce878710cf3bb039bea54390
2013-07-18VP[89]_COMMON: remove golden/altref frame countsJames Zern
these are only used in the encoder. frames_since_golden / frames_till_alt_ref_frame -> VP[89]_COMP Change-Id: Ie14a6f46987bced685ddb449b85dc261caba6dfe
2013-07-16use consistent framerate namingJames Zern
s/frame_rate/framerate/g Change-Id: I6fc3e088e419c5f46e3a9390dd8a2cad2677a2fc
2013-02-28firstpass.c: correct casting around gf_group_bitsJames Zern
gf_group_bits is int64_t remove casts to int. Change-Id: I3b4225905041fac9af9fdfcbcb6f1c357ea4b593
2013-02-22Merge "vp8: make gf_group_bits 64-bit"James Zern
2013-02-22vp8: make gf_group_bits 64-bitJames Zern
avoids signed integer overflow; matches kf_group_bits Change-Id: I193145cdc4fa53e70fba0a1731a03eb1a574931d
2013-02-22vp8_first_pass(): avoid floating point div by 0James Zern
Change-Id: Id1e6a12db6b0c1d3f64ead8fd8834aadc30fbed2
2013-01-08Merge vp9-preview changes into experimental branchJohn Koleszar
Incorportate vp9-preview changes by merging master branch into experimental. Conflicts: test/test.mk vp9/common/vp9_filter.c vp9/common/vp9_idctllm.c vp9/common/vp9_invtrans.h vp9/common/vp9_mbpitch.c vp9/common/vp9_rtcd_defs.sh vp9/common/vp9_systemdependent.h vp9/common/vp9_type_aliases.h vp9/common/x86/vp9_asm_stubs.c vp9/common/x86/vp9_subpixel_mmx.asm vp9/decoder/vp9_decodframe.c vp9/decoder/vp9_dequantize.c vp9/decoder/vp9_dequantize.h vp9/decoder/vp9_onyxd_int.h vp9/encoder/vp9_bitstream.c vp9/encoder/vp9_encodeframe.c vp9/encoder/vp9_rdopt.c Change-Id: I17f51c3666d1b59cf1a699f87607cbc5d30a87c5
2012-12-27Merge branch 'vp9-preview' of review:webm/libvpxJohn Koleszar
Merge the vp9-preview branch into master. Change-Id: If700b9054676f24bed9deb59050af546c1ca5296
2012-12-05Use 'vpx_scale' consistentlyJohann
Change-Id: I178352813d2b8702d081caf405de9dbad9af2cc3
2012-11-15support building vp8 and vp9 into a single libJohn Koleszar
Change-Id: Ib8f8a66c9fd31e508cdc9caa662192f38433aa3d
2012-11-06Moving rd_thresh_mult, rd_threshes to macroblock structScott LaVarnway
Change-Id: I650a593162280ab40e71e527ec6518303e2d5723
2012-08-20silent compiling warnings for VC9 buildYaowu Xu
Change-Id: Iaa947e640f27e6f6eaf7d845f243536bca2df513
2012-07-27Optimizes updates of encoder block ptrsAttila Nagy
Precalculated block ptrs do not need updates during encoding. Set these at init stage. Moved the allocation of 'mt_current_mb_col' (last encoded MB on each row) to vp8_alloc_compressor_data(), so that it is correctly reallocated when frame size is changing. Change-Id: Idcdaa2d0cf3a7f782b7d888626b7cf22a4ffb5c1
2012-07-02Fix subpixel_predict initializationYunqing Wang
xd->subpixel_predict16x16 is called in first pass, but isn't initialized in first pass, which causes segfault. This patch fixed that problem. Change-Id: Ibd2cad4e2d32ea589fc3e0876d60d3079ae836e7
2012-06-11Fix pedantic compiler warningsJohn Koleszar
Allows building the library with the gcc -pedantic option, for improved portabilty. In particular, this commit removes usage of C99/C++ style single-line comments and dynamic struct initializers. This is a continuation of the work done in commit 97b766a46, which removed most of these warnings for decode only builds. Change-Id: Id453d9c1d9f44cc0381b10c3869fabb0184d5966
2012-06-04Explicitly discard fwrite/fread return valuesJohann
Using if(); triggers an empty body warning with clang Change-Id: I0fa2ee676400a974b40f8eaafca9ae668107eebb
2012-05-04fix vp8_ namespace issuesJohn Koleszar
Make functions only referenced from one translation unit static. Other symbols with extern linkage get a vp8/vpx prefix. Change-Id: I928c7e0d0d36e89ac78cb54ff8bb28748727834f
2012-05-04Formalize encodeframe.c forward delclarationsJohn Koleszar
Change If4321cc5 fixed a bug caused by forward declarations not being kept in sync across C files, resulting in a function call with the wrong arguments. The commit moves the affected function declarations into a header file, along with the other symbols from encodeframe.c that were being sloppily shared. Change-Id: I76a7b4c66d4fe175f9cbef7e52148655e4bb9ba1
2012-05-04Make global data constAttila Nagy
Removes all runtime initialization of global data. This commit is a squashed version of the following series cherry-picked from master. This is necessary because of a change that was merged to the tester that depends on the scaler being moved to the RTCD framework, which is a worthwhile thing to include in Eider anyway. - a91b42f02 Makes all global data in entropy.c const - b35a0db0e Makes all global data in tokenize.c const - 441cac8ea Makes all mode token tables const - 5948a0210 Ports vpx_xcaler to new RTCD method - 317d4244c Makes all mode token tables const part 2 Change-Id: Ifeaea24df2b731e7c509fa6c6ef6891a374afc26
2012-05-02Fix compiler warningsAttila Nagy
Fix code for following warnings: -Wimplicit-function-declaration -Wuninitialized -Wunused-but-set-variable -Wunused-variable Change-Id: I2be434f22fdecb903198e8b0711255b4c1a2947a
2012-03-16Add motion search skipping in first passYunqing Wang
This change added a motion search skipping mechanism similar to what we did in second pass. For a macroblock that is very similar to the macroblock at same location on last frame, we can set its mv to be zero, and skip motion search. This improves first-pass performance for slide shows and video conferencing clips with a slight PSNR loss. Change-Id: Ic73f9ef5604270ddd6d433170091d20361dfe229
2012-03-05Move SAD and variance functions to commonJohann
The MFQE function of the postprocessor depends on these Change-Id: I256a37c6de079fe92ce744b1f11e16526d06b50a
2012-03-01vp8e - static key boostPaul Wilkins
This seeks to boost the size of the keyframe if the entire section is a single frame clip Change-Id: I3c00268dc155b047dc4b90e514cf403d55a4f8ef
2012-01-31BLOCKD structure cleanupScott LaVarnway
Removed redundancies. All of the information can be found in the MACROBLOCKD structure. Change-Id: I7556392c6f67b43bef2a5e9932180a737466ef93
2012-01-30RTCD: add arnr functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. It removes the last of the VP8_ENCODER_RTCD struct references. Change-Id: I2a44f52d7cccf5177e1ca98a028ead570d045395
2012-01-30RTCD: add variance functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. Change-Id: Ie5c1aa480637e98dc3918fb562ff45c37a66c538
2012-01-30RTCD: add recon functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. Change-Id: I9bfcf9bef65c3d4ba0fb9a3e1532bad1463a10d6
2011-12-22Remove legacy integer typesJohn Koleszar
Remove BOOL, INTn, UINTn, etc, in favor of C99-style fixed width types. Change-Id: I396636212fb5edd6b347d43cc940186d8cd1e7b5
2011-12-16Avoid heap allocation of firstpass statsJohn Koleszar
The total_stats, this_frame_stats, and total_left_stats structures were previously create by a heap allocation, despite being of fixed size. These structures were allocated and deallocated during {de,}allocate_compressor_data, which is reinvoked whenever the frame size changes. Unfortunately, this clobbers the total_stats and total_left_stats data. Historically, these were variable size at one time, due to the first pass motion map, which necessitated their being created by a unique heap allocation. However, this bug with the total_stats being clobbered has probably been present since that initial implementation. These structures are instead moved to be stored within the struct twopass_rc directly, rather than being heap allocated separately. Change-Id: I7f9e519e25c58b92969071f0e99fa80307e0682b
2011-11-11avoid resetting framerate during vpx_codec_enc_config_set()John Koleszar
The calculated frame_rate is a state variable in the codec, and shouldn't be maintained in the configuration struct. Move it to the main part of cpi so that it isn't clobbered when the configuration struct is updated. The initial framerate estimate is moved from the vp8_cx_iface.c wrapper into the body of init_config() in onyx_if.c, so that it is only called once and not reset on every call to vp8_change_config(). Change-Id: I8d9a3d1283330d1ee297d07e9d78d1f2875f2465
2011-10-04Fix uninitialized new_mv_count in first pass fileJohn Koleszar
Uninitialized data could be written to the first pass file when no motion vectors are present in the frame. Also fix a number of compiler warnings. Change-Id: Icc9f53b6d33da9de4563d86d9fd591910473ea90
2011-09-30CQ and two pass rate control.Paul Wilkins
Changes to the selection of Q limits for two pass and two pass CQ mode. Allowance made for Mode and motion vector costs. Some refactoring of common code. For Derf and YT sets CQ mode average improvement circa 1% (SSIM and Global PSNR). Some increased tendency to undershoot even when user CQ not reached. Patch2: Removed some test code accidentally merged. Change-Id: Icf74d13af77437c08602571dc7a97e747cce5066
2011-08-24Quiet warning by removing unused variable.Fritz Koenig
fwd_boost_score was not being computed or referenced, so remove declaration. Change-Id: Iece36cde1ec113e3c6afaff1407d24cdf12bd0a8
2011-08-17Small boost to every other frame.Paul Wilkins
Instead of a single mid GF boost apply a few extra bits to every other frame. This gives a very small average metrics improvement on both derf and YT sets. Also use min GF interval as min KF interval. Change-Id: Iee238b8cae0ffaed850a5a944ac825cee18da485
2011-08-12Revert "Improved 1-pass CBR rate control"John Koleszar
This reverts commit b5ea2fbc2c1554769848774c836aad262af95072. Further testing showed noticable keyframe popping in some cases, reverting this for now to give time for a proper fix. Conflicts: vp8/encoder/onyx_if.c vp8/encoder/ratectrl.c Change-Id: I159f53d1bf0e24c035754ab3ded8ccfd58fd04af
2011-07-26cosmetics: consistently use [u]int64_tJames Zern
Removes mixed usage of (unsigned) long long and INT64. Fixes Issue #208. Change-Id: I220d3ed5ce4bb1280cd38bb3715f208ce23cf83a
2011-07-18Improved 1-pass CBR rate controlJohn Koleszar
This patch attempts to improve the handling of CBR streams with respect to the short term buffering requirements. The "buffer level" is changed to be an average over the rc buffer, rather than a long running average. Overshoot is also tracked over the same interval and the golden frame targets suppressed accordingly to correct for overly aggressive boosting. Testing shows that this is fairly consistently positive in one metric or another -- some clips that show significant decreases in quality have better buffering characteristics, others show improvenents in both. Change-Id: I924c89aa9bdb210271f2e03311e63de3f1f8f920
2011-07-08Adjust full-pixel clamping and motion vector limit calculationYunqing Wang
Do mvp clamping in full-pixel precision instead of 1/8-pixel precision to avoid error caused by right shifting operation. Also, further fixed the motion vector limit calculation in change: b7480454706a6b15bf091e659cd6227ab373c1a6 Change-Id: Ied88a4f7ddfb0476eb9f7afc6ceeddbf209fffd7
2011-06-30Merge "Copy macroblock data to a buffer before encoding it"Yunqing Wang
2011-06-29Change to arf boost calculation.Paul Wilkins
In this commit I have added an experimental function that tests prediction quality either side of a central position to calculate a suggested boost number for an ARF frame. The function is passed an offset from the current position and a number of frames to search forwards and backwards. It returns a forward, backward and compound boost number. The new code can be deactivated using #define NEW_BOOST 0 In its current default state the code searches forwards and backwards from the proposed position of the next alt ref. The the old code used a boost number calculated by scanning forward from the previous GF up to the proposed alt ref frame position. I have also added some code to try and prevent placement of a gf/arf where there is a brief flash. Change-Id: I98af789a5181148659f10dd5dd2ff2d4250cd51c
2011-06-23Copy macroblock data to a buffer before encoding itYunqing Wang
I got this idea from Pascal (Thanks). Before encoding a macroblock, copy it to a 16x16 buffer, and then read source data from there instead. This will help keep the source data in cache, and help with the performance. Change-Id: Id05f4cb601299150511d59dcba0ae62c49b5b757
2011-06-23Revert "Reduce overshoot in 1 pass rate control"John Koleszar
This reverts commit 212f6183739d448ad5fa2ccf1b4edd30829b2806. Further testing shows that the overshoot accumulation/damping is too aggressive on some clips. Allowing the accumulated overshoot to decay and limiting to damping to golden frames shows some promise. But some clips show significant overshoot in the buffer window, so I think this still needs work. Change-Id: Ic02a9ca34f55229f9cc04786f4fab54cdc1a3ef5
2011-06-16Assign boost to GF bit allocation if past frame had no ARF.Ronald S. Bultje
Modify the second-pass code to provide a full golden-frame (GF) bit allocation boost if the past GF group (GFG) had no alt-ref frame (ARF), even if the current GFG does contain and ARF. This mostly has no effect on clips, since switching ARFs on/off between GFGs is not very common. Has a positive effect on e.g. cheer (+0.45 SSIM at 600kbps) and football (+0.25 SSIM at 600kbps), particularly at high bitrates. Has a negative effect (-0.04 SSIM at 300kbps) at pamphlet, which appears only marginally related to this patch, and crew (-0.1 SSIM at 700kbps). Change-Id: I2e32899638b59f857e26efeac18a82e0c0b77089
2011-06-16Merge "Disable specialcase for last frames if the sequence contains ARFs."John Koleszar
2011-06-15Disable specialcase for last frames if the sequence contains ARFs.Ronald S. Bultje
firstpass.c contains some rate adjustment code that assures that the last few frames in a sequence abide by rate limits. If the second-to- last group of frames contains an alt-ref frame (ARF), the last golden frame (GF) is zero bytes, and we will thus spend a ridiculously high number of bits on regular P-frames trying to hit the target rate. This does slightly enhance the quality of these last few frames, but has no perceptual value (other than hitting the target rate). Disabling this code means we consistently (slightly) undershoot the target rate and consequently do worse on the last few frames of a clip, which is particularly noticeable for small clips. The quality- per-bitrate is generally better, ~0.2% better overall on derf-set, especially on clips such as garden, tennis, foreman at low bitrates. Has a negative effect on hallmonitor at high bitrates. Change-Id: I1d63452fef5fee4a0ad2fb2e9af4c9f2e0d86d23
2011-06-14Fix RT only buildTero Rintaluoma
Moved encode_intra function from firstpass.c to encodeintra.c to prevent linking problem in real-time only build. Also changed name of the function to vp8_encode_intra because it is not a static. Change-Id: Ibf3c6c1de3152567347e5fbef47d1d39564620a5