Commit graph

409 commits

Author SHA1 Message Date
Ari Koivula e93ae54e70 Fix bug with selecting wrong coeff scan mode for 4x4 blocks. 2014-03-12 14:56:05 +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
Ari Koivula 470f36ce34 Remove left-over commented out code. 2014-03-07 12:44:45 +02:00
Ari Koivula 5d9aa3409b Merge branch 'new-search-wip'
Conflicts:
	src/encoder.c
	src/intra.c
	src/intra.h
	src/search.c
2014-03-06 19:00:53 +02:00
Ari Koivula 47af5207c5 Remove dead code and fix white space. 2014-03-06 18:35:17 +02:00
Marko Viitanen c3e47c6a8d Removed redundant coeff_y/u/v variables from CU 2014-03-05 17:18:03 +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
Ari Koivula 1cf03cfb37 Add --no-rdoq parameter. 2014-03-05 17:02:21 +02:00
Ari Koivula ca51f660d5 Fix fluctuation of coefficients on identical frames when RDOQ is on.
Moves CABAC context initialization to take place before search. This fixes
an issue with RDOQ returning different coefficients for identical adjacent
frames.

- This actually probably worsens BD-rate a little for all frames except the
  first one because we were using last frames final CABAC context for every
  LCU and now we are using initialized CABAC contexts. The fix is to encode
  the LCU before we start compressing the next LCU so we can update CABAC
  contexts.
2014-03-05 17:02:13 +02:00
Ari Koivula 8f3d5045b0 Add --no-rdoq parameter. 2014-03-05 17:00:08 +02:00
Ari Koivula 139e00f064 Fix fluctuation of coefficients on identical frames when RDOQ is on.
Moves CABAC context initialization to take place before search. This fixes
an issue with RDOQ returning different coefficients for identical adjacent
frames.

- This actually probably worsens BD-rate a little for all frames except the
  first one because we were using last frames final CABAC context for every
  LCU and now we are using initialized CABAC contexts. The fix is to encode
  the LCU before we start compressing the next LCU so we can update CABAC
  contexts.
2014-03-05 17:00:08 +02:00
Marko Viitanen bddadbb4ed Inter coding fixed and added call to encode_transform_tree() 2014-03-03 17:42:44 +02:00
Ari Koivula 448285a56a Fix bug in intra mode coding. 2014-02-28 17:36:04 +02:00
Marko Viitanen f1882a0d82 Fixed CU type initialization and PU index calculations 2014-02-28 15:56:27 +02:00
Marko Viitanen 0a6d9bda41 Fixed stride values in transform_chroma() 2014-02-27 17:47:00 +02:00
Marko Viitanen 4027de6e1f Fixed reconstruct_chroma() stride values 2014-02-27 16:48:51 +02:00
Ari Koivula 6e11eda133 Fix coeff flag initialization.
They should be initialized, even if none exist.
2014-02-27 16:43:20 +02:00
Marko Viitanen 9968fd46b0 Fixed chroma array index calculations in transform_tree() and intra_recon_lcu() 2014-02-27 16:42:32 +02:00
Ari Koivula 5f75753f85 Set coeff flags correctly.
The coeff flags are no longer propagated upwards because encode_transform_tree
is being called from depth > 0. The fix is to initialize the whole coeff flag
array when the coeff flag is set.
2014-02-27 15:45:07 +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 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
Marko Viitanen d2b8f50351 Merge branch 'master' of https://github.com/lu-zero/kvazaar 2014-02-25 10:53:51 +02:00
Marko Viitanen 565be069b9 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-24 15:28:37 +02:00
Luca Barbato a6dfe79d16 encoder: Export g_convert_to_bit correctly
It is a global table initialized in encoder.c and used all over the
codebase.
2014-02-22 18:02:09 +01:00
Ari Koivula 73f5c3b80e Fix compiler warnings for VS2010 /W4 in config.c and encmain.c.
- Working towards issue #11.
- Widened datatypes for cfg struct members that take values from atoi to full
  ints so that bounds checking can be done after parsing without overflow.
