Commit graph

1246 commits

Author SHA1 Message Date
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
Ari Koivula 79b86ce6e1 Add --tr-depth-intra command line option.
Conflicts:
	src/encoder.c
2014-09-04 13:42:24 +03:00
Marko Viitanen fe236de807 Fixed sps_max_dec_pic_buffering value to include current picture 2014-09-01 10:31:11 +03:00
Marko Viitanen dbcc8d65aa Removed duplicate function from RDOQ 2014-08-28 08:50:01 +03:00
Ari Koivula 931ec7301c Put slice delta QP to bitstream.
- Before slice delta QP was always 0. Now if global->QP is changed before
  contexts are set, the delta qp is put to the bitstream, allowing for rough
  frame level rate control.
2014-08-25 16:43:23 +03:00
Ari Koivula 4c3bbd4a35 Rewrite the SContruct.
- Works with new /strategy/ structure.
- Change architecture selection to use arch= instead of construction target.
2014-08-25 16:43:23 +03:00
Ari Lemmetti f88c3b6f37 Removed unnecessary if (both branches did the same thing) 2014-08-20 11:54:35 +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
Laurent Fasnacht f1b303a2d2 Fix compilation errors 2014-08-11 09:53:06 +02:00
Ari Lemmetti 47e3bcfb50 Fixed incorrect shift values for inverse transforms in generic strategy 2014-08-07 16:01:30 +03:00
Ari Lemmetti 709520a233 Removed all AVX2 instructions from SATD functions.
-Zero extend macro now returns results in 2 xmm registers instead of one ymm
2014-07-31 13:25:28 +03:00
Ari Lemmetti 0beb278f5b Partial butterfly strategy is now called DCT strategy. Made changes to transform functions in preparation for optimizations.
-Moved fast_forward_dst and fast_inverse_dst to DCT strategies
2014-07-31 13:25:28 +03:00
Ari Lemmetti 6bf63bd171 Added AVX2 strategy for partial butterfly (no optimizations yet) 2014-07-31 13:25:28 +03:00
Ari Lemmetti faccc4f09b Partial butterfly functions now utilize the strategy selector 2014-07-31 13:25:28 +03:00
Ari Koivula c2fac805d7 Give HAVE_ALIGNED_STACK to yasm on windows.
- Linux gets it through some other means but on windows it needs to be
  given explicitly.

- Fixes issue #78.
2014-07-30 16:26:23 +03:00
Ari Koivula 669e99dd7f Improve intra SAD AVX2 intrinsics.
- Moved implementations for different sizes to inline functions that are
  defined using each other, reducing the amount of redundant code.

- Performance of sad_8bit_32x32_avx2 improved by about 10% due to unrolling of
  the loop.
2014-07-25 15:59:55 +03:00
Ari Koivula e00102f0ca Compile asm optimizations only if yasm is present. 2014-07-23 14:57:40 +03:00
Ari Lemmetti 85fb0784e4 Fixed intendentation and added some empty lines for readability 2014-07-23 12:32:27 +03:00
Ari Lemmetti bd6e89c1f0 Updated include directories and file names to Makefile 2014-07-22 15:36:54 +03:00
Ari Lemmetti 4f88ebce5a Added comments and made visual studio not to compile x86inc.asm 2014-07-22 15:07:57 +03:00
Ari Koivula cfd3636e08 Move some repetitive SATD asm into a macro.
Conflicts:
	src/strategies/x86_avx/picture_x86.asm
2014-07-22 12:46:39 +03:00
Ari Lemmetti c81639dd09 Removed old unused macro 2014-07-22 11:11:20 +03:00
Ari Lemmetti cf0797cafd Reordered and intended assembly code 2014-07-22 11:07:42 +03:00
Ari Lemmetti fea44c8234 Renaming AVX/asm files
-Splitted SAD and SATD functions in separate files
2014-07-21 18:02:01 +03:00
Ari Lemmetti a64df6f0d0 Merge branch 'asm'
Conflicts:
	build/kvazaar_lib/kvazaar_lib.vcxproj.filters
	src/Makefile
	src/strategies/strategies-picture.c
