Commit graph

3026 commits

Author SHA1 Message Date
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
Arttu Ylä-Outinen 382636de55 Fix handling too large QPs
Changes kvz_config_validate to output an error if the given QP is out of
range and changes kvz_set_picture_lambda_and_qp to clip the QP to the
valid range if is too large after applying QP offset from GOP structure.
2017-05-17 12:41:51 +03:00
Arttu Ylä-Outinen 87bc59fc9c Merge branch 'tu-z-order-coeffs' 2017-05-16 08:00:42 +03:00
Arttu Ylä-Outinen de8b59c681 Drop unused function kvz_coefficients_blit 2017-05-12 16:48:30 +03:00
Arttu Ylä-Outinen bcfa5a3cd9 Add a comment explaining the coefficient order 2017-05-12 16:46:57 +03:00
Arttu Ylä-Outinen 95775a1645 Change coefficient storage order
Changes coefficient storage order to a zig-zag order. Reduces
unnecessary copying of coefficients to temporary arrays.
2017-05-12 16:46:57 +03:00
Arttu Ylä-Outinen c2039889d1 Merge branch 'transform-refac' 2017-05-12 16:43:27 +03:00
Arttu Ylä-Outinen 9395867a9a Quantize all colors in a single traversal
Changes kvz_quantize_lcu_residual to process all three colors in
a single traversal of the TU tree.
2017-05-12 16:42:41 +03:00
Arttu Ylä-Outinen 1e58fd6b16 Split kvz_quantize_lcu_residual
Splits kvz_quantize_lcu_residual to two functions that handle the TU
tree recursion and quantization of a single TU.
2017-05-12 16:42:41 +03:00
Arttu Ylä-Outinen cc87e0dcc7 Combine luma and chroma quantization functions
Replaces functions kvz_quantize_lcu_luma_residual and
kvz_quantize_lcu_chroma_residual in transform.c with function
kvz_quantize_lcu_residual. The new function can handle any of the YUV
colors. Removes some duplicated code.
2017-05-12 16:42:41 +03:00
Arttu Ylä-Outinen 1357dd0599 Pass coeffs through encoder state
Changes the way coefficients are passed from kvz_search_lcu to
kvz_encode_coding_tree. Drops fields coeff_y, coeff_u and coeff_v in
videoframe_t and instead passes them through field coeff in
endoder_state_t.
2017-05-12 16:42:41 +03:00
Eemeli Kallio 2cad3173ec Reduced amount of modes for search_intra_rdo 2017-05-12 15:56:07 +03:00
Arttu Ylä-Outinen 26adef4492 Merge branch 'erp-aqp' 2017-05-12 15:05:24 +03:00
Eemeli Kallio 55e0e65733 Added INLINE to kvz_get_ic_rate and kvz_get_coded_level in rdo.c 2017-05-12 15:03:30 +03:00
Arttu Ylä-Outinen ee3d4d0e78 Add adaptive QP for 360 degree video
Adds option --erp-aqp for enabling adaptive QP for 360 degree video with
equirectangular projection. When projected into a spherical surface,
the middle part of the video covers relatively larger area than the top
and bottom parts. Enabling --erp-aqp sets up a ROI delta QP array which
uses higher QPs for the top and bottom of the video and lower QPs for
the middle part.
2017-05-11 12:31:53 +03:00
Arttu Ylä-Outinen 79cb3a2fd3 Permit negative QP deltas in ROI
Delta QPs should not be arbitrarily restricted to positive values.
2017-05-11 12:13:47 +03:00
Arttu Ylä-Outinen edfbd6f122 Add field lcu_dqp_enabled to encoder_control_t
Delta QPs for LCUs are enabled when either ROI coding or rate control is
enabled. Having a single field is simpler than always checking whether
ROI or rate control is enabled.
2017-05-11 12:13:47 +03:00
Arttu Ylä-Outinen 2f2405dfe6 Fix crash when PU depth is limited
When video width or height was not a multiple of the smallest CU size,
no prediction would be performed at the border CUs. Kvazaar would later
crash at an assertion failure when attempting to write the bitstream for
the CU.

Fixed by permitting inter and intra prediction when the CU split is
forced, even if CUs of that size would otherwise be disabled.
2017-04-27 10:35:48 +03:00
Arttu Ylä-Outinen 9130b5107c Change handling of infinite PSNR in encmain
Changes encmain to print 999.99 as PSNR when SSE is zero. This behavior
is in line with HM. Previously SSE was set to 99 when it was zero.
2017-04-27 10:35:13 +03:00
Arttu Ylä-Outinen a9c878b535 Fix crash with WPP when threads are disabled
When WPP is enabled, a reference to SAO reconstruction job is copied
from the wavefront to the main encoder state. However, when threads are
disabled, the job is a null pointer and dereferencing it crashes the
encoder. Fixed by adding a null pointer check.
2017-04-24 12:59:57 +03:00