Commit graph

2672 commits

Author SHA1 Message Date
Arttu Ylä-Outinen 26693e1402 Fix reliance on undefined behaviour in encmain
Pthread mutexes were used for synchronization in encmain by locking and
unlocking them from different threads. However, according to the POSIX
standard, unlocking a mutex from a different thread is undefined
behaviour. This commit replaces the mutexes by semaphores which can be
used from different threads.
2017-04-12 03:23:58 -07:00
Ari Lemmetti 033bc6bc45 Disable -Werror by default. Enable it on Travis. 2017-04-11 14:31:05 +03:00
Ari Lemmetti 47a9f0de04 Modify and use FILL_ARRAY macro to prevent warning on GCC 7
Following warning was given and is false positive

error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
2017-04-11 14:04:25 +03:00
Eemeli Kallio f7e01b8ba1 Fixed error on rd=3 2017-04-05 13:27:14 +03:00
Eemeli Kallio 9f605152ae Changed intra to use best rough cost when using inter and rd=2 2017-04-05 13:01:32 +03:00
Ari Lemmetti 33ce101ab5 Revert "Use sizeof(uint32_t) to avoid warning in GCC7."
Did not fix the problem.

This reverts commit e3c3e74926.
2017-04-03 20:21:33 +03:00
Ari Lemmetti e3c3e74926 Use sizeof(uint32_t) to avoid warning in GCC7.
error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
2017-04-03 19:16:09 +03:00
Marko Viitanen a3acd01a20 Fixed preset table formatting in README.md 2017-03-30 13:19:05 +03:00
Arttu Ylä-Outinen df359b8f95 Fix indentation in encode_coding_tree.c
Fixes indentation of a for loop that was causing a misleading
indentation warning on GCC.

Fixes #163.
2017-03-08 22:56:28 +09:00
Marko Viitanen 81b06a7acc Merge pull request #162 from pcabarat/master
Add intra prediction modes encryption
2017-03-06 18:57:28 +02:00
Pierre-Loup Cabarat 2b8ce5e47c Add intra prediction modes encryption 2017-03-06 17:27:39 +01:00
Arttu Ylä-Outinen aae141f2d3 Fix order of frames with --debug
When the decoding and presentation orders of pictures are different
(with GOP), the frames in YUV debug output would be in the decoding
order. This commit changes the kvazaar command line program to store the
reconstructed pictures in a buffer so that they can be output in the
presentation order.

Fixes #101.
2017-02-28 14:09:24 +09:00
Arttu Ylä-Outinen 4fb0783cb0 Merge branch 'inter-refac' 2017-02-22 15:57:34 +09:00
Arttu Ylä-Outinen 094b39e7fc Refactor inter MV/merge candidate selection
Adds struct merge_candidates_t for holding the spatial and temporal
merge candidates. Changes functions with separate parameters for each
candidate to use the struct instead.
2017-02-22 15:56:36 +09:00
Arttu Ylä-Outinen 3409748a8f Refactor inter MVP candidate selection
Adds helper function add_mvp_candidate.
2017-02-22 15:56:27 +09:00
Arttu Ylä-Outinen ef6503c728 Refactor inter merge candidate selection
Adds helper function add_merge_candidate and replaces macro
CHECK_DUPLICATE with function is_duplicate_candidate.
2017-02-22 02:50:52 +09:00
Arttu Ylä-Outinen f12e09bc40 Refactor inter TMVP selection
Adds helper function add_temporal_candidate to inter.c.
2017-02-22 02:08:10 +09:00
Arttu Ylä-Outinen 4f88066740 Refactor MV and merge candidate selection
Replaces macros APPLY_MV_SCALING and CALCULATE_SCALE with helper
functions.
2017-02-22 01:14:16 +09:00
Arttu Ylä-Outinen db08041d9a Refactor inter TMVP selection
Merges three if-clauses to remove two levels of indentation.
2017-02-21 23:56:01 +09:00
Marko Viitanen 85e2a40da3 Clip scaled motion vectors, scale and td/tb values to appropriate limits
Fixes #158.
2017-02-20 15:40:20 +02:00
Ari Koivula 7369f25f64 Bump version to 1.1.0 2017-02-16 20:52:05 +02:00
Ari Lemmetti b021d2244e Reduce more unnecessary initializations. 2017-02-16 17:25:26 +02:00
Ari Lemmetti acd12cba1e Remove unnecessary memory initialization to zero
Values in interval [last_scanpos, 0] are overwritten in following for loop, except for the sig_coeff_inc value.
2017-02-16 16:48:48 +02:00
Ari Koivula c32f5fafc9 Fix OSX test
Work around for a bug in Travis CI env travis-ci/travis-ci#6522