2014-07-21 16:41:09 +03:00
Ari Lemmetti 1be2c3aae5 Preparing push to master and misc
-Removed unnecessary <math.h> headers
-Updated AVX/asm optimizations to match the new file hierarchy
-Makefile only compiles .asm files if KVAZAAR_DISABLE_YASM is not set to 1 and TARGET_CPU_ARCH is x86
2014-07-21 12:39:56 +03:00
Ari Koivula a8f7103797 Add AVX2 implementations for sad_8bit_ 8x8, 16x16 and 32x32. 2014-07-18 18:27:30 +03:00
Ari Koivula 3daa5dd1f1 Add sse2 implementaton for sad_8bit_4x4. 2014-07-18 18:20:34 +03:00
Ari Koivula f49332c9b8 Add missing includes. 2014-07-18 17:56:15 +03:00
Ari Koivula 291817667f Tidy up the Makefile. 2014-07-18 17:31:18 +03:00
Ari Koivula e241866f43 Compile intrinsic functions with appropriate flags in gcc.
- Remove -march=native as it's no longer necessary for intrinsics to work.
  Closes #77.

- I couldn't test altivec or sse4.1, but sse4.1 compiles so I expect it
  to work.
2014-07-18 17:28:14 +03:00
Ari Koivula 5662621b3c Free threadqueue jobs when they are not needed.
- Also add destroying the mutex when the job is freed.

- This makes Kvazaar no longer acquire thousands of OS handles on Windows.
2014-07-16 16:51:20 +03:00
Ari Lemmetti 1e94262f85 Made AVX asm compatible with the changed system
- x86inc.asm is now located in extras
- Removed unused cpu.asm/h
2014-07-14 18:51:17 +03:00
Ari Lemmetti 683eda1183 Merge branch 'master' into asm
Conflicts:
	build/kvazaar_lib/kvazaar_lib.vcxproj
	build/kvazaar_lib/kvazaar_lib.vcxproj.filters
	src/Makefile
	src/strategies/strategies-picture.c
2014-07-14 16:42:33 +03:00
Ari Lemmetti 7f873e037c Updated Makefile to compile picture_x86.asm 2014-07-14 15:30:08 +03:00
Ari Lemmetti 2169f9ab8c Added AVX asm comments and fixes
-Added vzeroupper to satd macro to prevent AVX-SSE transition penalties int picture_x86.asm
-Fixed the order of registers in zero extend macro in picture_x86.asm
-Fixed SATD checkers test pattern in satd_tests.c
2014-07-14 14:43:36 +03:00
Ari Koivula 5d0df56c94 Move optimizations to their own compilation units according to target.
- This is necessary in order to compile AVX intrinsics correctly in
  Visual Studio. Having everything in their own units should also make
  compiling normal C code with optimizations on easier.

- For now the makefile still relies on GCC __target__ attribute for compiling
  intrinsics.
2014-07-11 17:26:19 +03:00
Ari Koivula f605d6c35b Align intra buffers to 32 bytes for 256 bit SIMD instructions. 2014-07-11 17:26:19 +03:00
Ari Koivula fbd03b706e Reconfigure VS project.
- Moved compilation flag stuff from project file to the abstraction layer.

- Disabled randomized base address as unnecessary.

- Disable stack buffer security check from release.
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 1a318c714d log poc with new_frame 2014-07-08 11:42:19 +02:00
Laurent Fasnacht e64a692780 Add CU type in threadqueue.log 2014-07-08 09:06:31 +02:00
Laurent Fasnacht abfbb7cad3 Fix duplicate type key in threadqueue.log 2014-07-07 11:36:50 +02:00
Laurent Fasnacht 946e3b9651 Log search_cu to threadqueue.log 2014-07-07 10:50:05 +02:00
Laurent Fasnacht f62e571c15 Add missing info to threadqueue.log 2014-07-07 10:49:40 +02:00
Ari Lemmetti 048127c7e3 AVX assembly optimizations improved 2014-07-02 16:57:06 +03: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
Laurent Fasnacht 1112dca933 Fix compilation issue with assertion disabled 2014-06-26 07:31:37 +02:00
Laurent Fasnacht 9ab9defe67 Bitstream length per frame works again 2014-06-19 10:24:03 +02:00
Laurent Fasnacht 45faadb2c9 Fix bug where the wrong number of frames could be encoded (if one frame takes longer than the others) 2014-06-19 10:24:02 +02:00
Ari Koivula d5a77be4b8 Fix avx detection for gcc.
- GCC doesn't support _xgetbv intrinsic so we have to use inline assembler.
2014-06-18 11:50:17 +03:00
Ari Lemmetti bdef5384ef Added AVX strategy 2014-06-17 16:52:24 +03:00
Ari Koivula d7abe6a7c2 Address compilation warning.
strategyselector.c:170:10: error: ‘__get_cpuid’ is static but used in inline function ‘get_cpuid’ which is not static [-Werror]
   return __get_cpuid(level, eax, ebx, ecx, edx);