2014-02-21 17:28:11 +02:00
Luca Barbato 350826bc00 encoder: Staticize functions 2014-02-21 15:03:35 +01:00
Luca Barbato 934a4e3b88 whitespace: Drop trailing spaces 2014-02-21 15:03:35 +01:00
Marko Viitanen e3a528df2e Added rate cost to SAO mode selection calculations
Decreased BD-rate 1% on LP configuration with 600 frames of BQMall, QP 22,27,32,37
Merge check is now performed in a function to ease the checking
2014-02-21 15:54:56 +02:00
Marko Viitanen f1f293ae0c Implemented SAO merging 2014-02-21 13:20:54 +02:00
Marko Viitanen e4880aa4b7 Fixed SAO bitstream generation and band offset a bit 2014-02-20 17:22:33 +02:00
Marko Viitanen 5d946c774a Implemented draft SAO band offset functions 2014-02-20 16:08:09 +02:00
Marko Viitanen c230a73155 Added number of reference frames to prefix SEI user data 2014-02-19 14:45:18 +02:00
Marko Viitanen 54e68378dc Fixed merge candidate selection on multiref 2014-02-18 16:59:45 +02:00
Marko Viitanen cda60897e1 Fixed inter mv_ref propagation and merge candidate mv_ref matching 2014-02-17 11:13:12 +02:00
Marko Viitanen 7dee412cb0 Fixed some of the motion vector scaling problems
motion vector candidates are not yet scaled or selected correctly
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
Yusuke Nakamura a860bbc7f9 config: Add --cqmfile to use custom quantization matrices from a file.
The coefficients in a matrix are stored in up-right diagonal order.

The following indicates the default matrices specified in the spec.

INTRA4X4_LUMA
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTRA4X4_CHROMAU
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTRA4X4_CHROMAV
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTER4X4_LUMA
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTER4X4_CHROMAU
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTER4X4_CHROMAV
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16

INTRA8X8_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTRA8X8_CHROMAU
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTRA8X8_CHROMAV
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTER8X8_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTER8X8_CHROMAU
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTER8X8_CHROMAV
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTRA16X16_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTRA16X16_CHROMAU
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTRA16X16_CHROMAV
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTER16X16_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTER16X16_CHROMAU
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTER16X16_CHROMAV
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTRA32X32_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115

INTER32X32_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91

INTRA16X16_LUMA_DC
16

INTRA16X16_CHROMAU_DC
16

INTRA16X16_CHROMAV_DC
16

INTER16X16_LUMA_DC
16

INTER16X16_CHROMAU_DC
16

INTER16X16_CHROMAV_DC
16

INTRA32X32_LUMA_DC
16

