Commit graph

349 commits

Author SHA1 Message Date
Ari Koivula 0df974cb0d Change sad functions to accept negative block widths.
This makes boundary checking clearer.
2013-10-11 14:11:21 +03:00
Ari Koivula 235b1ec0bc Add rest of the quadrants for sad calculation.
- All tests pass.
- Movement vectors that don't overlap with the frame aren't handled yet.
2013-10-11 12:41:07 +03:00
Ari Koivula b58a6387ee Clean up the code a bit. 2013-10-11 11:04:49 +03:00
Ari Koivula 7e6c9aefe8 Add handling of more cases to sad calculation. 2013-10-10 21:51:27 +03:00
Ari Koivula 4e36992752 Move basic SAD functions to picture-module. 2013-10-10 21:49:41 +03:00
Ari Koivula 0e078b2d18 Rethink SAD-calculation. 2013-10-10 21:49:20 +03:00
Ari Koivula 1fcb452479 Simplify reference buffer calculation. 2013-10-10 21:48:55 +03:00
Marko Viitanen 7a53bddead Fixed inter deblocking by setting correct CU residual info on transform split 2013-10-10 17:47:08 +03:00
Marko Viitanen 1b2b3c19bb Added option to enable residual coding skip when residual under threshold 2013-10-10 16:31:00 +03:00
Ari Koivula 684f6d548c Start adding sad calculation outside frame.
Works for top-left corner. 2/9 tests pass.
2013-10-10 16:11:07 +03:00
Marko Viitanen 2716b74100 Merge branch 'inter_residual' 2013-10-10 15:24:34 +03:00
Marko Viitanen 3d8e14f58b Fixed dequantization of inter-blocks 2013-10-10 15:22:25 +03:00
Marko Viitanen bc815e8cd2 Fixed scan_idx selection on quantization 2013-10-10 14:59:20 +03:00
Marko Viitanen 788a0c9d18 Bugfix for quantization scaling list selection 2013-10-10 11:17:17 +03:00
Marko Viitanen 82eca02ec8 Fixed deblocking condition on residual and deblocking disabling 2013-10-09 17:39:26 +03:00
Marko Viitanen 12fbc5fb4a Fixed and simplified inter deblocking strength selection 2013-10-09 17:39:25 +03:00
Marko Viitanen bb9ac4f03b Fixed quant to select table according to block type 2013-10-09 17:39:24 +03:00
Marko Viitanen c9cf75775b Deblocking fix: store block residual status and use it in deblocking 2013-10-09 17:39:23 +03:00
Marko Viitanen 2b5159d8ab Bugfix: residual coding almost working 2013-10-09 17:39:07 +03:00
Ari Koivula ea30bf0126 Fix SAD calculation to return correct value in non-overlapping case. 2013-10-09 16:08:56 +03:00
Marko Viitanen 817f83cc93 Bugfix for inter reconstruction: half-pel chroma reused variables 2013-10-09 13:39:00 +03:00
Ari Koivula 8719867330 Merge branch 'hexagon' 2013-10-09 12:12:19 +03:00
Marko Viitanen 102c39a396 Bugfix for inter reconstruction: half-pel chroma reused variables 2013-10-09 11:03:38 +03:00
Marko Viitanen bcd29cba5c Refactoring: residual related variable renaming and code styling 2013-10-09 11:01:16 +03:00
Ari Koivula cdcb56dd4a Add special case for the 0,0 vector to hexagon search. 2013-10-08 16:11:00 +03:00
Marko Viitanen ef0bea32e1 Merge branch 'master' into inter_residual
Conflicts:
	src/encoder.c
2013-10-08 15:04:31 +03:00
Marko Viitanen ac0db59408 Renamed variable to fix a typo 2013-10-08 14:49:02 +03:00
Ari Koivula 8910037936 Add hexagon-based motion vector search. 2013-10-08 13:38:03 +03:00
Ari Koivula 9d02dfdd13 Make debug html more strict. 2013-10-08 12:30:57 +03:00
Marko Viitanen a477d554d5 Merge branch 'inter_deblock' 2013-10-08 12:14:20 +03:00
Marko Viitanen 351817d008 Fixed intra block selection (always selected 64x64 which was not in search) 2013-10-08 12:13:52 +03:00
Marko Viitanen 8b9c5d129a Enabled deblocking by default 2013-10-08 12:12:43 +03:00
Marko Viitanen 40664c41d6 Fixed inter deblocking 2013-10-08 12:12:04 +03:00
Marko Viitanen e3899b8174 Fixed inter chroma deblocking 2013-10-03 11:05:00 +03:00
Marko Viitanen 2d38612e9a Inter deblocking changes, not working! 2013-10-02 18:09:22 +03:00
Marko Viitanen 13bbd2fb37 Fixed inter_get_mv_cand() candidate selection of B0 CU 2013-10-02 15:10:40 +03:00
Ari Koivula 36fe88caef Fix rounding errors in chrome half pel prediction.
The spec speaks nothing about rounding these values, but HM12 rounds the final
values. HM might be based on an old version of the spec that does all this rounding and clipping.

