Commit graph

448 commits

Author SHA1 Message Date
Marko Viitanen da3fe9f199 Fixed rounding in bi-pred reconstruction 2015-04-02 15:55:13 +03:00
Marko Viitanen c7a17cf1c4 Changed motion vector candidate derivation to work with bi-pred case 2015-04-02 14:05:24 +03:00
Marko Viitanen d26b89174b Fixed intra chroma search ref_v pointer 2015-03-31 15:43:22 +03:00
Marko Viitanen 4b7db2e014 Added a dummy bi-pred search, always selects bi-pred block when possible 2015-03-31 15:02:43 +03:00
Marko Viitanen 2c676927f0 Fixed a bug in bipred reconstruction causing an overflow 2015-03-31 15:02:10 +03:00
Marko Viitanen 06bc4f3d5e Fixed duplicate checking for merge cand and some cleanup 2015-03-31 12:23:46 +03:00
Marko Viitanen f881d6bf8a Modified structures and mv handling to use L0/L1 vectors 2015-03-30 14:40:29 +03:00
Marko Viitanen 9a828ae5da Fixed merge candidate scaling in hexbs and excluded weighted pred candidates in cost calc 2015-03-24 09:38:24 +02:00
Marko Viitanen 2d8552d0d6 Fixed merge candidate usage by skipping weighted prediction candidate 2015-03-23 15:17:41 +02:00
Marko Viitanen 34e8f70c8c Fixed temporal MV predictor offset 2015-03-23 09:22:47 +02:00
Marko Viitanen eccf1c1a16 Fixed temporal MV predictor offset 2015-03-23 09:21:52 +02:00
Marko Viitanen 164b7a7743 Merge remote-tracking branch 'remotes/origin/master' into GOP 2015-03-20 11:40:15 +02:00
Marko Viitanen 26082d5328 Zero merge candidate fix for B-frames 2015-03-20 10:33:05 +02:00
Arttu Ylä-Outinen 3f31e7bf47 Merge branch 'tz-search' 2015-03-19 19:04:44 +02:00
Arttu Ylä-Outinen 176dbb6a5b Add --me parameter.
Selects the integer motion estimation algorithm (hexbs or tz).
2015-03-19 18:48:10 +02:00
Marko Viitanen d72c560880 Generate sorted reference list for L0 and L1 2015-03-19 12:26:59 +02:00
Marko Viitanen c761a6beb3 Added encoder state as an input parameter to inter_get_merge_cand() 2015-03-18 12:35:47 +02:00
Marko Viitanen c56b4d5747 Added combined merge candidates on B-slices and struct inter_merge_cand_t 2015-03-18 10:03:06 +02:00
Ari Koivula 6ec177f75c Improve handling of input vector to inter search. 2015-03-17 17:16:15 +02:00
SanteriS 913ade461b tz_search step 1, first if: && -> || 2015-03-12 17:57:17 +02:00
SanteriS bdb0639ac9 fixed function interfaces for tz_search and its subfunctions. 2015-03-12 17:54:21 +02:00
Marko Viitanen 66660516b7 Merge remote-tracking branch 'remotes/github/master' into GOP
Conflicts:
	src/cabac.h
	src/config.h
	src/cu.h
	src/encoder_state-bitstream.c
	src/encoderstate.c
2015-03-10 10:32:00 +02:00
Marko Viitanen eba298e635 Added cu->inter.mv_ref_coded variable 2015-03-10 09:17:25 +02:00
SanteriS 9e9f5e3150 Merge branch 'master' of https://github.com/ultravideo/kvazaar 2015-03-08 19:20:08 +02:00
SanteriS e2f9fe130a changed step 1 for tz_search 2015-03-08 19:19:23 +02:00
Marko Viitanen 6095503918 Modified search to use correct reference id and mv directions 2015-03-06 16:29:24 +02:00
Ari Koivula 2f79bfebf7 Rename parameter encoder_state to state in all functions.
- It's so widely used that there isn't really need to emphasize that
  it's the encoders state. Also, it isn't really the encoders state,
  but encoding jobs state.
