Commit graph

787 commits

Author SHA1 Message Date
Laurent Fasnacht 76ec605b72 SAO works with tiles now 2014-04-28 06:29:21 +02:00
Yusuke Nakamura 0214d4ffcc Makefile: Remove unneeded arguments in CCFLAGS.
This fixes a compilation on clang.
2014-04-27 00:41:10 +09:00
Yusuke Nakamura 03da39e229 config: Use built-in getopt on non-MSVC environments. 2014-04-27 00:40:52 +09:00
Yusuke Nakamura c5a4e7b52c encmain: Remove a warning on MinGW. 2014-04-26 23:56:50 +09:00
Ari Koivula 145816cfb5 Move printing of CLI stuff to stderr.
- Printing to stdout corrupts the stream when used with "-o -".
2014-04-26 12:56:39 +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 7719837f17 Simple OpenMP parallelization 2014-04-25 09:11:10 +02:00
Laurent Fasnacht 4e34859e66 Fix compilation error with USE_TILES=1 and -Werror=maybe-uninitialized 2014-04-24 08:41:05 +02:00
Laurent Fasnacht 59392c4a62 Fix compilation issue with USE_TILES=0 2014-04-24 08:38:24 +02:00
Laurent Fasnacht 571a373f69 Use tile offset in search 2014-04-24 08:38:24 +02:00
Laurent Fasnacht 2e7d958af3 Picture and reference may have different sizes 2014-04-24 08:38:24 +02:00
Laurent Fasnacht af9a1c0fbb Use same reference images for all subencoders 2014-04-24 08:38:23 +02:00
Laurent Fasnacht 73c574fb45 P-frame: first try... 2014-04-24 08:38:22 +02:00
Laurent Fasnacht 03361dcf2c sao try... still not working 2014-04-24 08:38:22 +02:00
Laurent Fasnacht 3db4c59478 Recontruct full frame from tiles 2014-04-24 08:38:21 +02:00
Laurent Fasnacht 35d5d22ccc Fix tile size not to go outside of the original picture 2014-04-24 08:38:20 +02:00
Laurent Fasnacht 985630b8b2 Add a check to fix picture_blit_pixels when width > orig_stride 2014-04-24 08:38:20 +02:00
Laurent Fasnacht b36e154c38 Some cleanup 2014-04-24 08:38:19 +02:00
Laurent Fasnacht 01580a93c3 Encoding with tiles now more or less works with -p 1 --no-sao --no-deblock 2014-04-24 08:38:19 +02:00
Laurent Fasnacht fd89b9af76 New functions: bitstream_append and bitstream_clear 2014-04-24 08:38:18 +02:00
Laurent Fasnacht 356c17e0de Add missing break in bitstream_writebyte 2014-04-24 08:38:18 +02:00
Laurent Fasnacht 5fb4d9c36e substream_encode function 2014-04-24 08:38:17 +02:00
Laurent Fasnacht e292b2c274 allocate subencoders 2014-04-24 08:38:17 +02:00
Laurent Fasnacht 12e3900fd1 ( ) for preprocessor directives... 2014-04-24 08:38:16 +02:00
Laurent Fasnacht fba4f5432a Fix debug code 2014-04-24 08:38:16 +02:00
Laurent Fasnacht b255133460 Debug for tiles 2014-04-24 08:38:15 +02:00
Laurent Fasnacht 066ce6c9f4 Remove unused prototype 2014-04-24 08:38:15 +02:00
Laurent Fasnacht 11629ce811 Use tile scan order in encode_one_frame() 2014-04-24 08:38:14 +02:00
Laurent Fasnacht 0036afa056 Write tiles related information picture parameter set and slice header 2014-04-24 08:38:14 +02:00
Laurent Fasnacht 1e9c894eba Coding tree block raster and tile scanning conversion process, according to ITU-T Rec. H.265 (04/2013) 6.5.1 2014-04-24 08:38:13 +02:00
Laurent Fasnacht 7bd6aa2e9c encoder_control_input_init call moved to encoder_control_init 2014-04-24 08:38:13 +02:00
Laurent Fasnacht ff318ae0e9 Tiles in encoder_control 2014-04-24 08:38:12 +02:00
Laurent Fasnacht 9353f14792 Parameters for using tiles in command line arguments.
--tiles-width-split
--tiles-height-split
2014-04-24 08:38:11 +02:00
Laurent Fasnacht 61c67dc485 Allow -DUSE_TILES=1 to be specified in Makefile; define MAX_TILES_PER_DIM. 2014-04-24 08:38:11 +02:00
Laurent Fasnacht 19b1642aa2 Removed all cabac parameters (cabac is part of encoder_state) 2014-04-22 11:46:53 +02:00
Ari Koivula a539ae7e08 Address clang-analyzer warning.
- The assert needs to be before the initialization.
2014-04-22 11:55:28 +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
Ari Koivula 88a67a4e49 Fix faulty assert that stops the program from working with inter frames.
- The assert would be true after the next if block, but in it's current place
  it's false.
