Commit graph

830 commits

Author SHA1 Message Date
Laurent Fasnacht a03f0cba19 encoder_control_input_init near the other encoder_control_* functions 2014-05-07 11:53:21 +02:00
Laurent Fasnacht 1e2671ac30 Renamed encoder_clear_refs to encoder_state_clear_refs 2014-05-07 11:53:12 +02:00
Laurent Fasnacht 831b221cf8 Parsing seems to work now 2014-05-07 11:53:01 +02:00
Laurent Fasnacht 8b5cb62237 Debug code to generate a graph 2014-05-07 11:52:04 +02:00
Laurent Fasnacht cee6bb0e71 Fix iteration on children 2014-05-07 11:49:14 +02:00
Laurent Fasnacht 699669ee35 fixed typo 2014-05-07 11:48:16 +02:00
Laurent Fasnacht 6c6adf18c7 Refactor encoder_state 2014-05-07 11:47:31 +02:00
Laurent Fasnacht a23edd0339 added parent to encoder_state 2014-05-07 11:42:54 +02:00
Laurent Fasnacht 5ce518a47a lcu_at_tile_start and lcu_at_tile_end helper functions 2014-05-07 11:42:30 +02:00
Laurent Fasnacht c2872bd6b0 Slices and WPP in command line and encoder 2014-05-07 11:42:04 +02:00
Laurent Fasnacht 2d6f199246 reorganized encoder_state structure 2014-05-07 11:41:27 +02:00
Laurent Fasnacht f0b076876f Moved all the stream related stuff into substream_write_bitstream 2014-05-07 11:40:20 +02:00
Laurent Fasnacht f30b9c2a11 Fix a buffer overflow in parse_tiles_specification 2014-05-07 11:39:45 +02:00
Ari Koivula eaf8835bda Add some comments and const qualifiers. 2014-05-06 19:20:38 +03:00
Ari Koivula 3910b7989a Clear old cbf data before recursion in encode_transform_tree.
- Because encode_transform_tree also maintains the CBF data and assumes that
  the CBFs are initially zeroed, calling the function more than once would
  result in incorrect CBF data.
2014-05-06 19:03:29 +03:00
Ari Koivula bdc16d2612 Improve cu_info coded block flag data structure a bit.
- It works just like the old structure except that the flags are checked with
  bitmasks instead of having the flag value be propagated upwards. There isn't
  really any benefit to this because the flags still have to be propagated to
  parent CUs.

- Wrapped them inside a struct to make copying them easier. (Just need to copy
  the struct instead of making individual copies)
2014-05-06 18:28:04 +03:00
Ari Koivula d123b98aea Remove unnecessary tertiary expressions from usages of CABAC_BIN. 2014-05-06 17:39:25 +03:00
Ari Koivula 380401b2eb Have CABAC_BIN accept any >0 as binary 1.
It used to treat odd numbers as false.
2014-05-06 17:39:10 +03:00
Marko Viitanen bf2c2a1330 Small changes to fix compiling on VS
- Added threads.h to VS project
- Included Windows.h in threads.h
2014-05-05 11:18:43 +03:00
Laurent Fasnacht f3d4e6eb09 Move bitstream write to a separate function, and add assertions about the part which should not write to bitstream. 2014-05-05 09:24:57 +02:00
Laurent Fasnacht 0fe080ad0a bitstream_tell 2014-05-05 08:53:06 +02:00
Laurent Fasnacht 7f6f4fe9c1 Reference count for picture 2014-05-05 08:03:24 +02:00
Laurent Fasnacht 323054d5e2 naming: alloc_yuv_t -> yuv_t_alloc dealloc_yuv_t -> yuv_t_free 2014-05-02 11:45:27 +02:00
Laurent Fasnacht 7d6d1d5536 Remove pic->pred_* 2014-05-02 11:38:07 +02:00
Laurent Fasnacht 92e14cc80d rename picture_init to picture alloc and picture_destroy to picture_free 2014-05-02 10:58:28 +02:00
Laurent Fasnacht b76f7377b6 Always initialize tiles data structures (even with only one tile) 2014-05-02 10:00:22 +02:00
Laurent Fasnacht f97e60a80d Doc for encoder state 2014-05-02 10:00:12 +02:00
Laurent Fasnacht 161fe38f5e Remove USE_TILES define 2014-05-01 13:58:13 +02:00
Laurent Fasnacht a84fd6486d Add function subencoder_blit_pixels 2014-05-01 11:16:11 +02:00
Laurent Fasnacht b8b28635ff Iterable structure for sub-encoders (more flexibility) 2014-05-01 11:16:10 +02:00
Laurent Fasnacht 212d390003 Cleanup of encoder_state_init and encoder_state_finalize 2014-05-01 11:16:10 +02:00
Laurent Fasnacht 161053f86b Do not allow more tiles than dimension in LCU 2014-05-01 07:11:31 +02:00
Ari Koivula 42295d3cb9 Pass preprocessor defines for supported intrinsics in VS2010 explicitly.
- _M_IX86_FP defines whether VS should generate code using SSE or SSE2
  instructions. It isn't correct to use it to check whether optional runtime
  optimizations should be compiled in. It's also not defined at all in 64-bit
  mode.

- So let's just keep it simple and give a list of everything that is supported
  as release optimizations. It's not clear from the documentation if all of
  these are really supported. It just list a bunch of intrinsics from these
  that are.
2014-04-30 17:41:15 +03:00
Ari Koivula d1fbc6dc80 Fix a small memory leak.
- Malloced pointer returned by alloc_yuv_t was not being freed in
  substream_encode.

- Remove use of yuv_t from encode_one_frame, as it's not used there anymore.
2014-04-30 11:15:34 +03:00
Ari Koivula d808fe3b02 Merge branch 'strategy_selector' 2014-04-29 15:36:48 +03:00
Ari Koivula bd7e021742 Modify strategyselector to work with VS2010.
- VS doesn't have snprintf.

- VS doesn't support GCC attributes.

- Add defines for __SSE__ and __SSE2__ on VS.
2014-04-29 15:29:06 +03:00
Laurent Fasnacht bf7e755cf7 Strategies and runtime detection/choice of best algorithm 2014-04-29 11:51:41 +02:00
Ari Koivula 27b94d4b45 Address gcc -Wtype-limits errors.
- Fixes warnings in #19 and #16.
2014-04-29 09:15:52 +03:00
Ari Koivula 2a17e9a7aa Merge branch 'sse_intrinsics' 2014-04-28 19:38:08 +03:00
Ari Koivula cecf4b0b4e Move __USE_MINGW_ANSI_STDIO to Makefile.
- I'm not too clear on how this should be used, but having it in the source
  file after mingw stuff was included caused a warning about redefinition of
  __USE_MINGW_ANSI_STDIO.
2014-04-28 19:37:37 +03:00
Ari Koivula 4e7e40054f Move picture-sse2.c to src/inline-optimizations/.
- Having it in the src dir even though it's not a module on it's own breaks
  the scons build script. It's probably better to have these a little bit
  separated from the normal code anyway.
2014-04-28 19:36:40 +03:00
Laurent Fasnacht d66f809734 reg_sad implementation using SSE2/SSE4.1 intrinsics 2014-04-28 15:36:58 +02:00
Ari Koivula 4490e8afd6 Remove depth dimension from picture->cu_array.
- It isn't used for anything anymore.

- It was used in the past to hold information during search, but now that
  information is held in lcu_t structs.
2014-04-28 10:18:22 +03:00
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