2015-03-04 17:31:07 +02:00
Ari Koivula ded6fd9ee8 Renamed typedef pixel to pixel_t. 2015-03-04 16:35:53 +02:00
Ari Koivula 1f42adb1ea Renamed typedef coefficient to coeff_t. 2015-03-04 16:33:47 +02:00
Ari Koivula fe55961f84 Rename struct image to image_t. 2015-03-04 14:01:17 +02:00
Ari Koivula e5b18cd536 Inline cu_info_intra and cu_info_inter into cu_info_t. 2015-03-04 14:01:16 +02:00
Ari Koivula a0767a76d2 Rename struct vector2d to vector2d_t. 2015-03-04 14:01:16 +02:00
Ari Koivula 727fefacc4 Rename struct cabac_ctx to cabac_ctx_t. 2015-03-04 14:01:16 +02:00
Ari Koivula 7ca688b376 Rename struct videoframe to videoframe_t. 2015-03-04 14:01:15 +02:00
Ari Koivula 63e224574e Rename struct cu_info to cu_info_t. 2015-03-04 14:01:15 +02:00
Ari Koivula f6147b410a Rename struct encoder_control to encoder_control_t.
Conflicts:
	src/encoder_state-geometry.h
	src/encoderstate.h
2015-03-04 14:01:14 +02:00
Ari Koivula b14f89c88f Rename struct encoder_state to encoder_state_t. 2015-03-04 14:00:46 +02:00
SanteriS b55bfe1729 Merge branch 'master' of https://github.com/ultravideo/kvazaar 2015-02-25 18:15:35 +02:00
SanteriS bef7cae4f8 Merge branch 'master' of https://github.com/ultravideo/kvazaar 2015-02-25 15:29:11 +02:00
SanteriS f478732b4c tz search bugfix 2015-02-25 15:28:45 +02:00
Ari Koivula d7383ccb25 Change license to LGPL.
- Everyone who has contributed code to the project has been asked to license
  their contributions under LPGL and they have agreed.

- COPYING file changed to say LGPLv2.1 instead of GPLv2.

- GPL changed to LGPL in the header of every single file that a header and
  header added to the few that were missing one.

- Also.. Happy new year!
2015-02-25 15:19:05 +02:00
Ari Koivula 3e58e03b56 Select motion compensation search starting point from among merge candidates.
- Greatly reduces bdrate for most sequences.
2015-02-25 12:58:15 +02:00
SanteriS 2f68cf3847 (TZ search) Fixed missing check for owf mode. Added 6 point hexagon search pattern. 2015-02-23 16:59:48 +02:00
Ari Koivula c979db7e95 Avoid sorting intra modes unnecessarily. 2015-02-19 16:25:45 +02:00
Ari Koivula 1c2129fdcb Improve sort_modes.
- When encoding with fast enough settings this function can use up to 5%
  of the cpu time, so I tried to optimize it a little bit.
2015-02-19 16:25:38 +02:00
Ari Koivula 5fa6438b25 Clean up calls to memset.
- Replaces all calls to memset with new FILL and FILL_ARRAY macros. The use
  of memset was inconsistent and we never use it for anything complicated.