INTER32X32_LUMA_DC
16
2014-02-13 17:47:21 +09:00
Marko Viitanen 96d62e1bec Fixed general_profile_compatibility_flag value
Might help with issue #5
2014-02-12 16:01:02 +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
Marko Viitanen 0ac12e72f6 Added init value for encoder->ref_list to fix valgrind warnings
This might help with issue #16
Thanks again to ps-auxw for pointing this out ;)
2014-02-10 20:06:54 +02:00
Marko Viitanen 4bd6131499 Fixed array overflow causing segfault, fixes #17
Should also solve issue #16
Thanks to ps-auxw @ IRC for finding this stupid bug!
2014-02-10 19:40:43 +02:00
Ari Koivula 75f3ba5b2f Fix compiler warnings for VS2010 /W4 in nal.c.
- Working towards issue #11.
- Leaving this as a separate commit in case there is a regression.
2014-02-10 17:46:38 +02:00
Ari Koivula ea600ec980 Fix some compiler warnings for VS2010 /W4 in encoder.c.
- Working towards issue #11.
- There is a lot in this module so I'm fixing only ~half in this commit.
2014-02-10 17:31:52 +02:00
Marko Viitanen 5f79f30b8c Added preliminary support for multiple reference frames
L0 reference list is being updated and sent to bitstream but actual usage of other than default reference might break something.
2014-02-10 11:32:48 +02:00
Marko Viitanen 241aa9155c Fixed crash-bug when using NxN Intra mode (array index overflow)
In NxN mode, chroma predictions were pushed to buffer when chroma should not have been used at all. (Because it is processed only on first of the four NxN luma blocks)
2014-02-07 17:24:58 +02:00
Marko Viitanen d106b21954 Removed redundant function call from encode_block_residual()
intra_set_block_mode() was called twice with the same parameters.
2014-02-07 15:33:58 +02:00
Ari Koivula b48d1c9ca2 Fixes to version sei message.
- Fixed the last 16 characters of the url string being cut of.
- Added some guards against the message overwriting the stack.
2014-02-07 11:43:38 +02:00
Yusuke Nakamura 3e96df2a81 Write Kvazaar's version and encoding options in an user data unregistered SEI. 2014-02-07 10:53:18 +09:00
Yusuke Nakamura 430e475954 config: Add --aud to use access unit delimiters. 2014-02-07 07:35:15 +09:00
Yusuke Nakamura a29b6f7c92 Add some options to specify VUI parameters. 2014-02-07 06:50:43 +09: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
Yusuke Nakamura de2c4ab78e Avoid reading one extra frame at the end of the input file. 2014-02-04 21:55:08 +09:00
Marko Viitanen 39a45936a6 Fixed crash bug on QP < 15 caused by division with zero lambda cost 2014-02-04 09:39:27 +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 d1b093c2ee Merge branch 'master' of https://github.com/ultravideo/kvazaar 2014-02-03 17:20:36 +02:00
Ari Koivula 91ff5ff086 Merge branch 'jeeb-cleanup'
Conflicts:
	src/encoder.c
	src/encoder.h
2014-02-03 17:13:13 +02:00
Yusuke Nakamura 4ffdb358ed nal: Add the writing of an additional zero_byte before the start code.
Enables the output of spec-compliant byte streams, as the specification
notes that an additional zero_byte has to be added under certain
circuimstances.
2014-02-03 17:00:55 +02:00
Jan Ekström ac8fbc0519 Move initialization away from main() 2014-02-03 16:53:51 +02:00
Marko Viitanen d69f97cb90 Fixed level and profile sent to bitstream, for issue #5 b 2014-02-03 16:08:25 +02:00
Marko Viitanen ffd00695c7 Better cleanup of allocated memory at exit
Using valgrind all the leaks were tracked and fixed.
2014-02-03 11:52:43 +02:00
Jan Ekström d8d44e5bcd encoder: Remove a non-UTF-8 symbol from the code
Silences a Visual Studio warning on systems where the symbol is not
in the local code page
2014-01-31 17:17:44 +02:00
Marko Viitanen 5d5fbb8704 Added commandline configuration of intra period (-p <intra_period>) 2014-01-31 10:23:56 +02:00
Ari Koivula b93629f26e Re-enable P frames.
It was inadvertently disabled due to an aborted merge.
2014-01-29 17:56:38 +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 bf80007270 Try to fix 4x4 luma coding.
Still doesn't work. I have no idea what the problem is. Probably somehow related to the coefficient coding, since the bitstream seems to work, the prediction is correct and the error is not very severe.

- Change scan order selection to be more verbose and based on the correct mode for 4x4. Didn't affect the problem with 4x4 luma in any way although it should have.
- Re-enable residual coding as everything seems to work now besides 4x4 luma.
2014-01-29 15:09:41 +02:00
Ari Koivula de3c58862a Fix intra NxN chroma coefficients.
- The NxN coefficients were being saved to the bottom right PU offset instead of
  the parent CU offset.
