Ari Koivula
ccc575e2c6
Disable transform tree bits.
2014-10-03 11:36:56 +03:00
Ari Koivula
a0ab469c89
Disable rdo_cost_intra.
2014-10-03 11:36:56 +03:00
Ari Koivula
c164978e21
Add FULL_CU_SPLIT_SEARCH macro for disabling cu split optimization.
2014-10-03 11:36:56 +03:00
Ari Koivula
549ac96438
Change costs to doubles to avoid rounding intermediate results.
...
- Helps with debugging.
2014-10-03 11:36:56 +03:00
Ari Koivula
e591e89ade
Add prediction mode to chroma reconstruction parameters.
...
- Just like in luma.
2014-10-03 11:36:56 +03:00
Ari Koivula
bfa399c8fc
Fix compiler warnings.
...
- Non-parenthesized parameter in a macro.
- Unused variables.
- Wrong const qualifiers.
- Signed/unsigned comparison.
2014-09-22 10:04:57 +03:00
Ari Koivula
0db7d8d20f
test cu split cost
2014-09-15 15:42:03 +03:00
Ari Koivula
3c73892609
Fix transform split search.
...
- Redo the search with the best mode to make sure the tr_depth parameters are
correct.
2014-09-11 10:56:53 +03:00
Ari Koivula
46b6b1243b
Add --rd=3 mode and enable searching of intra depth 0.
...
- intra_build_reference_border was overflowing at depth 0 because it uses
arrays just large enough to accommodate 32x32 transforms, which is the
biggest transform.
- For similar reasons search_intra_rough doesn't work at depth 0.
- The --rd=3 mode tries all modes with transform search. It also works without
rough search so it was used to test depth 0 search. If --rd=3 is not on intra
split at depth 0 is not searched for.
Conflicts:
src/search.c
2014-09-11 10:54:41 +03:00
Ari Koivula
c5fa824347
Rebase transform split search.
2014-09-08 14:13:59 +03:00
Laurent Fasnacht
f3c311fe1a
Fix commit 8502f3d
2014-08-11 15:17:15 +02:00
Laurent Fasnacht
f9bffe35a5
Log tile id in sad perf log
2014-08-11 11:57:08 +02:00
Laurent Fasnacht
6a937de9b2
Fix search_cu log
2014-08-11 11:57:08 +02:00
Laurent Fasnacht
8502f3d850
Improve logging
2014-08-11 11:57:07 +02:00
Ari Koivula
f605d6c35b
Align intra buffers to 32 bytes for 256 bit SIMD instructions.
2014-07-11 17:26:19 +03:00
Laurent Fasnacht
72abc69b3d
Measure time for SAD in _DEBUG mode
2014-07-08 11:42:58 +02:00
Laurent Fasnacht
e64a692780
Add CU type in threadqueue.log
2014-07-08 09:06:31 +02:00
Laurent Fasnacht
946e3b9651
Log search_cu to threadqueue.log
2014-07-07 10:50:05 +02:00
Ari Koivula
7ecf78bb70
Use sqrt lambda cost for searches not using SSD.
...
- Add encoder_state->global->cur_lambda_cost_sqrt.
- Use sqrt lambda for inter search and rough intra search.
- The effect on inter is around 10-20% bdrate. The effect on intra is smaller
and non-existent when --rd=2 is enabled, as the intra search refinement was
already done with SSD and correct lambda.
2014-06-26 13:56:38 +03:00
Ari Koivula
60ecc6baae
Remove unused stuff.
2014-06-17 16:20:01 +03:00
Ari Koivula
94bc457b6c
Add option to disable fast intra search.
2014-06-17 15:32:05 +03:00
Ari Koivula
e27fc875c0
Clean up intra search.
2014-06-17 15:09:12 +03:00
Ari Koivula
e4d70ac1ab
Use more starting points for smaller blocks in intra search.
2014-06-17 13:28:27 +03:00
Ari Koivula
9911c7553b
Avoid unnecessary intra dir searching.
2014-06-17 13:11:35 +03:00
Ari Koivula
bd16a55b9b
Always check DC and planar intra modes.
...
- At least one of them is always in predicted modes, but to make sure they
are both included add them explicitly.
2014-06-17 12:51:15 +03:00
Ari Koivula
70740da123
Add smarter rough intra search.
...
- Directional intra mode search is done using halving search from the best
known mode. Starting modes are vertical, horizontal and the 3 diagonal
modes.
Conflicts:
src/search.c
2014-06-17 12:33:10 +03:00
Marko Viitanen
0e2fe9e7ff
Changed intra search to skip some modes speeding it up
2014-06-17 12:32:29 +03:00
Marko Viitanen
a1c3cfe944
Moved intra mode cost calculation to a function
...
Conflicts:
src/search.c
2014-06-17 12:32:29 +03:00
Marko Viitanen
eb7d46f9ef
Modify CU split cost.
2014-06-17 12:30:32 +03:00
Ari Koivula
b3c15b8f94
Merge branch 'owf'
2014-06-16 16:07:41 +03:00
Laurent Fasnacht
91de92134f
Constrain the search not to go under the LCU below if OWF is enabled
2014-06-16 14:27:56 +02:00
Ari Koivula
1c97a10a6d
Move intra SAD and SATD functions under strategies.
2014-06-16 12:13:41 +03:00
Laurent Fasnacht
f4187dd10c
cu_array data structure
2014-06-16 10:54:57 +02:00
Ari Koivula
87ca828a63
Correct intra sad function labels.
...
- These haven't been 16 bit for a long time.
2014-06-16 10:45:10 +03:00
Laurent Fasnacht
6b408b5904
No-copy works with --no-sao --no-deblock
2014-06-12 11:47:30 +02:00
Laurent Fasnacht
27a49d287d
Big refactor to use videoframe, image_list, and image instead of picture*
2014-06-10 09:19:06 +02:00
Laurent Fasnacht
2456c65822
Replace accesses to picture->cu_array with picture_get_cu and picture_get_cu_const
2014-06-05 10:41:58 +02:00
Ari Koivula
e585da37e5
Give correct transform depth to RDOQ.
...
Conflicts:
src/search.c
2014-05-28 15:47:49 +03:00
Ari Koivula
ddc02cc09e
Avoid regenerating reference pixels for every rdo mode.
2014-05-22 13:18:28 +03:00
Ari Koivula
dbe13d0cba
Separate sad intra search from rdo search.
2014-05-22 12:47:45 +03:00
Ari Koivula
19ce21e07c
Split final cost to luma and chroma functions.
2014-05-22 09:45:00 +03:00
Ari Koivula
a6962e2974
Separate intra transform coding to luma and chroma functions.
2014-05-22 09:40:34 +03:00
Ari Koivula
f9a603e4ea
Move intra mode search form intra module to search module.
...
- Make the actual intra prediction function global.
- Move the rdo stuff to rdo module.
2014-05-19 16:12:02 +03:00
Ari Koivula
656b0a321b
Add chroma mode to lcu_set_intra_mode.
...
- This is needed for intra split.
2014-05-19 15:58:54 +03:00
Ari Koivula
921f58b249
Add tr_split to lcu_set_intra_mode.
2014-05-19 15:58:54 +03:00
Ari Koivula
846b608125
Add transform split recursion to intra reconstruction.
2014-05-19 15:58:54 +03:00
Ari Koivula
c9a8756fbd
Fix NxN scan mode for lcu_get_final_cost.
...
- Scan mode was always selected according to the first PU mode.
2014-05-15 16:20:35 +03:00
Marko Viitanen
b08047cce9
Fixed intra chroma mode selection
2014-05-15 09:50:05 +03:00
Tapio Katajisto
4d879945b2
Fixed cost calculations in fme
2014-05-15 03:42:42 +00:00
Ari Koivula
f0e990905e
Remove chroma mode "36".
...
- It's an unnecessary chore to handle this special case everywhere (it means
chroma_mode == intra_mode). Better just to use the actual mode.
2014-05-14 19:56:35 +03:00
Laurent Fasnacht
bb86f24000
Take advantage of the new buffers to remove uneeded item assignment
2014-05-14 13:27:13 +02:00
Laurent Fasnacht
6607c9f563
Use new buffers for search
2014-05-14 13:27:12 +02:00
Laurent Fasnacht
c257c4b863
Add const for the buffers
2014-05-14 13:27:12 +02:00
Ari Koivula
9147b7acbf
Split residual quantization to separate luma and chroma function.
2014-05-14 11:19:48 +03:00
Tapio Katajisto
cc92cfee18
Added few warnings to Makefile
...
Cleaned fme code a bit
2014-05-14 01:49:34 +00:00
Tapio Katajisto
efc43c8b3a
Added fractional pixel motion estimation
...
Added farctional mv support for inter recon
Added 1/8-pel chroma and 1/4-pel luma interpolation
2014-05-14 01:42:02 +00:00
Ari Koivula
1c38209cab
Add missing include.
2014-05-13 09:33:05 +03:00
Laurent Fasnacht
0e6f1c99fc
Refactor picture to remove hidden dependency between slice and tiles
...
picture.type -> encoder_state->global->pictype
picture.slicetype -> encoder_state->global->slicetype
picture.slice_sao_luma_flag -> 1 (was constant)
picture.slice_sao_chroma_flag -> 1 (was constant)
This may be changed later. For now it's better to avoid having slice related stuff in picture.
2014-05-07 11:55:48 +02:00
Laurent Fasnacht
6c6adf18c7
Refactor encoder_state
2014-05-07 11:47:31 +02:00
Ari Koivula
bdc16d2612
Improve cu_info coded block flag data structure a bit.
...
- It works just like the old structure except that the flags are checked with
bitmasks instead of having the flag value be propagated upwards. There isn't
really any benefit to this because the flags still have to be propagated to
parent CUs.
- Wrapped them inside a struct to make copying them easier. (Just need to copy
the struct instead of making individual copies)
2014-05-06 18:28:04 +03:00
Ari Koivula
4490e8afd6
Remove depth dimension from picture->cu_array.
...
- It isn't used for anything anymore.
- It was used in the past to hold information during search, but now that
information is held in lcu_t structs.
2014-04-28 10:18:22 +03:00
Laurent Fasnacht
5e7945888a
Inter-frame prediction with tiles works.
...
Many thanks to Jean-Hugues Recolin for the insightful comments about shifts!
2014-04-25 09:28:00 +02:00
Laurent Fasnacht
571a373f69
Use tile offset in search
2014-04-24 08:38:24 +02:00
Laurent Fasnacht
19b1642aa2
Removed all cabac parameters (cabac is part of encoder_state)
2014-04-22 11:46:53 +02:00
Laurent Fasnacht
5fea5875a5
Huge refactoring
...
Split some parts of encoder_control into encoder_state
(idea: encoder_control is immutable)
Goal is to allow multiple substreams in the future.
2014-04-22 10:39:12 +02:00
Laurent Fasnacht
3396264f3c
Moved g_cur_lambda_cost into encoder_control.cur_lambda_cost
2014-04-17 12:00:21 +02:00
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
Marko Viitanen
b5fca8b206
Added missing chroma ref pixel init and fixed pic width/height in intra ref border
...
intra_build_reference_border() was given wrong picture width and height on chroma.
Chroma top-left reference pixels were not copied on init_lcu_t()
2014-03-03 12:21:55 +02:00
Marko Viitanen
f1882a0d82
Fixed CU type initialization and PU index calculations
2014-02-28 15:56:27 +02:00
Ari Koivula
768d54ff4c
Fix wrong array offset in intra search.
2014-02-28 14:22:13 +02:00
Ari Koivula
71d9ab7e26
Fix copying-up of coefficients during search.
2014-02-27 15:58:47 +02:00
Ari Koivula
526fdfc078
Fix erroneous indexing of pixel arrays.
2014-02-27 15:51:21 +02:00
Ari Koivula
eda5ade06d
Add missing offsets for lcu_t.cu pointers.
...
Also changes alternate ways of doing the offset to use LCU_CU_OFFSET macro.
2014-02-27 14:22:01 +02:00
Ari Koivula
a8237bcb1e
Remove duplicated defines.
2014-02-27 14:03:33 +02:00
Marko Viitanen
b58c5b872a
Fixed cu coordinate derivation in lcu_set_intra_mode()
2014-02-27 13:53:26 +02:00
Ari Koivula
f6c97712b2
Add lcu_set_intra_mode.
2014-02-27 13:02:24 +02:00
Ari Koivula
faea7caaf4
Remove unnecessary copying of reconstructed pixels from init_lcu_t.
...
The reconstructed pixels don't exist yet.
2014-02-27 11:58:32 +02:00
Ari Koivula
869ca5aa58
Add copying of LCU coefficients to search.
2014-02-27 11:56:16 +02:00
Marko Viitanen
7a1bf6b17d
Intra fix: encode_transform_tree() call was missing and depth was not set
2014-02-27 10:53:01 +02:00
Marko Viitanen
8ae453551d
Fixed cu type definition and reconstruction function calling
...
reconstruction could have been called when no search was done
2014-02-26 17:50:09 +02:00
Ari Koivula
879c355d9d
Add work_tree_copy_down.
2014-02-26 17:31:26 +02:00
Ari Koivula
9faecd375a
Add work_tree_copy_up.
2014-02-26 16:08:43 +02:00
Ari Koivula
1450d0edf8
Add lcu_t copying to main CU array.
2014-02-26 16:08:43 +02:00
Ari Koivula
e651078e78
Fix compilation for rebase.
...
Conflicts:
src/search.c
2014-02-26 16:08:15 +02:00
Marko Viitanen
b4181dd398
Fixed problems with the new structure and commented out old search
2014-02-26 14:57:57 +02:00
Marko Viitanen
bf21e4d019
Modified encode_transform_tree() to use new structure
2014-02-26 14:28:02 +02:00
Marko Viitanen
43abe296d0
Fixed intra headers and implemented intra search in the new structure
2014-02-26 12:45:43 +02:00
Marko Viitanen
fb9e3ad1d2
Implemented proper intra mode cost calculation
...
This does not currently affect the search primary search defining the used block sizes, only the refining second intra search. Gain 1.9% BD-rate on All Intra 600f of BQMall QP 22,27,32,37.
2014-02-26 12:26:54 +02:00
Ari Koivula
b067b2f802
Add lcu_t initialization.
2014-02-26 10:58:20 +02:00
Ari Koivula
7e520a85c4
Add skeleton/plan for LCU based search.
...
The plan is to replace the dumb search we are doing now with proper sequential
search that is encapsulated inside data structure that holds all temporary
search data for the LCU.
2014-02-25 13:06:22 +02:00
Luca Barbato
0cafa8105f
search: Conditionally compile conditionally used functions
2014-02-21 15:07:15 +01:00
Luca Barbato
e03049782c
search: Staticize functions
2014-02-21 15:07:15 +01:00
Luca Barbato
934a4e3b88
whitespace: Drop trailing spaces
2014-02-21 15:03:35 +01:00
Marko Viitanen
8490ff1a9d
Disabled NxN mode
...
Something must be done to enable better selection of NxN blocks in order to gain BD-rate with this mode.
2014-02-19 14:36:17 +02:00
Marko Viitanen
3618eab72a
Added lambda cost when using reference frames with refIdx > 0
...
Because selecting references "far away" costs bits, this should help with the issue that multiple reference frames actually increases coded bits with no quality gain.
2014-02-19 14:34:36 +02:00
Marko Viitanen
28aa20df12
Basic search for multiple reference frames
2014-02-17 09:58:10 +02:00
Ari Koivula
8e63dd29bb
Fix compiler warnings for VS2010 /W4 in intra.c.
...
- Working towards issue #11 .
- Removed intra_get_block_mode as unused.
- Removed unused parameters from functions. Many of them were remnants from
earlier data structures and earlier features of HEVC that have been removed.
- Lots of implicit conversions from larger types to smaller ones. I tried to
avoid turning all of them to explicit ones this time and opted for changing
the original data type instead. Had to do it in few cases though to stop the
changes from propagating too widely.
2014-02-14 17:15:54 +02:00
Marko Viitanen
5c4c47b07a
Fixed and enabled Intra NxN
...
NxN block needs reference border from previous NxN blocks and to do this, the structure was changed a bit.
2014-02-11 18:31:41 +02:00
Ari Koivula
c18b6f53e1
Fix regression that disabled intra prediction in inter frames.
...
The intent was to remove the flag that enabled intra in inter frames, as that
is not really that usefull anymore, but it ended up disabling intra instead.
2014-02-11 11:57:54 +02:00
Marko Viitanen
c202c8caac
Fixed motion vector cost calculation a bit
...
Cost was calculated a bit wrong causing non-zero motion vectors on totally black video.
2014-02-10 20:30:55 +02:00
Ari Koivula
bc3b80b9e4
Fix compiler warnings for VS2010 /W4 in intra.c.
...
- Working towards issue #11 .
2014-02-10 16:50:10 +02:00
Marko Viitanen
27ffb98d08
Fixed an issue with NxN using uninitialized y_recdata
...
NxN is still disabled by default as it's being fixed.
2014-02-07 15:33:58 +02:00
Ari Koivula
0188aa8631
Fix compiler warnings for VS2010 /W4 in search.c.
...
- Working towards issue #11 .
- Implicit conversions to explicit ones.
2014-02-06 14:40:18 +02:00
Ari Koivula
2614aa0fe4
Fix compiler warnings for VS2010 /W3.
...
- Working towards issue #11 .
- Change lambda cost multiplier for intra NxN to from 256 to 4.
- Add 0.5 to the lambda multipliers so it's rounded instead of truncated.
2014-02-06 11:04:23 +02:00
Ari Koivula
355340067f
Modify search_tree to take a pixel coordinate instead of CU coordinate.
...
I need at least 4x4 resolution for NxN. It's simpler to just use pixel
coordinates.
2014-02-05 18:43:34 +02:00
Ari Koivula
ea312082a4
Simplify the prediction mode search recursion.
...
No need to be so clever for something this simple.
I moved the cost initialization outside the recursing function because it
relied on the clever recursion to work. It should eventually be moved to its
own function that also initializes all the other fields just to be safe. I
didn't do that yet because I want to do it per-LCU and these functions are
still working on per-frame basis.
2014-02-05 18:43:34 +02:00
Marko Viitanen
337a565232
Better lambda cost implementation (from HM12)
...
- Lambda array changed to double as in HM
- Needs updating when GOP / B-pictures are used
2014-02-05 15:57:16 +02:00
Ari Koivula
7bb9c25447
Remove duplicate implementation of intra_build_reference_border.
...
The search_buildReferenceBorder was an ugly hack and a place for bugs to hide
that should never have existed. Now it doesn't.
The change reduces PSNR a little, but also reduces the bitrate, when the
expected result was to have no change in either. I'm guessing there was still
some bug in the search_buildReferenceBorder, but the bug could also be in
intra_build_reference_border. Will have to do more testing to be sure, but
having one place to look at will be better than having two.
2014-02-03 18:35:11 +02:00
Marko Viitanen
80da15df4d
Adjusted cost calculation of CU split
...
Quick testing shows BD-rate change of -14% (LP) and -4% (AI) with 600 frames of BQMall using QP 22,27,32,37.
2014-01-31 12:31:51 +02:00
Ari Koivula
5d12706510
Merge branch 'intra_NxN'
...
Conflicts:
src/encoder.c
- Chroma RDOQ changes conflicted because I had moved the chroma
quantization/dequantization to it's own function.
- Merged to master because I want my code to show up in github. =)
All the old stuff still works, even though NxN doesn't work, so there
is no reason not to merge anyway.
2014-01-29 17:04:41 +02:00
Ari Koivula
e33655fde5
Remove debug stuff and disable intra NxN in preparation for a merge.
...
- Re-enable intra search based on reconstructed image.
- This didn't have as much of an effect as I thought it would.
- Re-enable SAO and deblocking.
- Disable NxN searching. (4x4 luma coding is still broken)
2014-01-29 16:45:37 +02:00
Ari Koivula
71a996f50f
Work on reconstruction and searching.
...
- Set part-size for Inter.
- Change to Intra Only mode for testing.
- Many small changes here and there. Should have been separate commits probably, but too late.
- Disable SAO and deblocking to be able to see problems with reconstruction better.
2014-01-29 14:18:01 +02:00
Ari Koivula
77339efa57
Add COPYING file and add boilerplate for copyright and GPLv2 to every file.
2014-01-24 12:48:48 +02:00
Ari Koivula
73fdc35c4f
Try to implement 4x4 luma transform coding.
...
- Doesn't work yet so it's disabled.
- Change encode_transform_coeff to accept PU (Prediction Unit) coordinates
instead of CU coordinates because CUs are 8x8.
2014-01-09 19:30:54 +02:00
Ari Koivula
b897562ef8
Enable NxN.
2014-01-03 16:46:02 +02:00
Ari Koivula
4c84a35391
Add part size to intra_set_block_mode.
2014-01-03 13:01:13 +02:00
Ari Koivula
d9cdab052b
Add NxN mode selection to search_intra.
2014-01-03 10:21:59 +02:00
Ari Koivula
5083e6db10
Change cu_info.intra into an array to support NxN split.
2014-01-02 15:13:20 +02:00
Ari Koivula
ee92fc341c
Move intra and inter search into their own functions.
2013-12-17 11:32:28 +02:00
Marko Viitanen
06ab158c55
Enable using intra blocks in inter frame by default
2013-11-13 08:46:32 +02:00
Ari Koivula
a57b938270
Add new module sao.
...
- Move sao-stuff not directly related to encoding to sao-module.
- Calculate sao for all LCUs before encoding any of them. This is in
preparation to doing the reconstruction line at a time instead of
LCU at a time.
2013-11-04 19:41:01 +02:00
Marko Viitanen
601d64f04f
Merge branch 'merge-mode'
2013-10-25 15:40:58 +03:00
Ari Koivula
2d26175293
Fix bug that causes lambda_cost to be ignored in search_best_mode.
2013-10-22 19:02:00 +03:00
Ari Koivula
8f5567ba6f
Add full motion vector search back.
2013-10-22 19:00:36 +03:00
Marko Viitanen
b20b583d9b
Moved all residual/coeff functionality to encode_block_residual()
2013-10-22 16:27:50 +03:00
Ari Koivula
ecf10a9717
Add an estimate of the cost of the motion vector to motion search.
2013-10-22 14:09:20 +03:00
Ari Koivula
a81cc45b97
Comment and clean up hexagon search.
2013-10-22 12:28:43 +03:00
Ari Koivula
27f5555b1c
Change hexacon_search to take const pointers.
2013-10-18 17:51:53 +03:00
Ari Koivula
c7ca3a6b44
Clarify parameter passing for hexagon_search.
...
Handling mv as a local struct instead of pointer had no performance impact,
but it makes the parameter passing clearer so I'm keeping it.
2013-10-18 17:45:42 +03:00
Ari Koivula
afc84b4ef8
Change motion vectors search to accept vector2d structs.
2013-10-18 17:33:18 +03:00
Marko Viitanen
c44f0ff540
Refactoring: all int16_t pixel info in intra to pixel typedef
2013-10-18 16:19:17 +03:00
Ari Koivula
f9a99b9111
Clean up inter search.
2013-10-18 15:57:43 +03:00
Ari Koivula
0f95bec907
Clean up control flow of best search.
...
Conflicts:
src/search.c
2013-10-18 15:23:17 +03:00
Ari Koivula
2fa2098236
Remove unnecessary guards against 0 cost.
2013-10-18 15:20:45 +03:00
Ari Koivula
99d4a669c3
Fix bug with partitioning search.
2013-10-18 10:45:38 +03:00
Ari Koivula
202aec69f2
Change more 8-bit pixels to pixel typedef.
2013-10-15 16:02:06 +03:00
Ari Koivula
b8dd664026
Move all 8-bit pixels into new pixel typedef.
2013-10-15 14:36:30 +03:00
Ari Koivula
0c3bd7e223
Move SAD calculations to picture module.
2013-10-11 15:37:58 +03:00
Ari Koivula
69d1f6d1e2
Clean up the code.
...
- Rename get_block_sad to calc_sad and handle special cases in general_sad.
- Remove old search functions because I don't want to update or test them.
2013-10-11 15:19:21 +03:00
Ari Koivula
be501f720c
Reorder conditions.
2013-10-11 14:11:49 +03:00
Ari Koivula
235b1ec0bc
Add rest of the quadrants for sad calculation.
...
- All tests pass.
- Movement vectors that don't overlap with the frame aren't handled yet.
2013-10-11 12:41:07 +03:00
Ari Koivula
b58a6387ee
Clean up the code a bit.
2013-10-11 11:04:49 +03:00
Ari Koivula
7e6c9aefe8
Add handling of more cases to sad calculation.
2013-10-10 21:51:27 +03:00
Ari Koivula
4e36992752
Move basic SAD functions to picture-module.
2013-10-10 21:49:41 +03:00
Ari Koivula
0e078b2d18
Rethink SAD-calculation.
2013-10-10 21:49:20 +03:00
Ari Koivula
1fcb452479
Simplify reference buffer calculation.
2013-10-10 21:48:55 +03:00
Ari Koivula
684f6d548c
Start adding sad calculation outside frame.
...
Works for top-left corner. 2/9 tests pass.
2013-10-10 16:11:07 +03:00
Ari Koivula
ea30bf0126
Fix SAD calculation to return correct value in non-overlapping case.
2013-10-09 16:08:56 +03:00
Ari Koivula
cdcb56dd4a
Add special case for the 0,0 vector to hexagon search.
2013-10-08 16:11:00 +03:00
Ari Koivula
8910037936
Add hexagon-based motion vector search.
2013-10-08 13:38:03 +03:00
Marko Viitanen
351817d008
Fixed intra block selection (always selected 64x64 which was not in search)
2013-10-08 12:13:52 +03:00
Ari Koivula
61eb3b3b71
Improve cu-visualization by arranging them to picture dimensions and colors.
2013-10-01 20:46:10 +03:00
Ari Koivula
9bd35fcdb1
Remove split attribute from cu_info.
...
It is no longer used.
2013-09-30 16:42:23 +03:00
Ari Koivula
f58e418a1a
Fix out-of-bounds detection in mv-search.
...
All blocks were intra because no movement vectors could be found.
2013-09-30 10:47:05 +03:00
Ari Koivula
571fec7c39
Add a more general cost function to motion search.
2013-09-28 16:41:57 +03:00
Ari Koivula
562a43d541
Fix bug with initial prediction of motion vector.
2013-09-28 16:34:23 +03:00
Ari Koivula
8bce7c84a0
Disable early cutoff optimization for motion vector search.c
...
It probably doesn't work right and might cause issues.
2013-09-28 16:04:11 +03:00
Ari Koivula
7979a59168
Fix check for (0, 0) vector when searching for best movement vector.
2013-09-28 16:02:30 +03:00
Ari Koivula
9bad984f14
Add special case for the (0, 0) vector to the fast search.
2013-09-25 19:31:49 +03:00
Ari Koivula
224bda37e7
Make a define switch for full search vs fast search.
2013-09-25 19:20:31 +03:00
Ari Koivula
b1ada6bcd4
Take initial motion vector from last frame.
2013-09-25 19:09:08 +03:00
Ari Koivula
1d1bfd2a6f
Remove unused stuff from motion search.
...
- inter_set_block is no longer needed.
2013-09-25 18:43:16 +03:00
Ari Koivula
4cda086035
Add an early stop condition to motion estimation.
2013-09-25 18:37:37 +03:00
Ari Koivula
2c894b49bf
Disable cu-structure debug rendering.
...
- This can be enabled when needed. It doesn't have to be enabled in git.
2013-09-25 18:18:10 +03:00
Ari Koivula
6f13168285
Add faster motion estimation algorithm.
...
- New motion estimation does the same pattern as the old one, but centers the
search on the best candidate at each step.
2013-09-25 18:16:31 +03:00
Ari Koivula
04f1dde8a1
Fix overwriting of motion vectors during search.
...
- Makes everything besides search to only use the bottom most layer of the
picture.cu_array structure.
2013-09-25 16:21:51 +03:00
Ari Koivula
cda681294c
Fix unsigned/signed mismatch warning.
2013-09-24 21:32:11 +03:00
Ari Koivula
6dd049a238
Refactor: picture.h remaining renames.
2013-09-20 12:49:44 +03:00
Ari Koivula
8d5dd67f76
Refactor: Change name of CU_info.CU to cu_array.
2013-09-20 12:47:53 +03:00
Ari Koivula
5233c417df
Refactor: search.c/.h full cleanup.
2013-09-20 12:18:23 +03:00
Ari Koivula
d09e2bd214
Refactor: picture.c/.h full cleanup.
2013-09-20 11:15:18 +03:00
Marko Viitanen
5264569f43
Refactor: inter.c/.h full cleanup
2013-09-19 15:08:30 +03:00
Ari Koivula
adf619f9dd
Refactor: Update file comments.
2013-09-18 18:01:20 +03:00
Ari Koivula
de447ee18b
Refactoring: intra.h renaming.
2013-09-18 15:13:45 +03:00
Marko Viitanen
a018567854
Refactor: picture.h renaming.
2013-09-18 14:58:46 +03:00
Marko Viitanen
0bf4f65a55
Refactor: encoder.h renaming
2013-09-18 14:49:01 +03:00
Ari Koivula
4f360fcb80
Split MAX_SEARCH_DEPTH to inter and intra versions.
2013-09-18 12:29:23 +03:00
Ari Koivula
44a5498e30
Reorder includes to avoid hidden dependencies.
...
- Includes of global.h have been moved to headers because most headers
require stdint.h.
- Includes required by the header have been moved from the .c to the header.
- Spaces have been added between includes to distinguish classes of includes.
2013-09-18 12:29:23 +03:00
Ari Koivula
03f6bddfb0
Add visualization of CU blocks for mode searching.
...
This is for debugging the inter movement vector search.
2013-09-18 12:29:23 +03:00
Ari Koivula
48581bdad8
Add temporary mechanism to force use of prediction units.
2013-09-16 23:00:38 +03:00
Ari Koivula
fa0bab47f9
Fix MV search bugs.
...
- Calculate motion vector from the source instead of origo.
- Don't return without searching deeper.
2013-09-16 22:44:44 +03:00
Ari Koivula
48c2dc4cd9
Merge remote-tracking branch 'remotes/origin/fador'
2013-09-16 17:49:00 +03:00
Ari Koivula
82e2299b38
Add motion vector search.
...
- Add SAD calculation for arbitrary shape and size blocks.
2013-09-16 17:39:12 +03:00
Marko Viitanen
8e776366dc
Added (basic) motion vector prediction
2013-09-16 16:37:24 +03:00
Marko Viitanen
beef362624
Implemented inter reconstruction inter_recon()
2013-09-12 18:50:11 +03:00
Marko Viitanen
81f584742c
Added picture_init() and changed cur_pic to pointer in encoder_input struct
...
Also contains few inter coding changes
2013-09-12 16:28:40 +03:00
Marko Viitanen
6ede4c60df
Merge branch 'master' of Z:/Work/HEVC_encoder into fador
...
Conflicts:
src/context.c
src/search.c
2013-09-11 14:38:23 +03:00
Marko Viitanen
1763eb22cb
Fixed search_best_mode() to select inter blocks
2013-09-11 14:32:20 +03:00
Ari Koivula
28ce121f32
Improve code style for search_best_mode before analyzing.
2013-09-09 14:39:01 +03:00
Ari Koivula
5acb280407
Change "ToDo" to "TODO".
...
Visual Studio recognized only TODO.
2013-09-09 14:22:53 +03:00
Marko Viitanen
31a8574f1b
Modified search to check for inter cost
2013-09-05 15:02:53 +03:00
Marko Viitanen
e4a8aaa8eb
Added and fixed some functionality to support inter frames
2013-09-02 09:53:36 +03:00
Marko Viitanen
b3a724afb0
Added codes for inter coding
2013-08-02 16:35:30 +03:00
Marko Viitanen
06fd1d6fa9
Fix for sign bit hiding, not working yet
2013-06-12 15:41:57 +03:00
Marko Viitanen
d32f06b4e6
Fixed chroma QP scaling on filtering, this version produces bit-perfect output
2013-06-03 14:22:50 +03:00
Marko Viitanen
4c1e015c5f
Work on Deblocking filter
2013-05-22 17:27:15 +03:00
Marko Viitanen
9011478dba
New contexts and other inter code
2013-04-24 16:49:47 +03:00
Marko Viitanen
3f009e6421
Added skipflag and predflag coding when not in I-slice
2013-04-19 10:56:40 +03:00
Marko Viitanen
e8f04b32f1
Bug fixes, this version produces bit-perfect output
2013-04-18 14:37:56 +03:00
Marko Viitanen
58ba4b306c
Fixes for search-tree, almost working, some visible errors
2013-04-18 14:04:15 +03:00
Marko Viitanen
ae506ceaf5
Moved all the intra-search functionalities to search-tree, does not work completely.
2013-04-17 17:08:52 +03:00