Ari Koivula
b73b275e08
Remove unused includes from search.
2015-07-21 15:06:06 +03:00
Ari Koivula
ae56118010
Move functions from search to search_intra.
2015-07-21 14:59:19 +03:00
Ari Koivula
bf7542c35d
Move functions from search to search_inter.
2015-07-21 12:16:05 +03:00
Ari Koivula
3c9b830d8f
Add modules search_intra and search_inter.
...
- For breaking up search module.
2015-07-21 12:04:16 +03:00
Arttu Ylä-Outinen
06ea593477
Change dylib file name to libkvazaar.X.dylib.
...
Changes the version number in the dylib filename from a three-digit
version (libkvazaar.X.Y.Z.dylib) to a single-digit one
(libkvazaar.X.dylib).
2015-07-20 15:09:46 +03:00
Arttu Ylä-Outinen
df749e032e
Add necessary linker options when building dylib.
...
Sets linker options -compatibility_version and -install_name when making
dylib.
2015-07-20 15:09:09 +03:00
Luca Barbato
9c414995c5
build: Add a MacOSX install target for the library
2015-07-17 19:44:20 +02:00
Arttu Ylä-Outinen
59f95b8e73
Add nasm support.
...
Makes is possible to build kvazaar using nasm instead of yasm.
- Adds trailing slashes to -I params in ASFLAGS.
- Disables CPU NOP directives when assembler is not yasm.
2015-07-17 13:59:25 +03:00
Arttu Ylä-Outinen
e307b7cec4
Check that input dimensions are multiples of two.
...
Fixes wrongly accepting non-multiple of two resolutions and a segfault
when one of the input dimensions is one.
2015-07-17 10:07:24 +03:00
Arttu Ylä-Outinen
d2c42cb303
Fix making tests.
...
Commit 9cfbd55e
removed "./" prefix of the TESTS variable in the
Makefile but the recipe of target tests was expecting it. Fixed by
prepending "./" to the tests recipe.
2015-07-17 10:07:24 +03:00
Luca Barbato
56ff1c7805
build: Drop the non-standard -t
...
Should unbreak freebsd.
2015-07-16 16:50:09 +02:00
Arttu Ylä-Outinen
94e8fc1536
Build dylib on Darwin.
...
Adds target libkvazaar.dylib to Makefile. On Darwin, libkvazaar.dylib is
set as a prerequisite of the all target.
2015-07-16 14:15:09 +03:00
Arttu Ylä-Outinen
a4ec92081a
Make symbols hidden by default.
...
Adds "-fvisibility=hidden" to CFLAGS and LDFLAGS. Defines macro
KVZ_PUBLIC for marking symbols that should be visible.
2015-07-13 14:20:21 +03:00
Arttu Ylä-Outinen
9cfbd55ea8
Add making symlinks to make install.
...
Running "make install" now creates symlinks libkvazaar.so and
libkvazaar.so.X pointing to libkvazaar.so.X.Y.Z.
2015-07-13 11:45:42 +03:00
Ari Koivula
c94d91061c
Merge branch 'cpuid-fix'
2015-07-09 11:40:46 +03:00
Arttu Ylä-Outinen
8550c6ccd8
Fix AVX2 detection.
...
Replaces calls to __get_cpuid by __cpuid_count on gcc and clang and
calls to __cpuid by __cpuidex on MSVC. Unlike __get_cpuid and __cpuid,
__cpuid_count and __cpuidex set the ecx register which is required for
AVX2 detection.
2015-07-09 11:20:37 +03:00
Ari Koivula
9acf7795a2
Refactor cpuid capability detection.
...
- Moved cpuid data to a struct to make it easier to group data from one
cpuid call together.
- Renamed the bit masks to make it harder to mask the wrong register or
cpuid.
- Remove the .byte trick. We don't really need to support such ancient
compilers?
2015-07-09 11:20:37 +03:00
Arttu Ylä-Outinen
e69088026e
Write slice header before joining child streams.
...
The lengths of the leaf streams must be available when the slice header
is written. Writing the header before joining child streams removes the
need to copy leaf bitstreams instead of moving them.
2015-07-08 13:14:17 +03:00
Arttu Ylä-Outinen
907451590e
Fix encoding when both GOP and OWF are enabled.
...
Changes kvazaar_encode to not increase cur_state_num unless a frame is
started.
2015-07-07 10:05:42 +03:00
Arttu Ylä-Outinen
3efdee2c13
Fix compilation warnings when using clang.
...
Removes typedef redefinitions in kvazaar_internal.h.
2015-07-06 13:46:56 +03:00
Arttu Ylä-Outinen
cc580ac861
Only print PSNR if some frames were encoded.
2015-07-06 13:39:47 +03:00
Arttu Ylä-Outinen
089ff895ad
Fix seeking when input stream is not seekable.
2015-07-06 12:07:05 +03:00
Arttu Ylä-Outinen
aca5d7514f
Fix pocs reallocation in imagelist.
...
Replaced sizeof(int32_t*) by sizeof(int32_t).
2015-07-06 11:58:05 +03:00
Arttu Ylä-Outinen
ca8435f581
Remove setting CC in Makefile.
2015-07-06 11:27:28 +03:00
Arttu Ylä-Outinen
3a47aab696
Fix allocating tile boundary arrays.
...
Column and row numbers had been mixed up.
2015-07-06 10:48:19 +03:00
Arttu Ylä-Outinen
a0865ff351
Change ime_algorithm in kvz_config to an enum.
...
Adds enum kvz_ime_algorithm to kvzaar.h.
2015-07-06 09:47:18 +03:00
Arttu Ylä-Outinen
66656fdebc
Move handling of command line args to cli module.
...
- Adds struct cmdline_opts_t.
- Adds functions cmdline_opts_parse and cmdline_opts_free to cli module.
- Removes fields input, output, debug, frames and seek from struct
kvz_config.
- Removes function config_read from config module.
2015-07-06 08:25:54 +03:00
Arttu Ylä-Outinen
581f740c59
Fix compilation when checkpoints are enabled.
...
- Include string.h in checkpoint.h
- Check return values of fgets calls in checkpoint.h.
- Replace variable length array in image.c by a dynamically allocated
array.
- Add -DCHECKPOINTS to CFLAGS in Makefile when CHECKPOINTS is defined.
2015-07-03 13:54:44 +03:00
Arttu Ylä-Outinen
6eb89a2813
Adjust Makefile for building kvazaar.dll.
...
Adds targets "kvazaar.dll" and "install-dll" to the Makefile.
2015-07-02 16:58:30 +03:00
Arttu Ylä-Outinen
af2b417809
Set up Makefile for building libkvazaar.so.
...
Adds targets "libkvazaar.so.0.0.0", "install", "install-prog" and
"install-lib" to the Makefile.
2015-07-02 16:58:30 +03:00
Arttu Ylä-Outinen
4ab9aa3e2f
Move kvz_encoder definition to kvazaar_internal.h.
2015-07-02 16:58:30 +03:00
Arttu Ylä-Outinen
b715ae9767
Return length of the data from encoder_encode.
...
Adds parameter len_out returning the length of the encoded data in bytes
to function encoder_encode.
2015-07-02 16:58:29 +03:00
Arttu Ylä-Outinen
538deaa9d6
Add functions picture_{alloc,free} to kvazaar API.
2015-07-02 16:58:29 +03:00
Arttu Ylä-Outinen
6451df9a4f
Move bitstream chunk definition to kvazaar.h.
...
- Renames struct bitstream_chunk_t to kvz_data_chunk.
- Renames macro BITSTREAM_MEMORY_CHUNK_SIZE to KVZ_DATA_CHUNK_SIZE.
- Removes kvz_payload typedef.
- Adds function chunk_free(kvz_data_chunk *chunk) to kvazaar API.
2015-07-02 16:58:28 +03:00
Arttu Ylä-Outinen
f7f17a060c
Rename pixel_t to kvz_pixel.
2015-07-02 16:58:28 +03:00
Arttu Ylä-Outinen
cecea44d37
Rename config_t to kvz_config.
2015-07-02 16:58:28 +03:00
Arttu Ylä-Outinen
17d720363a
Rename struct image_t to kvz_picture.
2015-07-02 16:55:48 +03:00
Arttu Ylä-Outinen
fab07d80da
Rename macro BIT_DEPTH to KVZ_BIT_DEPTH.
2015-07-02 16:55:47 +03:00
Arttu Ylä-Outinen
7b6178f6e0
Rename macro MAX_GOP to KVZ_MAX_GOP_LENGTH.
2015-07-02 16:55:47 +03:00
Arttu Ylä-Outinen
3f32d500e2
Move config_t structure to kvazaar.h.
2015-07-02 16:55:46 +03:00
Arttu Ylä-Outinen
cecdf4f34e
Move config validation to encoder_control_init.
...
Ensures that config is valid even when not initialized by config_read.
2015-07-02 16:47:28 +03:00
Arttu Ylä-Outinen
04a1fc07cf
Move all config validation to config_validate.
2015-07-02 16:43:19 +03:00
Arttu Ylä-Outinen
25706af770
Add a function for moving bitstream data.
...
Replaces calls to bitstream_append with bitstream_move where possible.
2015-07-02 16:35:47 +03:00
Arttu Ylä-Outinen
398f0c823b
Replace memory bitstreams with linked lists.
...
- Removes all bitstream types.
- Changes encoder_encode to return the encoded data as list of chunks.
- Moves writing of the encoded data to the main function.
2015-07-02 16:35:46 +03:00
Arttu Ylä-Outinen
7e20e62cc7
Make kvazaar_encode consume one frame on each call.
...
- Replaces read_one_frame by encoder_feed_frame.
- Adds field "prepared" to encoderstate_t to indicate that
encoder_next_frame has been called.
- Input frames are read in the main function and passed to
encoder_encode.
2015-07-02 16:28:40 +03:00
Arttu Ylä-Outinen
012c0580df
Move writing reconstructed image to yuv_io module.
...
Adds function yuv_io_write.
2015-07-02 16:28:39 +03:00
Arttu Ylä-Outinen
7bd23f5dbb
Rename yuv_input module to yuv_io.
2015-07-02 16:28:39 +03:00
Arttu Ylä-Outinen
1f41717351
Rename stats_done to frame_done in encoderstate.
...
The new field frame_done is set to zero when starting to encode a new
frame and reset to one when the encoded data has been written.
2015-07-02 16:24:26 +03:00
Arttu Ylä-Outinen
50a5d5faa5
Let subimages have multiple references.
...
Adds function image_copy_ref to image module for getting a new reference
to an image. It can be used instead of image_make_subimage when the
sizes of the original and the subimage are same.
2015-07-02 16:24:26 +03:00
Arttu Ylä-Outinen
cec9b937dc
Make image list resize use realloc.
...
Much simpler than allocating, copying and freeing the arrays manually.
2015-07-02 16:24:25 +03:00
Arttu Ylä-Outinen
fe3b629905
Move poc from image_t to image_list_t.
2015-07-02 16:24:25 +03:00
Arttu Ylä-Outinen
5d524c0290
Move seeking to yuv_input module.
2015-07-02 16:24:24 +03:00
Arttu Ylä-Outinen
f41ce04488
Refactor main function.
...
- Make sure that everything which is allocated gets deallocated.
- Move finalization of encoder states to kvazaar.c.
- Remove empty strategyselector_free function.
- Remove unused variable curpos.
- Fix includes.
2015-07-02 16:24:24 +03:00
Arttu Ylä-Outinen
9c20f96397
Move opening files in main to separate functions.
2015-07-02 16:24:24 +03:00
Arttu Ylä-Outinen
40b136cf48
Fix seeking when reading from stdin.
...
Seeking used read_one_frame to skip frames. Changed to simply use fread
instead.
2015-07-02 16:24:24 +03:00
Arttu Ylä-Outinen
970d0ec182
Move input reading functions to yuv_input module.
...
Adds function read_yuv_frame and moves functions fill_after_frame and
read_and_fill_frame_data from encoderstate to yuv_input.
2015-07-02 16:24:23 +03:00
Arttu Ylä-Outinen
4a7b86a43b
Make g_exp_table statically allocated.
...
Removes the need to free the table.
2015-07-02 16:14:52 +03:00
Arttu Ylä-Outinen
b130ecc9bb
Fix "reference not found" when GOP is enabled.
...
The encoder state must be cleared by calling encoder_next_frame before
calling read_one_frame.
2015-07-02 16:14:51 +03:00
Ari Koivula
7e98a483d7
Use the API for checking whether the encoding is finished.
2015-07-02 16:14:51 +03:00
Ari Koivula
fc58748ae8
Output bitstream through API.
...
- Use the existing bitstream_t type to give access to the bitstream.
We can extend it later to make it a linked list like I was planning
to do with the payload type.
- The main encoder now also stores the bitstream in memory.
2015-07-02 16:10:51 +03:00
Ari Koivula
df50a0dae6
Move config_parse into api.
2015-07-02 15:52:24 +03:00
Ari Koivula
4e5326d3d5
Move encoding to API.
...
- Api->encoder_encode can now be called repeatedly to start encoder
jobs and to retrieve the results.
Conflicts:
src/encmain.c
2015-07-02 15:52:23 +03:00
Ari Koivula
9a3edce3fc
Separate input and output from encoding.
...
- Move image_t and pixel_t to the kvazaar.h API.
- Try and arrange things such that image_t can be used as input and
output for encoding.
Conflicts:
src/encmain.c
2015-07-02 15:52:23 +03:00
Ari Koivula
f87cea78da
Wait for bitstream immediately after encoding the frame.
...
- This should reduce the encoding delay by one frame when encoding in
real time.
2015-07-02 15:52:23 +03:00
Ari Koivula
ad11d1bca5
Add kvazaar.h to hold high-level encoder API.
...
- Move encoder initialization from main to kvazaar.c.
- Have main use the API for initialization.
Conflicts:
src/encmain.c
2015-07-02 15:52:23 +03:00
Ari Koivula
0170e9280f
Move some initialization to encoder_control_init.
...
- Removed some members from encoder_control_t that weren't really used
very much anymore.
2015-07-02 15:45:35 +03:00
Ari Koivula
504f3d9c9b
Move some config initialization to config_read.
2015-07-02 15:45:34 +03:00
Ari Koivula
c99fe63860
Move seek functionality outside the main input loop.
2015-07-02 15:45:34 +03:00
Ari Koivula
4f4b62b13c
Fix owf.
2015-07-02 15:45:34 +03:00
Ari Koivula
5c28745457
Move OWF logic and CLI stuff out of encoder_compute_stats.
...
- CLI stuff is moved to either cli-module or to main function.
- OWF stuff is made more explicit by counting the frames instead of
communicating through encoder_state_t.stats_done.
2015-07-02 15:45:33 +03:00
Ari Koivula
ea50d03e52
Add cli module and move interface stuff to there.
2015-07-02 15:45:33 +03:00
Marko Viitanen
ff4fb64169
Fixed a precedence bug in bipred search
2015-06-12 09:49:56 +03:00
Marko Viitanen
44ba9d9f7c
Bump version number to 0.5.0
2015-06-11 10:33:27 +03:00
Ari Koivula
30f8640380
Disable trskip SAD calcultation when trskip is not enabled.
2015-06-08 13:16:12 +03:00
Marko Viitanen
3253ba4812
Fixed non-deterministic behavior when using bipred and owf
2015-06-08 13:14:53 +03:00
Ari Koivula
cdb66baf16
Fix mutex being unlocked twice.
2015-06-01 16:28:50 +03:00
Ari Koivula
80ec1fda3a
Remove unnecessary dependency between I-frames.
...
- Inter OWF dependency was being added to non-IDR I-frames.
2015-06-01 16:26:30 +03:00
Arttu Ylä-Outinen
984e7cb4e0
Fix setting QP when rate control is disabled.
...
When rate control is disabled, QP and lambda are now selected like they
were before rate control was implemented.
2015-06-01 13:57:11 +03:00
Arttu Ylä-Outinen
b0435d37a9
Update rate control parameters.
...
On each frame, adjust the parameters alpha and beta in the equation
lambda = alpha * pow(R, beta)
2015-05-29 11:50:08 +03:00
Arttu Ylä-Outinen
b24d92bd6e
Move initialization of constants to encoder.c.
...
Some constants used in rate control are now initialized only once instead
of being computed on every frame. Adds pixels_per_pic, target_avg_bppic,
target_avg_bpp and gop_layer_weights to encoder_control_t.
2015-05-29 11:45:36 +03:00
Arttu Ylä-Outinen
b54d5aa91f
Select GOP picture weights according to bitrate.
...
Pictures in same layer have equal weights. At low bitrates, the difference
between low and high layers is greater than at high bitrates.
2015-05-29 11:43:42 +03:00
Arttu Ylä-Outinen
93d2a95ddc
Implement rate control in lambda domain.
...
- Rate control adjusts the lambda value.
- QP is selected according to lambda.
- Bits are allocated for GOPs and individual pictures.
2015-05-19 11:40:51 +03:00
Arttu Ylä-Outinen
664de9ade0
Keep track of bits written in current gop.
...
Adds cur_gop_bits_coded into encoder_state_config_global_t. The count is
updated whenever a frame is written.
2015-05-19 10:42:23 +03:00
Arttu Ylä-Outinen
4a5698a6ba
Implement basic rate control.
2015-05-19 10:42:17 +03:00
Arttu Ylä-Outinen
d27cde55a4
Add --input-fps and --bitrate parameters.
2015-05-15 13:57:51 +03:00
Arttu Ylä-Outinen
5b8cd76f01
Keep track of total number of bits coded.
...
Adds total_bits_coded into encoder_state_config_global_t. The count is
updated whenever a frame is written.
2015-05-15 13:57:50 +03:00
Arttu Ylä-Outinen
815a2bea55
Use bitstream_tell to get stream position.
2015-05-15 13:57:50 +03:00
Ari Koivula
56bb8e75ba
Fix non-deterministic behavior with tiles.
...
- Depend on the whole previous frame.
- We should really go through all these FIXME's sometime.
2015-05-12 12:00:32 +03:00
Ari Koivula
a48d91dacd
Fix WPP not working when SAO is off and OWF is on.
...
- Every wavefront row was being set to done when the first wavefront
row got done.
- Looks like I didn't understand how the data structure worked when I
"cleaned this up", and it didn't get caught in tests because it
needs OWF to be on to affect anything.
2015-05-11 12:01:17 +03:00
Ari Koivula
87936eb99f
Revert "Fix keeping of reference frames over IDR boundary."
...
This reverts commit b43f1cb9eb
.
- This change resulted in use of uninitialized memory with owf != 0.
Conflicts:
src/encoderstate.c
2015-05-05 17:07:49 +03:00
Ari Koivula
c3b42291e1
Merge branches 'coverity-fix-5', 'coverity-fix-6', 'coverity-fix-7', 'coverity-fix-8', 'coverity-fix-9', 'coverity-fix-10', 'coverity-fix-11', 'coverity-fix-12', 'coverity-fix-13' and 'coverity-fix-14' into coverity-fixes2
2015-05-05 12:27:02 +03:00
Ari Koivula
62285c405c
Fix coverity warning.
...
- False positive about a shift with -1 when code_num overflows.
2015-05-05 12:20:07 +03:00
Ari Koivula
ed670f4185
Fix coverity warning.
...
- False positive about buffer overrun due to thinking work_tree_copy_up
could be called with depth == 4.
2015-05-05 11:54:09 +03:00
Ari Koivula
2276e0028f
Fix coverity warning.
...
- False positive about use of an uninitialized value. Actually just
copying uninitialized data from one struct to another.
2015-05-05 10:39:29 +03:00
Ari Koivula
41d9889e28
Fix coverity warning.
...
- False positive about coeff_y being uninitialized when width == 0.
2015-05-05 10:23:52 +03:00
Ari Koivula
80cbda364b
Fix coverity warning.
...
- Variable guards dead code. Although, maybe it will complain about the
dead code now instead.
2015-05-05 10:17:06 +03:00
Ari Koivula
08d079773f
Fix coverity warning.
...
- Dead code.
2015-05-05 10:12:01 +03:00
Ari Koivula
e225c5b302
Fix coverity warning.
...
- Dead code due to current value of MRG_MAX_NUM_CANDS. Not sure if this
fix will work but I think it looks better.
2015-05-05 10:06:18 +03:00
Ari Koivula
17bdc82b5e
Fix coverity warning.
...
- Dereferencing a pointer from realloc before checking if it's null.
2015-05-05 09:40:24 +03:00
Ari Koivula
cc980fb815
Fix coverity warning.
...
- False positive for use of uninitialized variable.
2015-05-05 09:37:34 +03:00