Commit graph

2445 commits

Author SHA1 Message Date
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
Arttu Ylä-Outinen cbb35e7fbe Merge branch 'fixes' 2017-07-07 11:29:19 +03:00
Arttu Ylä-Outinen 67a60a35e3 Fix invalid calls to normalize_lcu_weights
Changes encoder_state_init_new_frame to only call normalize_lcu_weights
when the weights have been written to the array and rate control is
enabled. When rate control is disabled, the weights are not used.
2017-07-07 11:05:31 +03:00
Arttu Ylä-Outinen 563bc26e71 Fix out-of-bounds read in AVX2 SAO
AVX2 version of SAO loaded offsets with a 256 bit read even though there
are only five 32 bit integers.
2017-07-06 13:04:52 +03:00
Arttu Ylä-Outinen 050e90dc05 Merge branch 'ctu-sao' 2017-07-06 08:36:15 +03:00
Arttu Ylä-Outinen 0850b17f96 Drop get_wpp_limit in search_inter
WPP limit for motion vectors is now computed inside fracmv_within_tile.
2017-07-05 13:22:53 +03:00
Arttu Ylä-Outinen 2a85f0f5a4 Move hard-coded MV limits to encoder_control_t
Adds field max_inter_ref_lcu to encoder_control_t. It is used to set up
inter-LCU dependencies in encoder_state_encode_leaf and restrict motion
vectors in fracmv_within_tile.
2017-07-05 13:22:53 +03:00
Arttu Ylä-Outinen bb5354f7e2 Relax inter-CTU dependencies when SAO is off
When using WPP and OWF, the first CTU of a row depends on the last CTU
of the row below in the reference frame. This is necessary when SAO is
enabled since we currently do SAO for a whole CTU row at a time. When
SAO is disabled, however, it is unnecessary to wait for the whole row.

Changes CTUs to depend only on the CTU below in the reference frame
instead of the whole row when WPP and OWF are enabled and SAO disabled.
Gives a significant speedup when running on a machine with many CPU
cores.
2017-07-05 13:21:06 +03:00
Arttu Ylä-Outinen 1efa2708b2 Do SAO reconstruction for a single CTU at a time
Moves SAO reconstruction into encoder_state_worker_encode_lcu instead of
doing it in a separate step for the whole CTU row. Reconstruction of the
rightmost 10 pixels and bottommost 10 pixels of a CTU is delayed until
the neighboring CTU has been deblocked.

Doing SAO for the whole CTU row at a time caused unnecessary inter-CTU
dependencies when using WPP and OWF. The first CTU of a row would need
to wait until SAO was done for the row below in the previous frame.
Moving SAO reconstruction to immediately after deblocking each CTU fixes
this problem.
2017-07-04 15:14:31 +03:00
Arttu Ylä-Outinen ec9ff42077 Rewrite SAO recon to handle arbitrary sized blocks
Adds width and height parameters to function kvz_sao_reconstruct and
changes it to take coordinates in units of pixels. This will be useful
for doing SAO for areas smaller than a whole CTU.
2017-06-30 16:09:18 +03:00
Arttu Ylä-Outinen 61fc028eef Merge pull request #171 from jbeich/freebsd
Unbreak `make check` on FreeBSD
2017-06-28 15:25:24 +03:00
Jan Beich bb01721cf8 tests: load util.sh from source directory
$ mkdir build
$ cd build
$ ../kvazaar/configure
$ gmake check VERBOSE=1
...
FAIL: test_gop.sh
=================

.: cannot open util.sh: No such file or directory
FAIL test_gop.sh (exit status: 2)

FAIL: test_interlace.sh
=======================

.: cannot open util.sh: No such file or directory
FAIL test_interlace.sh (exit status: 2)
2017-06-28 06:27:46 +00:00
Jan Beich adf0bfea07 tests: drop mktemp(1) flags for better compatibility
$ mktemp --tmpdir tmp.XXXXXXXXXX.yuv
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
$ gmktemp --tmpdir tmp.XXXXXXXXXX.yuv
/tmp/tmp.ddQTBn4XmE.yuv

$ mktemp -t tmp.XXXXXXXXXX.yuv
/tmp/tmp.XXXXXXXXXX.yuv.SYYNp8Ki
$ gmktemp -t tmp.XXXXXXXXXX.yuv
/tmp/tmp.2ena2nKgv5.yuv

$ mktemp -t yuv
/tmp/yuv.rX2UAbax
$ gmktemp -t yuv
gmktemp: too few X's in template ‘yuv’
2017-06-28 05:22:46 +00:00
Jan Beich 0280871287 tests: convert scripts to POSIX shell
$ gmake check VERBOSE=1
[...]
FAIL: test_external_symbols.bash
================================

