summaryrefslogtreecommitdiff
path: root/vp8/encoder/firstpass.c
AgeCommit message (Collapse)Author
2011-02-01Merge remote branch 'internal/upstream' into HEADJohn Koleszar
2011-01-28Merge remote branch 'internal/upstream' into HEADJohn Koleszar
Conflicts: vp8/encoder/rdopt.c Change-Id: I68d04397a12f565b9f1bd35d4e50f1cc9afb76ff
2011-01-26Performance improvement of first passScott LaVarnway
Improved the performance of the first pass only (~6% on 720p test clip) by making use of LUT instead of the float calculations. Might try a SIMD version later. Also started to make use of int_mv instead of MV. Change-Id: If2a217c7d6b59cd2c25c5553e0ca7e0502403af8
2011-01-26Merge remote branch 'internal/upstream' into HEADJohn Koleszar
2011-01-25Fix for incorrect variable declaration.Fritz Koenig
Commit 336aa0b7da8a35ba57400ce92fc016fc7fb35233 incorrectly declared current_pos as and int, when it should have been a FIRSTPASS_STATS pointer. Change-Id: I0a51c7a86ebba8546c95dd5d9d1c1143d4613e40
2011-01-25Incorrect bit allocation in forced KF groups.Paul Wilkins
The old 2 pass code estimated error distribution when coding a forced (by interval) key frame. The result of this was that in some cases, when allocating bits at the GF group level within a KF group there was either a glut of bits or starvation of bits at the end of the KF group. Added code to rescan and get the correct data once the position of a forced key frame has been determined. Change-Id: I0c811675ef3f9e4109d14bd049d7641682ffcf11
2011-01-22Merge remote branch 'internal/upstream' into HEADJohn Koleszar
2011-01-21Modified static scene check.Paul Wilkins
Added code to scan ahead a few frames when we see what we think is a static scene in the two pass GF loop to see if the conditions persist. Moved calculation of decay rate out into a fuunction. Change-Id: I6e9c67e01ec9f555144deafc8ae67ef25bffb449
2011-01-21Merge remote branch 'internal/upstream' into HEADJohn Koleszar
Conflicts: configure Change-Id: I0bc38a6558d0d7f62cd2c551e75c3a59e39008bd
2011-01-20Further work to reduce pulsing.Paul Wilkins
These changes are specifically targeted at fade transitions to static scenes. Here we want to place a GF/ARF immediately after the fade and prevent an ARF just before the fade. Also some code lines and comment lines shortened to 80 chars while I was there. Change-Id: Iefdc09a4fa7b265048fc017246b73e138693950f
2011-01-20Fixed use of motion percentage in KF/GF group calcAdrian Grange
In both vp8_find_next_key_frame and define_gf_group, motion_pct was initialised at the top of the loop before next_frame stats had been read in. This fix sets motion_pct after next_frame stats have been read. Change-Id: I8c0bebf372ef8aa97b97fd35b42973d1d831ee73
2011-01-20Merge remote branch 'origin/master' into experimentalJohn Koleszar
Change-Id: Ia0840303fe1dc8c12f3389e7a1fe20b6d3c6b9c5
2011-01-19experiment extending the quantizer rangeYaowu Xu
Prior to this change, VP8 min quantizer is 4, which caps the highest quality around 51DB. This experimental change extends the min quantizer to 1, removes the cap and allows the highest quality to be around ~73DB, consistent with the fdct/idct round trip error. To test this change, at configure time use options: --enable-experimental --enable-extend_qrange The following is a brief log of changes in each of the patch sets patch set 1: In this commit, the quantization/dequantization constants are kept unchanged, instead scaling factor 4 is rolled into fdct/idct. Fixed Q0 encoding tests on mobile: Before: 9560.567kbps Overall PSNR:50.255DB VPXSSIM:98.288 Now: 18035.774kbps Overall PSNR:73.022DB VPXSSIM:99.991 patch set 2: regenerated dc/ac quantizer lookup tables based on the scaling factor rolled in the fdct/idct. Also slightly extended the range towards the high quantizer end. patch set 3: slightly tweaked the quantizer tables and generated bits_per_mb table based on Paul's suggestions. patch set 4: fix a typo in idct, re-calculated tables relating active max Q to active min Q patch set 5: added rdmult lookup table based on Q patch set 6: fix rdmult scale: dct coefficient has scaled up by 4 patch set 7: make transform coefficients to be within 16bits patch set 8: normalize 2nd order quantizers patch set 9: fix mis-spellings patch set 10: change the configure script and macros to allow experimental code to be enabled at configure time with --enable-extend_qrange patch set 11: rebase for merge Change-Id: Ib50641ddd44aba2a52ed890222c309faa31cc59c
2011-01-19First pass loop bug.Paul Wilkins
Incorrect value loop_decay_rate used in GF loop. The intent was to test the cumulative value decay_accumulator. Change-Id: I62928c63eb09f4f6936a45ebd1c23784d1c9681b
2011-01-18Further CQ, Key frame and ARF changesPaul Wilkins
This code fixes a bug in the calculation of the minimum Q for alt ref frames. It also allows an extended gf/arf interval for sections of clips that completely static (or nearly so). Change-Id: I1a21aaa16d4f0578e5f99b13bebd78d59403c73b
2011-01-12Limit key frame quantizer for forced key frames.Paul Wilkins
Where a key frame occurs because of a minimum interval selected by the user, then these forced key frames ideally need to be more closely matched in quality to the surrounding frame. Change-Id: Ia55b1f047e77dc7fbd78379c45869554f25b3df7
2011-01-11Remove unused local variablesHenrik Lundin
Removing unused local variables causing compiler warnings in Visual Studio. Change-Id: I0e2096303be1fdbc01428a6e57cca9796bb32c8a
2011-01-10Two Pass VBR changePaul Wilkins
Further experiment with restriction of the Q range. This uses the average non KF/GF/ARF quantizer, instead of just relying on the initial value. It is not such a strong constraint but there may be a reduced risk of rate misses. Change-Id: I424fe782a37a2f4e18c70805e240db55bfaa25ec
2011-01-10Revert BASE_ERRPERMBPaul Wilkins
Constant value reverted pending more tests on different video formats. Change-Id: I07d11a0e0185e60724698c835416caf2e0774e61
2011-01-07CQ ModePaul Wilkins
The merge includes hooks to for CQ mode and other code changes merged from the test branch. CQ mode attempts to maintain a more stable quantizer within a clip whilst also trying to adhere to a guidline maximum bitrate. The existing target data rate parameter is used to specify the guideline maximum bitrate. A new parameter allows the user to specify a target CQ level. For normal (non kf/gf/arf) frames, the quantizer will not drop BELOW the user specified value (0-63). However, in some cases the encoder may choose to impose a target CQ that is above that specified by the user, if it estimates that consistent use of the target value is not compatible with guideline maximum bitrate. Change-Id: I2221f9eecae8cc3c431d36caf83503941b25e4c1
2011-01-07Limit Q variability in two pass.Paul Wilkins
In two pass encoding each frame is given an active Q range to work with. This change limits how much this Q range can be altered over time from the initial estimate made for the clip as a whole. There is some danger this could lead to overshoot or undershoot in some corner cases but it helps considerably in regard to clips where either there is a glut or famine of bits in some sections, particularly near the end of a clip. Change-Id: I34fcd1af31d2ee3d5444f93e334645254043026e
2011-01-04Adjustment to boost calculation in two pass.Paul Wilkins
Calculate a minimum intra value to be used in determining the IIratio scores used in two pass, second pass. This is to make sure sections that are low complexity" in the intra domain are still boosted appropriately for KF/GF/ARF. For now I have commented out the Q based adjustment of KF boost. Change-Id: I15deb09c5bd9b53180a2ddd3e5f575b2aba244b3
2010-12-06Merge "Improve MV prediction accuracy to achieve performance gain"Scott LaVarnway
2010-12-03Improve MV prediction accuracy to achieve performance gainYunqing Wang
Add vp8_mv_pred() to better predict starting MV for NEWMV mode in vp8_rd_pick_inter_mode(). Set different search ranges according to MV prediction accuracy, which improves encoder performance without hurting the quality. Also, as Yaowu suggested, using diamond search result as full search starting point and therefore adjusting(reducing) full search range helps the performance. Change-Id: Ie4a3c8df87e697c1f4f6e2ddb693766bba1b77b6
2010-11-19Added extra two pass stats gathering.Paul Wilkins
Added code to record spend so far against planed budget. Change-Id: I5a3335346fa1771b2b1219df9f6127f9993d2594
2010-11-10Relax rate control for last few framesPaul Wilkins
VBR rate control can become very noisy for the last few frames. If there are a few bits to spare or a small overshoot then the target rate and hence quantizer may start to fluctuate wildly. This patch prevents further adjustment of the active Q limits for the last few frames. Patch also removes some redundant variables and makes one small bug fix. Change-Id: Ic167831bec79acc9f0d7e4698bcc4bb188840c45
2010-10-27Eliminate more warnings.Timothy B. Terriberry
This eliminates a large set of warnings exposed by the Mozilla build system (Use of C++ comments in ISO C90 source, commas at the end of enum lists, a couple incomplete initializers, and signed/unsigned comparisons). It also eliminates many (but not all) of the warnings expose by newer GCC versions and _FORTIFY_SOURCE (e.g., calling fread and fwrite without checking the return values). There are a few spurious warnings left on my system: ../vp8/encoder/encodemb.c:274:9: warning: 'sz' may be used uninitialized in this function gcc seems to be unable to figure out that the value shortcut doesn't change between the two if blocks that test it here. ../vp8/encoder/onyx_if.c:5314:5: warning: comparison of unsigned expression >= 0 is always true ../vp8/encoder/onyx_if.c:5319:5: warning: comparison of unsigned expression >= 0 is always true This is true, so far as it goes, but it's comparing against an enum, and the C standard does not mandate that enums be unsigned, so the checks can't be removed. Change-Id: Iaf689ae3e3d0ddc5ade00faa474debe73b8d3395
2010-10-26Add half-pixel variance RTCD functionsJohn Koleszar
NEON has optimized 16x16 half-pixel variance functions, but they were not part of the RTCD framework. Add these functions to RTCD, so that other platforms can make use of this optimization in the future and special-case ARM code can be removed. A number of functions were taking two variance functions as parameters. These functions were changed to take a single parameter, a pointer to a struct containing all the variance functions for that block size. This provides additional flexibility for calling additional variance functions (the half-pixel special case, for example) and by initializing the table for all block sizes, we don't have to construct this function pointer table for each macroblock. Change-Id: I78289ff36b2715f9a7aa04d5f6fbe3d23acdc29c
2010-10-21Move firstpass motion map to stats packetJohn Koleszar
The first implementation of the firstpass motion map for motion compensated temporal filtering created a file, fpmotionmap.stt, in the current working directory. This was not safe for multiple encoder instances. This patch merges this data into the first pass stats packet interface, so that it is handled like the other (numerical) firstpass stats. The new stats packet is defined as follows: Numerical Stats (16 doubles) -- 128 bytes Motion Map -- 1 byte / Macroblock Padding -- to align packet to 8 bytes The fpmotionmap.stt file can still be generated for debugging purposes in the same way that the textual version of the stats are available (defining OUTPUT_FPF in firstpass.c) Change-Id: I083ffbfd95e7d6a42bb4039ba0e81f678c8183ca
2010-10-02Tune effect of motion on KF/GF boost in two pass;Paul Wilkins
This code adjust the impact of the amount and speed of motion on GF and KF boost. Sections with lots of slow motion will tend to have a somewhat bigger boost and sections with fast motion may have less. There is a knock on effect to the selection of the active quantizer range. This will likely require further tuning but helps with a couple of particularly bad edge cases. Change-Id: Ic2449cda7305672b69acf42fc0a845b77ac98d40
2010-09-28Enabled AltRef motion map creationAdrian Grange
Enabled the first-pass encode to output the map of macroblock coding modes required by the AltRef filter.
2010-09-28Made AltRef filter adaptive & added motion compensationAdrian Grange
Modified AltRef temporal filter to adapt filter length based on macroblock coding modes selected during first-pass encode. Also added sub-pixel motion compensation to the AltRef filter.
2010-09-09Fix GF interval for non-lagged ARFsJohn Koleszar
When ARFs are enabled in non-lagged compress modes, the GF interval was being reset to zero. Non-lagged ARF updates were enabled in commit 63ccfbd, but this incorrect GF interval caused a quality regression. Change-Id: I615c3b493f4ce2127044f4e68d0bcb07d6b730c3
2010-09-09Use WebM in copyright notice for consistencyJohn Koleszar
Changes 'The VP8 project' to 'The WebM project', for consistency with other webmproject.org repositories. Fixes issue #97. Change-Id: I37c13ed5fbdb9d334ceef71c6350e9febed9bbba
2010-09-03Reduced the size of MB_MODE_INFOScott LaVarnway
Moved partition_bmi and partition_count out of MB_MODE_INFO and placed into MACROBLOCK. Also reduced the size of other members of the MB_MODE_INFO struct. For 1080p, the memory was reduced by 1,209,516 bytes. The decoder performance appeared to improve by 3% for the clip used. Note: The main goal for this change is to improve the decoder performance. The encoder will be revisited at a later date for further structure cleanup. Change-Id: I4733621292ee9cc3fffa4046cb3fd4d99bd14613
2010-08-31Improved Force Key Frame BehaviourPaul Wilkins
These changes improve the behaviour of the code with forced key frames sent in by a calling application. The sizing of the frames is still suboptimal for two pass in particular but the behaviour is much better than it was. Change-Id: I35fae610c67688ccc69d11f385e87dfc884e65a1
2010-08-12Removed unnecessary MB_MODE_INFO copiesScott LaVarnway
These copies occurred for each macroblock in the encoder and decoder. Thetemp MB_MODE_INFO mbmi was removed from MACROBLOCKD. As a result, a large number compile errors had to be fixed. Change-Id: I4cf0ffae3ce244f6db04a4c217d52dd256382cf3
2010-07-23Swap alt/gold/new/last frame buffer ptrs instead of copying.Fritz Koenig
At the end of the decode, frame buffers were being copied. The frames are not updated after the copy, they are just for reference on later frames. This change allows multiple references to the same frame buffer instead of copying it. Changes needed to be made to the encoder to handle this. The encoder is still doing frame buffer copies in similar places where pointer reference could be done. Change-Id: I7c38be4d23979cc49b5f17241ca3a78703803e66
2010-07-23Rate control bug with long key frame interval.Paul Wilkins
In two pass encodes, the calculation of the number of bits allocated to a KF group had the potential to overflow for high data rates if the interval is very long. We observed the problem in one test clip where there was one section where there was an 8000 frame gap between key frames. Change-Id: Ic48eb86271775d7573b4afd166b567b64f25b787
2010-07-01Fix bug in 1st pass motion compensationAdrian Grange
In the case where the best reference mv is not (0,0) a secondary search is carried out centered on (0,0). However, rather than sending tmp_err into the search function, motion_error was inadvertently passed. As a result tmp_err remains set at INT_MAX and the (0,0)-based search result will never be selected, even if it is better. Change-Id: I3c82b246c8c82ba887b9d3fb4c9e0a0f2fe5a76c
2010-06-21Moved DOUBLE_DIVIDE_CHECK to denominator (was on numerator)agrange
The DOUBLE_DIVIDE_CHECK macro prevents from divide by 0, so must be on the denominator to work as intended. Change-Id: Ie109242d52dbb9a2c4bc1e11890fa51b5f87ffc7
2010-06-18cosmetics: trim trailing whitespaceJohn Koleszar
When the license headers were updated, they accidentally contained trailing whitespace, so unfortunately we have to touch all the files again. Change-Id: I236c05fade06589e417179c0444cb39b09e4200d
2010-06-14Fix compiler warningsGuillermo Ballester Valor
Change-Id: I2a97f08cc3c7808ce5be39e910cc5147ecf03a1d
2010-06-10Adjust to avoid long linePaul Wilkins
2010-06-07Fix RD bug.Paul Wilkins
2010-06-04LICENSE: update with latest textJohn Koleszar
Change-Id: Ieebea089095d9073b3a94932791099f614ce120c
2010-05-19remove unneeded variablesPavol Rusnak
2010-05-18Initial WebM releaseJohn Koleszar