- Re-enable coefficient coding for chroma NxN.
2014-01-29 14:22:31 +02:00
Ari Koivula f1b2e9f603 Fix buggy chroma when NxN is present.
- NxN intra prediction seems to work fully now.
- Coefficients still don't work for NxN.
2014-01-29 14:22:31 +02:00
Ari Koivula acbe656c6d Fix intra prediction mode list generation. 2014-01-29 14:22:30 +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 5e2f22f447 Try to fix intra prediction mode coding for NxN.
- Adjust predictor list to take modes from PUs in addition to 2Nx2N CUs.
- Change intra_get_dir_luma_predictor to take PU index instead of CU index.
- Comment prediction encoding now that I've had to look it up.
2014-01-29 13:52:17 +02:00
Marko Viitanen 23427a72cf Merge branch 'rdoq' 2014-01-28 12:29:21 +02:00
Marko Viitanen 7a21b9b769 Changed lambda calculation to fix RDOQ issues, RDOQ is now in use by default. 2014-01-28 12:14:43 +02:00
Marko Viitanen de6faf623d Imported entropy bits array from HM and added macro to access it 2014-01-27 14:34:57 +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 7a7110ff7a Move chroma transformation and reconstruction to it's own functions.
Just a simple copy and paste with minimal changes.
2014-01-15 16:55:05 +02:00
Ari Koivula 35ba873abc Move transform unit coding to its own function. 2014-01-14 18:47:02 +02:00
Ari Koivula a38a5fd647 Improve transform tree coding.
- Clean up code and comment.
- Change terminology to match H.265 specification where possible.
- Move transform splitting for depth==0 out of the coding part. It's not
  possible to do it here anyway because intra reconstruction is different
  if the transform is split.
- Add checking for transform hierarchy depth when coding split flag.
- Fixes bug with cu_data.tr_depth being set. The CU struct was being reused
  for inter coded CUs, which did not initialize the tr_depth.
2014-01-14 18:39:24 +02:00
Ari Koivula d5745aa31a Fix encode_transform_tree to handle 4x4 luma.
- Add room to cu_data.coeff_top_yuv arrays for the 4x4 PUs data. Will probably have to do the same to other coeff flags. The flags could also probably be combined as they are a bit redundant.
2014-01-13 18:37:47 +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 c3f4a628af Try to fix stuff related to NxN intra transform splitting. 2014-01-03 16:47:27 +02:00
Ari Koivula 1b7e44c4d4 Add NxN to intra reconstruction. 2014-01-03 13:01:54 +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 80cd172f75 Clean up SAO encoding.
- Fixes a bug when pic->slice_sao_chroma == false.
2014-01-02 15:10:07 +02:00
Ari Koivula f1d8aae5b4 Clean up SAO encoding.
- Fixes a bug when pic->slice_sao_chroma == false.
2013-12-19 13:54:32 +02:00
Ari Koivula 8e2a7ef6ed Start implementing NxN prediction coding. 2013-12-18 14:55:05 +02:00
Ari Koivula 553bcdc324 Rewrite intra prediction mode coding to be simpler.
Should work exactly the same, but with the prediction mode selection done
separately from the binarization it's easier to see that the implementation
is correct.
2013-12-18 14:16:04 +02:00
Ari Koivula cf0d314d03 Clean up prediction mode coding.
This was done as preparation for adding NxN intra.

- Monochrome coding was removed as it's not part of the standard.
- No other functional changes.
2013-12-18 11:25:44 +02:00
Ari Koivula 8f610176d8 Add NxN part_mode coding. 2013-12-18 10:50:24 +02:00
Ari Koivula 3af65b8477 Add SAO searching and reconstruction for chroma.
One I frame and 99 P frames encoded with SAO off and on.
Processed 100 frames,    6693224 bits AVG PSNR: 30.7248 37.8978 37.8287
Processed 100 frames,    6295072 bits AVG PSNR: 32.2511 38.9373 38.9818
2013-11-12 11:55:39 +02:00
Ari Koivula 692ef3e9d9 Add guard against illegal SAO edge offsets. 2013-11-08 16:13:48 +02:00
Ari Koivula 43ae719ddb Tweak implementation of SAO reconstruction to be a bit more clear. 2013-11-08 15:04:06 +02:00
Ari Koivula f9061d322a Fix handling of incomplete LCU's in SAO reconstruction. 2013-11-06 23:09:56 +02:00
Ari Koivula 7a20e797be Fix incorrect SAO encoding. 2013-11-06 22:50:26 +02:00
Ari Koivula 3eccdc0d7b Move deblocking filtering to happen before SAO reconstruction.
-Re-enable deblocking.
2013-11-06 22:50:14 +02:00
Ari Koivula 98f2a1aedc Fix LCU borders in sao reconstruction. 2013-11-06 11:23:01 +02:00
Ari Koivula f21df00386 Save a copy of luma for sao. 2013-11-04 20:33:29 +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
Ari Koivula 03f2967899 Block based sao dead end.
This will never work because the adjacent blocks require the original values
of the boundary pixels to make category decisions.
2013-11-04 17:55:29 +02:00
Ari Koivula 31af7e3929 Fix sao offsets. Reconstruction kind of works. 2013-11-04 13:05:05 +02:00
Ari Koivula 66fe302520 Fix cabac context for sao. HM accepts encoded sao. 2013-11-04 13:03:51 +02:00
Ari Koivula b6c5c87fb7 Merge branch 'master' into sao
SAO needs to be coded before LCU data has been searched. Searching
has already been moved to happen before encoding in the master branch.