2014-04-22 10:57:38 +03:00
Ari Koivula 54270f271d Fix c89 problem to allow compilation with VS2010. 2014-04-17 19:12:39 +03:00
Ari Koivula 1b437a5989 Address clang-analyzer warnings about garbage values.
- False alarm, but surprisingly difficult to convince clang of that. It
  doesn't seem to understand bit shifts very well.

- Only assert and changing LCU_WIDTH>>depth to width was necessary to satisfy
  clang.

- Closes #35.
2014-04-17 18:43:09 +03:00
Ari Koivula 11509c68dc Address clang-analyzer warnings about unused values.
- Related to issue #35.
2014-04-17 18:43:08 +03:00
Ari Koivula 0704c43836 Address clang-analyzer warning about undefined behavior in intra.
- Related to issue #35.
2014-04-17 18:43:08 +03:00
Ari Koivula 32da12f653 Address a clang-analyzer warning about undefined behavior in filter.
- Analyzer didn't see that code is never called with MAX_DEPTH as it doesn't
  know the properties of width, height, x and y. Following would also
  silence the error:
    assert(cur_pic->width > 0 && cur_pic->height > 0);
    assert(cur_pic->width % 8 == 8 && cur_pic->height % 8 == 0);
    assert(x > 0 && y > 0);
    assert(x % 8 == 0 && y % 8 == 0);

- Related to issue #35.
2014-04-17 18:43:08 +03: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 83360918ba Removed table generation from main code, moved it to tools. 2014-04-17 11:13:15 +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 d01e3ae67f bitstream is a union, and is statically in encoder_control structure 2014-04-17 11:13:12 +02:00
Laurent Fasnacht 122576fe8b some const in cabac.c 2014-04-17 11:13:11 +02:00
Laurent Fasnacht 94a48fc153 added const in bitstream 2014-04-17 11:13:11 +02:00
Laurent Fasnacht 9ac3b7bf2b encoder->in.cur_pic --> cur_pic 2014-04-17 11:13:10 +02:00
Laurent Fasnacht 21d34613c2 Replace encoder->stream by stream 2014-04-17 11:13:09 +02:00
Laurent Fasnacht 2286175378 nal are now written to a bitstream, not a FILE* 2014-04-17 11:13:09 +02:00
Laurent Fasnacht 677fc2ec7d Fix prototype of create_bitstream in bitstream.h 2014-04-17 11:13:08 +02:00
Ari Koivula 51ba80513b Centralize resource deallocation for encmain.
- CppCheck was complaining about unreleased resources for FILE*. They weren't
  really because they get flushed and closed when program exits normally, but
  let's close them anyway.
2014-04-17 11:58:03 +03:00
Ari Koivula b35f33b3da Address warnings about unused values.
- Related to issue #35.
2014-04-16 18:05:03 +03:00
Ari Koivula 9229e5d11b Fix undefined behavior of EO_IDX.
- Move the whole eo_cat thing to it's own function.