../build-aux/test-driver: ./test_external_symbols.bash: not found
FAIL test_external_symbols.bash (exit status: 127)

FAIL: test_gop.bash
===================

../build-aux/test-driver: ./test_gop.bash: not found
FAIL test_gop.bash (exit status: 127)
[...]
2017-06-28 05:22:46 +00:00
Arttu Ylä-Outinen 6bbe5e10cd Merge branch 'move-tests-to-scripts' 2017-06-22 10:33:38 +03:00
Arttu Ylä-Outinen 3da5558956 Add an LP-GOP test 2017-06-22 09:44:01 +03:00
Arttu Ylä-Outinen 674af752a2 Convert travis tests to scripts
Moves tests from .travis.yml to bash scripts in tests directory. Adds
the test scripts to tests/Makefile.am so that they are included when
running make check.
2017-06-22 09:37:55 +03:00
Arttu Ylä-Outinen 2c66e0bbd2 Fix warnings about invalid reads in AVX2 ipol
AVX2 filter functions read pixels in chunks of 8 or 16 bytes. At the end
of the block, the read goes out of the bounds of the pixels array. The
extra pixels do not affect the result.

Fixes valgrind complaining about the invalid reads by allocating 5 extra
pixels in kvz_get_extended_block_avx2
2017-06-22 09:37:55 +03:00
Arttu Ylä-Outinen 4d20e156db Fix handling intra period not multiple of GOP length
With low delay GOP structure, it is possible to use an intra period that
is not a multiple of the GOP structure length. Commit 00c9f52 changed
encoder_state_init_new_frame to reset POC on intra frames. GOP offset,
however, was not reset, resulting in invalid POCs and references for the
following frames.

This commit changes function kvz_encoder_feed_frame so that GOP offset
is correctly reset on intra frames.
2017-06-22 09:29:00 +03:00
Arttu Ylä-Outinen 00c9f52bd4 Fix setting picture type when using GOP
Changes encoder_state_init_new_frame to set intra frame pictype to
KVZ_NAL_IDR_W_RADL even when using GOP.
2017-06-21 13:21:47 +03:00
Arttu Ylä-Outinen 595ca152de Merge pull request #170 from ahresse/master
Change some configure.ac library searching order.
2017-06-19 13:43:00 +03:00
Alexandre Esse c7d00e9a6d Change some configure.ac library searching order.
./configure --with-cryptopp failed while cross-compiling for an ARM target and this fixed it.
2017-06-17 00:03:46 +02:00
Arttu Ylä-Outinen f54a25f112 Fix crash when immediately closing encoder
When closing the encoder, the pictures stored in the input frame buffer
are freed by repeatedly calling kvz_encoder_feed_frame. If the encoder
was closed immediately after opening it, kvz_encoder_feed_frame would be
called with an unprepared encoder state. This would trigger an assert.

Fixed by changing kvz_encoder_feed_frame so that it does not require the
encoder state to be prepared.
2017-06-15 11:57:46 +03:00
Arttu Ylä-Outinen b74e0458fd Set inter transform depth to zero
Sets max_transform_hierarchy_depth_inter to 0 in SPS. This saves some
bits because split_transform_flag does not need to be coded for inter
blocks.