2015-02-19 16:25:28 +02:00
SanteriS 1a4d30d15a fixed step 1 of TZ algorithm 2015-02-11 18:51:21 +02:00
SanteriS ce4c251cd1 Merge branch 'master' of https://github.com/ultravideo/kvazaar 2015-02-09 17:29:49 +02:00
Ari Lemmetti 7846cf3093 Merge branch 'faster_interpolation' 2015-02-05 13:29:43 +02:00
SanteriS 50dd59eb21 Added different search patterns for TZ search. 2015-02-02 19:14:45 +02:00
SanteriS 4b3d77aaf2 Enable tz search. 2015-01-21 12:55:00 +02:00
Ari Koivula f86def8ed8 Remove unused variables. 2015-01-20 17:50:19 +02:00
Ari Koivula 81ad583e08 Use the same coeff cost calculation for all rd modes.
- It's not worth it to have these faster approximations for coefficient cost.
2015-01-20 17:34:59 +02:00
Ari Koivula 870171e6ad Fix --rd=0 actually work. 2015-01-20 17:34:59 +02:00
Ari Lemmetti 0e56d13b5d Use smaller bit depth for fractional pixel interpolation 2015-01-15 15:00:09 +02:00
Ari Lemmetti cc061b4c3d Added ipol strategy for interpolation filters.
Added initial files for AVX2 and generic strategies.
2015-01-15 14:59:37 +02:00
Ari Koivula ab3364afb4 Add skipping of intra search in inter frames for rd=0. 2015-01-15 11:54:35 +02:00
Ari Lemmetti cad5f14372 Fixed compile errors (-Werror) 2015-01-14 18:27:35 +02:00
SanteriS 126569c737 Added first version of TZ search algorithm. 2015-01-14 14:54:09 +02:00
Ari Koivula 01195aecbb Move cu split model to a function. 2015-01-14 11:16:34 +02:00
Ari Koivula 8c89dcfc50 Move mode bit calculation to a function. 2015-01-14 10:44:52 +02:00
Ari Koivula fc79c2103e Generalize the fast intra-mode tryout code to work for any depth. 2015-01-12 11:47:21 +02:00
Ari Koivula f1364d297b Fix bug resulting in incorrect bitstream.
- If 64x64 intra PUs were enabled and --rd was less than 2, no intra mode
  search was performed for depth 0 resulting in incorrect bitstream.
2015-01-12 11:16:33 +02:00
Ari Koivula f4bd322804 Add command line options for prediction unit depth. 2015-01-12 10:40:34 +02:00
Ari Koivula edf2681ea4 Comment functions in search.c. 2015-01-07 14:56:14 +02:00
Ari Koivula 374012ab26 Merge branch 'intraskip' 2014-12-01 17:30:03 +02:00
Ari Koivula 21d221c075 Add fast 64x64 intra test.
- If intra search is not enabled for a depth, try the result from the
  top left CU of the next depth. This seems to give most of the benefit
  of at least 64x64 intra prediction units without costing very much
  in performance.
2014-11-20 17:20:24 +02:00
Ari Lemmetti 4874f2662f Added --subme commandline parameter for fractional pixel motion estimation: 1 == enable (default), 0 == disable. 2014-11-20 14:59:04 +02:00
Ari Lemmetti d5d2e04995 Merge branch 'fme' 2014-11-19 16:40:22 +02:00
Ari Koivula f6fead6221 Fix crash on inter frames.
- If the bitcost was 0 it would underflow for skip mode. The bitcost is now
  checked before decrementing.
2014-10-21 18:11:39 +03:00
Ari Koivula dfc67b766a Disable rd1 chroma search.
- The bdrate improvement isn't really worth the time it takes, so enable it
  only for rd3 untill it can be made faster or better.
2014-10-16 13:59:20 +03:00
Ari Koivula e9b8d9b889 Fix gcc warnings.
- Remove unused variables.
- Change intra prediction functions to take their inputs as const pointers.
- Change intra_get_pred to take two pointers instead of an array of pointers,
  because the warnings got just too exotic.
2014-10-16 13:17:46 +03:00
Ari Koivula 4bac52d9b6 Merge branch 'intra' 2014-10-16 13:11:23 +03:00
Ari Koivula 02ec26fcea Try different number of chroma intra modes for different depths.
- And avoid doing extra work if no extra modes are tested for certain depths.
2014-10-16 12:21:36 +03:00
Ari Koivula 3cf5e422e8 Make fast chroma mode search select modes for slower chroma search. 2014-10-16 12:21:36 +03:00
Ari Koivula d12dbd4aa0 Add fast intra chroma mode search. 2014-10-16 12:21:08 +03:00
Ari Koivula 3e6023dfb5 Rename search constants and set sane defaults. 2014-10-16 03:08:11 +03:00
Ari Koivula 8a407b0313 Estimate luma and chroma intra mode bits separately.
- Remove cu_info.intra[].cost and bitcost as unnecessary.
- Add luma_mode_bits to complement chroma_mode_bits and remove
  intra_pred_ratecost as unneccessary. Difference is that intra_pred_ratecost
  was more coarse and included chroma mode with the assumption that it would
  be the same as chroma.