2014-06-17 16:26:55 +03:00
Ari Koivula 60ecc6baae Remove unused stuff. 2014-06-17 16:20:01 +03:00
Ari Koivula 7532b789f8 Add -std=gnu99 for gcc.
- std=c99 doesn't work because then struct timespec won't be defined.
2014-06-17 16:15:39 +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
Marko Viitanen bfa37b876b Conformance fix: set sps_max_dec_pic_buffering to correct value 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
Laurent Fasnacht ef9c2258e9 Fix frame counter and stats 2014-06-16 13:21:52 +02:00
Ari Koivula 153b1ee41f Merge branch 'intra-sad-strategies' 2014-06-16 12:34:37 +03:00
Laurent Fasnacht 84d34c2655 Fix compilation on non-intel 2014-06-16 11:24:02 +02:00
Ari Koivula 3f00592b96 Separate strategyselector debug prints from _DEBUG.
- I only want to see the strategy stuff.
2014-06-16 12:15:19 +03:00
Ari Koivula 1c97a10a6d Move intra SAD and SATD functions under strategies. 2014-06-16 12:13:41 +03:00
Laurent Fasnacht 4b4702819b Also print encoding FPS 2014-06-16 11:10:11 +02:00
Laurent Fasnacht 2347574a8e Fix problems revealed by valgrind 2014-06-16 11:10:09 +02:00
Laurent Fasnacht 28c3f22ba1 Fix possible freeze 2014-06-16 11:03:48 +02:00
Laurent Fasnacht a96c742ad4 Fix depends for wpp+owf 2014-06-16 11:03:47 +02:00
Laurent Fasnacht f99e41d41f Improved CPU time statistics 2014-06-16 11:03:46 +02:00
Laurent Fasnacht 8a33c0a688 Fix recon job for wfrow 2014-06-16 10:55:01 +02:00
Laurent Fasnacht bf6024734a Fix statistics with OWF 2014-06-16 10:55:00 +02:00
Laurent Fasnacht 0522a3d8e5 --owf option 2014-06-16 10:55:00 +02:00
Laurent Fasnacht 47d1ded7b0 Dependencies between frames 2014-06-16 10:54:59 +02:00
Laurent Fasnacht 003d3c504c image_list_copy_contents 2014-06-16 10:54:58 +02:00
Laurent Fasnacht f4187dd10c cu_array data structure 2014-06-16 10:54:57 +02:00
Laurent Fasnacht 3be3fa8d6e Use different processing order depending if we have OWF or not 2014-06-16 10:54:56 +02:00
Laurent Fasnacht c32943f78b OWF 2014-06-16 10:54:56 +02:00
Laurent Fasnacht 490dd15f3d Remove flush between frame 2014-06-16 10:51:33 +02:00
Laurent Fasnacht fddcbabe28 bitstream writing is now a "normal" job in a thread 2014-06-16 10:51:32 +02:00
Laurent Fasnacht ff7143cc24 Assign thread_queue_jobs and move image_free to a more suitable place 2014-06-16 10:51:32 +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
Ari Koivula fcce6ae823 Fix printing of AVX2 capability. 2014-06-14 01:24:19 +03:00
Ari Koivula a49ba2633a Add OS and CPU detection for AVX2 and AVX. 2014-06-13 16:57:53 +03:00
Ari Koivula 1de102be61 Move strategies to their own compilation units.
- Enforces a little bit more hierarchy. Compilation units are in strategies
  and whatever inline includes they have are in a folder with the same name
  as the strategy.
