Commit graph

186 commits

Author SHA1 Message Date
Laurent Fasnacht 534013be77 Remove g_lambda_cost 2014-04-17 11:49:27 +02:00
Laurent Fasnacht 4a9c239027 Remove g_bitdepth 2014-04-17 11:13:13 +02:00
Laurent Fasnacht 7a2b883059 Remove encoder_input width, height, height_in_lcu, and width_in_lcu 2014-04-17 11:13:12 +02:00
Laurent Fasnacht 9ac3b7bf2b encoder->in.cur_pic --> cur_pic 2014-04-17 11:13:10 +02:00
Laurent Fasnacht 52ae027b3a Avoid undefined behavior in memcpy calls
"The memcpy() function shall copy n bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined."
2014-04-15 06:30:21 +02:00
Laurent Fasnacht 78c579053a encoder_control should be const in nearly all the code 2014-04-14 10:56:06 +02:00
Ari Koivula 5fa5e01e05 Merge branch 'intra-cleanup'
Conflicts:
	src/intra.c
	src/intra.h
	src/search.c
2014-04-10 13:51:14 +03:00
Ari Koivula 088dd9ab96 Clean up intra mode search.
- This changes the bitstream a little bit, because it changes the order in
  which the modes are tried and when two modes have the same cost the first
  one is chosen.

- Dst buffer was removes as it was no longer used.
2014-04-10 10:25:57 +03:00
Marko Viitanen 43ae0a3b9a Implemented RDO cost calculation to Intra modes 2014-04-10 10:25:20 +03:00
Marko Viitanen c38ec1aa10 Added commandline option for RDO (--rd) 2014-04-09 12:29:15 +03:00
Ari Koivula 92ac5025f9 Take intra mode based coeff scan mode into account for coeff bit cost.
- Previously only diagonal scan mode, the most common one, would be used.

- This improved bdrate by 0.1-0.5 % for p0 and 0-0.2 % for p60.
2014-04-09 10:44:44 +03:00
Ari Koivula 0251bf5a1a Improve calculation of chroma coding cost for 4x4 blocks.
- Adds calculation of chroma coefficient cost for 4x4 blocks.

- Previously there was no cost. Now the cost is added to the first prediction
  block for NxN.

- This fix should improve bdrate by about 1%.
2014-04-08 12:43:26 +03:00
Ari Koivula 3c0977c7f3 Fix buffer overflow on copying of reference pixels.
- Valgrind noticed this.

- Shouldn't affect anything as the buffer overflowed to pixel buffers which
  were initialized later.
2014-04-04 17:28:56 +03:00
Marko Viitanen e15a86268d Clean up tabs and whitespaces 2014-04-04 16:04:44 +03:00
Laurent Fasnacht 8a14bd3b7b Remove cabac global variable 2014-04-04 14:26:40 +02:00
Marko Viitanen c5ba5eb3c8 Use RDO in final_cost 2014-04-04 14:10:49 +03:00
Ari Koivula d44d1837bb Remove unreferenced parameters.
- Working towards issue #11.
2014-04-04 12:56:24 +03:00
Ari Koivula 46d33d3945 Resolve unsigned/signed mismatch warnings.
- Working towards issue #11.
2014-04-04 12:56:23 +03:00
Ari Koivula 313466fdff Remove unused variables.
- Working towards issue #11.

- Either removed or redefined variables to not cause a warning.
2014-04-03 15:37:59 +03:00
Marko Viitanen 0da8071300 Changed final cost (and transform skip) error function from SAD to SSD 2014-04-02 14:51:39 +03:00
Ari Koivula bbd1202f90 Replace old LCU reference pixels initialization with new ones.
In the future we might even have just a const pointer to reference pixels.
2014-03-19 16:01:31 +02:00
Ari Koivula 7328fc2897 Add special handling for bottom right LCU pixel.
I didn't take into account that the reference pixel on the top-left of the
LCU gets over written if we just replace the top reference pixels for
current LCU with the bottom reference pixels after doing the search.
To handle this I copy the pixel that gets overwritten to the vertical
reference pixels.
2014-03-19 16:01:31 +02:00
Ari Koivula 57ce7e990b Add new reference pixel buffer management to encoding loop.
- This is necessary because after we add in-loop filters to be done per LCU,
  the reconstruction buffer will have the deblocked pixels. We only need the
  edge-pixels for intra prediction though so we just save those.

- Right now it only copies the pixels and passes them on to search, where
  the copied pixels are asserted to be the same ones we copy from
  reconstruction buffer.