2014-10-16 03:08:11 +03:00
Ari Koivula c9e212ba92 Add intra chroma mode search.
- Based on full chroma reconstruction so enabled only for --rd=2.
2014-10-16 03:07:50 +03:00
Ari Koivula a469c059a5 Take chroma tr-skip bits into account. 2014-10-13 10:48:39 +03:00
Ari Koivula 7a5cf5d865 Add trskip mode cost to fast trskip mode decision. 2014-10-13 10:45:41 +03:00
Ari Koivula f164a5ba79 Add fast transform skip estimation to rough intra search. 2014-10-13 10:42:24 +03:00
Ari Koivula 28d1532578 Make rd=1 use cabac for coeff cost estimation. 2014-10-08 12:50:03 +03:00
Ari Koivula cbb2aa75b7 Add macros for adjusting weight of distortion between luma and chroma.
- Everything needs to have a short name because windows has a maximum path
  length limitation that is breaking my testing framework.
2014-10-08 10:31:54 +03:00
Ari Koivula 49ad845c33 Add cabac bits for part_mode. 2014-10-08 10:31:54 +03:00
Ari Koivula b6710e7893 Add cabac bits for cu split flag. 2014-10-08 10:31:54 +03:00
Ari Koivula 38b224cf69 Change rest of cu split search costs to double. 2014-10-08 10:31:54 +03:00
Ari Koivula 17473624d3 Add transform tree bit costs for cbf_luma. 2014-10-08 10:31:54 +03:00
Ari Koivula 3b04d39db4 Take cabac bits into account on transform tree. 2014-10-08 10:31:54 +03:00
Ari Koivula 296f142d9e Retain coded block flag data during transform split search. 2014-10-08 10:31:54 +03:00
Ari Koivula 85dea10f3f Clean up transform split search.
- Remove unnecessary checks and comment.
2014-10-08 10:31:54 +03:00
Ari Koivula e1b801eb6f Add transform tree chroma cbf bits. 2014-10-08 10:31:23 +03:00
Ari Koivula 3868cc7ff1 Fix crash on inter search when --tr-depth-intra is used.
- Transform splits meant for intra modes were used for inter when inter mode
  was chosen, which caused an assert to be triggered if the split transform
  block didn't have any coefficients.
2014-10-03 19:29:06 +03:00
Ari Koivula 8a80845b91 Add chroma to transform split search. 2014-10-03 11:36:57 +03:00
Ari Koivula 51662e1081 Fix differences between cu_rd_cost_luma and rdo_cost_intra. 2014-10-03 11:36:57 +03:00
Ari Koivula bc7d7d5cb6 Add cu_info* as parameter to reconstruction functions.
- This is required so these functions can be used for searching. When NULL
  is given they take the CU from LCU struct as they did previously.

Conflicts:
	src/search.c
