Commit graph

111 commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 4a5698a6ba Implement basic rate control. 2015-05-19 10:42:17 +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 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 9015aab996 Clean up IDR handling code.
- IDR was called RADL, probably because the NAL type is IDR_W_RADL.
- Move things around to make it clearer what is happening.
2015-04-30 20:46:07 +03:00
Ari Koivula b43f1cb9eb Fix keeping of reference frames over IDR boundary.
-
2015-04-30 15:42:16 +03:00
Ari Koivula c0c9bc619a Fix valgrind warning.
- Attribute state->global->slicetype was used before being initialized.
- The reference frame lists should be updated based on current frame,
  not on previous frame (or uninitialized data).
2015-04-30 13:18:28 +03:00
Marko Viitanen 8ed5d06ebe Fixed compiler warnings caused by the bipred branch merge 2015-04-23 15:12:48 +03:00
Marko Viitanen 3c694a8f6e Fixed bipred mv candidate selection 2015-04-23 12:18:05 +03:00
Marko Viitanen 06bc4f3d5e Fixed duplicate checking for merge cand and some cleanup 2015-03-31 12:23:46 +03:00
Marko Viitanen f881d6bf8a Modified structures and mv handling to use L0/L1 vectors 2015-03-30 14:40:29 +03:00
Marko Viitanen d6f68d0950 Force clearing of references when GOP not used and I-slice 2015-03-30 10:21:41 +03:00
Marko Viitanen c82915761f Enabled insertion of I-slices when GOP is used 2015-03-30 10:09:49 +03:00
Marko Viitanen 815e0b8897 Moved reference list printing to encoder_compute_stats() 2015-03-30 10:09:32 +03:00
Marko Viitanen 2243d139bf Fixed GOP reference usage when using owf 2015-03-26 14:11:13 +02:00
Marko Viitanen bbeb85f9ee Fixed case when cfg->frames is zero 2015-03-26 11:24:41 +02:00
Marko Viitanen 5c04603421 Remove unused ref frames on GOP case even when number of ref frames is within limits 2015-03-26 11:14:13 +02:00
Marko Viitanen 5071b5c990 Moved reference list sorting and parsing to encoder_state_new_frame()
* fixed a bug in reference verification and added an error state
2015-03-26 10:58:56 +02:00
Marko Viitanen fe581b881e Changed GOP structure to enable coding sequences not divisible by gop_len 2015-03-25 16:00:20 +02:00
Marko Viitanen c649c90f3a Changes to enable adaptation to any GOP len 2015-03-24 12:01:57 +02:00
Marko Viitanen 164b7a7743 Merge remote-tracking branch 'remotes/origin/master' into GOP 2015-03-20 11:40:15 +02:00
Marko Viitanen 5ae9a70e38 Disable usage of P-slices when GOP 2015-03-20 10:43:59 +02:00
Marko Viitanen 0c1aa6f73c Better reference picture removal function encoder_state_remove_refs() 2015-03-20 10:28:17 +02:00
Marko Viitanen d72c560880 Generate sorted reference list for L0 and L1 2015-03-19 12:26:59 +02:00
Ari Koivula 55ae02f367 Copy cu_info from tiles to main state.
- Main states cu_array can be accessed through state->global->ref, which
  allows the use of cu_info data from reference frames.
- This was already used by giving previous frames movement vector to next
  frame as a starting point candidate, but that functionality was broken at
  some point because the data wasn't being moved from child tiles cu_array
  to the main cu_array.
- Alternative would be to access the child tiles array directly, but
  currently there isn't a mechanism to preserve those arrays for reference
  frames.
2015-03-17 13:24:20 +02:00
Ari Koivula 4bec6cec93 Simplify wavefront handling.
- Move the reconstruction status assignment out of the main for job loop.
2015-03-17 13:23:27 +02:00
Ari Koivula 4a27f79f20 Update comments. 2015-03-17 13:23:16 +02:00
Marko Viitanen 1da1dc9578 Clean up reference index and mvd writing 2015-03-16 09:41:02 +02:00
Ari Koivula ca09e8bfe3 Fix WPP not working with threads=0.
- Apparently threadqueue_submit runs the job if there are no threads.
2015-03-13 17:15:05 +02:00
Ari Koivula d2bb71739f Clean up and comment WPP threading code.
- Remove WPP row reconstruction dependency to the row above current one in
  the previous frame. It's obviously unnecessary.
- Remove WPP row reconstruction dependency to the current row in the
  previous frame, unless the current row is the last row.
2015-03-11 18:30:37 +02:00
Marko Viitanen bc8ea9547e Use P-frames when last GOP picture 2015-03-11 15:23:16 +02:00