Commit graph

1880 commits

Author SHA1 Message Date
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 238b1bbcff Make incompatible pointer an error in VS. 2015-07-02 15:45:35 +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
Arttu Ylä-Outinen 1587a50be4 Add missing files to the Visual Studio project.
Adds rate_control.c and rate_control.h to the kvazaar_lib project. Fixes
Visual Studio build.
2015-06-29 12:23:28 +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 947e67d670 Add Valgrind test for rate control. 2015-06-01 16:36:49 +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
Ari Koivula be0770f1fa Merge branch 'rate-control' 2015-06-01 16:25:52 +03:00
Ari Koivula 52122d6aea Fix CI tests.
- The ffmpeg version got bumped. To make sure this doesn't happen again,
  let's just host it our selves.
2015-06-01 16:25:25 +03:00
Ari Koivula 3a11e011ee Fix CI tests.
- The ffmpeg version got bumped. To make sure this doesn't happen again,
  let's just host it our selves.
2015-06-01 16:15:46 +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 dd11dd488b Modify Valgrind tests for GOP.
- Add --owf=0 test.
- Allow GOP tests to fail, as they are still experimental.
- Reduce the number of frames to 20.
2015-05-11 13:35:16 +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 00ec1f16c5 Move Travis-ci stuff to scripts and add more tests.
- Make valgrind tests run in parallel.
- Install only the tools necessary to run each test.
- Make individual tests smaller and faster, but run more tests
  with a more diverse set of parameters.
2015-05-05 17:17:32 +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