- Casting pixel values to int should solve issues with SIGN3. Not casting them
  was detected as undefined behavior by CLANG. Probably because the result of
  two unsigned might be treated as unsigned (but isn't on VS2010).
2014-04-16 14:50:19 +03:00
Laurent Fasnacht ec9d70f70c Moved scalinglist_process into init_encoder_control 2014-04-16 11:45:51 +02:00
Ari Koivula 6e24ba0a5f Merge branch 'sao-mode-cost' 2014-04-16 12:25:05 +03: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
Ari Koivula 051484f8d8 Remove unused old mode cost estimation from SAO. 2014-04-16 11:19:23 +03:00
Laurent Fasnacht 9112cbb58c Generate and use static tables 2014-04-16 09:49:09 +02:00
Ari Koivula a982800e1b Merge remote-tracking branch 'remotes/lfasnacht/const' 2014-04-16 10:28:31 +03:00
Ari Koivula df5af669f9 Merge remote-tracking branch 'remotes/lfasnacht/makefile_deps' 2014-04-16 10:28:04 +03:00
Ari Koivula 33b9594fec Take into account the coding cost of not using SAO. 2014-04-15 21:32:24 +03:00
Ari Koivula 880d09b27a Add sao_type_idx to SAO mode cost estimation. 2014-04-15 21:29:09 +03:00
Ari Koivula 280a946269 Apply bit cost fixes to edge band band sao search.
- Increases bdrate slightly. It's still a cleaner solution though and further
  improvements to bit cost estimation might improve things.
2014-04-15 21:28:16 +03:00
Ari Koivula c968253eb3 Estimate SAO merge coding costs better.
- This doesn't seem to have very much of an effect. I guess the difference
  between 1 and 2 bits isn't that important.
2014-04-15 21:27:16 +03:00
Ari Koivula ef7840c623 Add SAO coding costs for sao_eo_class, band position and offset sign.
- This reduces bdrate a little bit.

- It seems like increasing the bit cost of using SAO in general
  increases bdrate.
2014-04-15 21:24:44 +03:00
Ari Koivula 9ff32c566c Adjust SAO mode coding cost for zero offsets.
- Coding zero with TR only takes one bit.

- Even though offset 0 should be fairly common, this doesn't seem to help very
  much and actually increases bdrate on some sequences.
2014-04-15 21:21:31 +03:00
Ari Koivula 67a3d5542c Add better delta distortion calculation to sao. 2014-04-15 21:17:29 +03:00
Ari Koivula 8c4796e56e Calculate edge and band sao separately. 2014-04-15 21:16:55 +03:00
Ari Koivula 1017c6639c Move band and edge sao to their own functions. 2014-04-15 21:14:59 +03:00
Laurent Fasnacht 960f2cb4b0 g_sig_last_scan -> const uint32_t* 2014-04-15 16:09:52 +02:00
Laurent Fasnacht 288a4537ba const bit_table for exp_golomb 2014-04-15 16:09:52 +02:00
Laurent Fasnacht 763b775d3e encoder_control->cfg is const 2014-04-15 16:09:52 +02:00
Laurent Fasnacht ae2d79c954 Remove encoder_control.cqmfile 2014-04-15 16:09:51 +02:00
Laurent Fasnacht 86c1cf339f Add Makefile to dependencies 2014-04-15 15:47:40 +02:00
Laurent Fasnacht e135a88fb5 Remove encoder_control.cqmfile 2014-04-15 14:21:25 +02:00
Laurent Fasnacht 29c93d8f3f Automatic generation of build dependencies 2014-04-15 13:52:31 +02:00
Laurent Fasnacht 7897f7d5cd Remove counter from debug version of WRITE_*
It's not very useful, and create unneeded noise when trying to make diffs
2014-04-15 11:37:45 +02:00
Laurent Fasnacht f47e23cd24 Allow FREE_POINTER to free const xxx * ptr without warning 2014-04-15 11:37:44 +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 317a3f87a4 Initialize scaling_list_dc (avoids branching on uninitialized value) 2014-04-15 06:19:12 +02:00
Laurent Fasnacht 9f3aeed6be Fix pixel access in sao 2014-04-14 15:40:06 +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
Marko Viitanen 0e7a5057d1 Merge pull request #26 from lfasnacht/warnings_fix
Fix warnings and compile with -Werror
2014-04-14 11:30:37 +03:00
Marko Viitanen 04f09a2bc8 Merge pull request #25 from lfasnacht/memory_bitstream
Changed bitstream handling to allow in-memory bitstream.
2014-04-14 11:29:25 +03:00
Laurent Fasnacht 13398e011b Fix create_bitstream() 2014-04-14 10:23:09 +02:00
Laurent Fasnacht 64f3f57af3 Compile with -Werror 2014-04-14 09:38:37 +02:00
Laurent Fasnacht 89ef1161c4 Fix warnings 2014-04-14 09:37:39 +02:00
Laurent Fasnacht baba299bb8 Obviously a void function cannot return NULL 2014-04-14 09:11:15 +02:00
Laurent Fasnacht 418e6eae51 Changed bitstream handling to allow in-memory bitstream. 2014-04-14 08:13:00 +02:00
Laurent Fasnacht 520dbdd86d Change return type of free_exp_golomb to be void, and add it to bitstream.h 2014-04-14 06:41:27 +02:00
Ari Koivula 29787efbbc Fix whitespace.
Fix some whitespace issues from a merge.
2014-04-11 17:06:21 +03:00
Ari Koivula 83d5a4753d Move input resolution to the same line as internal resolution.
The \n must have been left there by accident.
2014-04-11 16:55:08 +03:00
Ari Koivula 0b5c357795 Move all output to stderr.
It has to be in stderr to allow piping bitstream from stdout.
2014-04-11 16:50:59 +03:00