2014-06-13 15:30:23 +03:00
Ari Koivula aa3549a717 Change SLEEP(0) to SLEEP(10) on Windows.
- This is a workaround for a performance problem on Windows where main thread
  is busy looping.
2014-06-13 12:01:03 +03:00
Laurent Fasnacht 4acadccf89 Only signal the required number of threads 2014-06-13 08:34:59 +02:00
Laurent Fasnacht 70ce7cec20 Remove unneccessary locks by adding threadqueue->queue_running counter 2014-06-13 08:34:58 +02:00
Laurent Fasnacht 7ef34ff5a1 Ability to dump mutex_lock, mutex_unlock and cond_wait timing, if compiled with -D_PTHREAD_DUMP 2014-06-13 08:32:14 +02:00
Laurent Fasnacht 68ad323e84 Tentative fix for race condition 2014-06-12 14:01:33 +02:00
Laurent Fasnacht b194e19708 Tentative fix for deadlock 2014-06-12 12:57:14 +02:00
Laurent Fasnacht b765eca153 Remove unneeded encoder_state_blit_pixels 2014-06-12 11:47:46 +02:00
Laurent Fasnacht da07b8b35d No-copy works (SAO and deblocking enabled) 2014-06-12 11:47:38 +02:00
Laurent Fasnacht 2cc700fab8 No-copy works with --no-sao (deblocking enabled) 2014-06-12 11:47:31 +02:00
Laurent Fasnacht 6b408b5904 No-copy works with --no-sao --no-deblock 2014-06-12 11:47:30 +02:00
Laurent Fasnacht 0dbfa62698 Replace copy of images made for tiles by sub-images (no copy)
- replace width by stride where required in the source code
2014-06-12 11:47:30 +02:00
Laurent Fasnacht b1347efef5 Add checkpoint in sao_reconstruct 2014-06-12 11:47:29 +02:00
Laurent Fasnacht ae4dc4eb44 Fix uninitialized sao_info structure members, which was creating false positive when checkpointing SAO 2014-06-12 11:47:29 +02:00
Laurent Fasnacht f371bdafc3 sao_info checkpoints 2014-06-12 11:47:28 +02:00
Laurent Fasnacht b7fe81c55c Checkpoint in pixels_blit, and avoid doing undefined behaviour when source and destination is the same.
Seems a reasonnable point to observe when refactoring, since it's called on most image data.
2014-06-12 11:47:28 +02:00
Laurent Fasnacht da8559fa34 Fix bug in CHECKPOINTS_FINALIZE() when checkpoints are disabled 2014-06-12 11:47:27 +02:00
Laurent Fasnacht 14df6de0d0 Checkpoint on frame checksum 2014-06-12 11:47:00 +02:00
Laurent Fasnacht 22df7cf98b Use an assert instead of a dumb assignment 2014-06-12 11:47:00 +02:00
Laurent Fasnacht cf123e317f Code to checkpoint cu_info and lcu_t 2014-06-12 11:47:00 +02:00
Ari Koivula ea830d3dd2 Add warning for VLAs in Makefile. 2014-06-12 09:57:08 +03:00
Ari Koivula 443f2f00aa Fix compilation for VS.
- VS2013 does not support variable length arrays.
2014-06-11 17:51:55 +03:00
Laurent Fasnacht 87ed365053 typo fix 2014-06-11 10:29:05 +02:00
Laurent Fasnacht 6ca30367f9 Fix POC bug 2014-06-11 10:29:05 +02:00
Laurent Fasnacht 8437229885 Fix handling of cu_arrays 2014-06-11 10:29:04 +02:00
Laurent Fasnacht e1d9cb015a Basic checkpointing system 2014-06-11 10:29:03 +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 530faf3951 Move video frame related stuff to videoframe 2014-06-05 14:08:31 +02:00
Laurent Fasnacht 0fac77f9eb Image now in separate module 2014-06-05 14:04:12 +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
Laurent Fasnacht 821b71910b Move picture_list to its own module 2014-06-05 09:49:24 +02:00
Laurent Fasnacht 7372f9244d Basic infrastructure for OWF 2014-06-05 09:09:25 +02:00
Laurent Fasnacht 16e3a58359 Performance improvement 2014-06-05 06:57:51 +02:00
Laurent Fasnacht bad6d45e5f Performance improvement 2014-06-05 06:57:51 +02:00
Laurent Fasnacht aad2089fcf Use -ftree-vectorize 2014-06-05 06:57:50 +02:00
Laurent Fasnacht ea04bcd6a4 AltiVec support for SAD 2014-06-05 06:57:34 +02:00
Ari Koivula 3a7147baf4 Merge branch 't-20140602' 2014-06-04 18:11:15 +03:00
Ari Koivula 31b1bbc215 Address implicit declaration of warnings. 2014-06-04 18:00:50 +03:00
Ari Koivula 4f5c87fc5e Remove duplicate function definition. 2014-06-04 17:56:05 +03:00
Ari Koivula cb7d7f9e15 Update Makefile. 2014-06-04 17:52:28 +03:00
Ari Koivula bb47534b88 Make encoder_state .c files their own compilation units.
- It's good that this module has been chopped to smaller pieces, but lets
  avoid including .c files unless we really have to. These make pretty good
  submodules on their own so just make them their own compilation units.