- Also fixes erroneous indexing when both horizontal and vertical are half pel.
2013-10-02 14:49:23 +03:00
Ari Koivula c753f6bac6 Fix boundary checking in CU visualization. 2013-10-02 11:11:21 +03:00
Ari Koivula 665b369164 Fix chroma problem in inter prediction.
There is still a separate problem, but this fixes the visible chroma problem
with motion vectors that have reference a chroma half-pixel.
2013-10-02 10:59:34 +03:00
Ari Koivula 61eb3b3b71 Improve cu-visualization by arranging them to picture dimensions and colors. 2013-10-01 20:46:10 +03:00
Marko Viitanen 192b077dba Modified residual coding to allow inter block data (BUGGY!) 2013-10-01 10:54:10 +03:00
Ari Koivula 681975ad4b Fix inter reconstruction for 8x8 blocks and enable 8x8 inter blocks again.
Inter reconstruction was modifying the movement in place when it shouldn't
have. This was causing issues only for the 8x8 blocks, because for larger
blocks the modified movement vector was too far away to be seen by the blocks
below it.
2013-09-30 18:01:21 +03:00
Ari Koivula 9bd35fcdb1 Remove split attribute from cu_info.
It is no longer used.
2013-09-30 16:42:23 +03:00
Ari Koivula 4a8088be20 Update cu visualization. 2013-09-30 16:42:23 +03:00
Ari Koivula a6200860b7 Merge branch 'encoder-cleanup' 2013-09-30 10:48:39 +03:00
Ari Koivula f58e418a1a Fix out-of-bounds detection in mv-search.
All blocks were intra because no movement vectors could be found.
2013-09-30 10:47:05 +03:00
Ari Koivula 9ad8bf2915 Refactor: encoder.c full cleanup. 2013-09-28 23:31:26 +03:00
Ari Koivula aee54cdcfa Refactor: encoder.c fix [] 2013-09-28 23:29:26 +03:00
Ari Koivula 36119985b5 Refactor: encoder.c variable renaming. 2013-09-28 20:27:36 +03:00
Ari Koivula 7e6aa31c6f Refactor: encoder.h renaming and cleanup. 2013-09-28 20:20:15 +03:00
Ari Koivula 571fec7c39 Add a more general cost function to motion search. 2013-09-28 16:41:57 +03:00
Ari Koivula 562a43d541 Fix bug with initial prediction of motion vector. 2013-09-28 16:34:23 +03:00
Ari Koivula 8bce7c84a0 Disable early cutoff optimization for motion vector search.c
It probably doesn't work right and might cause issues.
2013-09-28 16:04:11 +03:00
Ari Koivula 7979a59168 Fix check for (0, 0) vector when searching for best movement vector. 2013-09-28 16:02:30 +03:00
Ari Koivula 9bad984f14 Add special case for the (0, 0) vector to the fast search. 2013-09-25 19:31:49 +03:00
Ari Koivula 224bda37e7 Make a define switch for full search vs fast search. 2013-09-25 19:20:31 +03:00
Ari Koivula b1ada6bcd4 Take initial motion vector from last frame. 2013-09-25 19:09:08 +03:00
Ari Koivula 1d1bfd2a6f Remove unused stuff from motion search.
- inter_set_block is no longer needed.
2013-09-25 18:43:16 +03:00
Ari Koivula 4cda086035 Add an early stop condition to motion estimation. 2013-09-25 18:37:37 +03:00
Ari Koivula 2c894b49bf Disable cu-structure debug rendering.
- This can be enabled when needed. It doesn't have to be enabled in git.
2013-09-25 18:18:10 +03:00
Ari Koivula 6f13168285 Add faster motion estimation algorithm.
- New motion estimation does the same pattern as the old one, but centers the
  search on the best candidate at each step.
2013-09-25 18:16:31 +03:00
Ari Koivula 04f1dde8a1 Fix overwriting of motion vectors during search.
- Makes everything besides search to only use the bottom most layer of the
  picture.cu_array structure.
