Commit Graph

78 Commits

Author SHA1 Message Date
Yunqing Wang
1aa46abbdf VP9 motion vector unit test
To prevent the motion vector out of range bug, added a motion vector unit
test in VP9. In the 4k video encoding, always forced to use extreme motion
vectors and also encouraged to use INTER modes. In the decoding, checked if
the motion vector was valid, and also checked the encoder/decoder mismatch.

The tests showed that this unit test could reveal the issue we saw before.

Change-Id: I0a880bd847dad8a13f7fd2012faf6868b02fa3b4
2017-04-06 00:50:56 +00:00
Ranjit Kumar Tulabandu
bf15ca1091 Fix for out of range motion vector bug in sub-pel motion estimation
BUG=webm:1397

(yunqingwang)
To verify that this patch wouldn't cause much performance change,
the Borg tests were run. Here was the result:
       avg_psnr   overall_psnr  ssim
hdres: -0.002     0.006         0.013
midres:   0         0             0
lowres:   0         0             0

Change-Id: Iae395ae7b741e0513cf5bab9dcace110b792a67d
2017-04-03 16:16:49 +00:00
Ranjit Kumar Tulabandu
359a6796da Changes to facilitate row based multi-threading of ARNR filtering
Change-Id: I2fd72af00afbbeb903e4fe364611abcc148f2fbb
2017-02-01 13:03:52 -08:00
Alex Converse
6554333b59 Refactor mv limits.
Change-Id: Ifebdc9ef37850508eb4b8e572fd0f6026ab04987
2016-08-08 11:54:00 -07:00
clang-format
e0cc52db3f vp9/encoder: apply clang-format
Change-Id: I45d9fb4013f50766b24363a86365e8063e8954c2
2016-08-02 16:47:11 -07:00
Yaowu Xu
87bf1a149c Fix ubsan warnings: vp9/encoder/vp9_mcomp.c
This commit fixes a number of ubsan warnings in HBD build.

BUG=webm:1219

Change-Id: I05f0fd0ef50e93db4ba34205005c54af1ed32acc
2016-06-21 15:37:59 -07:00
Alex Converse
55859e8428 Use whole pixel only at speed 8 screen content.
+5.857% BD-RATE on SCREEN_CONTENT

Leaving this off for non-screen content because:
+25.300% on TWITCH120
+37.833% BD-RATE on RTC

Change-Id: Ie0a312182d6cc859fb04298e4cd81d02b39e23fe
2016-03-15 15:04:48 -07:00
Geza Lore
5eefd3ebfd Add AVX vectorized vp9_diamond_search_sad
This function now has an AVX intrinsics version which is about 80%
faster compared to the C implementation. This provides a 2-4% total
speed-up for encode, depending on encoding parameters. The function
utilizes 3 properties of the cost function lookup table, constructed
in 'cal_nmvjointsadcost' and 'cal_nmvsadcosts'.
For the joint cost:
  - mvjointsadcost[1] == mvjointsadcost[2] == mvjointsadcost[3]
For the component costs:
  - For all i: mvsadcost[0][i] == mvsadcost[1][i]
        (equal per component cost)
  - For all i: mvsadcost[0][i] == mvsadcost[0][-i]
        (Cost function is even)
These must hold, otherwise the AVX version of the function cannot be used.

Change-Id: I6c2791d43022822a9e6ab43cd124a773946d0bdc
2015-11-11 14:03:47 +00:00
James Zern
30466f26b4 Revert "Add AVX vectorized vp9_diamond_search_sad"
This reverts commit f1342a7b07.

This breaks 32-bit builds:
 runtime error: load of misaligned address 0xf72fdd48 for type 'const
__m128i' (vector of 2 'long long' values), which requires 16 byte
alignment

+ _mm_set1_epi64x is incompatible with some versions of visual studio

Change-Id: I6f6fc3c11403344cef78d1c432cdc9147e5c1673
2015-11-06 13:15:01 -08:00
Geza Lore
f1342a7b07 Add AVX vectorized vp9_diamond_search_sad
This function now has an AVX intrinsics version which is about 80%
faster compared to the C implementation. This provides a 2-4% total
speed-up for encode, depending on encoding parameters. The function
utilizes 3 properties of the cost function lookup table, constructed
in 'cal_nmvjointsadcost' and 'cal_nmvsadcosts'.
For the joint cost:
  - mvjointsadcost[1] == mvjointsadcost[2] == mvjointsadcost[3]