- Move some stuff around to avoid having to forward declare them
  in encoderstate.c.
2014-06-04 17:45:18 +03:00
Ari Lemmetti 9e649a8f38 Updated usage message 2014-06-04 15:23:27 +03:00
Laurent Fasnacht b8acdc784a Fix compilation of encoder.c with -D_DEBUG 2014-06-03 15:02:14 +02:00
Laurent Fasnacht 961da05235 Split encoderstate.c in multiple files 2014-06-03 14:47:49 +02:00
Laurent Fasnacht 3d07f8cc84 encoderstate refactor 2014-06-03 14:25:16 +02:00
Laurent Fasnacht 2e821b79a9 encoder_state in now in encoder_state.[ch] 2014-06-03 13:51:30 +02:00
Laurent Fasnacht 9bdecbe071 Better thread scheduling 2014-06-03 11:39:16 +02:00
Laurent Fasnacht 0811dbcfbe Remove unneeded cond_broadcast. Limit contention 2014-06-03 09:45:17 +02:00
Laurent Fasnacht 5ee1319c08 Altivec detection 2014-06-03 07:55:39 +02:00
Laurent Fasnacht 58ad3b4d26 Log more performance data, plot also now many threads are running 2014-06-03 07:42:22 +02:00
Laurent Fasnacht 5ed69b063b Strategy selector for array_checksum, basic implementation using precomputed 256*256 block with larger accesses than byte 2014-06-03 07:42:22 +02:00
Ari Koivula a483e8cb0f Move cpuid stuff away from compiler namespace.
Conflicts:
	src/strategyselector.c
2014-05-30 10:08:14 +03:00
Marko Viitanen 6a72f87028 Merge commit '792a5a5dd1946a327f22b2daba05c6645dfa8037' 2014-05-30 08:47:01 +03:00
Marko Viitanen 792a5a5dd1 Small fix for __get_cpuid() 2014-05-30 08:37:03 +03:00
Laurent Fasnacht 642564b6fb Remove unused variable 2014-05-28 15:04:45 +02:00
Laurent Fasnacht 4f86919d75 Get rid of assembly cpuid for x86, compilation works for powerpc 2014-05-28 15:04:00 +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 dceb3da9b8 Fix bug in search relating to transform with no non-zero coefficients.
- Because cost was calculated even though there were no coefficients, these
  very good modes were less likely to be selected.