Conflicts:
	src/encoder.c
	src/picture.c
	src/picture.h
2013-11-04 12:44:01 +02:00
Ari Koivula 7bd0902727 Implement fast distortion estimation for sao.
Add function for blitting pixels from one buffer to another.

Several commits have been squashed to this one.
2013-11-04 12:37:37 +02:00
Marko Viitanen caa010a972 Changed scalinglist_process() to be done on frame level 2013-10-28 11:47:54 +02:00
Marko Viitanen ded4c18bf6 Fixed merge candidate duplicate removal and implemented skip mode selection 2013-10-25 15:39:19 +03:00
Ari Koivula e9819cbb5e Fix coding of sao chroma type idx. 2013-10-25 10:51:11 +03:00
Ari Koivula 3244c98b29 Fix sao cabac contexts.
According to HM implementation, sao luma and chroma use the same contexts.
2013-10-25 10:51:10 +03:00
Ari Koivula 291be9507b Start adding Sample Adaptive Offset capability. 2013-10-25 10:39:42 +03:00
Marko Viitanen e1f0274b51 Merge mode working on blocks > 8x8 2013-10-23 15:14:26 +03:00
Marko Viitanen 8883fb27aa Implemented skip/merge mode checking, disabled for now because it's not working 2013-10-22 17:40:55 +03:00
Marko Viitanen bb9d8ee9dd Fixed motion vector difference calculation 2013-10-22 16:53:18 +03:00
Marko Viitanen b20b583d9b Moved all residual/coeff functionality to encode_block_residual() 2013-10-22 16:27:50 +03:00
Marko Viitanen 0cce17453c Simplified chroma-coeff-coded-flag derivation on transform split 2013-10-22 13:04:58 +03:00
Marko Viitanen 4cec2963ac Fixed transform splitting to allow 64x64 inter blocks 2013-10-22 12:33:11 +03:00
Marko Viitanen bcb900371f Added top_coeff array to cu_info and implemented derivation logic 2013-10-22 12:09:18 +03:00
Marko Viitanen 2efcc12678 Fixed DC-filtering stride 2013-10-18 17:42:16 +03:00
Marko Viitanen bc9ddb64e5 Fixed luma reconstruction overflow/underflow 2013-10-18 16:54:11 +03:00
Marko Viitanen 927155de2b Set correct block residual bit -> fixes deblocking 2013-10-18 16:23:15 +03:00
Marko Viitanen c44f0ff540 Refactoring: all int16_t pixel info in intra to pixel typedef 2013-10-18 16:19:17 +03:00
Marko Viitanen dda53f48a7 Refactoring encoder transform/quant related functions, cu_info and picture 2013-10-18 11:41:52 +03:00
Marko Viitanen db266e74ff Added merge mode selection (NOT WORKING!) and a function to get candidates 2013-10-18 11:39:32 +03:00
Marko Viitanen 96a0f03298 Refactoring encoder.c in preparation for adding merge-mode 2013-10-18 11:39:31 +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
Marko Viitanen 7a53bddead Fixed inter deblocking by setting correct CU residual info on transform split 2013-10-10 17:47:08 +03:00
Marko Viitanen 1b2b3c19bb Added option to enable residual coding skip when residual under threshold 2013-10-10 16:31:00 +03:00
Marko Viitanen 3d8e14f58b Fixed dequantization of inter-blocks 2013-10-10 15:22:25 +03:00
Marko Viitanen bc815e8cd2 Fixed scan_idx selection on quantization 2013-10-10 14:59:20 +03:00
Marko Viitanen 82eca02ec8 Fixed deblocking condition on residual and deblocking disabling 2013-10-09 17:39:26 +03:00
Marko Viitanen c9cf75775b Deblocking fix: store block residual status and use it in deblocking 2013-10-09 17:39:23 +03:00
Marko Viitanen 2b5159d8ab Bugfix: residual coding almost working 2013-10-09 17:39:07 +03:00
Marko Viitanen bcd29cba5c Refactoring: residual related variable renaming and code styling 2013-10-09 11:01:16 +03:00
Marko Viitanen ef0bea32e1 Merge branch 'master' into inter_residual
Conflicts:
	src/encoder.c