2013-09-25 16:21:51 +03:00
Marko Viitanen 91ff438238 Disabled deblocking filter and changed encoder to use P-slices after the first 2013-09-25 15:52:55 +03:00
Marko Viitanen 410d201e99 Fixed filter_inter_halfpel_chroma() sample rounding 2013-09-25 15:51:43 +03:00
Marko Viitanen 7cf8b1062b minor style changes to inter_recon() 2013-09-25 14:28:00 +03:00
Marko Viitanen 90239a8bbd fixed filter_inter_halfpel_chroma() by adding offset value 2013-09-25 14:27:26 +03:00
Marko Viitanen 37b0f45d80 Merge branch 'projects' of Z:/Work/HEVC_encoder into interpolation 2013-09-25 11:02:40 +03:00
Marko Viitanen 3d228278ef Fixes and comments for inter_recon and filter_inter_halfpel_chroma 2013-09-25 11:01:08 +03:00
Ari Koivula cda681294c Fix unsigned/signed mismatch warning. 2013-09-24 21:32:11 +03:00
Ari Koivula e5cced6b4a Move _CRT_SECURE_NO_WARNINGS to property sheet. 2013-09-24 21:31:48 +03:00
Marko Viitanen 13e058abce Fixed (some) bugs in filter_inter_halfpel_chroma and inter_recon
Optimizations for filter to only filter horizontal or vertical pixels
2013-09-24 15:43:20 +03:00
Ari Koivula adf98f7876 Change HEVC_encoder into a static library and add HEVC_interface for the exe.
- Move more settings to property sheets.
2013-09-24 13:43:15 +03:00
Ari Koivula 28e0090bd2 Make cpu-id arch detection use our own macro. 2013-09-24 12:41:14 +03:00
Marko Viitanen 469644dd5b Added interpolation filter for half-pel chroma, NOT WORKING 2013-09-23 18:07:16 +03:00
Ari Koivula e770f77564 Remove unnecessary preprocessor defines from project settings.
- _WIN32 and _WIN64 are defined by windows headers.
- _DEBUG is defined when debug libs are used.
- _CONSOLE does nothing.
2013-09-23 17:32:07 +03:00
Ari Koivula a3f2e84587 Redo x64 detection to not rely on predefined macro. 2013-09-23 17:27:17 +03:00
Ari Koivula 30c16fe299 Remove unused members from cabac_data.
- Removing them also makes cabac_init unnecessary.
2013-09-20 15:04:02 +03:00
Ari Koivula 6dd049a238 Refactor: picture.h remaining renames. 2013-09-20 12:49:44 +03:00
Ari Koivula 8d5dd67f76 Refactor: Change name of CU_info.CU to cu_array. 2013-09-20 12:47:53 +03:00
Ari Koivula 5233c417df Refactor: search.c/.h full cleanup. 2013-09-20 12:18:23 +03:00
Marko Viitanen 03ab259a9e Refactor: transform.c/.h full cleanup. 2013-09-20 11:51:09 +03:00
Ari Koivula d09e2bd214 Refactor: picture.c/.h full cleanup. 2013-09-20 11:15:18 +03:00
Ari Koivula 86b4ee475a Refactor: picture.c remove leading whitespace.
Changing indentation like this really messes with diff, so I did it in
a separate commit.
2013-09-20 11:08:27 +03:00
Marko Viitanen 3a9449e5e0 Refactor: intra.c full cleanup 2013-09-19 16:21:53 +03:00
Ari Koivula f750c24948 Refactor: nal.c/.h full cleanup.
- Move constant from the signature of calc_checksum into a macro.
2013-09-19 16:03:02 +03:00
Ari Koivula 4416d6ec36 Refactor: filter.c/.h full cleanup. 2013-09-19 15:29:54 +03:00
Ari Koivula 61c1d7413f Add extern for g_chroma_scale.
- g_chroma_scale is used in filter.c.
2013-09-19 15:29:54 +03:00
Marko Viitanen 5264569f43 Refactor: inter.c/.h full cleanup 2013-09-19 15:08:30 +03:00
Ari Koivula d6932128aa Fix incorrect precedence.
- This bug was due to incorrect translation of ternary to if-expression
  during refactoring. Addition has higher precedence than bit shift.