2014-10-03 11:36:56 +03:00
Ari Koivula ccc575e2c6 Disable transform tree bits. 2014-10-03 11:36:56 +03:00
Ari Koivula a0ab469c89 Disable rdo_cost_intra. 2014-10-03 11:36:56 +03:00
Ari Koivula c164978e21 Add FULL_CU_SPLIT_SEARCH macro for disabling cu split optimization. 2014-10-03 11:36:56 +03:00
Ari Koivula 549ac96438 Change costs to doubles to avoid rounding intermediate results.
- Helps with debugging.
2014-10-03 11:36:56 +03:00
Ari Koivula e591e89ade Add prediction mode to chroma reconstruction parameters.
- Just like in luma.
2014-10-03 11:36:56 +03:00
Ari Koivula bfa399c8fc Fix compiler warnings.
- Non-parenthesized parameter in a macro.
- Unused variables.
- Wrong const qualifiers.
- Signed/unsigned comparison.
2014-09-22 10:04:57 +03:00
Ari Koivula 0db7d8d20f test cu split cost 2014-09-15 15:42:03 +03:00
Ari Koivula 3c73892609 Fix transform split search.
- Redo the search with the best mode to make sure the tr_depth parameters are
  correct.
2014-09-11 10:56:53 +03:00
Ari Koivula 46b6b1243b Add --rd=3 mode and enable searching of intra depth 0.
- intra_build_reference_border was overflowing at depth 0 because it uses
  arrays just large enough to accommodate 32x32 transforms, which is the
  biggest transform.
- For similar reasons search_intra_rough doesn't work at depth 0.
- The --rd=3 mode tries all modes with transform search. It also works without
  rough search so it was used to test depth 0 search. If --rd=3 is not on intra
  split at depth 0 is not searched for.

Conflicts:
	src/search.c
2014-09-11 10:54:41 +03:00
Ari Koivula c5fa824347 Rebase transform split search. 2014-09-08 14:13:59 +03:00
Laurent Fasnacht f3c311fe1a Fix commit 8502f3d 2014-08-11 15:17:15 +02:00
Laurent Fasnacht f9bffe35a5 Log tile id in sad perf log 2014-08-11 11:57:08 +02:00
Laurent Fasnacht 6a937de9b2 Fix search_cu log 2014-08-11 11:57:08 +02:00
Laurent Fasnacht 8502f3d850 Improve logging 2014-08-11 11:57:07 +02:00
Ari Koivula f605d6c35b Align intra buffers to 32 bytes for 256 bit SIMD instructions. 2014-07-11 17:26:19 +03:00
Laurent Fasnacht 72abc69b3d Measure time for SAD in _DEBUG mode 2014-07-08 11:42:58 +02:00
Laurent Fasnacht e64a692780 Add CU type in threadqueue.log 2014-07-08 09:06:31 +02:00
Laurent Fasnacht 946e3b9651 Log search_cu to threadqueue.log 2014-07-07 10:50:05 +02:00
Ari Koivula 7ecf78bb70 Use sqrt lambda cost for searches not using SSD.
- Add encoder_state->global->cur_lambda_cost_sqrt.

- Use sqrt lambda for inter search and rough intra search.

- The effect on inter is around 10-20% bdrate. The effect on intra is smaller
  and non-existent when --rd=2 is enabled, as the intra search refinement was
  already done with SSD and correct lambda.
2014-06-26 13:56:38 +03:00
Ari Koivula 60ecc6baae Remove unused stuff. 2014-06-17 16:20:01 +03:00
Ari Koivula 94bc457b6c Add option to disable fast intra search. 2014-06-17 15:32:05 +03:00
Ari Koivula e27fc875c0 Clean up intra search. 2014-06-17 15:09:12 +03:00
Ari Koivula e4d70ac1ab Use more starting points for smaller blocks in intra search. 2014-06-17 13:28:27 +03:00
Ari Koivula 9911c7553b Avoid unnecessary intra dir searching. 2014-06-17 13:11:35 +03:00
Ari Koivula bd16a55b9b Always check DC and planar intra modes.
- At least one of them is always in predicted modes, but to make sure they
  are both included add them explicitly.
2014-06-17 12:51:15 +03:00
Ari Koivula 70740da123 Add smarter rough intra search.
- Directional intra mode search is done using halving search from the best
  known mode. Starting modes are vertical, horizontal and the 3 diagonal
  modes.

Conflicts:
	src/search.c
