Commit graph

1894 commits

Author SHA1 Message Date
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 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