When SMP and AMP blocks are enabled the depth is set to 1 instead.
Otherwise inter split flag would default to 1 for SMP and AMP blocks,
resulting in an unnecessary transform split.
2017-06-08 10:08:20 +03:00
Arttu Ylä-Outinen 2c734760bc Merge branch 'search-refac' 2017-06-06 10:32:23 +03:00
Arttu Ylä-Outinen 8dd01ba5a9 Refactor helper functions in search
Combines functions lcu_set_intra_mode and lcu_set_inter_pu to a single
function. Removes some duplicated code.
2017-06-06 10:32:09 +03:00
Arttu Ylä-Outinen 1bbecf7584 Refactor work tree copy functions
Extracts common code shared by work_tree_copy_up and work_tree_copy_down
to a separate function.
2017-06-06 10:32:00 +03:00
Arttu Ylä-Outinen c1c7b8d8cc Merge branch 'fix-encoder-close' 2017-06-05 11:34:03 +03:00
Arttu Ylä-Outinen 2b169d5d63 Fix crash in kvazaar_close
Changes kvazaar_close to stop all threads before freeing encoder states.
Fixes a crash when the encoder is closed before all pictures have been
encoded.
2017-06-02 10:05:33 +03:00
Arttu Ylä-Outinen eb9a05b7ef Fix memory leak
Changes kvazaar_close to free the remaining pictures in the the input
frame buffer. Fixes a memory leak when the encoder is closed while there
are pictures left in the buffer.
2017-06-01 15:39:35 +03:00
Arttu Ylä-Outinen e944416ae6 Merge branch 'intra-refac' 2017-05-26 10:27:05 +03:00
Arttu Ylä-Outinen 8b2483ca1c Combine intra reconstruction functions
Replaces function kvz_intra_recon_lcu_luma and
kvz_intra_recon_lcu_chroma in intra.c with function kvz_intra_recon_cu.
The new function can handle reconstruction for both luma and chroma.
Removes some duplicated code.
2017-05-24 12:07:31 +03:00
Arttu Ylä-Outinen e67fdb853d Move intra leaf TB recon to a separate function
Moves code for intra leaf transform block reconstruction from functions
kvz_intra_recon_lcu_luma and kvz_intra_recon_lcu_chroma to a new
function intra_recon_tb_leaf. Removes some duplicated code.
2017-05-24 12:07:31 +03:00
Arttu Ylä-Outinen 752db73284 Merge branch 'coding-refac' 2017-05-24 11:54:50 +03:00
Arttu Ylä-Outinen 13d2fdbd21 Drop unused kvz_videoframe_get_cu functions 2017-05-24 11:15:31 +03:00
Arttu Ylä-Outinen f5eef7f33c Use luma pixel coordinates in encode_coding_tree
Changes functions encode_intra_coding_unit and encode_coding_tree to
take coordinate arguments in units of luma pixels instead of 8 px
blocks. This should make the code easier to understand.
2017-05-24 11:15:31 +03:00
Arttu Ylä-Outinen 525a5180ff Combine intra CU encoding functions
Merges functions encode_intra_coding_unit and
encode_intra_coding_unit_encry. Removes a lot of duplicated code.
2017-05-24 11:12:40 +03:00
Arttu Ylä-Outinen 610c91b0c5 Use luma pixel coordinates in TU coding functions
Changes functions encode_transform_unit and encode_transform_coeff to
take coordinate arguments in units of luma pixels instead of 4 px
blocks. This should make the code easier to understand.
2017-05-23 15:36:16 +03:00
Arttu Ylä-Outinen 85ac7e6b7a Fix build with --with-cryptopp --disable-shared
Adds -lstdc++ to LIBS in configure when cryptopp is enabled. Without
-lstdc++ linking fails when configured with --with-cryptopp and
--disable-shared.
2017-05-23 15:31:45 +03:00
Arttu Ylä-Outinen 2e8838de6e Fix crash when crypto compiled in but disabled
When kvazaar was built with crypto++ but running without using
encryption features, kvazaar attempted to delete an uninitialized crypto
handle. Fixed by setting the handle to NULL in kvz_encoder_state_init.
2017-05-23 14:01:48 +03:00
Arttu Ylä-Outinen 8654b48186 Merge branch 'crypto-fixes' 2017-05-23 11:51:30 +03:00
Arttu Ylä-Outinen 2f2c281e8e Fix a memory leak in crypto
A CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption was allocated at the
beginning of encoder_state_encode_leaf and was never freed. This commit
changes encoder_state_worker_encode_lcu to delete the CFB_Mode. Also
moves crypto handle from encoder_state_config_tile_t to encoder_state_t
so that it can be safely deleted without affecting other threads in the
same tile.
2017-05-23 11:51:25 +03:00
Arttu Ylä-Outinen 22155950c1 Rewrite crypto to conform to kvazaar code style 2017-05-23 11:51:25 +03:00
Arttu Ylä-Outinen 6829865190 Fix inline declaration in intra_mode_encryption
Moves the inline declaration of intra_mode_encryption before the type
and changes it to use the INLINE macro. Inline declaration after type
triggered a warning on GCC.
2017-05-23 11:50:32 +03:00
Arttu Ylä-Outinen 7086bc144a Fix build on Win32
On Windows, the platform name (Win32 or x64) is used as the object
format parameter for vsyasm. However, vsyasm 1.3.0 expects the format
name to be in lower case. This commit changes vsyasm.props so that the
object format is converted to lower case.

Fixes #168.
2017-05-22 14:22:50 +03:00
Arttu Ylä-Outinen 5f8e17d4ba Eliminate a race condition in threadqueue
Fixes the order of acquiring locks for the job and its dependency in
kvz_threadqueue_job_dep_add. The dependency is locked before the job
that depends on it. This is the same order as in threadqueue_worker.

Acquiring the locks in different order in kvz_threadqueue_job_dep_add
and threadqueue_worker would sometimes result in a deadlock.
2017-05-18 12:25:53 +03:00
Arttu Ylä-Outinen 4b213477f0 Return best MV from inter early terminate
When using --me-early-termination=sensitive, early termination of inter
search used to always return the starting point if no tested motion
vector was good enough to continue the search. This commit changes
early_termination to always return the best motion vector and cost
found.
2017-05-18 09:05:14 +03:00