For the component costs:
  - For all i: mvsadcost[0][i] == mvsadcost[1][i]
        (equal per component cost)
  - For all i: mvsadcost[0][i] == mvsadcost[0][-i]
        (Cost function is even)
These must hold, otherwise the AVX version of the function cannot be used.

Change-Id: I184055b864c5a2dc37b2d8c5c9012eb801e9daf6
2015-11-05 10:02:17 +00:00
Geza Lore
965a8dea0b Convert motion search config from AoS to SoA
This is a prerequisite for vectorizing vp9_diamond_search_sad_c.

Change-Id: I49cd9148782410ca8b16e8a468ca9e7c6d088410
2015-10-28 15:30:43 +00:00
James Zern
ff03d5448a vp9_mcomp: make search functions private
vp9_full_pixel_search() can be used as a replacement as it dispatches to
all search methods

Change-Id: I57fcb79c1362b569dc95237bdcc8390f54efd440
2015-08-28 18:54:10 -07:00
Johann
6a82f0d7fb Move sub pixel variance to vpx_dsp
Change-Id: I66bf6720c396c89aa2d1fd26d5d52bf5d5e3dff1
2015-07-07 15:51:04 -07:00
Jingning Han
96dba4902c Fix integral projection motion search for frame resize
This commit fixes the integral projection motion search crash when
frame resize is used. It fixes issue 994.

Change-Id: Ieeb52619121d7444f7d6b3d0cf09415f990d1506
2015-05-22 15:40:45 -07:00
Jingning Han
2deecdd5cb Move integral projection motion search to vp9_mcomp.c
Make it a general purpose fast motion estimation function, to be
used in the mode search process.

Change-Id: Ib354cb0e664dc61c30c0b2314297835ee75b157a
2015-03-04 10:30:15 -08:00
Yaowu Xu
1687c47bfd change to call vp9_refining_search_sad() directly
The function pointer in compressor instance does not change, so this
commit changes to call the function directly.

Change-Id: I9c9c460e3475711c384b74c9842f0b4f3d037cc5
2014-11-17 11:30:17 -08:00
Deb Mukherjee
d78dbff09a Subpel search cleanups and enhancements
- Some fixes to surface fit.
- Returns variance function as cost rather than sad in the
  pattern search and diamond search functions. Only
  vp9_pattern_search_sad function used in bigdia search
  uses sad as integer 1-away costs.
- Deploys SUBPEL_TREE_PRUNED_MORE for speed 4+.

Results:
derf [Speed 3]: About +0.036% in coding efficiency without any
discernible speed loss.
derf [Speed 4]: About 2-3% faster at -0.199% loss in coding efficiency.
derf [Speed 5]: About 3-4% faster at -0.149% loss in coding efficiency.

Change-Id: I8462f94f6adb46966ca964f2bd0400977357fd63
2014-10-08 23:59:43 -07:00
Deb Mukherjee
4e9c0d2ad4 Adds two new subpel search methods
One is a more aggressive version of the pruned subpel tree
search where only a single halfpel candidate is searched.
The search candidate is based on a surface fit result.
The other is a method to obtain the subpel position at one
shot based on the same surface fit.

The methods have not been deployed in any speed setting yet.

Change-Id: I34fef3f2e34f11396c9d1ba97f4be8c4ffca62d3
2014-09-29 12:51:20 -07:00
Deb Mukherjee
c94b17f4b2 Pruned subpel search for speed 3.
Adds code to return an integer cost list for NSTEP search. Then
uses it for pruned subpel search in speed 3.

derf: -0.06%
Speed on mobcal 720p increaes from 10.28 fps to 10.65 fps.
[Subject to further testing].

Change-Id: Ib591382d25b2c11bcaba9d3a27a93a9d1ab27a96
2014-09-23 11:27:58 -07:00
Deb Mukherjee
04b100b23e Updates vp9_pattern search to return integer sads
Updates the vp9_pattern_search function to return integer one-away
neighbors' sad values, for subsequent use in speeding up the
sub-pel search. Also, removes code for the do_refine option
which is not being used currently.
Updates the integer and subpel functions to pass in a 5-element
sad list for output or input.

