summaryrefslogtreecommitdiff
path: root/vp8/encoder/bitstream.c
AgeCommit message (Collapse)Author
2012-11-06Moving count_mb_ref_frame_usage to macroblock structScott LaVarnway
Change-Id: I44e4e3869f231ae270cca98c9565f23c512e3ddf
2012-11-05Moving ymode_count, uv_mode_count to macroblock structScott LaVarnway
Change-Id: Ib73c7b2bee4cb2eb2528fa6b381fffe9503079a0
2012-11-05Moved skip_true_count to macroblock structScott LaVarnway
Change-Id: Ie9a26be7c9baa54a0e43a63ed6c77f2746477a9c
2012-11-05Moving coef_counts to macroblock structScott LaVarnway
Change-Id: I289564a5a27f0d03ddc6f19c7838542ff22719be
2012-08-20silent compiling warnings for VC9 buildYaowu Xu
Change-Id: Iaa947e640f27e6f6eaf7d845f243536bca2df513
2012-06-11Fix pedantic compiler warningsJohn Koleszar
Allows building the library with the gcc -pedantic option, for improved portabilty. In particular, this commit removes usage of C99/C++ style single-line comments and dynamic struct initializers. This is a continuation of the work done in commit 97b766a46, which removed most of these warnings for decode only builds. Change-Id: Id453d9c1d9f44cc0381b10c3869fabb0184d5966
2012-05-11Merge branch 'origin/eider' into masterJohn Koleszar
Conflicts: vp8/common/entropymode.c vp8/common/entropymode.h vp8/encoder/encodeframe.c vp8/vp8_cx_iface.c Change-Id: I708b0f30449b9502b382e47b745d56f5ed2ce265
2012-05-04Make global data constAttila Nagy
Removes all runtime initialization of global data. This commit is a squashed version of the following series cherry-picked from master. This is necessary because of a change that was merged to the tester that depends on the scaler being moved to the RTCD framework, which is a worthwhile thing to include in Eider anyway. - a91b42f02 Makes all global data in entropy.c const - b35a0db0e Makes all global data in tokenize.c const - 441cac8ea Makes all mode token tables const - 5948a0210 Ports vpx_xcaler to new RTCD method - 317d4244c Makes all mode token tables const part 2 Change-Id: Ifeaea24df2b731e7c509fa6c6ef6891a374afc26
2012-05-02Fix compiler warningsAttila Nagy
Fix code for following warnings: -Wimplicit-function-declaration -Wuninitialized -Wunused-but-set-variable -Wunused-variable Change-Id: I2be434f22fdecb903198e8b0711255b4c1a2947a
2012-04-23Removes duplication of key frame mode probabilitiesAttila Nagy
Key frame macrobock and block mode probabilities are constant. Remove the allocation of tables for each codec instance and use instead the default const prob tables. Change-Id: I8361798ac491f9b3889e86925a494c58647c753f
2012-04-17Makes all global data in entropy.c constAttila Nagy
Removes all runtime initialization of global data in entropy.c. Precalculated values are used for initializing all entropy related tabels. First patch in a series to make sure code is reentrant. Change-Id: I9aac91a2a26f96d73c6470d772a343df63bfe633
2012-02-29Packing bitstream on-the-fly with delayed context updatesAttila Nagy
Produce the token partitions on-the-fly, while processing each MB. Context is updated at the beginning of each frame based on the previoud frame's counters. Optimally encoder outputs partitions in separate buffers. For frame based output, partitions are concatenated internally. Limitations: - enabled just in combination with realtime-only mode - number of encoding threads has to be equal or less than the number of token partitions. For this reason, by default the encoder will do 8 token partitions. - vpxenc supports partition output (-P) just in combination with IVF output format (--ivf) Performance: - Realtime encoder can be up to 13% faster (ARM) depending on the number of threads and bitrate settings. Constant gain over the 5-16 speed range. - Token buffer reduced from one frame to 8 MBs Quality: - quality is affected by the delayed context updates. This again dependents on input material, speed and bitrate settings. For VC style input the loss seen is up to 0.2dB. If error-resilient=2 mode is used than the effect of this change is negligible. Example: ./configure --enable-realtime-only --enable-onthefly-bitpacking ./vpxenc --rt --end-usage=1 --fps=30000/1000 -w 640 -h 480 --target-bitrate=1000 --token-parts=3 --static-thresh=2000 --ivf -P -t 4 -o strm.ivf tanya_640x480.yuv Change-Id: I127295cb85b835fc287e1c0201a67e378d025d76
2012-02-21Merge changes I0341554f,I64e110c8John Koleszar
* changes: Consolidate C version of token packing functions Multithreaded encoder, late sync loopfilter
2012-02-17Update encoder mb_skip_coeff and prob_skip_false calculationAttila Nagy
mode_info_context->mbmi.mb_skip_coeff has to always reflect the existence or not of coeffs for a certain MB. The loopfilter needs this info. mb_skip_coeff is either set by the vp8_tokenize_mb or has to be set to 1 when the MB is skipped by mode selection. This has to be done regardless of the mb_no_coeff_skip value. prob_skip_false is needed just when mb_no_coeff_skip is 1. No need to keep count of both skip_false and skip_true as they are complementary (skip_true+skip_false = total_mbs) Change-Id: I3c74c9a0ee37bec10de7bb796e408f3e77006813
2012-02-16Consolidate C version of token packing functionsAttila Nagy
Replace inner loops of pack_mb_row_tokens_c and pack_tokens_into_partitions_c with a call to pack_tokens_c. Change-Id: I0341554fb154a14a5dadb63f8fc78010724c2c33
2012-01-26Correct clamping in use of vp8_find_near_mvs()John Koleszar
Commit e06c242ba introduced a change to call vp8_find_near_mvs() only once instead of once per reference frame by observing that the only effect that the frame had was on the bias applied to the motion vector. By keeping track of the sign_bias value, the mv to use could be flip-flopped by multiplying its components by -1. This behavior was subtley wrong in the case when clamping was applied to the motion vectors found by vp8_find_near_mvs(). A motion vector could be in-bounds with one sign bias, but out of bounds after inverting the sign, or vice versa. The clamping must match that done by the decoder. This change modifies vp8_find_near_mvs() to remove the clamping from that function. The vp8_pick_inter_mode() and vp8_rd_pick_inter_mode() functions instead track the correctly clamped values for both bias values, switching between them by simple assignment. The common clamping and inversion code is in vp8_find_near_mvs_bias() Change-Id: I17e1a348d1643497eca0be232e2fbe2acf8478e1
2011-12-22Merge "Remove unnecessary ternary constructs"John Koleszar
2011-12-22Remove unnecessary ternary constructsJohn Koleszar
The code had a number of constructs like (condition)?1:0, which is redundant with C's semantics. In the cases where a boolean operator was used in the condition, simply remove the ternary part. Otherwise adjust the surrounding expression to remove the condition (eg, for rounding up. See pickinter.c and rdopt.c) Change-Id: Icb2372defa3783cf31857d90b2630d06b2c7e1be
2011-12-21squash some signed/unsigned comparison warningsJames Zern
Change-Id: Ifc64cf990ae04d77934da3324d0afb3993f061e7
2011-12-09vp8e - entropy stats per frame typeJim Bankoski
Change-Id: I4168eb6ea22ae541471738a7a3453e7d52059275
2011-11-23Fix encoder partitioned output on ARMAttila Nagy
API was not returning correct partition sizes on arm targets. The armv5 token packing functions were not storing the information to the partition size table. As a fix, have one boolcoder instance allocated for each partition so that partition sizes are internally available after all partitions were encoded. This will also allow more flexibility in producing several partitions in parallel. Use buffer validation (overflow check) in all ARM bitpacking functions. Change-Id: I31c8a11d8a7613676f0ff50928cb2a2ab14fd169
2011-11-18Validate encoder buffer writes for single token partitionAttila Nagy
Extend buffer write validation (overflow check) to single token partition packing, both mb and row based functions. Change-Id: I36e19b7d37fc43712d05c70e3ad223d3eb5b973d
2011-11-04Compiler warning fix for const array.Fritz Koenig
Fix compiler warning for passing a non const array to a function expecting a const array by using an intermediary pointer and casting. Change-Id: I9bdd358ebdc926223993fb8fb2098ffedd2f3fc7
2011-10-20Merge "Fix: check cx_data buffer prior to write"John Koleszar
2011-10-20Fix: check cx_data buffer prior to writeJames Berry
check to make sure that cx_data buffer has enough room before writting to it, prior behavior did not which could result in a crash. Change-Id: I3fab6f2bc4a96d7c675ea81acd39ece121738b28
2011-10-10enc: save entropy probs only when needed for refreshAttila Nagy
Previous entropy probs need to be saved (and restored) only when current updates are not propagated. Change-Id: Ie6ee0543066e30874e56258be0a6b7d2dd2fdb2b
2011-08-16Faster vp8_default_coef_probsScott LaVarnway
Copies from a generated table instead of building the default coeff probabilities during runtime. Change-Id: I4d9551ea3a2d7d4a4f7ce9eda006495221a8de50
2011-07-19Moved vp8_encode_bool into boolhuff.hScott LaVarnway
allowing the compiler to inline this function. For real-time encodes, this gave a boost of 1% to 2.5%, depending on the speed setting. Change-Id: I3929d176cca086b4261267b848419d5bcff21c02
2011-06-28Use MAX_ENTROPY_TOKENS and ENTROPY_NODES more consistentlyJohn Koleszar
There were many instances in the code of vp8_coef_tokens and vp8_coef_tokens-1, which was a preprocessor macro despite the naming convention. Replace these with MAX_ENTROPY_TOKENS and ENTROPY_NODES, respectively. Change-Id: I72c4f6c7634c94e1fa066cd511471e5592c748da
2011-06-28New ways of passing encoded data between encoder and decoder.Stefan Holmer
With this commit frames can be received partition-by-partition from the encoder and passed partition-by-partition to the decoder. At the encoder-side this makes it easier to split encoded frames at partition boundaries, useful when packetizing frames. When VPX_CODEC_USE_OUTPUT_PARTITION is enabled, several VPX_CODEC_CX_FRAME_PKT packets will be returned from vpx_codec_get_cx_data(), containing one partition each. The partition_id (starting at 0) specifies the decoding order of the partitions. All partitions but the last has the VPX_FRAME_IS_FRAGMENT flag set. At the decoder this opens up the possibility of decoding partition N even though partition N-1 was lost (given that independent partitioning has been enabled in the encoder) if more info about the missing parts of the stream is available through external signaling. Each partition is passed to the decoder through the vpx_codec_decode() function, with the data pointer pointing to the start of the partition, and with data_sz equal to the size of the partition. Missing partitions can be signaled to the decoder by setting data != NULL and data_sz = 0. When all partitions have been given to the decoder "end of data" should be signaled by calling vpx_codec_decode() with data = NULL and data_sz = 0. The first partition is the first partition according to the VP8 bitstream + the uncompressed data chunk + DCT address offsets if multiple residual partitions are used. Change-Id: I5bc0682b9e4112e0db77904755c694c3c7ac6e74
2011-06-28Adding support for independent partitionsStefan Holmer
Adding support in the encoder for generating independent residual partitions by forcing equal probabilities over the prev coef entropy contexts. Change-Id: I402f5c353255f3ca20eae2620af739f6a498cd21
2011-06-07Wrapped asserts in critical code with CONFIG_DEBUGScott LaVarnway
Change-Id: I5b0aaca06f2e0f40588cb24fb0642b6865da8970
2011-06-02Removed B_MODE_INFOScott LaVarnway
Declared the bmi in BLOCKD as a union instead of B_MODE_INFO. Then removed B_MODE_INFO completely. Change-Id: Ieb7469899e265892c66f7aeac87b7f2bf38e7a67
2011-05-26Merge "Use int_mv instead of MV in vp8_mv_cont"Scott LaVarnway
2011-05-25remove code not in useYaowu Xu
Change-Id: I6e5e86235d341cce3b02abda26dbeb71940ed955
2011-05-24Use int_mv instead of MV in vp8_mv_contScott LaVarnway
Less operations. Change-Id: Ibb9cd5ae66b8c7c681c9a654d551c8729c31c3ae
2011-05-24MODE_INFO size reductionScott LaVarnway
Declared the bmi in MODE_INFO as a union instead of B_MODE_INFO. This reduced the memory footprint by 518,400 bytes for 1080 resolutions. The decoder performance improved by ~4% for the clip used and the encoder showed very small improvements. (0.5%) This reduction was first mentioned to me by John K. and in a later discussion by Yaowu. This is WIP. Change-Id: I8e175fdbc46d28c35277302a04bee4540efc8d29
2011-05-12Using int_mv instead of MVScott LaVarnway
The compiler produces better assembly when using int_mv for assignments. The compiler shifts and ors the two 16bit values when assigning MV. Change-Id: I52ce4bc2bfbfaf3f1151204b2f21e1e0654f960f
2011-03-11Fix "used uninitialized" warning in vp8_pack_bitstream()Attila Nagy
Change-Id: Iadcbdba717439f47a2c24e65fd69a3a1464174b5
2011-02-17Use endian-neutral bitstream packing/unpackingJohn Koleszar
Eliminate unnecessary checks on target endianness and associated macros. Change-Id: I1d4e6a9dcee9bfc8940c8196838d31ed31b0e4aa
2011-02-10Fix relative include pathsJohn Koleszar
Allow compiling without adding vp8/{common,encoder,decoder} to the include paths. Change-Id: Ifeb5dac351cdfadcd659736f5158b315a0030b6c
2011-02-09Put more code under #if CONFIG_MULTITHREAD.Gaute Strokkenes
Change-Id: Icf4b692099d7d249fe3553852b1022b027b28e4b
2010-09-29Fix loopfilter delta zero transitionsJohn Koleszar
Loopfilter deltas are initialized to zero on keyframes in the decoder. The values then persist from the previous frame unless an update bit is set in the bitstream. This data is not included in the entropy data saved by the 'refresh entropy' bit in the bitstream, so it is effectively an additional contextual element beyond the 3 ref-frames and the entropy data. The encoder was treating this delta update bit as update-if-nonzero, meaning that the value would be refreshed even if it hadn't changed, and more significantly, if the correct value for the delta changed to zero, the update wouldn't be sent, and the decoder would preserve the last (presumably non-zero) value. This patch updates the encoder to send an update only if the value has changed from the previously transmitted value. It also forces the value to be transmitted in error resilient mode, to account for lost context in the event of lost frames. Change-Id: I56671d5b42965d0166ac226765dbfce3e5301868
2010-09-09Use WebM in copyright notice for consistencyJohn Koleszar
Changes 'The VP8 project' to 'The WebM project', for consistency with other webmproject.org repositories. Fixes issue #97. Change-Id: I37c13ed5fbdb9d334ceef71c6350e9febed9bbba
2010-09-03Reduced the size of MB_MODE_INFOScott LaVarnway
Moved partition_bmi and partition_count out of MB_MODE_INFO and placed into MACROBLOCK. Also reduced the size of other members of the MB_MODE_INFO struct. For 1080p, the memory was reduced by 1,209,516 bytes. The decoder performance appeared to improve by 3% for the clip used. Note: The main goal for this change is to improve the decoder performance. The encoder will be revisited at a later date for further structure cleanup. Change-Id: I4733621292ee9cc3fffa4046cb3fd4d99bd14613
2010-08-11avoid negative array subscript warningsJohn Koleszar
The mv_ref and sub_mv_ref token encodings are indexed from NEARESTMV and LEFT4X4, respectively, rather than being zero-based like the other token encodings. Change-Id: I3699c3f84111209ecfb91097c4b900773e9a3ad5
2010-06-18cosmetics: trim trailing whitespaceJohn Koleszar
When the license headers were updated, they accidentally contained trailing whitespace, so unfortunately we have to touch all the files again. Change-Id: I236c05fade06589e417179c0444cb39b09e4200d
2010-06-04LICENSE: update with latest textJohn Koleszar
Change-Id: Ieebea089095d9073b3a94932791099f614ce120c
2010-05-19remove unneeded variablesPavol Rusnak
2010-05-18Initial WebM releaseJohn Koleszar