- Added assert to encode_coeff_nxn to avoid these problems in the future.
2014-05-28 15:22:18 +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
Laurent Fasnacht 3a30a886fc FREE_POINTER of job->rdepends was at the wrong place (memory leak) 2014-05-22 07:15:18 +02:00
Laurent Fasnacht 3b38777b71 Fix condition depending on uninitialized value in SAO 2014-05-21 16:33:24 +02:00
Laurent Fasnacht 66e730ba94 Fix encoder_state_init, which was making out of bound reads 2014-05-21 14:23:36 +02:00
Laurent Fasnacht 37c20b8ce5 Add dependency between SAO rows 2014-05-21 13:52:56 +02:00
Laurent Fasnacht 90f46dc56f Threadqueue has now a start index to the first queue job. It improves the speed a little 2014-05-21 12:02:55 +02:00
Laurent Fasnacht f4f9093cb5 Parallel SAO 2014-05-21 11:48:29 +02:00
Laurent Fasnacht a3fcb141ed lcu_order_element now has pointer to neighbor LCUs 2014-05-21 11:06:53 +02:00
Ari Koivula de76d0a294 Don't add dependency to the above LCU in wavefront if it's not necessary.
- The top-right LCU already has dependency to the top LCU.
2014-05-20 10:48:19 +03:00
Laurent Fasnacht bdc2d43180 Write bitstream directly after doing the search. This is required since we need the correct entropy status for wpp 2014-05-20 09:29:01 +02:00
Laurent Fasnacht 06532292fc Wavefront are in tile coordinates 2014-05-20 09:28:58 +02:00
Ari Koivula 4751a3744b Fix intra mode search not doing boundary smoothing for DC.
- Move the boundary smoothing to the prediction function to make sure it's not
  forgotten.
2014-05-19 16:23:17 +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 1da94f2085 Stop deblocking from filtering edges not on 8x8 grid. 2014-05-19 15:58:54 +03:00
Ari Koivula 2224e18a46 Make deblocking work with transform splits.
- It used to work only with the implicit transform split from LCU size.
2014-05-19 15:58:54 +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 63f6cad5a0 Include global.h in thread modules. 2014-05-19 15:58:16 +03:00
Ari Koivula 551b087b47 Remove bunch of unnecessary code from encode_transform_unit.
- Really, it's useless. Selecting scan order isn't this hard.

- Checked from HM that ctx_idx doesn't have anything to do with contexts.
2014-05-16 17:42:40 +03:00
Ari Koivula f73bef0941 Remove unused include. 2014-05-16 16:09:59 +03:00
Laurent Fasnacht 6fdb821b14 Fix memory leaks 2014-05-16 12:20:40 +02:00
Laurent Fasnacht d4a6aed471 Multi-row jobs 2014-05-16 12:20:40 +02:00
Marko Viitanen 94285fbed7 Fixed compiling on visual studio with _DEBUG defined 2014-05-16 12:22:06 +03:00
Marko Viitanen 86155ef1ba Added windows specific timing macros for thread debugging 2014-05-16 12:16:22 +03:00
Laurent Fasnacht 36945e89ce Stubs to be able to make a portable version of the profiling 2014-05-16 10:15:05 +02:00
Laurent Fasnacht 53b0835316 Improve handling of jobs when not using threads 2014-05-16 08:50:43 +02:00
Laurent Fasnacht 519750d630 Write bitstream of a wavefront in a parallel way 2014-05-16 08:50:42 +02:00
Laurent Fasnacht 7473ac1bfc Able to log time in a simple way 2014-05-16 08:50:42 +02:00
Laurent Fasnacht 86e01284b8 Add -lrt 2014-05-16 08:48:54 +02:00
Laurent Fasnacht 4f73a7fc91 Instrument threads in order to be able to do some visualization 2014-05-16 08:44:32 +02:00
Ari Koivula a7cd31d87b Update the names of some bins to the current spec.
- Helps with debugging.
2014-05-16 05:44:03 +03:00
Ari Koivula ab4041c8fc Change cabac debug statements to show information better.
- Show the number of bits when encoding multiple bins. I would like just the
  bits them selves in string form, but that's too much trouble for this.

- Print then as unsigned and coerce them to unsigned, as they are going
  get coerced to unsigned by the function call anyway.

- Change state to be less verbose.
2014-05-16 05:44:03 +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
Ari Koivula 60a0ba4280 Update VS project files to link win32-pthread.
- I haven't found a good way of including external dependencies to VS projects
  yet. Win32-pthreads is assumed to be found at the same level as kvazaar dir
  and has the files x86/pthreadVC2.lib and x64/pthreadVC2.lib.

- Win32-pthreads also requires the pthreadVC2.dll to be in PATH when running
  the program. Not sure what to do about that yet. We might need an installer
  for windows to handle that.

- Disable openmp as it's no longer used.