I was waiting for them to fix it, but looks like they are never going to.
2017-02-15 14:21:26 +02:00
Ari Koivula 54a3bf1115 Update README.md
Closes #154.
2017-02-13 18:25:15 +02:00
Ari Koivula 7ff33e1bf2 Fix default reference picture count
The default was 3, instead of the intended 1 of the medium preset.
2017-02-13 17:34:28 +02:00
Marko Viitanen d892be51ec Merge branch 'TMVP_inter' 2017-02-13 16:00:22 +02:00
Marko Viitanen 4251607c04 Fix a bug in TMVP reference POC list 2017-02-13 15:19:24 +02:00
Marko Viitanen 4270d451e6 Fixed some errors after rebase 2017-02-13 15:19:24 +02:00
Marko Viitanen 95effb00d0 Disable TMVP in frames with zero L0 references 2017-02-13 15:19:24 +02:00
Marko Viitanen b4de1878be Fixed TMVP scaling and candidate selection for B-frames 2017-02-13 15:19:23 +02:00
Marko Viitanen 23be633ad7 Added TMVP merge candidate scaling for L0 2017-02-13 15:19:23 +02:00
Marko Viitanen e6aa1b9b9a Renamed get_mv_cand_from_spatial() to get_mv_cand_from_candidates() 2017-02-13 15:19:23 +02:00
Marko Viitanen 1124bb5fd0 Cleaned up TMVP, mv candidate selection working, merge candidate selection not 2017-02-13 15:19:23 +02:00
Marko Viitanen d65d2ec88d WIP: add list of POCs used in the image when pushing to reference 2017-02-13 15:19:22 +02:00
Marko Viitanen 6a25cd3248 WIP: work on tmvp on inter 2017-02-13 15:19:22 +02:00
Marko Viitanen e538a94eda Enable TMVP with B-frames 2017-02-13 15:19:22 +02:00
Arttu Ylä-Outinen 363b8b49a2 Fix integer overflows with large resolutions
Limits video size so that the number of luma and chroma pixels can be
stored in an int. Fixes some integer overflows that resulted in
segmentation faults.
2017-02-12 11:40:13 +09:00
Arttu Ylä-Outinen a5a925fc28 Replace timed waits by normal waits in threadqueue
Replaces calls to pthread_cond_timedwait with pthread_cond_wait in
threadqueue.c. Simplifies code, as there should be no need for the
timeout.
2017-02-11 15:42:03 +09:00
Arttu Ylä-Outinen fd057498fc Simplify kvz_config_alloc 2017-02-11 15:42:03 +09:00
Arttu Ylä-Outinen 2d7daa1da7 Fix autoreconf and configure without pkg-config
The PKG_CHECK_MODULES macro is provided by pkg-config. Not having the
macro available caused autoreconf and configure to fail with obscure
error messages. This commit adds the file pkg.m4 from pkg-config so that
the macros are available even when pkg-config is not installed. Now
pkg-config is only needed when running configure --with-cryptopp.

Fixes #138.
2017-02-09 21:53:57 +09:00
Arttu Ylä-Outinen efc5ac6f6c Merge branch 'fixes' 2017-02-09 14:05:35 +09:00
Arttu Ylä-Outinen 7f7844caad Fix finalizing uninitialized encoder states
Finalization functions for frame and tile encoder states accessed the
frame and tile fields of the encoder state even though they might be
NULL. This is the case when the initialization of an encoder state
fails. Fixed by adding NULL checks.
2017-02-09 14:05:28 +09:00
Arttu Ylä-Outinen 51786eda67 Drop redundant fields in encoder_control_t
Some of the fields in encoder_control_t were simply copies of the
corresponding fields in kvz_config. This commit drops the copied fields
in favor of using the fields in encoder_control_t.cfg directly.
2017-02-09 14:05:28 +09:00
Arttu Ylä-Outinen 6a178dee96 Fix leaking memory when --cqmfile given many times
Any previously allocated CQM file name was not freed when allocating
memory for the new file name.
2017-02-09 14:05:28 +09:00
Arttu Ylä-Outinen 63a567ad8a Fix leaking memory when --roi given many times
Any previously allocated delta QP array was not freed when allocating
a new array.
2017-02-09 14:05:21 +09:00
Arttu Ylä-Outinen bfd89136a4 Fix ROI delta QP array not getting freed 2017-02-09 13:23:55 +09:00
Arttu Ylä-Outinen e78a8dfcf5 Copy the kvz_config passed to encoder_open
The kvz_config struct is created by the user but kvazaar keeps a pointer
to it. It is easy to break things by modifying the configuration outside
kvazaar. In addition, kvazaar modifies the struct even though it is has
a const modifier.

This commit changes the field cfg in encoder_control_t to be a copy of
the kvz_config struct instead of a pointer, removing modifications to
the const struct and allowing users to do whatever they want with it
after opening the encoder.
2017-02-09 13:23:54 +09:00
Ari Koivula 4b2d1c2686 Add tests for weird shapes. 2017-02-08 21:41:37 +02:00
Ari Koivula b8e3513a23 Fix crash with sub-LCU frame sizes and WPP
The end of slice was being calculated incorrectly, which led to no tile
being created inside the slice, which led to an assert triggering.

This fixes the wrong end of slice calculation, but also disallows
wavefront rows from being created, if there would be only one.
The wavefront initialization code assumes there are always more than
one row, so the inter-frame dependency doesn't get added properly.

Fixes #153.
2017-02-08 21:41:30 +02:00