- New yuv_t struct added for arrays of dynamic length. We might want to change
  other buffers to use it or something like it in the future.
2014-03-19 16:01:30 +02:00
Ari Koivula 6a384112cc Remove old unnecessary functions from search module.
- As we move to per-LCU encoding only search_lcu will be necessary.

- Function search_best_mode is no longer used.
2014-03-17 18:04:41 +02:00
Marko Viitanen c7ee176480 Removed unused function search_best_mode() 2014-03-17 12:56:04 +02:00
Ari Koivula 34d4e74cd6 Fix selection of bitcost for NxN mode intra CUs. 2014-03-12 18:05:42 +02:00
Ari Koivula 462b75f0f3 Merge branch 'intra-NxN'
Conflicts:
	src/search.c
2014-03-12 15:08:39 +02:00
Marko Viitanen e6985eeb08 Terminate search when any block is found with no coefficients to code 2014-03-12 14:14:42 +02:00
Marko Viitanen 362fc6c5a5 Reduced bit cost when skip mode is selected 2014-03-12 14:13:38 +02:00
Ari Koivula aa59605392 Set correct max depth for search work-tree copying.
The copy up and down functions had wrong max depth so they didn't work with
4x4 blocks.
2014-03-12 14:02:13 +02:00
Marko Viitanen b5756821dd Tuned cost calculations for "final cost"
By adding chroma cost and using 1.5x coeff cost instead of 0.5x, additional 3% (LP) and 1.8% (AI) drop in BD-rate noticed.
2014-03-12 10:35:56 +02:00
Ari Koivula 409b094acf Try and get NxN to work again.
- Moved NxN search to be done on the same level as other searches, as it's
  really not any different from 2Nx2N.
- Produces working bitstream but reconstruction is different.
2014-03-11 19:19:20 +02:00
Marko Viitanen 75dd1f48ef Bugfix: calculate "final cost" only when block is inter or intra 2014-03-11 17:09:08 +02:00
Marko Viitanen 3b59d7c3a3 Implemented "final cost" calculation for best CU on each depth in search
Take SAD between reconstruction and original and add cost from coding and cost for coding coefficients.
2014-03-11 15:01:50 +02:00
Marko Viitanen aa0fb6ccad Store intra coding bit costs to CU structure 2014-03-11 12:15:50 +02:00
Marko Viitanen bdf8166e5c Store inter coding bit costs to CU structure
To be used for calculating better coding cost later
2014-03-11 11:40:39 +02:00
Marko Viitanen eaf4434ae9 Removed unused parameter cur_cu from inter_get_merge_cand() 2014-03-11 09:04:17 +02:00
Marko Viitanen f2e722fed8 Implemented early search termination when skip mode is used 2014-03-11 08:55:38 +02:00
Marko Viitanen a7dade5069 Tuned inter MV coding costs to achieve BD-rate reduction
Compared to version with no inter costs, around -2% BD-rate in LP configuration
2014-03-10 12:08:09 +02:00
Marko Viitanen 1bd79c719e Fixed MV candidate derivation in search 2014-03-10 10:16:30 +02:00
Marko Viitanen c7e4861dbf Added coding cost calculations to MV search 2014-03-10 10:16:30 +02:00
Ari Koivula 9dde96f25e Refactor search_cu_intra.
- Formatted.
- Renamed and consolidated variables.
- Removed unused x and y pos from intra_prediction function.
2014-03-07 16:25:25 +02:00
Ari Koivula 47af5207c5 Remove dead code and fix white space. 2014-03-06 18:35:17 +02:00
Marko Viitanen 877e156cb8 Fixed the case where transform split is used (always on depth 0)
After this fix, inter coding should be working.
2014-03-06 14:52:58 +02:00
Marko Viitanen b00f4c8dbf Fixed transform offset value and set tr_depth to correct value when depth 0 2014-03-05 17:10:17 +02:00
Marko Viitanen 278042aaac Fixed top-right CU copy to lcu structure 2014-03-04 16:32:31 +02:00
Marko Viitanen df669ca7df Added skip mode checking to the new lcu search 2014-03-04 12:48:19 +02:00
Marko Viitanen bddadbb4ed Inter coding fixed and added call to encode_transform_tree() 2014-03-03 17:42:44 +02:00
Marko Viitanen 17b256b5e3 Converted inter mv candidate functions to use lcu structure
Implemented merge and mvd candidate search
Added initialization of the whole work_tree
2014-03-03 16:08:35 +02:00
Marko Viitanen 1f82239367 Implemented inter search and reconstruction with lcu structure 2014-03-03 14:51:36 +02:00