- Stop linking Ws2_32.lib as that hasn't been used for ages.
2014-05-14 17:54:34 +03:00
Laurent Fasnacht 8ff9ea0eee Wavefront works with parallelism + deblock (still no SAO) 2014-05-14 14:01:26 +02:00
Laurent Fasnacht 38444a81a6 Threads should be put in queue in wait state if we want to add dependencies later 2014-05-14 14:01:25 +02:00
Laurent Fasnacht e72408249b Add encoder_state pointer to lcu_order_element, new worker_encoder_state_search_lcu function to run the search stuff on one LCU 2014-05-14 14:01:24 +02:00
Laurent Fasnacht eb62696461 Fix problems when image dimensions is not a multiple of LCU 2014-05-14 13:27:14 +02:00
Laurent Fasnacht 1ba1683c05 search buffer has to be allocated tile-wise to avoid problems with wavefronts 2014-05-14 13:27:13 +02: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
Laurent Fasnacht 1680273e80 Store search borders in a buffer for the whole picture 2014-05-14 13:27:11 +02:00
Laurent Fasnacht 0ceb1469a2 Improve decision about when to split into threads 2014-05-14 13:27:11 +02:00
Laurent Fasnacht d4a303e7e6 Free jobs as soon as possible 2014-05-14 13:27:09 +02:00
Laurent Fasnacht 63adb54a3d Add --threads <int> command line parameter 2014-05-14 13:27:09 +02:00
Laurent Fasnacht e772799d5e encoder_state_encode uses now the threadqueue 2014-05-14 13:27:08 +02:00
Laurent Fasnacht baede7f6c4 threadqueue 2014-05-14 13:27:08 +02:00
Laurent Fasnacht 8b7774153f Add SLEEP() define 2014-05-14 13:27:08 +02:00
Laurent Fasnacht aac7fc55b1 Remove filter_deblock function, which is not used and somewhat dangerous, since it doesn't take into account specific stuff about subencoders. 2014-05-14 13:27:07 +02:00
Laurent Fasnacht bc3ca90bdf Fix tiles when SAO or deblock is enabled.
Was broken by previous commit.
2014-05-14 13:27:07 +02:00
Laurent Fasnacht 4815a0604b Entropy coding sync works without parallelism, without SAO and without deblocking 2014-05-14 13:27:06 +02:00
Laurent Fasnacht 2c2a2528f3 Remove openmp stuff 2014-05-14 13:27:06 +02:00
Ari Koivula aee9bf2875 Re-add rdo control to transformskip decision.
- It got left out when rewriting the function.
2014-05-14 12:39:23 +03:00
Ari Koivula 9147b7acbf Split residual quantization to separate luma and chroma function. 2014-05-14 11:19:48 +03:00
Tapio Katajisto cc92cfee18 Added few warnings to Makefile
Cleaned fme code a bit
2014-05-14 01:49:34 +00:00
Tapio Katajisto efc43c8b3a Added fractional pixel motion estimation
Added farctional mv support for inter recon

Added 1/8-pel chroma and 1/4-pel luma interpolation
2014-05-14 01:42:02 +00:00
Ari Koivula e947bd4c0e Clean up trskip decision code and remove old code.
- You can define structs inside functions! This changes everything!!

- Bitstream changes a little bit compared to old trskip decision. Bdrate
  change is insignificant though.
2014-05-13 22:00:04 +03:00
Ari Koivula a3cdee9ec5 Move new trskip decision to a function. 2014-05-13 21:59:00 +03:00
Ari Koivula 2ff713ccb2 Add new implementation for trskip decision. 2014-05-13 21:57:45 +03:00
Ari Koivula 8b8da6f493 Make luma and chroma use the same quantization function.
- Only thing not working was transform skip.
2014-05-13 21:57:23 +03:00
Ari Koivula f0bfcedba2 Clean up coeff reconstruction code. 2014-05-13 21:56:10 +03:00
Ari Koivula 0c65a9b658 Remove abs_sum from coeff quantization.
- It's meant for checking if there are any coefficients, but we don't use it
  and it's annoying to remember to initialize it and pass it around. The
  benefit should be quite small anyway.