2013-09-19 13:46:20 +03:00
Marko Viitanen 33df8e3db5 Refactor: encmain.c full cleanup 2013-09-19 12:48:45 +03:00
Ari Koivula 996769c725 Refactor: Move ctx_init from cabac to context. 2013-09-19 12:47:39 +03:00
Ari Koivula d47391163c Refactoring: Remove array g_next_state from cabac.h.
- This array is no longer used. Macros CTX_UPDATE_LPS and CTX_UPDATE_MPS are
  used instead.
2013-09-19 12:41:36 +03:00
Ari Koivula b25abe7c0b Refactor: cabac.c/.h full cleanup. 2013-09-19 12:38:11 +03:00
Marko Viitanen 32c984159f Refactor: context.c/.h full cleanup 2013-09-19 12:22:26 +03:00
Marko Viitanen f9f30e33ee Refactor: config.c/.h full cleanup 2013-09-19 11:28:58 +03:00
Ari Koivula f4833ba931 Refactor: cabac.c renaming. 2013-09-19 11:05:42 +03:00
Ari Koivula 627762dcd8 Refactor: Fix include guards.
- Remove _ from the beginning of include guards because that prefix is
  for the implementation.
- Move include guards to the beginning of file.
- Unify the syntax.
2013-09-19 10:36:24 +03:00
Ari Koivula adf619f9dd Refactor: Update file comments. 2013-09-18 18:01:20 +03:00
Marko Viitanen db3d8d8a6e Refactor: bitstream.c full cleanup 2013-09-18 16:03:47 +03:00
Marko Viitanen df8c5a6acd Refactor: transform.h renaming. 2013-09-18 15:14:31 +03:00
Ari Koivula de447ee18b Refactoring: intra.h renaming. 2013-09-18 15:13:45 +03:00
Marko Viitanen bdab04976d Refactor: search.h renaming. 2013-09-18 15:00:13 +03:00
Marko Viitanen a018567854 Refactor: picture.h renaming. 2013-09-18 14:58:46 +03:00
Marko Viitanen 1bfc520ddf Refactor: inter.h renaming. 2013-09-18 14:53:11 +03:00
Ari Koivula 19e9b95a71 Refactor: global.h renaming. 2013-09-18 14:51:24 +03:00
Marko Viitanen 945e6c9c0e Merge branch 'refactoring' of Z:/Work/HEVC_encoder into refactoring 2013-09-18 14:49:36 +03:00
Marko Viitanen 0bf4f65a55 Refactor: encoder.h renaming 2013-09-18 14:49:01 +03:00
Ari Koivula 81e4e05b42 Refactor: filter.h renaming. 2013-09-18 14:46:55 +03:00
Ari Koivula 1ed509b74e Refactor: debug.h renaming. 2013-09-18 14:42:05 +03:00
Marko Viitanen 0a6c38a8e9 Refactor: context.h renaming 2013-09-18 14:33:47 +03:00
Marko Viitanen a1621bf900 Refactor: bitstream.h/.c renaming 2013-09-18 14:11:23 +03:00
Ari Koivula 81cb6264ab Refactor: cabac.h renaming. 2013-09-18 14:06:45 +03:00
Ari Koivula 4f360fcb80 Split MAX_SEARCH_DEPTH to inter and intra versions. 2013-09-18 12:29:23 +03:00
Ari Koivula 44a5498e30 Reorder includes to avoid hidden dependencies.
- Includes of global.h have been moved to headers because most headers
  require stdint.h.
- Includes required by the header have been moved from the .c to the header.
- Spaces have been added between includes to distinguish classes of includes.
2013-09-18 12:29:23 +03:00
Ari Koivula 03f6bddfb0 Add visualization of CU blocks for mode searching.
This is for debugging the inter movement vector search.
2013-09-18 12:29:23 +03:00
Ari Koivula 16edf834f6 Add debug module and add CU visualization to the debug module. 2013-09-18 12:29:22 +03:00
Ari Koivula e657482a9e Add a missing include to a header.
- Remove unnecessary unrelated forward declaration.
2013-09-18 12:29:22 +03:00
Marko Viitanen c87d3870ce Fixed inter_get_mv_cand and added new define ENABLE_TEMPORAL_MVP 2013-09-18 10:15:05 +03:00
Ari Koivula 48581bdad8 Add temporary mechanism to force use of prediction units. 2013-09-16 23:00:38 +03:00
Ari Koivula fa0bab47f9 Fix MV search bugs.
- Calculate motion vector from the source instead of origo.

