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
ee92fc341c
Move intra and inter search into their own functions.
2013-12-17 11:32:28 +02:00
Ari Koivula
80064d3834
Streamline SAO to have less duplicated code.
2013-11-14 15:38:19 +02:00
Ari Koivula
21678930b1
Add an alternate way of accessing pixel buffers.
2013-11-14 15:38:10 +02:00
Marko Viitanen
06ab158c55
Enable using intra blocks in inter frame by default
2013-11-13 08:46:32 +02:00
Marko Viitanen
60cb42735e
Fixed issues on compiling the encoder on linux
2013-11-13 08:46:31 +02:00
Marko Viitanen
661ed343e6
Fixed deblocking filter when using intra blocks in inter slice
2013-11-13 08:46:31 +02:00
Ari Koivula
61232b466c
Move types to more appropriate places.
2013-11-12 12:44:58 +02:00
Ari Koivula
181a044b86
Merge branch 'sao'
2013-11-12 11:59:04 +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
84cd618daf
Add calculation of SAO-offsets for non-LCU sized CUs. Luma SAO works now.
2013-11-11 09:49:49 +02:00
Ari Koivula
692ef3e9d9
Add guard against illegal SAO edge offsets.
2013-11-08 16:13:48 +02:00
Ari Koivula
22d21ffac2
Enable SAO search.
...
-Add guard to reconstruction to avoid reconstructing LCUs with no sao type.
-Add temporary guard to SAO search to skip LCUs can't be handled yet.
2013-11-08 15:39:01 +02:00
Ari Koivula
8b0eb66555
Fix bug in SAO reconstruction.
2013-11-08 15:04:53 +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
ef8a984d4f
Fix incorrect blitting of top row during SAO reconstruction.
2013-11-08 11:02:18 +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
1c03471d57
Fix for leftmost LCUs being offset by one pixel during SAO reconstruction.
2013-11-06 22:26:00 +02:00
Ari Koivula
98f2a1aedc
Fix LCU borders in sao reconstruction.
2013-11-06 11:23:01 +02:00
Marko Viitanen
2c61286326
Added missing (0,0) merge/skip candidate to search
2013-11-05 12:49:39 +02:00
Marko Viitanen
93f2b75df7
Fixed a bug in flat scaling list and disabled scaling list by default
2013-11-05 09:41:14 +02:00
Ari Koivula
5791301c2b
Fix moving of rightmost LCUs during sao reconstruction.
...
Now the leftmost LCUs move though.
2013-11-04 21:37:04 +02:00
Ari Koivula
91024a2095
Disable deblocking because it breaks sao.
2013-11-04 20:51:51 +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
2f53b0aa3a
Enabled sign-bit-hiding by default
2013-10-29 13:14:43 +02:00
Marko Viitanen
caa010a972
Changed scalinglist_process() to be done on frame level
2013-10-28 11:47:54 +02:00
Marko Viitanen
601d64f04f
Merge branch 'merge-mode'
2013-10-25 15:40:58 +03: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
0fd9105f0a
Fix sao type context init values.
...
The initialization slice types are in reverse order compared to the codes used
for slice types. They are BPI instead of IPB.
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
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
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
Ari Koivula
ecf10a9717
Add an estimate of the cost of the motion vector to motion search.
2013-10-22 14:09:20 +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
Ari Koivula
a81cc45b97
Comment and clean up hexagon search.
2013-10-22 12:28:43 +03:00
Marko Viitanen
bcb900371f
Added top_coeff array to cu_info and implemented derivation logic
2013-10-22 12:09:18 +03:00
Ari Koivula
c0f06fdb9e
Change intra prediction to use SAD instead of SATD.
...
Inter uses only SAD and we don't have mechanisms for comparing these two.
2013-10-21 17:42:55 +03:00
Ari Koivula
27f5555b1c
Change hexacon_search to take const pointers.
2013-10-18 17:51:53 +03:00
Ari Koivula
4576736575
Change inter SAD functions to take const pointers.
2013-10-18 17:51:16 +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
Marko Viitanen
2efcc12678
Fixed DC-filtering stride
2013-10-18 17:42:16 +03:00
Ari Koivula
afc84b4ef8
Change motion vectors search to accept vector2d structs.
2013-10-18 17:33:18 +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
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
Marko Viitanen
dda53f48a7
Refactoring encoder transform/quant related functions, cu_info and picture
2013-10-18 11:41:52 +03:00
Marko Viitanen
d236d58981
Added more data to cu_info and renamed "residual" to "coeff_y/u/v" in the struct
2013-10-18 11:39:32 +03:00
Marko Viitanen
d9e6d8413d
Added coeff data to picture-struct
2013-10-18 11:39:32 +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
52335adda0
Split merge candidate derivation to its own function
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
99d4a669c3
Fix bug with partitioning search.
2013-10-18 10:45:38 +03:00
Ari Koivula
61cef4eef4
Add intra modes to CU visualization.
2013-10-16 17:09:04 +03:00
Ari Koivula
d74d4e4ef1
Refactor intra sad calculation functions.
...
- Move SATD (hadamart) code to it's own functions.
- Generate functions for fixed block sizes with macros, as if using templates.
- Define new interface with function pointer cost_16bit_nxn_func that different
cost functions can use.
- Hide fixed size block cost functions with getters.
2013-10-16 17:09:03 +03:00
Ari Koivula
202aec69f2
Change more 8-bit pixels to pixel typedef.
2013-10-15 16:02:06 +03:00
Ari Koivula
ef0caee959
Fix compiler warnings.
2013-10-15 14:36:42 +03:00
Ari Koivula
b8dd664026
Move all 8-bit pixels into new pixel typedef.
2013-10-15 14:36:30 +03:00
Ari Koivula
dba20b2467
Merge branch 'sad-boundary'
2013-10-11 15:38:35 +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
0df974cb0d
Change sad functions to accept negative block widths.
...
This makes boundary checking clearer.
2013-10-11 14:11:21 +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
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
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
Marko Viitanen
2716b74100
Merge branch 'inter_residual'
2013-10-10 15:24:34 +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
788a0c9d18
Bugfix for quantization scaling list selection
2013-10-10 11:17:17 +03:00
Marko Viitanen
82eca02ec8
Fixed deblocking condition on residual and deblocking disabling
2013-10-09 17:39:26 +03:00
Marko Viitanen
12fbc5fb4a
Fixed and simplified inter deblocking strength selection
2013-10-09 17:39:25 +03:00
Marko Viitanen
bb9ac4f03b
Fixed quant to select table according to block type
2013-10-09 17:39:24 +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
Ari Koivula
ea30bf0126
Fix SAD calculation to return correct value in non-overlapping case.
2013-10-09 16:08:56 +03:00
Marko Viitanen
817f83cc93
Bugfix for inter reconstruction: half-pel chroma reused variables
2013-10-09 13:39:00 +03:00
Ari Koivula
8719867330
Merge branch 'hexagon'
2013-10-09 12:12:19 +03:00
Marko Viitanen
102c39a396
Bugfix for inter reconstruction: half-pel chroma reused variables
2013-10-09 11:03:38 +03:00
Marko Viitanen
bcd29cba5c
Refactoring: residual related variable renaming and code styling
2013-10-09 11:01:16 +03:00
Ari Koivula
cdcb56dd4a
Add special case for the 0,0 vector to hexagon search.
2013-10-08 16:11:00 +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
Ari Koivula
8910037936
Add hexagon-based motion vector search.
2013-10-08 13:38:03 +03:00
Ari Koivula
9d02dfdd13
Make debug html more strict.
2013-10-08 12:30:57 +03:00
Marko Viitanen
a477d554d5
Merge branch 'inter_deblock'
2013-10-08 12:14:20 +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
Marko Viitanen
8b9c5d129a
Enabled deblocking by default
2013-10-08 12:12:43 +03:00
Marko Viitanen
40664c41d6
Fixed inter deblocking
2013-10-08 12:12:04 +03:00
Marko Viitanen
e3899b8174
Fixed inter chroma deblocking
2013-10-03 11:05:00 +03:00
Marko Viitanen
2d38612e9a
Inter deblocking changes, not working!
2013-10-02 18:09:22 +03:00
Marko Viitanen
13bbd2fb37
Fixed inter_get_mv_cand() candidate selection of B0 CU
2013-10-02 15:10:40 +03:00
Ari Koivula
36fe88caef
Fix rounding errors in chrome half pel prediction.
...
The spec speaks nothing about rounding these values, but HM12 rounds the final
values. HM might be based on an old version of the spec that does all this rounding and clipping.
- Also fixes erroneous indexing when both horizontal and vertical are half pel.
2013-10-02 14:49:23 +03:00
Ari Koivula
c753f6bac6
Fix boundary checking in CU visualization.
2013-10-02 11:11:21 +03:00
Ari Koivula
665b369164
Fix chroma problem in inter prediction.
...
There is still a separate problem, but this fixes the visible chroma problem
with motion vectors that have reference a chroma half-pixel.
2013-10-02 10:59:34 +03:00
Ari Koivula
61eb3b3b71
Improve cu-visualization by arranging them to picture dimensions and colors.
2013-10-01 20:46:10 +03:00
Marko Viitanen
192b077dba
Modified residual coding to allow inter block data (BUGGY!)
2013-10-01 10:54:10 +03:00
Ari Koivula
681975ad4b
Fix inter reconstruction for 8x8 blocks and enable 8x8 inter blocks again.
...
Inter reconstruction was modifying the movement in place when it shouldn't
have. This was causing issues only for the 8x8 blocks, because for larger
blocks the modified movement vector was too far away to be seen by the blocks
below it.
2013-09-30 18:01:21 +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
4a8088be20
Update cu visualization.
2013-09-30 16:42:23 +03:00
Ari Koivula
a6200860b7
Merge branch 'encoder-cleanup'
2013-09-30 10:48:39 +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
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
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
Marko Viitanen
91ff438238
Disabled deblocking filter and changed encoder to use P-slices after the first
2013-09-25 15:52:55 +03:00
Marko Viitanen
410d201e99
Fixed filter_inter_halfpel_chroma() sample rounding
2013-09-25 15:51:43 +03:00
Marko Viitanen
7cf8b1062b
minor style changes to inter_recon()
2013-09-25 14:28:00 +03:00
Marko Viitanen
90239a8bbd
fixed filter_inter_halfpel_chroma() by adding offset value
2013-09-25 14:27:26 +03:00
Marko Viitanen
37b0f45d80
Merge branch 'projects' of Z:/Work/HEVC_encoder into interpolation
2013-09-25 11:02:40 +03:00
Marko Viitanen
3d228278ef
Fixes and comments for inter_recon and filter_inter_halfpel_chroma
2013-09-25 11:01:08 +03:00