summaryrefslogtreecommitdiff
path: root/vp8/encoder/bitstream.c
AgeCommit message (Collapse)Author
2012-02-06Modified prediction behavior for reference frame.Paul Wilkins
Trial of a modified prediction function that ranks each possible reference frame based on a combination of local usage and frame level probability. The code is a bit cleaner and simpler. In direct comparison with old unpredicted method with segment level coding turned off for mode,ref & EOB the prediction gives a gain on derf of around 0.4%. There is some further gain from bug fixes over earlier code. With segment coding on the prediction method is slightly -ve on some very easy clips (at low rates) due to slightly higher overheads, but better on harder clips. Overall neutral on derf in direct comparison on latest code base, but compared to earlier code without bug fixes about +0.7% overall psnr +0.3% SSIM. Change-Id: I5b8474658b208134d352d24f6517f25795490789
2012-02-03Reference frame prediction:Paul Wilkins
Extended prediction and coding of reference frame where a subset of options are flagged as available at the segment level. Updated copyright notices. Switch to SAD in mbgraph code as SATD problematic for the foreground and background separation as it can ignore large DC shifts. Change-Id: I661dbbb2f94f3ec0f96bb928c1655e5e415a7de1
2012-02-02Added encoding in Superblock OrderAdrian Grange
As a precursor to encoding 32x32 blocks this cl adds the ability to encode the frame superblock (=32x32 block) at a time. Within a SB the 4 indiviual MBs are encoded in raster-order (NW,NE,SW,SE). This functionality is added as an experiment which can be enabled by ispecifying --enable-superblocks in the command line specified to configure (CONFIG_SUPERBLOCKS macro in the code). To make this work I had to disable the two intra prediction modes that use data from the top-right of the MB. On the tests that I have run the results produce almost exactly the same PSNRs & SSIMs with a very slightly higher average data rate (and slightly higher data rate than just disabling the two intra modes in the original code). NOTE: This will also break the multi-threaded code. This replaces the abandoned change: Iebebe0d1a50ce8c15c79862c537b765a2f67e162 Change-Id: I1bc1a00f236abc1a373c7210d756e25f970fcad8
2012-02-02Comment out segref segmentation filter changes.Paul Wilkins
Commented out changes from earlier checking: "Change Iab7f1eff: vpnext use segref segmentation filter" Which in its current state breaks the decoder. Change-Id: I9185098aeda8ce65310f338c4c9375f4a39005d3
2012-01-31Implementation of new prediction model for reference frame coding.Paul Wilkins
This check in uses the common prediction interface functions to code reference frame. Some updates made regarding the impact of the new code in rd loop but there remain TODOs in this regard. Change-Id: I9da3ed5dfdaa489e0903ab33258b0767a585567f
2012-01-31Use common prediction interface for segment coding.Paul Wilkins
This does not change any functionality just modifies the code to use the common prediction module interface for coding the segment data. Change-Id: Ifd43e9153573365619774a4f5572215e44fb5aa3
2012-01-31Moved some reference frame data structures into common.Paul Wilkins
Encoder side changes Change-Id: I8921800e4fccec5e5a9e4755b80cbd472623107b
2012-01-31Moved some segmentation data structures.Paul Wilkins
Moved some segmentation data structures into VP8_COMMON Change-Id: I59c6e2edf7a0176e35319936eea450027aeb3b39
2012-01-27vpnext use segref segmentation filterJim Bankoski
Goes through set of ref frames used by each macroblock and sets seg_lvl_ref_frame flags accordingly.. http://www.corp.google.com/~jimbankoski/no_crawl/segref.html Change-Id: Iab7f1effd75a839b34eb310d7168692c8f105411
2011-12-22Fix more warnings.Christian Duvivier
Change-Id: Ifadf65026a11bdb5d39840748613880bcfb364bb
2011-12-19Further QIndex realted Fixes:Paul Wilkins
Added code to support 256 index steps instead of 128 but disabled for now. Replace hard wired table vp8cx_base_skip_false_prob[128] Observed Qindex problem with setting minimum loop filter value. (Experiment code using real Q in place but for now just returning 0. This has a big beneficial effect on some clips, particularly waterfall which shows 5% ssim gain) Change-Id: I2f7117de8adc1797164c106aa13effc900a1467e
2011-12-15Fixed bug to use mode_info_stride rather than mb_colsAdrian Grange
Both encoder & decoder were using mb_cols to offset from one row of MODE_INFO structures to the next when they should have been using mode_info_stride. Fixing this in both encoder and decoder gives around a 3KB size saving and 0.025dB PSNR improvement on the one 720P clip I tried. (Also removed "index" which was being updated but not used) Change-Id: I413bea802b142886bfcf8d8aa7f5a2f0c524fd4b
2011-12-09Enabled adaptive UV intra coding for inter framesYaowu Xu
Previously, Y-adaptive UV intra coding only enabled on key frames in UVINTRA experiment. This commit enabled the same coding for inter frames, so the encoding of UV intra modes are consistent cross all frame types. Tests on derf set showed a very small overall gain around .04%: http://www.corp.google.com/~yaowu/no_crawl/interUVintra.html The gain looks to be reasonable given inta coded MBs is only a small portion of MBs in inter frames. Change-Id: Ic6fc261923f2c253f4a0c9f8bccf4797557b9e16
2011-12-09Revised coding using adaptive mode context to depend on frame typeYaowu Xu
A previous commit 76feb965 made the vp8_mode_context adaptive on a frame frame basis, this commit further made the coding context adaptive to two frame types separately. Tests on derf set showed a further small gain on all metrics: avg psnr 0.10%, glb psnr: 0.11%, ssim: 0.08% http://www.corp.google.com/~yaowu/no_crawl/newNearMode_1209.html Change-Id: I7b3e32ec8729de1903d14a3f1213f1624b78cdee
2011-12-07Removed #if CONFIG_MULCONTEXTYaowu Xu
This commit removed the macro CONFIG_MULCONTEXT, which was used to indicate the experiment code for using separate context for altref and normal frames. This commit made the change fully merged in. Change-Id: I525f927f68e2365d37b340ef23b836a136a4f70b
2011-12-07Removed #if CONFIG_I8X8Yaowu Xu
This commit removed the macro CONFIG_I8X8, which was used to indicate the 8x8 intra prediction experiment, made the change fully merged in. Change-Id: Iafa4443781ce6e83f5591c12ba615a0e92ce0ea0
2011-12-07made vp8_mode_context adaptiveYaowu Xu
vp8_mode_contexts[] is an entropy table used to code inter mode choices. It was a fixed constant table. This commit made the entropy context adaptive. Tests on derf set showed very good consistent gains on all metrics: avg psnr .47%, overall psnr .46% and ssim .40%. http://www.corp.google.com/~yaowu/no_crawl/newModeContext.html Change-Id: Ia62b14485c948e2b74586118619c5eb2068b43b2
2011-12-07Minor fixes:Paul Wilkins
fixed issues caused by conflicts between two experiments. Change-Id: I56a9bd69493e4850c121ea057a6233c55777c2a5
2011-12-06Dual 16x16 inter prediction.Ronald S. Bultje
This patch introduces the concept of dual inter16x16 prediction. A 16x16 inter-predicted macroblock can use 2 references instead of 1, where both references use the same mvmode (new, near/est, zero). In the case of newmv, this means that two MVs are coded instead of one. The frame can be encoded in 3 ways: all MBs single-prediction, all MBs dual prediction, or per-MB single/dual prediction selection ("hybrid"), in which case a single bit is coded per-MB to indicate whether the MB uses single or dual inter prediction. In the future, we can (maybe?) get further gains by mixing this with Adrian's 32x32 work, per-segment dual prediction settings, or adding support for dual splitmv/8x8mv inter prediction. Gain (on derf-set, CQ mode) is ~2.8% (SSIM) or ~3.6% (glb PSNR). Most gain is at medium/high bitrates, but there's minor gains at low bitrates also. Output was confirmed to match between encoder and decoder. Note for optimization people: this patch introduces a 2nd version of 16x16/8x8 sixtap/bilin functions, which does an avg instead of a store. They may want to look and make sure this is implemented to their satisfaction so we can optimize it best in the future. Change-ID: I59dc84b07cbb3ccf073ac0f756d03d294cb19281
2011-12-02added separate entropy context for alt_refYaowu Xu
This commit added code to keep track of separate entropy contexts for normal frames and alt ref frames. The underly assumption was that the two type of frames have different entropy characteristics given they typically have quite different quantization levels. By keeping entropy contexts separate, it helps the entropy context distribution to be more closely adapted to each frame type. Tests on derf set showed a good and very consistent gain on all clips on all metrics, avg psnr: 0.89%, overall psnr: 0.84% and ssim 0.93%. http://www.corp.google.com/~yaowu/no_crawl/mulcontext.html Change-Id: I15bc9697f6ff7829042911fe0c62930585d7e65d
2011-12-02enabled 8x8 intra prediction modes on inter framesYaowu Xu
This commit enabled the usage of 8x8 intra prediction modes on inter frames. There are a few TODO items related to this: 1)baseline entropy need be calibrated; 2)cost of UV need to be done more properly rather than using decision only relying on Y; 3)Threshold for allowing picking 8x8 intra prediction should be lowered to lower than the B_PRED. Even with all the TODOs, tests showed consistent gain on derf set ~0.1% (PSNR:0.08% and SSIM:0.14%). It is assumed that 8x8 intra prediction will help more on large resolution clips, especially with above TODOs addressed. Change-Id: I398ada49dfc32575cfab962a569c2885111ae3ba
2011-11-28changed find_near_mvs search to include a mb from last frameYaowu Xu
This is an experiment to include a mv contribution from last frame to nearest and near mv definition. Initial test showed some small though consistent gain. latest patch slightly better result ~.13%-~.18%. TODO: the entropy used to encode the mode choice, i.e. the mv counts based conditional distribution of modes should be re-collected to reflect this change, it is expected that there is some further gain from that. Change-Id: Ief1e284a36d8aa56b49ae5b360c91419ec494fa4
2011-11-15Merge CONFIGURE_SEGMENTATION experiment.Paul Wilkins
Removal of CONFIGURE_SEGMENTATION ifdefs. Removal of legacy support code fo the old coding mechanism. Use local reference "xd" for MACROBLOCKD structure in encode_frame_to_data_rate() Moved call to choose_segmap_coding_method() out of encode loop as the cost of segmentation is not properly accounted in the loop anyway. If this is desirable in the future it can be moved back. The use of this function to do all the analysis and set the probabilities also removes the need to track segment useage in threading code. Change-Id: I85bc8fd63440e7176c73d26cb742698f9b70cade
2011-11-15Further clean up of Segmentation experiment codePaul Wilkins
Changed name and sense of segment_flag to "seg_id_predicted" Added some additional comments and retested. I also did some experimentation with a spatial prediction option using a similar strategy to the temporal mode implemented. This helps in some cases where temporal prediction is bad but I suspect there is more overlap here with work on a larger scale block structure and spatial correlation will likely be better handled through that mechanism. Next check in will remove #ifdefs and legacy mode code. Change-Id: I3b382b65ed2a57bd7775ac0f3a01a9508a209cbc
2011-11-15Further work on Segmentation Experiment:Paul Wilkins
This check in includes quite a lot of clean up and refactoring. Most of the analysis and set up for the different coding options for the segment map (currently simple distribution based coding or temporaly predicted coding), has been moved to one location (the function choose_segmap_coding_method() in segmenation.c). This code was previously scattered around in various locations making integration with other experiments and modification / debug more difficult. Currently the functionality is as it was with the exception that the prediction probabilities are now only transmitted when the temporal prediction mode is selected. There is still quite a bit more clean up work that will be possible when the #ifdef is removed. Also at that time I may rename and alter the sense of macroblock based variable "segment_flag" which indicates (1 that the segmnet id is not predicted vs 0 that it is predicted). I also intend to experiment with a spatial prediction mode that can be used when coding a key frame segment map or in cases where temporal prediction does not work well but there is spatial correlation. In a later check in when the ifdefs have gone I may also move the call to choose_segmap_coding_method() to just before where the bitsream is packed (currently it is in vp8_encode_frame()) to further reduce the possibility of clashes with other experiments and prevent it being called on each itteration of the recode loop. Change-Id: I3d4aba2a2826ec21f367678d5b07c1d1c36db168
2011-11-11Segmentation experiment:Paul Wilkins
Added last_segmentation_map[] structure to keep track of what we had before when doing temporal prediction. With this change the existing code does once again appear to be giving a decodable bitstream for both temporal and standard prediction modes. However, it is still somewhat messy and confused and there is no option to take advantage of spatial prediction so it could do with further work. Some housekeeping / clean out. Change-Id: I368258243f82127b81d8dffa7ada615208513b47
2011-11-11SEGMENTATION experiment:Paul Wilkins
Some initial cleanup to aid testing and debug. Pull code to choose temporal or spatial encoding out of encodeframe.c into a dedicated function in segmentation.c. For now disable broken temporal mode. Move the coding of "temporal_update" flag and only transmit if segment map update is indicated. Rename the functions read_mb_features() and write_mb_features() to read_mb_segid() and read_mb_segid() as they only read and write the macroblock segment id not any of the features. Change-Id: Ib75118520b1144c24d35fdfc6ce46106803cabcf
2011-11-09Merging and testing of SEGMENTATION experiment.Paul Wilkins
Removed code in #if CONFIG_SEGMENTATION that enables segmentation and creates a test segmentation map, to avoid conflicts with the other segmentation test code, Change-Id: I7a21a44ed188b814cd80b30dd628c62474eba730
2011-11-04Segment Feature Data AccessPaul Wilkins
No change to functionality or output. Updates to the segment feature data structure now all done through functions such as set_segdata() and get_segdata() in seg_common.c. The reason for this is to make changing the structures (if needed) and debug easier. In addition it provides a single location for subsequent addition of range and validity checks. For example valid combination of mode and reference frame. Change-Id: I2e866505562db4e4cb6f17a472b25b4465f01add
2011-11-03make uv intra mode coding adaptive to Y modeYaowu Xu
This commit tries to do UV intra mode coding adaptive to Y intra mode. Entropy context is defined as conditional PDF of uv intra mode given the Y mode. All constants are normalized with 256 to be fit in 8 bits. This provides further coding efficiency beyond the quantizer adaptive y intra mode coding. Consistent gains were observed on all clips and all bit rates for HD all key encoding tests. To test, configure with --enable-experimental --enable-uvintra Change-Id: I2d78d73f143127f063e19bd0bac3b68c418d756a
2011-11-03Segment Features. Removal of #ifdefsPaul Wilkins
Removal of configure #ifdefs so that segment features always available. Removal of code supporting old segment feature method. Still a good deal of tidying up to do. Change-Id: I397855f086f8c09ab1fae0a5f65d9e06d2e3e39f
2011-11-02Segmentation: Reference framesPaul Wilkins
Modify reference frame segmentation so that ONE or MORE reference frames may be marked as a available for a given segment. Fixed bugs relating to segment coding of INTRA and some INTER modes at the segment level. Modified Q boost for static areas based on ambient average Q. Strong results now on clips with significant static areas. (some data points in derf set as high as 9% and some static & slide show type content in YT set > 20%) Change-Id: Ia79f912efa84b977f35a23683ae3643251e24f0c
2011-10-31Segmentation Entropy and tweaks.Paul Wilkins
Some correction for entropy impact of segment signaled (EOB and ref frame) Other slight tweaks. Derf VBR average gain now over 1% (best over 7%) One YT test clip has gains of circa 30% (VBR) There is still an issue with noisy clips where making the background static and coded with 0,0 can have a negative effect, especially at low Q. This is probably because of the loss of smoothing by fractional pixel filters. Change-Id: I7a225613c98067b96f8fc7a7e36f95d465b2b834
2011-10-24Segmentation Features;Paul Wilkins
Only encode sign bit for feature data that can have a sign. Tweaks to the test segmentation rules so that it now actually gives a net benefit on the derf set of about 0.4% though much higher on some clips at the low end. Change-Id: I8e61f1aebf41c9037db7e67e2f8975aa18a0c986
2011-10-24Further segment feature extensions.Paul Wilkins
This quite large check in includes the following: Merge in some code from Ronald (mbgraph.c) that scans a Gf/arf group. This is used as a basis for a simple segmentation for the normal frames in a gf/arf group. This code also uses satd functions from Yaowu. Adds functionality for coding the latest possible position of an EOB for blocks in the segment. (Currently 0-15 only, hence just for 4x4 dct). Where the EOB position is 0 this acts like "skip" and the normal coding of skip at the per mb level is disabled. Added functions (seg_common.c) for setting and reading segment feature elements. These may want to be optimized away at some point but while the mecahnism is in a state of flux they provide a single location for making changes and keep things a bit cleaner. This is still proof of concept code. Currently the tested feature set:- Quantizer, Loop Filter level, Reference frame, Prediction Mode, EOB end stop. TBD:- Add functions for setting and reading the feature data with range and validity checking. Handling of signed and unsigned feature data. At the moment all is assumed to be signed and a sign bit is coded but many cannot be negative. Correct handling of EOB feature with intra coded blocks. Testing/trapping of legal/illegal ref frame and mode combinations. Transform size switch plus merge and test with 8c8 DCT work Merge and test with Sumans Segmenation coding optimizations Change-Id: Iee12e83661c7abbd1e0ce6810915eb4ec35e2d8e
2011-09-30Segment coding of mode and reference frame.Paul Wilkins
Proof of concept test code that encodes mode and reference frame data at the segment level. Decode-able bit stream but some issues not yet resolved. As it this helps a little on a couple of clips but hurts on most as the basis for segmentation is unsound. To build and test, configure with --enable-experimental --enable-segfeatures Change-Id: I22a60774f69273523fb152db8c31f4b10b07c7f4
2011-09-16enable selecting&transmitting to for intra mode entropyYaowu Xu
This commit added a 3 bit index to the bitstream, the index is used to look into the intra mode coding entropy context table. The commit uses the mode stats to calculate the cost of transmitting modes using 8 possible entropy distributions, and selects the distribution that provides the lowest cost to do the actual mode coding. Initial test show this provides additional .2%~.3% gain over quantizer adaptive intra mode coding. So the adaptive intra mode coding provides a total of .5%(psnr) to .6% gain(ssim) combined for all-key-encoding To build and test, configure with --enable-experimental --enable-qimode Change-Id: I7c41cd8bfb352bc1fe7c5da1848a58faea5ed74a
2011-09-16add quantizer adaptive intra mb mode encodingYaowu Xu
make intra mode coding entropy distribution adaptive to baseQindex, an encoding test on hd clips with all key frame shows universal gain on all clips in both .2%(psnr) and (ssim).3%. To build and test, configure with --enable-experimental --enable-qimode Change-Id: Iaa69241b984d4fdd8baa6d77ee78c0140f5ac00a
2011-09-16add 8x8 intra prediction modesYaowu Xu
Patch 1 to Patch 3 is an initial implementation of 8x8 intra prediction modes, here are with the following assumptions: a. 8x8 has 4 prediction modes DC, H, V and TM b. UV 4x4 block use the same mode as corresponding 8x8 area c. i8x8 modes are enabled for key frame only for now Patch 4: d. removed debug code from previous patches Patch 5: e. added stats code to collect entropy stats and further cleaned up Patch 6: f. changed mode stats code to collect finer stats of modes Patch 7: g. normalized i8x8 modes distribution to total at 256 (8bits). Patch 8: h. fixed a bug in decoder and removed debug printf output. Patch 9: i. more cleanups to address paul's comment Patch 10: j. messy rebase/merges to bring the commit up to date. Tests on HD clips encoded with all key frame showing consistent gain on all clips and all metrics:~0.5%(psnr) and 0.6%(ssim): http://www.corp.google.com/~yaowu/no_crawl/i8x8hd_allkey_fixedq.html To build and test, configure with: --enable-experimental --enable-i8x8 Change-Id: I9813fe07ae48cab5fdb5d904bca022514ad01e7f
2011-09-15Segment Feature SignalingPaul Wilkins
Plumbing for tuning new segment features on and off. Change-Id: If86cd6f103296b73030e8af7cf85c5b9bbffdbaf
2011-09-13Reverse coding order for segment features:Paul Wilkins
Code all the features for one segment (grouped together) then all for the next etc. etc. rather than grouping the data by feature. Change-Id: I2a65193b3a70aca78f92e855e35d8969d857b6dd
2011-09-13Change to segment_feature_data[][] structure.Paul Wilkins
This data structure is now [Segment ID][Features] rather than [Features][Segment_ID] I propose as a separate modification to make the experimental bit stream reflect this such that all the features for a segment are coded together. Change-Id: I581e4e3ca2033bdbdef3d9300977a8202f55b4fb
2011-09-13Segment Features:Paul Wilkins
Some basic plumbing added for a range of segment level features. MB_LVL_* changed to SEG_LVL_* to better reflect meaning. Change-Id: Iac96da36990aa0e40afc0d86e990df337fd0c50b
2011-08-25Merge remote branch 'internal/upstream' into HEADJohn Koleszar
Conflicts: vp8/common/defaultcoefcounts.h vp8/common/entropy.c vp8/encoder/bitstream.c Change-Id: Idd4990c80d5b5494ac036254694015fab449bc08
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-21fix more merge issuesYaowu Xu
With this fix, the experimental branch now builds and encodes correctly with the following two configure options respectively: --enable-experimental --enable-t8x8 --enable-experimental Change-Id: I3147c33c503fe713a85fd371e4f1a974805778bf
2011-07-20fixed a number of problems caused by auto mergesYaowu Xu
The auto merge process pull and merge commits from public git or master branch. These automerges while worked well most time, but has created a few problems. This commit fixed several issues existed long before the latest 8x8 transform commit. Change-Id: I895ca99713231b1aec521d57db5d9839f74aacfa
2011-07-20Add 8x8 transform to experimental branchDeb Mukherjee
Please refer to previous commit messages for detailed info: https://on2-git.corp.google.com/g/#change,5940 https://on2-git.corp.google.com/g/#change,6045 Change-Id: I8b16992f2f69c5a808ad40a3e32ef589cce7c59d
2011-07-20Merge remote branch 'internal/upstream' into HEADJohn Koleszar
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