2013-10-08 15:04:31 +03:00
Marko Viitanen ac0db59408 Renamed variable to fix a typo 2013-10-08 14:49:02 +03:00
Marko Viitanen 2d38612e9a Inter deblocking changes, not working! 2013-10-02 18:09:22 +03:00
Marko Viitanen 192b077dba Modified residual coding to allow inter block data (BUGGY!) 2013-10-01 10:54:10 +03:00
Ari Koivula 9ad8bf2915 Refactor: encoder.c full cleanup. 2013-09-28 23:31:26 +03:00
Ari Koivula aee54cdcfa Refactor: encoder.c fix [] 2013-09-28 23:29:26 +03:00
Ari Koivula 36119985b5 Refactor: encoder.c variable renaming. 2013-09-28 20:27:36 +03:00
Ari Koivula 7e6aa31c6f Refactor: encoder.h renaming and cleanup. 2013-09-28 20:20:15 +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
Marko Viitanen 91ff438238 Disabled deblocking filter and changed encoder to use P-slices after the first 2013-09-25 15:52:55 +03:00
Ari Koivula e5cced6b4a Move _CRT_SECURE_NO_WARNINGS to property sheet. 2013-09-24 21:31:48 +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 d09e2bd214 Refactor: picture.c/.h full cleanup. 2013-09-20 11:15:18 +03:00
Ari Koivula f750c24948 Refactor: nal.c/.h full cleanup.
- Move constant from the signature of calc_checksum into a macro.
2013-09-19 16:03:02 +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
Marko Viitanen 0a6c38a8e9 Refactor: context.h renaming 2013-09-18 14:33:47 +03:00
Ari Koivula 81cb6264ab Refactor: cabac.h renaming. 2013-09-18 14:06:45 +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
Marko Viitanen c87d3870ce Fixed inter_get_mv_cand and added new define ENABLE_TEMPORAL_MVP 2013-09-18 10:15:05 +03:00
Marko Viitanen 3ff3318980 Fixed bug(s) in inter_recon() 2013-09-16 17:15:54 +03:00
Marko Viitanen 6a4011a90a Added motion vector candidate selector 2013-09-16 16:51:13 +03:00
Marko Viitanen 8e776366dc Added (basic) motion vector prediction 2013-09-16 16:37:24 +03:00
Marko Viitanen 182381a23c Merge branch 'fador' of Z:/Work/HEVC_encoder
Conflicts:
	src/encoder.c
2013-09-12 19:15:05 +03:00
Marko Viitanen beef362624 Implemented inter reconstruction inter_recon() 2013-09-12 18:50:11 +03:00
Marko Viitanen 10485ab51a One reference picture is now kept on encoder->ref list 2013-09-12 17:38:08 +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 8d44f29d89 Fixed temporal_id to be always zero 2013-09-12 15:45:42 +03:00
Marko Viitanen b7c074f8c3 Fixed temporal_id to be always zero 2013-09-12 15:26:03 +03:00
Ari Koivula 7da00bc51a Merge branch 'funny-sizes' 2013-09-11 20:10:28 +03:00
Ari Koivula 116d5b14be Fix handling of non factor of 8 resolution.
- Reimplement bit filling routines to copy bits form the edge, instead of
  using a constant.

