Commit graph

188 commits

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