A new pruned sub-pel search algorithm is implemented that uses
the sad returned from the integer pel search. But it is not
deployed yet.

Change-Id: Ifa9f5ad024b5b660570366d2bd900343e1891520
2014-08-28 06:49:58 -07:00
Yaowu Xu
6673d2f309 Remove an unused parameter in vp9_init_search_range()
Change-Id: I3d9130e726a1299fd258f6dfe93315e2d12f76da
2014-07-11 10:32:39 -07:00
Yunqing Wang
a581da218e Remove repetitive code in mcomp.c
Deleted vp9_find_best_sub_pixel_comp_tree(), and combined it in
vp9_find_best_sub_pixel_tree().

Change-Id: Ifb25763c8b19822df5537cc1daa76ce88dc3b056
2014-07-09 14:50:50 -07:00
Dmitry Kovalev
442cbf565d Moving full_pixel_search() to vp9_mcomp.c.
Change-Id: I12389f801ebd3bd2ae3bf31e125433bfb429ee65
2014-06-12 13:06:37 -07:00
Paul Wilkins
200f9aed4f Silence unused parameter warnings.
Remove two unused parameters in the function
vp9_refining_search_8p_c().

Change-Id: Ic192734586291cf5400926eeb8e720e69d40835c
2014-05-14 14:06:16 +01:00
Dmitry Kovalev
7d9d5df263 Using SPEED_FEATURES instead of VP9_COMP in vp9_init_search_range().
Change-Id: I961d50d6fafdd37ef7f23f0a871d28e28d2084ca
2014-05-01 16:36:51 -07:00
Dmitry Kovalev
aa464eca5e Adding search_site_config struct.
Change-Id: I2ad333553e673dbabcdc0f0366aea311e90849bf
2014-04-29 10:34:53 -07:00
Dmitry Kovalev
63fa722179 Removing unused cost arguments from mcomp functions.
Change-Id: Id81a76d18be6b2de69f81bb563d74c3bb356d434
2014-04-11 10:24:36 -07:00
Dmitry Kovalev
224d986858 Cleaning up vp9_get_mvpred_{av_,}var() functions.
Change-Id: I0df8c2a6d9863f92ee406010f2daeb5e40627649
2014-03-26 15:40:41 -07:00
Deb Mukherjee
44a203f5cd Merge "Support for a fast diamond search" 2014-03-10 09:53:21 -07:00
Deb Mukherjee
bead2e8fb4 Support for a fast diamond search
Adds a fast diamond search which is about 5% faster than FAST_HEX
with only a 0.1% drop in psnr when turned on for both speeds 5 and 7.
This search is turned on for speed 7.

Change-Id: I497630aa88a5148926086bb3038e7975e5f4eb98
2014-03-07 17:15:09 -08:00
Dmitry Kovalev
ee7d26d50c Cleaning up vp9_get_mvpred_var().
Change-Id: Ic535f0a1c2501c1af143237af3b2b51b4b4980f4
2014-03-06 16:27:15 -08:00
Deb Mukherjee
b80020d4db Refactoring motion search libs
The core motion estimation fucntions all return sad now consistently.
The only exception is vp9_full_pixel_diamond(), however the core diamond
and refining search routines called from vp9_full_pixel_diamond() also
return SAD. If variance of pred error + mv cost is desired it must be
calculated explicitly outside these functions. For very fast encoding,
hopefully this will eliminate some redundant computations.

Also suggests reimplementing FAST_HEX with the vp9_pattern_search
framework. It is not exactly the same as the existing FAST_HEX, but
performance is slightly better and speed is very similar. Enables
removing a lot of duplicate code.

Change-Id: I152736393438c25bdf7e96b37cbb8ce330f4f94a
2014-03-03 15:13:59 -08:00
Dmitry Kovalev
7bca32a6a3 Merge "Changing vp9_full_search_sad{, x3, x8} signatures." 2014-02-25 10:51:17 -08:00
Yunqing Wang
360c80cfb9 Use fast HEX search in real time mode
In good quality mode motion search, the best matches are normally
found after searching in a large area. In real time mode, to make
encoding fast, a center-biased fast HEX search is used, which
converges quickly most of the time. A 4-point diamond search is
also carried out as the following refining search, which gives more
precise results, and maintains good motion search quality.