- Add real_width and real_height to encoder_input and store the actual input
  resolution in them instead of in encoder_input.width and height. This fixed
  a crash. It's also clearer.

- Correctly scale conf_win offsets to be in terms of chroma.
2013-09-11 20:02:38 +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
Ari Koivula 7cd57087da Fix string constant. 2013-09-11 00:31:13 +03:00
Ari Koivula 850e8b2586 Add filling out the blanks for reading non multiple of 8 resolutions. 2013-09-09 22:19:16 +03:00
Ari Koivula 2426a4bc1f Move file reading to encoder module. 2013-09-09 21:19:49 +03:00
Ari Koivula 2b9e2485db Add handling of resolutions that are not multiples of the smallest block size.
- When resolution is not a multiple of 8, increase the size of the picture.

- Add conformance window information to the SPS NAL. Thested to work in all
  dimensions with YUVplayer.
2013-09-09 20:43:14 +03:00
Marko Viitanen d6e51374e3 Added new context for root cbf, fixed a bug in MVD coding 2013-09-09 17:37:49 +03:00
Ari Koivula 5acb280407 Change "ToDo" to "TODO".
Visual Studio recognized only TODO.
2013-09-09 14:22:53 +03:00
Marko Viitanen dce892dce8 Merge branch 'master' of Z:/Work/HEVC_encoder into fador
Conflicts:
	.gitignore
2013-09-09 12:11:09 +03:00
Ari Koivula 2b94b9db4c Rename NAL type names to the ones used in the standard. 2013-09-09 11:04:09 +03:00
Ari Koivula 2b4f98e83d Add checksum SEI packages to the bit-stream. 2013-09-06 16:36:28 +03:00
Marko Viitanen 0f4a720206 Changed parameter from cabac_ctx** to cabac_ctx* in cabac_writeUnaryMaxSymbol() 2013-09-05 15:04:16 +03:00
Marko Viitanen 0af55b8676 P-Slice testing, outputs P-slice as the second output slice 2013-09-04 17:47:54 +03:00
Marko Viitanen cb2eecf002 Defined more NAL typed and added better checking for NAL type in slice_header 2013-09-03 17:55:36 +03:00
Marko Viitanen 764cf60971 Changed output slices to TRAIL_R (0x01) from TRAIL_N (0x00) 2013-09-03 17:22:54 +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 fd2e25727c Fixed transform split bug by moving intra prediction to the transform-quant loop 2013-05-21 15:57:22 +03:00
Marko Viitanen 2a70231c06 Fixed Chroma 4x4 2013-05-20 17:26:57 +03:00
Marko Viitanen 1b007efe43 Fixed bug with 8x8 split_flag coding. 4x4 chroma still produces wrong data. 2013-05-16 15:27:54 +03:00
Marko Viitanen 3942bbda51 Added short-term ref list parameters to allow HM10.0 to decode it properly 2013-05-07 10:36:04 +03:00
Marko Viitanen 8054b8ccb4 Bugfix for coeff scan order == 2 (with 8x8 CU's) 2013-04-25 16:29:44 +03:00
Marko Viitanen 9011478dba New contexts and other inter code 2013-04-24 16:49:47 +03:00
Marko Viitanen 003093b1ef Added inter.c/.h 2013-04-24 10:35:27 +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
Marko Viitanen 2aa465ab40 Added basic draft of the search functionality 2013-04-16 15:10:43 +03:00
Marko Viitanen a737e8660c New search.c/.h files and changed department name on all files 2013-04-16 11:23:03 +03:00
Marko Viitanen 01c7f267d7 Added CPUID fetch assembly functions (x86 and x64) 2013-04-10 16:55:31 +03:00