summaryrefslogtreecommitdiff
path: root/vp8/encoder/pickinter.c
AgeCommit message (Collapse)Author
2012-12-10Moved error_bins to macroblock structScott LaVarnway
Change-Id: Ic9956ddf1c2ddffcf7be7fdfc23ad9a2426fc47a WIP: Fixing unsafe threading in VP8 encoder.
2012-12-04Moving mbs_tested_so_far, mode_test_hit_counts to macroblock structScott LaVarnway
Change-Id: Ifa78c0a953fab3e5dd7af0446924846c7022cd09
2012-11-06Moving rd_thresh_mult, rd_threshes to macroblock structScott LaVarnway
Change-Id: I650a593162280ab40e71e527ec6518303e2d5723
2012-11-06Moving MVcount to macroblock structScott LaVarnway
Change-Id: Ie22841d096f3c86694b95bd06fc3a8ce1f032a10
2012-11-02Removed unnecessary VP8_COMP *cpi parametersScott LaVarnway
Code cleanup Change-Id: I82f9d787a2f511d39895fd8dfd5347a1676d9dbc
2012-10-16Fix to rd cost computation for mv bias.Marco Paniconi
This prevents the rd cost from wrapping around and going negative. Change-Id: Id61390537d2ad47762e410918bb4e18f6a0912d4
2012-10-09multi-res: disable intra on forced ref framesJohn Koleszar
If a reference frame is forced because of low dissimilarity, then shut off the search of intra modes. This change has mixed results. On one clip (QVGA), it hurt quality by ~1.5% with negligible speed impact. On another (VGA) it had negligible affect on quality, but a ~0.2% speed impact. Change-Id: Ic8b07648979d732f489de5f094957e140f84d2eb
2012-10-09multi-res: add parent_ref_valid flagJohn Koleszar
Rather than overloading the parent_ref_frame value to shut off the search in some cases, add a new validity flag. This cleans up some of the duplicated mr_encoder_id && mr_low_res_mv_avail checks as well, for readability. Change-Id: Iddad93a27066c3d85ff2f25a361ac113b288ab7b
2012-10-08multi-res: work around reference mismatchJohn Koleszar
In some situations, believed to be an interaction between temporal scalability and dropped frames, the references available to an encoder may not be the same references available to its parent. Previously, the code tried to force the reference frame chosen by the parent to be used on this frame, even if it was disabled. This was preventing the pick mode loop from running even once, which led to a crash. Attempts to reproduce this bug locally were unsuccessful, so it is still undetermined what the underlying cause of this issue is. In the specific case that was failing, the application did not set any flags which influenced the reference selection on that frame. ref_frame_flags indicated that the golden frame was disabled, believed to be because the last frame updated the last and golden frames, so golden was shut off by default. It's not clear why this wouldn't have also been true in the lower res encoder, ie, why the lower res encoder decided to use and/or was allowed to use the golden frame. We weren't able to debug into the non-crashing lower res encoder as the crash couldn't be reproduced locally. Change-Id: Ifb265253d26963ac2afde0e20cf6792788be6af7
2012-10-03fix uninitialized value in multi-res encodingJohn Koleszar
If a parent mb is available but is intra coded, then parent_ref_mv is invalid. Check that the parent is inter coded before trying to access the parent_ref_mv. Previously the parent_ref_mv was being read from an uninitialized stack allocation, causing potential OOB reads and other undefined behavior. Change-Id: I0c93cd412a19c3a184bcf6decaa145b3a036a6c0
2012-08-21Add biasing to ZEROMV for videos with static backgroundYunqing Wang
For videos with big static background(such as video conferencing clips), the mode decision was biased to ZEROMV in order to obtain a stable background. The percentage of ZEROMV on last frame was used to predict if there is static area in current frame, and checking already-encoded neighboring macroblocks' motion vectors to make sure the local area has low motion. Change-Id: I05b3241d3a56a0bda88b6681e5646c1c8baf2e57
2012-08-20static threshold fix for realtimeJim Bankoski
This code allows us to skip encoding if the sse is less than the error we could possibly encode. Change-Id: Iefb590dc0ee30b660495218398c7969f7d5fd19f
2012-08-02Pass B_PREDICTION_MODE to intra4x4_predictJohann
Use the correct type when calling and inside the function. Change-Id: Idbaf1bf58b9574f0cba73d78780e9aedd8889dfd
2012-08-01Rename vp8_intra4x4_predict_dJohann
predict_d has become canonical. Remove previous helper function. Disable ARM assembly pending update. Change-Id: Idd84ac8a28f9b0221ea97904a77de1e705d06a7d
2012-08-01Use intra4x4_predict_d parameter namesJohann
Rename the local variables for consistency. Change-Id: Ic202ff54551332f706d97da9b67b2e0959ee7f61
2012-08-01Change vp8_intra4x4_predict call sitesJohann
Use the _d variant from the decoder. It moves the pointer calculations to the caller. Change-Id: Iae2a793433ef082980a3ffa0a1cabf0264a6a24d
2012-07-26multi-res: add drop_frame supportYunqing Wang
Added drop_frame support in multi-resolution encoder. If one frame is dropped at a lower-resolution level, the next upper-resolution level encoder needs to encode that frame independently without any lower-resolution level motion information. Another issue is that if one frame is dropped at some but not all resolution levels, a frame after that one may use different set of reference frames at different resolution levels. This reference frame asynchronization could degrade motion search precision in upper-resolution level encoding, which uses lower-resolution level motion result. This change compares the lower-resolution and upper- resolution level's reference frames. If they are not the same, the upper-resolution level encoder can not use lower-resolution level motion result. Change-Id: I61afa4f313630e75b7cbdd5742e230e8724a988a
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-24fix denoiser for temporal patterns and rdJim Bankoski
This extends the denoiser to work for temporally scalable coding. I believe this also fixes a very rare but really bad bug in the original implementation. Change-Id: I8b3593a8c54b86eb76f785af1970935f7d56262a
2012-05-22Merge "multi-res: force Key frame sychronization"Yunqing Wang
2012-05-16multi-res: force Key frame sychronizationYunqing Wang
In multi-resolution encoding, frame_type decision for each frame is made by the lowest-resolution encoder. For all other higher- resolution encoders, kf_mode is always set to VPX_KF_DISABLED, and they are forced to use the same frame_type picked by the lowest-resolution encoder. Change-Id: Ic4d52ec65bbc012ca9c2d236210e28a295591eaf
2012-05-11fix warnings for building on win32Scott Graham
Change-Id: If6e11ba3d681e831d7d98662c0abdd2ac16b3811
2012-04-23Shares one set of RD costs tables between all encoding threadsAttila Nagy
RD costs were local to MACROBLOCK data and had to be copied all the time to each thread's MACROBLOCK data. Tables moved to a common place and only pointers are setup for each encoding thread. vp8_cost_tokens() generates 'int' costs so changed all types to be int (i.e. removed unsigned). NOTE: Could do some more cleaning in vp8cx_init_mbrthread_data(). Change-Id: Ifa4de4c6286dffaca7ed3082041fe5af1345ddc0
2012-03-26Removed duplicate vp8_build_intra_predictors_mb y/uvScott LaVarnway
Added y/uv stride as a parameter and remove the duplicate code. Change-Id: I019117a9dd9659a09d3d4e845d4814d3f33341b5
2012-03-13Merge "Adds a motion compensated temporal denoiser to the encoder."Jim Bankoski
2012-03-13Adds a motion compensated temporal denoiser to the encoder.Stefan Holmer
Some refactoring in rdopt.c and pickinter.c. Change-Id: I4f50020eb3313c37f4d441d708fedcaf219d3038
2012-03-05Move SAD and variance functions to commonJohann
The MFQE function of the postprocessor depends on these Change-Id: I256a37c6de079fe92ce744b1f11e16526d06b50a
2012-02-28Eliminated reconintra_mt.cScott LaVarnway
Reworked the code to use vp8_build_intra_predictors_mby_s, vp8_intra_prediction_down_copy, and vp8_intra4x4_predict_d_c functions instead. vp8_intra4x4_predict_d_c is a decoder-only version of vp8_intra4x4_predict. Future commits will fix this code duplication. Change-Id: Ifb4507103b7c83f8b94a872345191c49240154f5
2012-02-06Merge "Allow to skip highest-resolution encoding in multi-resolution encoder"Yunqing Wang
2012-02-03Allow to skip highest-resolution encoding in multi-resolution encoderYunqing Wang
Sometimes, a user doesn't have enough bandwidth to send high-resolution (i.e. HD) video even though the camera catches HD video. This change allowed users to skip highest-resolution encoding by setting that level's target bit rate to 0. To test it, modify the following line in vp8_multi_resolution_encoder.c. unsigned int target_bitrate[NUM_ENCODERS]={1400, 500, 100}; To skip the highest-resolution level, change it to unsigned int target_bitrate[NUM_ENCODERS]={0, 500, 100}; To skip the first and second highest resolution levels, change it to unsigned int target_bitrate[NUM_ENCODERS]={0, 0, 100}; This change also fixed a small problem in mapping, which slightly helped quality and performance. Change-Id: I977bae9a9fbfba85c8be4bd5af01539f2b84bc81
2012-02-02Moved ref_frame_cost from MACROBLOCKD to MACROBLOCKScott LaVarnway
Change-Id: I05788522e9cde4322cfb12032483bdbf184bdf0b
2012-01-31BLOCKD structure cleanupScott LaVarnway
Removed redundancies. All of the information can be found in the MACROBLOCKD structure. Change-Id: I7556392c6f67b43bef2a5e9932180a737466ef93
2012-01-30RTCD: add arnr functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. It removes the last of the VP8_ENCODER_RTCD struct references. Change-Id: I2a44f52d7cccf5177e1ca98a028ead570d045395
2012-01-30RTCD: add variance functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. Change-Id: Ie5c1aa480637e98dc3918fb562ff45c37a66c538
2012-01-30RTCD: add recon functionsJohn Koleszar
This commit continues the process of converting to the new RTCD system. Change-Id: I9bfcf9bef65c3d4ba0fb9a3e1532bad1463a10d6
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
2012-01-18Merge changes I1ebe76aa,Ia079b52bJohn Koleszar
* changes: rdopt/pickinter: factor out some common setup rdopt: remove unused frame_lf_or_gf
2012-01-11rdopt/pickinter: factor out some common setupJohn Koleszar
Add new get_predictor_pointers() and get_reference_search_order() functions for code shared between the two implementations. Change-Id: I1ebe76aa8f168b1f5cfabc00d05d8f19a0d4d207
2012-01-03Merge "Remove useless g_common.h"Scott LaVarnway
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-21Remove useless g_common.hJohn Koleszar
This file declared a bunch of nonexistent, unreferenced global function pointers. Change-Id: Ic26bb8c7712deba754c49fc01f383b53afc9e728
2011-12-16Merge mr_pick_inter_mode and pick_inter_modeYunqing Wang
Merged multi-resolution motion estimation with regular motion estimation function in order to remove duplicated part. This caused slight changes in multi-resulotion encoder quality & performance. Change-Id: Ib4ecc7acfebfe5eea959b5b91febae6db7b95fd1
2011-12-15Only call vp8_find_near_mvs() once for each macroblockYunqing Wang
While doing motion search on a macroblock, we usually call vp8_find_near_mvs once per reference frame. Actually, for different reference frames, the only difference in calculating these near_mvs is they may have different sign_bias, which causes a sign change in resulting near_mvs. In this change, we only do find_near_mvs for the first reference frame. For other reference frames, only need to adjust the near_mvs according to that reference frame's sign_bias value. Change-Id: I661394b49c6ad79fed7d0f2eb2be239b9c56f149
2011-12-05Multiple-resolution encoderYunqing Wang
The example encoder down-samples the input video frames a number of times with a down-sampling factor, and then encodes and outputs bitstreams with different resolutions. Support arbitrary down-sampling factor, and down-sampling factor can be different for each encoding level. For example, the encoder can be tested as follows. 1. Configure with multi-resolution encoding enabled: ../libvpx/configure --target=x86-linux-gcc --disable-codecs --enable-vp8 --enable-runtime_cpu_detect --enable-debug --disable-install-docs --enable-error-concealment --enable-multi-res-encoding 2. Run make 3. Encode: If input video is 1280x720, run: ./vp8_multi_resolution_encoder 1280 720 input.yuv 1.ivf 2.ivf 3.ivf 1 (output: 1.ivf(1280x720); 2.ivf(640x360); 3.ivf(320x180). The last parameter is set to 1/0 to show/not show PSNR.) 4. Decode: ./simple_decoder 1.ivf 1.yuv ./simple_decoder 2.ivf 2.yuv ./simple_decoder 3.ivf 3.yuv 5. View video: mplayer 1.yuv -demuxer rawvideo -rawvideo w=1280:h=720 -loop 0 -fps 30 mplayer 2.yuv -demuxer rawvideo -rawvideo w=640:h=360 -loop 0 -fps 30 mplayer 3.yuv -demuxer rawvideo -rawvideo w=320:h=180 -loop 0 -fps 30 The encoding parameters can be modified in vp8_multi_resolution_encoder.c, for example, target bitrate, frame rate... Modified API. John helped a lot with that. Thanks! Change-Id: I03be9a51167eddf94399f92d269599fb3f3d54f5
2011-11-18Speed selection support for disabled reference framesJohn Koleszar
There was an implicit reference frame test order (typically LAST, GOLD, ARF) in the mode selection logic, but this doesn't provide the expected results when some reference frames are disabled. For instance, in real-time mode, the speed selection logic often disables the ARF modes. So if the user disables the LAST and GOLD frames, the encoder was always choosing INTRA, when in reality searching the ARF in this case has the same speed penalty as searching LAST would have had. Instead, introduce the notion of a reference frame search order. This patch preserves the former priorities, so if a frame is disabled, the other frames bump up a slot to take its place. This patch lays the groundwork for doing something smarter in the frame test order, for example considering temporal distance or looking at the frames used by nearby blocks. Change-Id: I1199149f8662a408537c653d2c021c7f1d29a700
2011-11-09ARMv6 optimized Intra4x4 predictionTero Rintaluoma
Added ARM optimized intra 4x4 prediction - 2x faster on Profiler compared to C-code compiled with -O3 - Function interface changed a little to improve BLOCKD structure access Change-Id: I9bc2b723155943fe0cf03dd9ca5f1760f7a81f54
2011-10-18Remove usage of predict buffer for decodeScott LaVarnway
Instead of using the predict buffer, the decoder now writes the predictor into the recon buffer. For blocks with eob=0, unnecessary idcts can be eliminated. This gave a performance boost of ~1.8% for the HD clips used. Tero: Added needed changes to ARM side and scheduled some assembly code to prevent interlocks. Patch Set 6: Merged (I1bcdca7a95aacc3a181b9faa6b10e3a71ee24df3) into this commit because of similarities in the idct functions. Patch Set 7: EC bug fix. Change-Id: Ie31d90b5d3522e1108163f2ac491e455e3f955e6
2011-10-11Added rate-targeted temporal scalabilityAdrian Grange
Added the ability to create rate-targeted, temporally scalable, VP8 compatible bitstreams. The application vp8_scalable_patterns.c demonstrates how to use this capability. Users can create output bitstreams containing upto 5 temporally separable streams encoded as a single VP8 bitstream. (previously abandoned as: I92d1483e887adb274d07ce9e567e4d0314881b0a) Change-Id: I156250a3fe930be57c069d508c41b6a7a4ea8d6a
2011-09-30Call vp8_find_near_mvs lazilyAlpha Lam
vp8_find_near_mvs() is being called on all possible reference frames but the data computed may be used if the loop exits early, which can be due to x->skip beign set to 1. Optimize this by call vp8_find_near_mvs() laziy only if it is going to be used and not computed yet. Change-Id: Iccdbd4c962a670c9f2c99b8aca8096042ca5dc98
2011-09-22Replace vpx_ports/config.h with vpx_config.hAttila Nagy
Just a clean-up. Change-Id: Iea5b6dc925dcfa7db548bc1ab1a13d26ed5a2c9a