- Don't return without searching deeper.
2013-09-16 22:44:44 +03:00
Ari Koivula 48c2dc4cd9 Merge remote-tracking branch 'remotes/origin/fador' 2013-09-16 17:49:00 +03:00
Ari Koivula 82e2299b38 Add motion vector search.
- Add SAD calculation for arbitrary shape and size blocks.
2013-09-16 17:39:12 +03:00
Marko Viitanen 3ff3318980 Fixed bug(s) in inter_recon() 2013-09-16 17:15:54 +03:00
Marko Viitanen 6a4011a90a Added motion vector candidate selector 2013-09-16 16:51:13 +03:00
Marko Viitanen 8e776366dc Added (basic) motion vector prediction 2013-09-16 16:37:24 +03:00
Ari Koivula 2533b3bcb7 Add comments to CU_info_inter. 2013-09-16 14:42:05 +03:00
Marko Viitanen 182381a23c Merge branch 'fador' of Z:/Work/HEVC_encoder
Conflicts:
	src/encoder.c
2013-09-12 19:15:05 +03:00
Marko Viitanen beef362624 Implemented inter reconstruction inter_recon() 2013-09-12 18:50:11 +03:00
Marko Viitanen 10485ab51a One reference picture is now kept on encoder->ref list 2013-09-12 17:38:08 +03:00
Marko Viitanen cb8c0ebd99 Fixed 2 warning on unsigned/signed compare 2013-09-12 17:28:28 +03:00
Marko Viitanen 4421827d59 Fixed picture_destruct to free all allocated memory 2013-09-12 17:26:27 +03:00
Marko Viitanen 7cd7afe8a2 Added picture_list_rem and picture_list_add functions 2013-09-12 17:15:14 +03:00
Marko Viitanen 81f584742c Added picture_init() and changed cur_pic to pointer in encoder_input struct
Also contains few inter coding changes
2013-09-12 16:28:40 +03:00
Marko Viitanen 8d44f29d89 Fixed temporal_id to be always zero 2013-09-12 15:45:42 +03:00
Marko Viitanen b7c074f8c3 Fixed temporal_id to be always zero 2013-09-12 15:26:03 +03:00
Ari Koivula 7da00bc51a Merge branch 'funny-sizes' 2013-09-11 20:10:28 +03:00
Ari Koivula 116d5b14be Fix handling of non factor of 8 resolution.
- Reimplement bit filling routines to copy bits form the edge, instead of
  using a constant.

- Add real_width and real_height to encoder_input and store the actual input
  resolution in them instead of in encoder_input.width and height. This fixed
  a crash. It's also clearer.

- Correctly scale conf_win offsets to be in terms of chroma.
2013-09-11 20:02:38 +03:00
Marko Viitanen 6ede4c60df Merge branch 'master' of Z:/Work/HEVC_encoder into fador
Conflicts:
	src/context.c
	src/search.c
2013-09-11 14:38:23 +03:00
Marko Viitanen 1763eb22cb Fixed search_best_mode() to select inter blocks 2013-09-11 14:32:20 +03:00
Ari Koivula 7cd57087da Fix string constant. 2013-09-11 00:31:13 +03:00
Ari Koivula 850e8b2586 Add filling out the blanks for reading non multiple of 8 resolutions. 2013-09-09 22:19:16 +03:00
Ari Koivula 2426a4bc1f Move file reading to encoder module. 2013-09-09 21:19:49 +03:00
Ari Koivula be98d8fef1 Clarify some comments. 2013-09-09 20:44:21 +03:00
Ari Koivula 2b9e2485db Add handling of resolutions that are not multiples of the smallest block size.
- When resolution is not a multiple of 8, increase the size of the picture.

- Add conformance window information to the SPS NAL. Thested to work in all
  dimensions with YUVplayer.
2013-09-09 20:43:14 +03:00
Marko Viitanen d6e51374e3 Added new context for root cbf, fixed a bug in MVD coding 2013-09-09 17:37:49 +03:00
Ari Koivula 28ce121f32 Improve code style for search_best_mode before analyzing. 2013-09-09 14:39:01 +03:00
Ari Koivula 5acb280407 Change "ToDo" to "TODO".
Visual Studio recognized only TODO.
2013-09-09 14:22:53 +03:00
Ari Koivula 96cfc84dd8 Fix compiler warnings. 2013-09-09 14:09:08 +03:00
Marko Viitanen dce892dce8 Merge branch 'master' of Z:/Work/HEVC_encoder into fador
Conflicts:
	.gitignore
2013-09-09 12:11:09 +03:00
Ari Koivula 2b94b9db4c Rename NAL type names to the ones used in the standard. 2013-09-09 11:04:09 +03:00