Commit graph

2692 commits

Author SHA1 Message Date
Arttu Ylä-Outinen 7144a00beb Rewrite thread queue
Changes thread queue so that only the jobs that are ready to run are
stored in the queue. Other jobs are kept track of by pointers in the
reverse dependency lists of other jobs. When a job is ready to run it is
appended to the queue. The job queue is stored as a linked list.

The definitions of threadqueue_queue_t and threadqueue_job_t are moved
to the .c file, turning them into opaque structs.

Makes thread queue code simpler. Fixes some TSan errors.
2017-08-11 14:18:12 +03:00
Arttu Ylä-Outinen bc47fe94af Drop thread queue debug code 2017-08-11 14:18:12 +03:00
Arttu Ylä-Outinen ebddd854dc Fix clobbered warnings in tests
Adds volatile to loop variables in kvazaar tests in order to fix "might
be clobbered by ‘longjmp’ or ‘vfork’" warnings when building with -O3.
2017-08-11 14:18:12 +03:00
Eemeli Kallio e5cbc7a205 --sao now enables full sao 2017-08-11 13:26:55 +03:00
Eemeli Kallio 4c3453d26f Fixed issue with no-sao argument 2017-08-11 13:12:22 +03:00
Eemeli Kallio 8674c0f5ee Added paremeter for band and edge sao. 2017-08-11 11:57:09 +03:00
Eemeli Kallio d9b93ea368 Added possibility to skip edge or band sao. 2017-08-11 11:51:49 +03:00
Arttu Ylä-Outinen 2fa3d82946 Merge branch 'refactor-inter-search' 2017-08-09 14:40:50 +03:00
Arttu Ylä-Outinen 4b73bdd9aa Skip checked motion vectors in early termination
Changes the second iteration of early termination to skip the motion
vectors that were already checked in the first iteration.
2017-08-09 14:29:09 +03:00
Arttu Ylä-Outinen 606d441362 Skip computing MV cost twice in hexagon search
Changes the first step of hexagon search to skip the zero offset since
the cost of the motion vector has already been computed.
2017-08-09 14:29:09 +03:00
Arttu Ylä-Outinen fa4648061d Add mv, cost and bitcost to inter_search_info_t 2017-08-09 14:29:08 +03:00
Arttu Ylä-Outinen 328f051d7f Put inter search parameters in a single struct
Adds struct inter_search_info_t for holding the parameters that are used
by most function related to inter search. Passing the parameters in
a single struct greatly reduces the number of parameters for many
functions.
2017-08-09 14:27:53 +03:00
Miika Metsoila 0dd069f8af Fixed using wrong POC in add_temporal_candidate 2017-08-09 13:50:21 +03:00
Miika Metsoila 25e0a954c7 Fixed 2 bugs causing incorrect video output 2017-08-09 13:50:21 +03:00
Arttu Ylä-Outinen d20c9ab30f Merge branch 'fix-tiles-sao' 2017-08-01 15:52:59 +03:00
Arttu Ylä-Outinen 24ecddd2a5 Fix wrong strides in SAO reconstruction
Functions kvz_sao_reconstruct and encoder_sao_reconstruct used
frame->width as the stride instead of frame->rec->stride when accessing
frame->rec->data. This caused errors when using tiles and SAO.
2017-08-01 15:40:49 +03:00
Arttu Ylä-Outinen 242c11d379 Use deblock and SAO in tiles tests
Reveals a bug in SAO when using tiles.
2017-08-01 14:34:44 +03:00
Arttu Ylä-Outinen 4aef8f2588 Merge branch 'build-fixes' 2017-07-28 09:32:45 +03:00
Arttu Ylä-Outinen f0bf959d17 Fix alignment errors in 32-bit build with MSVC
Changes the work_tree parameter in search.c functions from an array to
a pointer. Fixes "formal parameter with requested alignment of 8 won't
be aligned" errors.
2017-07-28 09:27:02 +03:00
Arttu Ylä-Outinen 9694bd2fae Fix build on 32-bit systems
Function coeff_abs_sum_avx2 that was added in e950c9b was outside the
AVX2 #if directive.
2017-07-28 09:19:29 +03:00
Arttu Ylä-Outinen ecb0275cdd Store CU arrays as pointers to the main array
Changes field state->tile->frame->cu_array->data to point to the CU
array in the main encoder state. Removes the need to copy the CU array
to the main CU array after search.
2017-07-28 08:36:45 +03:00
Arttu Ylä-Outinen 5962cbf400 Add missing test files to Visual Studio project
Adds coeff_sum_tests.c to kvazaar_tests.vcxproj.
2017-07-28 07:56:05 +03:00
Arttu Ylä-Outinen 1ead9c0c39 Merge branch 'skip-coeff-cabac-cost' 2017-07-28 07:42:51 +03:00
Arttu Ylä-Outinen e950c9b101 Add AVX2 implementation for coefficient sum 2017-07-28 07:39:36 +03:00
Arttu Ylä-Outinen dca71a9091 Add tests for coefficient sum strategy 2017-07-28 07:39:18 +03:00
Arttu Ylä-Outinen d50ae6990c Add sum of absolute coefficients to strategies 2017-07-28 07:39:15 +03:00
Arttu Ylä-Outinen 59faca0646 Skip CABAC coefficient cost for --rd=0 2017-07-28 07:33:03 +03:00
Arttu Ylä-Outinen afc13f1974 Merge branch 'inter-satd' 2017-07-25 13:28:51 +03:00
Arttu Ylä-Outinen 19e051ea40 Reduce intra threshold
Reduces intra threshold for --rd=0 from 20 to 8. Threshold of 20
increased BD-Rate too much.
2017-07-25 13:26:38 +03:00
Arttu Ylä-Outinen e9cf15465e Fix inter cost in bipred
The cost of coding MV ref indices and MV direction was added to bitcost
but not inter cost. Fixed by adding the extra bits to inter as well.
2017-07-24 15:24:04 +03:00
Arttu Ylä-Outinen edbe00763e Drop extra parameter in kvz_image_calc_sad
Drops the parameter max_lcu_below which was always set to -1.
2017-07-24 15:21:19 +03:00
Arttu Ylä-Outinen ffac29061f Fix extrapolated inter SATD 2017-07-24 15:11:05 +03:00
Arttu Ylä-Outinen 631ef53d2a Fix inter cost calculations
Inter costs are computed using SAD except when fractional motion
estimation or bi-prediction is enabled. This commit changes
search_pu_inter_ref to recalculate the cost with SATD. Fixes inter/intra
cost comparisons since intra costs are always SATD costs.
2017-07-24 15:11:05 +03:00
Arttu Ylä-Outinen 6ce2fb1238 Add pixel offsets to encoder_state_config_tile_t
Adds fields offset_x and offset_y to encoder_state_config_tile_t.
2017-07-24 15:11:05 +03:00
Arttu Ylä-Outinen 924cf857ec Merge branch 'ub-fixes' 2017-07-24 14:50:15 +03:00
Arttu Ylä-Outinen 2380ba0d41 Reduce copying in kvz_get_coeff_cost
Changes function kvz_get_coeff_cost to only copy the CABAC contexts and
not the whole encoder state.

