Commit graph

76 commits

Author SHA1 Message Date
Laurent Fasnacht 27a49d287d Big refactor to use videoframe, image_list, and image instead of picture* 2014-06-10 09:19:06 +02: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
Ari Koivula aee9bf2875 Re-add rdo control to transformskip decision.
- It got left out when rewriting the function.
2014-05-14 12:39:23 +03:00
Ari Koivula 9147b7acbf Split residual quantization to separate luma and chroma function. 2014-05-14 11:19:48 +03:00
Ari Koivula e947bd4c0e Clean up trskip decision code and remove old code.
- You can define structs inside functions! This changes everything!!

- Bitstream changes a little bit compared to old trskip decision. Bdrate
  change is insignificant though.
2014-05-13 22:00:04 +03:00
Ari Koivula a3cdee9ec5 Move new trskip decision to a function. 2014-05-13 21:59:00 +03:00
Ari Koivula 2ff713ccb2 Add new implementation for trskip decision. 2014-05-13 21:57:45 +03:00
Ari Koivula 8b8da6f493 Make luma and chroma use the same quantization function.
- Only thing not working was transform skip.
2014-05-13 21:57:23 +03:00
Ari Koivula f0bfcedba2 Clean up coeff reconstruction code. 2014-05-13 21:56:10 +03:00
Ari Koivula 0c65a9b658 Remove abs_sum from coeff quantization.
- It's meant for checking if there are any coefficients, but we don't use it
  and it's annoying to remember to initialize it and pass it around. The
  benefit should be quite small anyway.
2014-05-13 21:54:34 +03:00
Ari Koivula 75042fc65d Move luma quantization to it's own function. 2014-05-13 21:34:06 +03:00
Ari Koivula ba3aaf3189 Expand chroma functions to parent function.
- This was done so that making the function work with luma would be easier.
2014-05-13 21:30:14 +03:00
Ari Koivula 637aceb495 Add TR_MAX_WIDTH.
- Max transform size is constrained by but independent of LCU size.

- Luma and chroma now have the same stride for transform arrays.
2014-05-13 21:22:40 +03:00
Ari Koivula fb763f7940 Move coefficient generation functions from encoder.c to transform.c.
- These functions probably should have been there to begin with.
2014-05-12 11:37:39 +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 27b94d4b45 Address gcc -Wtype-limits errors.
- Fixes warnings in #19 and #16.
2014-04-29 09:15:52 +03: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 4a9c239027 Remove g_bitdepth 2014-04-17 11:13:13 +02:00
Laurent Fasnacht e06253d437 scalinglist changes missing in previous commit 2014-04-16 11:00:29 +02:00
Laurent Fasnacht 9901c38dd5 scalinglist in independent file 2014-04-16 10:25:16 +02:00
Laurent Fasnacht 960f2cb4b0 g_sig_last_scan -> const uint32_t* 2014-04-15 16:09:52 +02:00
Laurent Fasnacht 317a3f87a4 Initialize scaling_list_dc (avoids branching on uninitialized value) 2014-04-15 06:19:12 +02:00
Laurent Fasnacht 486768fc79 scalinglist privatization 2014-04-14 13:39:28 +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 c142cbba21 Fix typo.
- Obvious typo. This g_bitdepth - 8 used to be g_bitincrement. Doesn't affect
  anything yet as we don't actually support bitdepth > 8 yet.
2014-04-04 12:56:22 +03:00
Ari Koivula 27a3329dfb Remove unreferenced_parameter macro.
- It was a silly hack to selectively silence compiler warnings from VS, but
  there is no point as it causes compiler warnings in GCC.
2014-04-03 15:38:17 +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 cfb21c0e4c Implemented transform skipping (for 4x4 blocks)
transform skip vs. normal transform selection criteria might need more work, currently both are calculated for each 4x4 block and SAD+coeff_SSE is compared.
2014-04-02 10:54:03 +03:00
Ari Koivula 47af5207c5 Remove dead code and fix white space. 2014-03-06 18:35:17 +02:00
Luca Barbato 5e585cc2bd transform: Drop now-unused variables 2014-02-21 15:07:15 +01:00
Luca Barbato 35ff5113a6 transform: Staticize 2014-02-21 15:07:15 +01:00
Luca Barbato d6095ff283 transform: Fix function prototypes 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 11bf11f33a Changed duplicate scaled QP calculations to use a function 2014-02-21 15:41:55 +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
Ari Koivula 4184818322 Fix compiler warnings for VS2010 /W4 in tranform.c.
- Working towards issue #11.
- Lots of implicit conversions to explicit ones.
2014-02-06 14:02:56 +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
Marko Viitanen f447b92755 Added error scaling list calculation from HM 12.0 2014-01-27 14:34:58 +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
Marko Viitanen 93f2b75df7 Fixed a bug in flat scaling list and disabled scaling list by default 2013-11-05 09:41:14 +02:00
Marko Viitanen 3d8e14f58b Fixed dequantization of inter-blocks 2013-10-10 15:22:25 +03:00
Marko Viitanen 788a0c9d18 Bugfix for quantization scaling list selection 2013-10-10 11:17:17 +03:00
Marko Viitanen bb9ac4f03b Fixed quant to select table according to block type 2013-10-09 17:39:24 +03:00
Marko Viitanen 03ab259a9e Refactor: transform.c/.h full cleanup. 2013-09-20 11:51:09 +03:00
Ari Koivula adf619f9dd Refactor: Update file comments. 2013-09-18 18:01:20 +03:00
Marko Viitanen df8c5a6acd Refactor: transform.h renaming. 2013-09-18 15:14:31 +03:00
Marko Viitanen 0bf4f65a55 Refactor: encoder.h renaming 2013-09-18 14:49:01 +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