2014-06-17 12:33:10 +03:00
Marko Viitanen 0e2fe9e7ff Changed intra search to skip some modes speeding it up 2014-06-17 12:32:29 +03:00
Marko Viitanen a1c3cfe944 Moved intra mode cost calculation to a function
Conflicts:
	src/search.c
2014-06-17 12:32:29 +03:00
Marko Viitanen eb7d46f9ef Modify CU split cost. 2014-06-17 12:30:32 +03:00
Ari Koivula b3c15b8f94 Merge branch 'owf' 2014-06-16 16:07:41 +03:00
Laurent Fasnacht 91de92134f Constrain the search not to go under the LCU below if OWF is enabled 2014-06-16 14:27:56 +02:00
Ari Koivula 1c97a10a6d Move intra SAD and SATD functions under strategies. 2014-06-16 12:13:41 +03:00
Laurent Fasnacht f4187dd10c cu_array data structure 2014-06-16 10:54:57 +02:00
Ari Koivula 87ca828a63 Correct intra sad function labels.
- These haven't been 16 bit for a long time.
2014-06-16 10:45:10 +03:00
Laurent Fasnacht 6b408b5904 No-copy works with --no-sao --no-deblock 2014-06-12 11:47:30 +02:00
Laurent Fasnacht 27a49d287d Big refactor to use videoframe, image_list, and image instead of picture* 2014-06-10 09:19:06 +02:00
Laurent Fasnacht 2456c65822 Replace accesses to picture->cu_array with picture_get_cu and picture_get_cu_const 2014-06-05 10:41:58 +02:00
Ari Koivula e585da37e5 Give correct transform depth to RDOQ.
Conflicts:
	src/search.c
2014-05-28 15:47:49 +03:00
Ari Koivula ddc02cc09e Avoid regenerating reference pixels for every rdo mode. 2014-05-22 13:18:28 +03:00
Ari Koivula dbe13d0cba Separate sad intra search from rdo search. 2014-05-22 12:47:45 +03:00
Ari Koivula 19ce21e07c Split final cost to luma and chroma functions. 2014-05-22 09:45:00 +03:00
Ari Koivula a6962e2974 Separate intra transform coding to luma and chroma functions. 2014-05-22 09:40:34 +03:00
Ari Koivula f9a603e4ea Move intra mode search form intra module to search module.
- Make the actual intra prediction function global.

- Move the rdo stuff to rdo module.
2014-05-19 16:12:02 +03:00
Ari Koivula 656b0a321b Add chroma mode to lcu_set_intra_mode.
- This is needed for intra split.
2014-05-19 15:58:54 +03:00
Ari Koivula 921f58b249 Add tr_split to lcu_set_intra_mode. 2014-05-19 15:58:54 +03:00
Ari Koivula 846b608125 Add transform split recursion to intra reconstruction. 2014-05-19 15:58:54 +03:00
Ari Koivula c9a8756fbd Fix NxN scan mode for lcu_get_final_cost.
- Scan mode was always selected according to the first PU mode.
2014-05-15 16:20:35 +03:00
Marko Viitanen b08047cce9 Fixed intra chroma mode selection 2014-05-15 09:50:05 +03:00
Tapio Katajisto 4d879945b2 Fixed cost calculations in fme 2014-05-15 03:42:42 +00:00
Ari Koivula f0e990905e Remove chroma mode "36".
- It's an unnecessary chore to handle this special case everywhere (it means
  chroma_mode == intra_mode). Better just to use the actual mode.
2014-05-14 19:56:35 +03:00
Laurent Fasnacht bb86f24000 Take advantage of the new buffers to remove uneeded item assignment 2014-05-14 13:27:13 +02:00
Laurent Fasnacht 6607c9f563 Use new buffers for search 2014-05-14 13:27:12 +02:00
Laurent Fasnacht c257c4b863 Add const for the buffers 2014-05-14 13:27:12 +02:00
Ari Koivula 9147b7acbf Split residual quantization to separate luma and chroma function. 2014-05-14 11:19:48 +03:00