summaryrefslogtreecommitdiff
path: root/vp8/encoder/mcomp.c
AgeCommit message (Collapse)Author
2012-07-17Restyle codeJohn Koleszar
Approximate the Google style guide[1] so that that there's a written document to follow and tools to check compliance[2]. [1]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml [2]: http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py Change-Id: Idf40e3d8dddcc72150f6af127b13e5dab838685f
2012-04-27Removed MV costing from ARNR filteringAdrian Grange
The ARNR filter uses a motion compensated temporal filter, but the motion estimation implementation accounts for the cost of the mv in its decision making process. The ARNR filter uses a dummy cost table initialized to 0 as a way to ignore the mv costs (which are irrelevant to the filter). This CL modifies the ARNR filter implementation to so that the mv costing is ignored without the requirement for dummy tables. Change-Id: I0dd9620c3b70682f938b2a70912c11d4d7c9284c
2012-04-18Compound prediction for splitmv macroblocks.Ronald S. Bultje
Change-Id: I0af3395500b1cb0ed629249eb6636a0c9322cb18
2012-04-11Superblock encoding orderAdrian Grange
This is the first patch to add superblock (32x32) coding order capabilities. It does not yet do any mode selection at the SB level, that will follow in a further patch. This patch encodes rows of SBs rather than MBs, each SB contains 2x2 MBs. Two intra prediction modes have been disabled since they require reconstructed data for the above-right MB which may not have been encoded yet (e.g. for the bottom right MB in each SB). Results on the one test clip I have tried (720p GIPS clip) suggest that it is somewhere around 0.2dB worse than the baseline version, so there may be bugs. It has been tested with no experiments enabled and with the following 3 experiments enabled: --enable-enhanced_interp --enable-high_precision_mv --enable-sixteenth_subpel_uv in each case the decode buffer matches the recon buffer (using "cmp" to compare the dumped/decoded frames). Note: Testing these experiments individually created errors. Some problems were found with other experiments but it is unclear what state these experiments are in: --enable-comp_intra_pred --enable-newentropy --enable-uvintra This code has not been extensively tested yet, so there is every likelihood that further bugs remain. I also intend to do some code cleanup & refactoring in tandem with the next patch that adds the 32x32 modes. Change-Id: I1eba7f740a70b3510df58db53464535ef881b4d9
2012-03-01Various bug fixes related to high precision mvDeb Mukherjee
Change-Id: Ie5a7c87d71bd4a541463b68704620d89cec142cf
2012-02-28Fix compiling issue when CONFIG_HIGH_PRECISION_MV is definedYaowu Xu
Change-Id: I3b8a230d5b119910e6a6767331a4d97768089355
2012-02-28Initial refactoring of high_precision mv code.Deb Mukherjee
This is the first patch for refactoring of the code related to high-precision mv, so that 1/4 and 1/8 pel motion vectors can co-exist in the same bit-stream by use of a frame level flag. The current patch works fine for only use of 1/4th and only use of 1/8th pel mv, but there are some issues with the mode switching in between. Subsequent patches on this change Id will fix the remaining issues. Patch 2: Adds fixes to make sure that multiple mv precisions can co-exist in the bit-stream. Frame level switching has been tested to work correctly. Patch 3: Fixes lines exceeding 80 char Patch 4: http://www.corp.google.com/~debargha/vp8_results/enhinterp.html Results on derf after ssse3 bugfix, compared to everything enabled but the 8-tap, 1/8-subpel and 1/16-subpel uv. Overall the gains are about 3% now. Hopefully there are no more bugs lingering. Apparently the sse3 bug affected the quartel subpel results more than the eighth pel ones (which is understandabale because one bad predictor due to the bug, matters less if there are a lot more subpel options available as in the 1/8 subpel case). The results in the 4th column correspond to the current settings. The first two columns correspond to two settings of adaptive switching of the 1/4 or 1/8 subpel mode based on initial Q estimate. These do not work as good as just using 1/8 all the time yet. Change-Id: I3ef392ad338329f4d68a85257a49f2b14f3af472
2012-02-23Supporting high precision 1/8-pel motion vectorsDeb Mukherjee
This is the initial patch for supporting 1/8th pel motion. Currently if we configure with enable-high-precision-mv, all motion vectors would default to 1/8 pel. Encode and decode syncs fine with the current code. In the next phase the code will be refactored so that we can choose the 1/8 pel mode adaptively at a frame/segment/mb level. Derf results: http://www.corp.google.com/~debargha/vp8_results/enhinterp_hpmv.html (about 0.83% better than 8-tap interpoaltion) Patch 3: Rebased. Also adding 1/16th pel interpolation for U and V Patch 4: HD results. http://www.corp.google.com/~debargha/vp8_results/enhinterp_hd_hpmv.html Seems impressive (unless I am doing something wrong). Patch 5: Added mmx/sse for bilateral filtering, as well as enforced use of c-versions of subpel filters with 8-taps and 1/16th pel; Also redesigned the 8-tap filters to reduce the cut-off in order to introduce a denoising effect. There is a new configure option sixteenth-subpel-uv which will use 1/16 th pel interpolation for uv, if the motion vectors have 1/8 pel accuracy. With the fixes the results are promising on the derf set. The enhanced interpolation option with 8-taps alone gives 3% improvement over thei derf set: http://www.corp.google.com/~debargha/vp8_results/enhinterpn.html Results on high precision mv and on the hd set are to follow. Patch 6: Adding a missing condition for CONFIG_SIXTEENTH_SUBPEL_UV in vp8/common/x86/x86_systemdependent.c Patch 7: Cleaning up various debug messages. Patch 8: Merge conflict Change-Id: I5b1d844457aefd7414a9e4e0e06c6ed38fd8cc04
2011-12-07made vp8_mode_context adaptiveYaowu Xu
vp8_mode_contexts[] is an entropy table used to code inter mode choices. It was a fixed constant table. This commit made the entropy context adaptive. Tests on derf set showed very good consistent gains on all metrics: avg psnr .47%, overall psnr .46% and ssim .40%. http://www.corp.google.com/~yaowu/no_crawl/newModeContext.html Change-Id: Ia62b14485c948e2b74586118619c5eb2068b43b2
2011-08-03Adjust half-pixel only searchYunqing Wang
Changed motion search in vp8_find_best_half_pixel_step() to be the same as in vp8_find_best_sub_pixel_step(), which checks 5 points instead of 8 points. This only affects real-time mode with cpu-used >=9. Tests showed it gives 2% encoding speedup with a quality loss(psnr) of up to 0.5%. Change-Id: I16049cad1535002346d46cfdfad345bfc3dc5146
2011-07-27Preload reference area in sub-pixel motion search (real-time mode)Yunqing Wang
This change implemented same idea in change "Preload reference area to an intermediate buffer in sub-pixel motion search." The changes were made to vp8_find_best_sub_pixel_step() and vp8_find_best_half _pixel_step() functions which are called when speed >= 5. Test result (using tulip clip): 1. On Core2 Quad machine(Linux) rt mode, speed (-5 ~ -8), encoding speed gain: 2% ~ 3% rt mode, speed (-9 ~ -11), encoding speed gain: 1% ~ 2% rt mode, speed (-12 ~ -14), no noticeable encoding speed gain 2. On Xeon machine(Linux) Test on speed (-5 ~ -14) didn't show noticeable speed change. Change-Id: I21bec2d6e7fbe541fcc0f4c0366bbdf3e2076aa2
2011-07-27Fix range checks in motion searchYunqing Wang
There were some situations that the start motion vectors were out of range. This fix adjusted range checks to make sure they are checked and clamped. Change-Id: Ife83b7fed0882bba6d1fa559b6e63c054fd5065d
2011-07-22Preload reference area to an intermediate buffer in sub-pixel motion searchYunqing Wang
In sub-pixel motion search, the search range is small(+/- 3 pixels). Preload whole search area from reference buffer into a 32-byte aligned buffer. Then in search, load reference data from this buffer instead. This keeps data in cache, and reduces the crossing cache- line penalty. For tulip clip, tests on Intel Core2 Quad machine(linux) showed encoder speed improvement: 3.4% at --rt --cpu-used =-4 2.8% at --rt --cpu-used =-3 2.3% at --rt --cpu-used =-2 2.2% at --rt --cpu-used =-1 Test on Atom notebook showed only 1.1% speed improvement(speed=-4). Test on Xeon machine also showed less improvement, since unaligned data access latency is greatly reduced in newer cores. Next, I will apply similar idea to other 2 sub-pixel search functions for encoding speed > 4. Make this change exclusively for x86 platforms. Change-Id: Ia7bb9f56169eac0f01009fe2b2f2ab5b61d2eb2f
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-30Bug fix in motion vector limit calculationYunqing Wang
Motion vector limits are calculated using right shifts, which could give wrong results for negative numbers. James Berry's test on one clip showed encoder produced some artifacts. This change fixed that. Change-Id: I035fc02280b10455b7f6eb388f7c2e33b796b018
2011-06-17Remove unnecessary bounds checking in motion searchYunqing Wang
The starting points are always within the limits, and bounds checking on these points is not needed. For speed < 5, the encoded result changes a little because different treatment is taken while starting point equals the bounds. Change-Id: I09a402d310f51e305a3519f1601b1d17b05c6152
2011-06-06Remove hex search's variance calculation while in real-time modeYunqing Wang
In real-time mode motion search, there is no need to calculate variance. This change improved encoding speed by 1% ~ 2%(speed=-5). Change-Id: I65b874901eb599ac38fe8cf9cad898c14138d431
2011-06-01further clean up of errorperbit and sadperbitYaowu Xu
this commit makes the usage errorperbit and sadperbit consistent for encoding modes and passes. Removed all different magic weight factors associated with errorperbit. Now 1/2 is used for both sadperbit16 and sadperbit4, the /2 operation is merged into initializations of the 2 variables. Tests on cif set show .23%, 0.18% and 0.19% gain by avg psnr, overall psnr and ssim respectively. Change-Id: Ifa285c3e065ce0a5a77addfc9f95aabf54ee270d
2011-06-01remove some magic weights associated with sad_per_bitYaowu Xu
sad_per_bit has been used for a number of motion vector search routines with different magic weights: 1, 1/2 and 1/4. This commit remove these magic numbers and use 1/2 for all motion search routines, also reformat a number of source code lines to within 80 column limit. Test on cif set shows overall effect is neutral on all metrics. <=0.01% Change-Id: I8a382821fa4cffc9c0acf8e8431435a03df74885
2011-05-25fix the mix use of errorperbit and sadperbitYaowu Xu
error_per_bit and sad_per_bit were designed as estimates of a bit worth of sum squared error and sum absolute difference respectively. Under this assumption, error_per_bit should be used in combination with 2nd order errors (variance or sum squared error) while sad_per_bit should be used in combination with 1st order SADs in motion estimation. There were a few places where sad_per_bit has been misused with variances, this commit changes to use error_per_bit for those places, also changes parameter names to properly indicate which constant is being used. On cif set, the change has a universal gain by all metrics: 0.13% by average/overall psnr and 0.1% by ssim. Change-Id: I4850fdcc3fd6886b30f784bd843f13dd401215fb
2011-05-23Rewrite hex search functionYunqing Wang
Reduced some bound checks in hex search function. Change-Id: Ie5f73a6c227590341c960a74dc508cff80f8aa06
2011-05-12Removed mv_bits_sadcostScott LaVarnway
This sad cost is being generated but never used. Change-Id: I562eebdcb792b743770954feca365b5b37491ecd
2011-05-12Using int_mv instead of MVScott LaVarnway
The compiler produces better assembly when using int_mv for assignments. The compiler shifts and ors the two 16bit values when assigning MV. Change-Id: I52ce4bc2bfbfaf3f1151204b2f21e1e0654f960f
2011-05-12Modification and issue fix in full-pixel refining searchYunqing Wang
Further modification and wrong implementation fix which caused refining_search and refining_searchx4 result mismatching. Change-Id: I80cb3a44bf5824413fd50c972e383eebb75f9b6f
2011-05-09Use diamond search to replace full search in full-pixel refining searchYunqing Wang
In NEWMV mode, currently, full search is used as the refining search after n-step search. By replacing it with an iterative diamond search of radius 1 largely reduced the computation complexity, but still maintained the same encoding quality since the refining search is done for every macroblock instead of only a small precentage of macroblocks while using full search. Tests on the test set showed a 3.4% encoding speed increase with none psnr & ssim loss. Change-Id: Ife907d7eb9544d15c34f17dc6e4cfd97cb743d41
2011-05-03Modify HEX searchYunqing Wang
Changed 8-neighbor searching to 4-neighour searching, and continued searching until the center point is the best match. Test on test set showed 1.3% encoding speed improvement as well as 0.1% PSNR and SSIM improvement at speed=-5 (rt mode). Will continue to improve it. Change-Id: If4993b1907dd742b906fd3f86fee77cc5932ee9a
2011-04-18Use sub-pixel search's SSE in mode selectionYunqing Wang
Passed SSE from sub-pixel search back to pick_inter_mode function, which is compared with the encode_breakout to see if we could skip evaluating the remaining modes. Change-Id: I4a86442834f0d1b880a19e21ea52d17d505f941d
2011-04-14Reduce unnecessary distortion computationYunqing Wang
In vp8_pick_inter_mode(), for NEWMV mode, use the error result got from motion search as distortion. This helps performance in real- time mode. Change-Id: I398c4e46cc5381f7d874e748cf78827ef0e0860c
2011-04-11Set cpu_used range to [-16, 16] in real-time modeYunqing Wang
Remove encoding speed limitation in real-time mode. Change-Id: Ib5e35d8bb522b2a25f3e4ad5cfe2788ebebb3617
2011-04-06Minor modificationYunqing Wang
A small change. Change-Id: I2e7726e58370a95d0319361f4f6ad231138d1328
2011-04-01Use full-pixel MV in mvsadcost calculationYunqing Wang
MV sad cost error is only used in full-pixel motion search, which only need full-pixel resolution instead of quarter-pixel resolution. This change reduced mvsadcost table size, and removed unneccessary pamameter passing since this table is constant once it is generated. Change-Id: I9f931e55f6abc3c99011321f1dfb2f3562e6f6b0
2011-03-17Increase static linkage, remove unused functionsJohn Koleszar
A large number of functions were defined with external linkage, even though they were only used from within one file. This patch changes their linkage to static and removes the vp8_ prefix from their names, which should make it more obvious to the reader that the function is contained within the current translation unit. Functions that were not referenced were removed. These symbols were identified by: $ nm -A libvpx.a | sort -k3 | uniq -c -f2 | grep ' [A-Z] ' \ | sort | grep '^ *1 ' Change-Id: I59609f58ab65312012c047036ae1e0634f795779
2011-03-11Align SAD output array to be 16-byte alignedYunqing Wang
Use aligned store. Change-Id: Icab4c0c53da811d0c52bb7e8134927f249ba2499
2011-02-10Improve motion search in real-time modeYunqing Wang
Applied better MV prediction in real-time mode, which improves the encoding quality. Used quarter-pixel search instead of iterative sub-pixel search for speed >=5 to improve encoding performance. Tests on the test set showed: 1. For speed=-5, quality improvement: 1.7% on AvgPSNR and 2.1% on SSIM, performance improvement: 3.6% (This counts in the performance lose caused by MV prediction calculation in "Improve MV prediction in vp8_pick_inter_mode() for speed>3"). 2. For speed=-8, quality improvement: 2.1% on AvgPSNR and 2.5% on SSIM. but, 6.9% performance decrease because of MV prediction calculation. This should be improved later. Change-Id: I349a96c452bd691081d8c8e3e54419e7f477bebd
2011-01-18Fix encoder real-time only configuration.Attila Nagy
Remove allocation/deallocation of stats storage. Remove full search functions in machine specific encoder inits. Remove last pass validation in validate_config. Change-Id: I7f29be69273981a4fef6e80ecdb6217c68cbad4e
2010-12-14Fix a bug in motion search code(2)Yunqing Wang
This fix added MV range checks for NEWMV mode as suggested by Jim. To reduce unnecessary MV range checks, I tried Yaowu's suggestion. Update UMV borders in NEWMV mode to also cover MV range check. Also, in this way, every MV that is valid gets checked in diamond search function. Change-Id: I95a89ce0daf6f178c454448f13d4249f19b30f3a
2010-12-14Fix a bug in motion search codeYunqing Wang
The MV's range is 256. Since the new motion search uses a different starting MV than the center ref MV, a MV range checking needs to be done to avoid corruption. Change-Id: I8ae0721d1bd203639e13891e2e54a2e87276f306
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-10-27Full search SAD function optimization in SSE4.1Yunqing Wang
Use mpsadbw, and calculate 8 sad at once. Function list: vp8_sad16x16x8_sse4 vp8_sad16x8x8_sse4 vp8_sad8x16x8_sse4 vp8_sad8x8x8_sse4 vp8_sad4x4x8_sse4 (test clip: tulip) For best quality mode, this gave encoder a 5% performance boost. For good quality mode with speed=1, this gave encoder a 3% performance boost. Change-Id: I083b5a39d39144f88dcbccbef95da6498e490134
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-26make arm hex search the generic implementationJohn Koleszar
The ARM version of vp8_hex_search() is a faster implementation of the same algorithm. Since it doesn't use any ARM specific code, it can be made the default implementation. This removes a linking error. Change-Id: I77d10f2c16b2515bff4522c350004e03b7659934
2010-10-26arm: remove duplicate functionsJohn Koleszar
These functions were true duplicates of functions present in the generic code. This fixes some of the link errors when building with --enable-shared --enable-pic. Change-Id: Idff26599d510d954e439207883607ad6b74df20c
2010-10-14Improve bounds checking in vp8_diamond_search_sadx4()Yunqing Wang
In order to know if all 4/8 neighbor points are within the bounds, 4 bounds checking are enough instead of checking 4 bounds for each points (16/32 checkings). This improvement reduces cost of vp8_diamond_search_sadx4() by 30%, and gives encoder a 1.5% performance gain (test options: 1 pass, good, speed=4). Change-Id: Ie8da29d18a6ecfc9829e74ac02f6fa70e042331a
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-06-24vp8cx : bestsad declared and initialized incorrectly.Fritz Koenig
bestsad needs to be a int and set to INT_MAX because at the end of the function it is compared to INT_MAX to determine if there was a match in the function. Change-Id: Ie80e88e4c4bb4a1ff9446079b794d14d5a219788
2010-06-24vp8cx : bestsad declared and initialized incorrectly.Fritz Koenig
bestsad should be an int initialized to INT_MAX. The optimized SAD function expects a signed value for bestsad to use for comparison and early loop termination. When no match is made, which is determined by a comparison of bestsad to INT_MAX, INT_MAX is returned.
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-04LICENSE: update with latest textJohn Koleszar
Change-Id: Ieebea089095d9073b3a94932791099f614ce120c
2010-05-24Fixed minor bug for realtime-only buildingYunqing Wang
2010-05-18Initial WebM releaseJohn Koleszar