At speed 5, the borg test on rtc set showed an overall PSNR loss of
0.936%. The encoding speed gain is 4% - 5%.

Change-Id: I42cd68bb56a09ca1b86293c99d5f7312225ca7ae
2014-02-18 14:35:16 -08:00
Dmitry Kovalev
36420009ea Changing vp9_full_search_sad{, x3, x8} signatures.
Passing block MV pointer instead of block index into
vp9_full_search_sad{, x3, x8} functions.

Change-Id: Ica07356633471c2c8f81b583a7aeba85a436bafb
2014-02-17 14:24:57 +01:00
Dmitry Kovalev
fde1b6d7f2 Using MV instead of int_mv inside vp9_full_pixel_diamond().
Change-Id: If33a5a12c4025d9b5ec863dfccea7ee70f800665
2014-02-13 11:23:05 -08:00
Dmitry Kovalev
50712fcaa9 Adding consts to mv search function arguments.
Change-Id: Ie79114bba4f0cea55d9f701e20d2be2017630f3b
2014-02-12 14:28:23 -08:00
Dmitry Kovalev
3b3f1d8303 Cleaning up vp9_mcomp.{c, h}.
Change-Id: Ib71d9ed3f98e9468ad951bdc24c9ab565216eb38
2014-01-31 18:11:41 -08:00
Dmitry Kovalev
c2ca97caaf Merge "Cleaning up motion compensation code." 2014-01-31 17:33:40 -08:00
Dmitry Kovalev
6c98df29e4 Cleaning up motion compensation code.
Change-Id: I74cf028e8c732cd0dbc070326152d3085b824a80
2014-01-23 17:15:30 -08:00
James Zern
b453941caf vp9/encoder: add extern "C" to headers
Change-Id: I4f51ce859a97bf1b8fd2b37ac585b7c643232b69
2014-01-23 16:21:24 -08:00
Dmitry Kovalev
d8bfe9e24c Cleaning up vp9_refining_search_sad() function.
Change-Id: I660b53da8ebf3049832ce8a10721051c4e0ebb00
2014-01-17 15:20:28 -08:00
Dmitry Kovalev
55d0230221 Cleaning up vp9_refining_search_8p_c() function.
Change-Id: Icf3b3dd96d7e133a4ad7260cd95288f6217998a6
2014-01-16 16:05:36 -08:00
Dmitry Kovalev
672c355a26 Replacing int_mv with MV.
Change-Id: Ifd432fa3741ba47102d298e0b348eb00f5a9ce53
2014-01-03 11:48:07 -08:00
Yunqing Wang
6ff4f19269 Remove a unused sub-pixel search
The original iterative search was replaced by subpel_tree search,
and was not used anymore.

Change-Id: I998b38e1cb0ee359a08b2410d0766dbf183ab071
2013-12-19 11:20:56 -08:00
Dmitry Kovalev
095b03231c Using MV struct instead of int_mv union in encoder (2).
Change-Id: I068345f722a7116e3119927295ad23a28d3066a0
2013-12-13 17:20:40 -08:00
Dmitry Kovalev
25da21b14e Using MV struct instead of int_mv union in encoder.
Change-Id: I8b81a3e4b4fa530a654c28d9c136afa0c1d379fd
2013-12-13 15:24:48 -08:00
Jingning Han
9d6e7ce12d Rename clamp_mv_min_max to set_mv_search_range
This function sets the motion search range limit. Rename it to be
more informative.

Change-Id: I2e8e01073dcb99c9bea9c9acd0a61d672d615444
2013-12-11 14:00:08 -08:00
Jingning Han
bbe68fbd2a Constrain encoder motion search range
Explicitly constrain the upper limit of motion search range (in the
unit of full pixel) to be [-1023, +1023]. It is intended to control
the effective motion search range for 4K sequences.

Change-Id: I645539c70885eec0f155781f439d97d333336e88
2013-11-18 11:19:45 -08:00
Dmitry Kovalev
2726f383cd Adding allow_hp as an argument to mv search functions.
Making this change in order to move allow_high_precision_mv field
from MACROBLOCKD structure to VP9_COMMON (because it is a frame level
flag).

Change-Id: I1d006ba36d938e0caf4d40fa051e2e38df9c1108
2013-10-17 14:02:04 -07:00