2014-05-13 21:54:34 +03:00
Ari Koivula 75042fc65d Move luma quantization to it's own function. 2014-05-13 21:34:06 +03:00
Ari Koivula ba3aaf3189 Expand chroma functions to parent function.
- This was done so that making the function work with luma would be easier.
2014-05-13 21:30:14 +03:00
Ari Koivula 637aceb495 Add TR_MAX_WIDTH.
- Max transform size is constrained by but independent of LCU size.

- Luma and chroma now have the same stride for transform arrays.
2014-05-13 21:22:40 +03:00
Ari Koivula 1c38209cab Add missing include. 2014-05-13 09:33:05 +03:00
Ari Koivula 13577562e5 Revert change to definition of LCU_WIDTH. 2014-05-13 09:28:01 +03:00
Ari Koivula fb763f7940 Move coefficient generation functions from encoder.c to transform.c.
- These functions probably should have been there to begin with.
2014-05-12 11:37:39 +03:00
Ari Koivula a3478ecd20 Move transform skip decision to it's own function. 2014-05-12 11:18:27 +03:00
Ari Koivula d9b890de6e Remove redundant variables.
- Redefine LCU_WIDTH to be 64. Stuff will break horribly if it's
  anything else anyway.

- Add LCU_WIDTH_C for chroma LCU width. It should be more readable than the
  constant (LCU_WIDTH >> 1).
2014-05-12 10:58:07 +03:00
Ari Koivula 59e0e98523 Separate luma and chroma coefficient generation variables. 2014-05-12 10:38:24 +03:00
Ari Koivula 0ca65e7606 Move chroma coefficient generation to it's own function.
- It's time to chop up this monster that is encode_transform_tree.
2014-05-12 10:24:06 +03:00
Ari Koivula 3c3c9a26c6 Move scan order selection to a function. 2014-05-12 08:47:16 +03:00
Ari Koivula 623d9001a8 Reorder chroma coefficient generation. 2014-05-12 08:47:16 +03:00
Ari Koivula 93141c7d2e Avoid unnecessary copying of predicted pixels when there are no coeffs.
- These are probably from a time when reconstruction happened in this
  function.
2014-05-09 16:39:58 +03:00
Ari Koivula 27ab882c25 Clean up coefficient generation. 2014-05-09 16:33:10 +03:00
Ari Koivula ce945ab4ef Handle coefficient initialization better.
- Coefficients are no longer required to be pre-zeroed. The resulting zeroes
  are copied in even in the case where we already know they are all zeroes.

- Move cbf clearing code to only happen at the leaves of the recursion.
2014-05-09 16:30:28 +03:00
Laurent Fasnacht b274558139 Refactor and fix entry_points functions.
Seems to be OK with HM now
2014-05-09 12:42:37 +02:00
Laurent Fasnacht 43b5f84c0d Fix sao_calc_edge_block_dims
It was computing wrong dimensions, which was causing out-of-bounds reads in sao_reconstruct.
2014-05-09 10:30:34 +02:00
Laurent Fasnacht 3f975e92cd Replace line fixing symptoms by assertions, to reveal the cause 2014-05-09 08:24:03 +02:00
Laurent Fasnacht 4dbf7c7a52 Fix blit dimensions in sao_search_best_mode 2014-05-09 08:24:02 +02:00
Ari Koivula cb5d7e6541 Fix compilation for VS2010. 2014-05-08 17:28:12 +03:00
Laurent Fasnacht 0452806ec4 Entry points 2014-05-08 15:04:56 +02:00
Laurent Fasnacht da588af2ba Partial support for wavefront 2014-05-08 15:04:55 +02:00
Laurent Fasnacht 4de5660254 Fix missing offset in LCU range computation for wavefronts 2014-05-08 15:04:55 +02:00
Laurent Fasnacht dc34a5eac6 LCU borders 2014-05-08 15:04:54 +02:00
Laurent Fasnacht 24f4a8cad1 Wavefront also needs entrypoints 2014-05-08 15:04:53 +02:00
Laurent Fasnacht d05f8b52aa Rewrite of encoder_state_write_bitstream_leaf: handle slice + tiles + wavefronts correctly 2014-05-08 15:04:53 +02:00
Laurent Fasnacht 27f694e3e8 Some initial code to support wpp and slices 2014-05-08 15:04:52 +02:00