Other threads could be simultaneously using the other parts of the
encoder state. Only copying the CABAC fixes a TSan data race warning.
2017-07-24 12:38:41 +03:00
Arttu Ylä-Outinen 24b462f801 Align coefficients to 8 bytes
Adds alignment attribute to lcu_coeff_t. The coefficients are sometimes
handled as 64-bit integers containing four coefficients so the arrays
should be aligned to 8 bytes.

Fixes a UBSan error about misaligned reads.
2017-07-24 12:37:37 +03:00
Arttu Ylä-Outinen 5ddb43c6fe Fix undefined left shifts in rdo
Replaces left shifts by multiplications when the operand may be
a negative value. Left shift of a negative value is undefined behavior.
2017-07-24 12:35:10 +03:00
Arttu Ylä-Outinen d1e64ad62b Fix undefined left shifts
Replaces left shifts by multiplications when the operand may be
a negative value. Left shift of a negative value is undefined behavior.
2017-07-20 11:15:30 +03:00
Arttu Ylä-Outinen 07b5fb9caf Fix out-of-bounds read in encoderstate
When calling encoder_state_encode_leaf with POC 0, index -1 of the GOP
array would be accessed. Fixed by skipping the code for I-frames.
2017-07-20 11:15:30 +03:00
Arttu Ylä-Outinen 8c4a3473a8 Change --owf=auto and --threads=auto selection
Changes OWF selection so that it is chosen based on the maximum number
of parallel CTUs. Number of threads is limited to prevent overhead from
extra threads.
2017-07-20 09:42:28 +03:00
Arttu Ylä-Outinen 4fc9b743c1 Drop an unnecessary pthread_cond_broadcast
Drop pthread_cond_broadcast on threadqueue->cond in function
kvz_threadqueue_waitfor. The broadcast caused threads to be woken up
more often than necessary.
2017-07-19 11:09:30 +03:00
Arttu Ylä-Outinen 20d6444f07 Merge branch 'psnr-output-changes' 2017-07-19 10:51:54 +03:00
Arttu Ylä-Outinen 14003c6a30 Disable printing PSNR with --no-psnr 2017-07-19 10:38:37 +03:00
Arttu Ylä-Outinen e90bde5c62 Clarify PSNR output
Adds letters Y, U and V to the PSNR output to make it clearer that the
printed values are the luma and chroma PSNR.
2017-07-19 10:33:43 +03:00
Arttu Ylä-Outinen 217202ca5f Merge branch 'sao-fixes' 2017-07-11 10:44:59 +03:00
Arttu Ylä-Outinen fdb3480b54 Enable strategies for SAO reconstruction
Re-enables strategies for SAO reconstruction. They were disabled in
commit ec9ff42.
2017-07-11 10:35:18 +03:00
Arttu Ylä-Outinen 333dba3884 Add static to SAO strategies 2017-07-11 10:02:01 +03:00
Miika Metsoila e8cc2d8f6a Small fixes 2017-07-07 13:58:19 +03:00
Arttu Ylä-Outinen cbb35e7fbe Merge branch 'fixes' 2017-07-07 11:29:19 +03:00