summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encodeframe.c
AgeCommit message (Collapse)Author
2013-03-26Merge "Use above/left (instead of previous in scan-order) as token context." ↵Ronald S. Bultje
into experimental
2013-03-26Implicit weighted prediction experimentDeb Mukherjee
Adds an experiment to use a weighted prediction of two INTER predictors, where the weight is one of (1/4, 3/4), (3/8, 5/8), (1/2, 1/2), (5/8, 3/8) or (3/4, 1/4), and is chosen implicitly based on consistency of the predictors to the already reconstructed pixels to the top and left of the current macroblock or superblock. Currently the weighting is not applied to SPLITMV modes, which default to the usual (1/2, 1/2) weighting. However the code is in place controlled by a macro. The same weighting is used for Y and UV components, where the weight is derived from analyzing the Y component only. Results (over compound inter-intra experiment) derf: +0.18% yt: +0.34% hd: +0.49% stdhd: +0.23% The experiment suggests bigger benefit for explicitly signaled weights. Change-Id: I5438539ff4485c5752874cd1eb078ff14bf5235a
2013-03-26Use above/left (instead of previous in scan-order) as token context.Ronald S. Bultje
Pearson correlation for above or left is significantly higher than for previous-in-scan-order (absolute values depend on position in scan, but in general, we gain about 0.1-0.2 by using either above or left; using both basically just makes this even better). For eob branch skipping, we continue to use the previous token in scan order. This helps about 0.9% on derf after re-training on a limited data set. Full re-training and results on larger-resolution clips are pending. Note that this commit breaks trellis, so we can probably get further gains out of it by fixing trellis at some later point. Change-Id: Iead68e296fc3a105cca746b5e3da9555d6010cfe
2013-03-26Merge "Modeling default coef probs with distribution" into experimentalDeb Mukherjee
2013-03-25Modeling default coef probs with distributionDeb Mukherjee
Replaces the default tables for single coefficient magnitudes with those obtained from an appropriate distribution. The EOB node is left unchanged. The model is represeted as a 256-size codebook where the index corresponds to the probability of the Zero or the One node. Two variations are implemented corresponding to whether the Zero node or the One-node is used as the peg. The main advantage is that the default prob tables will become considerably smaller and manageable. Besides there is substantially less risk of over-fitting for a training set. Various distributions are tried and the one that gives the best results is the family of Generalized Gaussian distributions with shape parameter 0.75. The results are within about 0.2% of fully trained tables for the Zero peg variant, and within 0.1% of the One peg variant. The forward updates are optionally (controlled by a macro) model-based, i.e. restricted to only convey probabilities from the codebook. Backward updates can also be optionally (controlled by another macro) model-based, but is turned off by default. Currently model-based forward updates work about the same as unconstrained updates, but there is a drop in performance with backward-updates being model based. The model based approach also allows the probabilities for the key frames to be adjusted from the defaults based on the base_qindex of the frame. Currently the adjustment function is a placeholder that adjusts the prob of EOB and Zero node from the nominal one at higher quality (lower qindex) or lower quality (higher qindex) ends of the range. The rest of the probabilities are then derived based on the model from the adjusted prob of zero. Change-Id: Iae050f3cbcc6d8b3f204e8dc395ae47b3b2192c9
2013-03-22Minor code clean upPaul Wilkins
Change-Id: Ifa864e0acb253b238b03cdeed0fe5d6ee30a45d8
2013-03-18Merge "removed reference to "LLM" and "x8"" into experimentalYaowu Xu
2013-03-15Remove some unused rate control variablesJohn Koleszar
These variables are unused, and are subject to overflowing, causing assertions when built with -ftrapv. Change-Id: Ia00a3201af309906c05bcd4b23a643925ed6ea86
2013-03-14force lossless coding at very high quality endYaowu Xu
Change-Id: I75fc4eee10bee9efd419d248827290cce8e6d637
2013-03-14Remove leftover reference to 2nd order dc/ac quantYaowu Xu
Change-Id: Ib8dacf1d2797743569771b8f699e40e1aeb085cb
2013-03-13removed reference to "LLM" and "x8"Yaowu Xu
The commit changed the name of files and function to remove obselete reference to LLM and x8. Change-Id: I973b20fc1a55149ed68b5408b3874768e6f88516
2013-03-08Continued experiment with nonzero countDeb Mukherjee
Adds probability updates for extra bits for the nzcs, code for getting nzc stats, plus some minor cleanups and fixes. Change-Id: If2814e7f04fb52f5025ad9f400f3e6c50a00b543
2013-03-08Merge "Add support for tx_select in i8x8 encoding in keyframes." into ↵Ronald S. Bultje
experimental
2013-03-08Extend diff MV limit from +/-256 to +/-1024Jingning Han
Increase the motion search range by 4x. Change MV_CLASS tree of the entropy coding to allow two additional mv classes to cover the extended motion vector limit. The codec determines the effective motion search range conditioned on the actual frame dimension. It provides coding gains: stdhd 0.39% yt 0.56% hd 0.47% Major coding performance gains are packed in several sequences with intense motion activities, e.g., ped_1080p gains 7% at high bit-rates, and on average 3%. TODO: Need to further tune the rate control and motion search units. Change-Id: Ib842540a6796fbee5a797809433ef6a477c6d78d
2013-03-08Add support for tx_select in i8x8 encoding in keyframes.Ronald S. Bultje
Also enable tx_select for keyframes. Change-Id: Iadb1231d9fa7af0c8dce3d9b41830b93a302479e
2013-03-07Coding con-zero count rather than EOB for coeffsDeb Mukherjee
This patch revamps the entropy coding of coefficients to code first a non-zero count per coded block and correspondingly remove the EOB token from the token set. STATUS: Main encode/decode code achieving encode/decode sync - done. Forward and backward probability updates to the nzcs - done. Rd costing updates for nzcs - done. Note: The dynamic progrmaming apporach used in trellis quantization is not exactly compatible with nzcs. A suboptimal approach has been used instead where branch costs are updated to account for changes in the nzcs. TODO: Training the default probs/counts for nzcs Change-Id: I951bc1e22f47885077a7453a09b0493daa77883d
2013-03-05Merge changes Ifacbf5a0,Ibad7c3dd into experimentalRonald S. Bultje
* changes: vpxenc: actually report mismatch on stderr. Make superblocks independent of macroblock code and data.
2013-03-04Make superblocks independent of macroblock code and data.Ronald S. Bultje
Split macroblock and superblock tokenization and detokenization functions and coefficient-related data structs so that the bitstream layout and related code of superblock coefficients looks less like it's a hack to fit macroblocks in superblocks. In addition, unify chroma transform size selection from luma transform size (i.e. always use the same size, as long as it fits the predictor); in practice, this means 32x32 and 64x64 superblocks using the 16x16 luma transform will now use the 16x16 (instead of the 8x8) chroma transform, and 64x64 superblocks using the 32x32 luma transform will now use the 32x32 (instead of the 16x16) chroma transform. Lastly, add a trellis optimize function for 32x32 transform blocks. HD gains about 0.3%, STDHD about 0.15% and derf about 0.1%. There's a few negative points here and there that I might want to analyze a little closer. Change-Id: Ibad7c3ddfe1acfc52771dfc27c03e9783e054430
2013-03-04Support 16K sequence codingJingning Han
Fixed a couple of variable/function definitions, as well as header handling to support 16K sequence coding at high bit-rates. The width and height are each specified by two bytes in the header. Use an extra byte to explicitly indicate the scaling factors in both directions, each ranging from 0 to 15. Tested coding up to 16400x16400 dimension. Change-Id: Ibc2225c6036620270f2c0cf5172d1760aaec10ec
2013-02-28Code cleanup.Dmitry Kovalev
Removing redundant 'extern' keyword, better formatting, code simplification. Change-Id: I132fea14f08c706ee9ea147d19464d03f833f25b
2013-02-27Use ref_frame_map vice active_ref_idx on the encoderJohn Koleszar
This patch makes the encoder's use of ref_frame_map and active_ref_idx consistent with the decoder. ref_frame_map[] maps a reference buffer index to its actual location in the yv12_fb array, since many references may share an underlying buffer. active_ref_idx[] mirrors cpi->{lst,gld,alt}_fb_idx, holding the active references in each slot. This also fixes a bug in setup_buffer_inter() where the incorrect reference was used to populate the scaling factors. Change-Id: Id3728f6d77cffcd27c248903bf51f9c3e594287e
2013-02-26Spatial resamping of ZEROMV predictorsJohn Koleszar
This patch allows coding frames using references of different resolution, in ZEROMV mode. For compound prediction, either reference may be scaled. To test, I use the resize_test and enable WRITE_RECON_BUFFER in vp9_onyxd_if.c. It's also useful to apply this patch to test/i420_video_source.h: --- a/test/i420_video_source.h +++ b/test/i420_video_source.h @@ -93,6 +93,7 @@ class I420VideoSource : public VideoSource { virtual void FillFrame() { // Read a frame from input_file. + if (frame_ != 3) if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) { limit_ = frame_; } This forces the frame that the resolution changes on to be coded with no motion, only scaling, and improves the quality of the result. Change-Id: I1ee75d19a437ff801192f767fd02a36bcbd1d496
2013-02-26Refactor inter recon functions to support scalingJohn Koleszar
Ensure that all inter prediction goes through a common code path that takes scaling into account. Removes a bunch of duplicate 1st/2nd predictor code. Also introduces a 16x8 mode for 8x8 MVs, similar to the 8x4 trick we were doing before. This has an unexpected effect with EIGHTTAP_SMOOTH, so it's disabled in that case for now. Change-Id: Ia053e823a8bc616a988a0af30452e1e75a739cba
2013-02-23Split coefficient token tables intra vs. inter.Ronald S. Bultje
Change-Id: I5416455f8f129ca0f450d00e48358d2012605072
2013-02-20Merge lossless experimentYaowu Xu
Change-Id: I7b7b8d4fda3a23699e0c920d727f8c15d37d43aa
2013-02-19Use lossless for Q0Yaowu Xu
The commit changes the coding mode to lossless whenever the lowest quantizer is choosen. As expected, test results showed no difference for cif and std-hd set where Q0 is rarely used. For yt and yt-hd set, Q0 is used for a number of clips, where this commit helped a lot in the high end. Average over all clips in the sets: yt: 2.391% 1.017% 1.066% hd: 1.937% .764% .787% Change-Id: I9fa9df8646fd70cb09ffe9e4202b86b67da16765
2013-02-15Remove some Y2-related code.Ronald S. Bultje
Change-Id: I4f46d142c2a8d1e8a880cfac63702dcbfb999b78
2013-02-13Add support for tile rows.Ronald S. Bultje
These allow sending partial bitstream packets over the network before encoding a complete frame is completed, thus lowering end-to-end latency. The tile-rows are not independent. Change-Id: I99986595cbcbff9153e2a14f49b4aa7dee4768e2
2013-02-13Merge "fix the lossless experiment" into experimentalYaowu Xu
2013-02-13fix the lossless experimentYaowu Xu
Change-Id: I95acfc1417634b52d344586ab97f0abaa9a4b256
2013-02-12Add tile column size limits (256 pixels min, 4096 pixels max).Ronald S. Bultje
This is after discussion with the hardware team. Update the unit test to take these sizes into account. Split out some duplicate code into a separate file so it can be shared. Change-Id: I8311d11b0191d8bb37e8eb4ac962beb217e1bff5
2013-02-08Pass macroblock index to pick inter functionsJohn Koleszar
Pass the current mb row and column around rather than the recon_yoffset and recon_uvoffset, since those offsets will change from predictor to predictor, based on the reference frame selection. Change-Id: If3f9df059e00f5048ca729d3d083ff428e1859c1
2013-02-07Added skip switches for SB32 and SB64Paul Wilkins
Added switches and code to skip/breakout from doing SB32 and SB64 tests based on whether the 16x16 MB tests used split modes. Also to optionally skip 64x64 if 16x16 was chosen over 32x32. Impact varies depending on clip from a few % up to almost 50% on encode speed. Only the split mode breakout is currently enabled. Change-Id: Ib5836140b064b350ffa3057778ed2cadcc495cf8
2013-02-05[WIP] Add column-based tiling.Ronald S. Bultje
This patch adds column-based tiling. The idea is to make each tile independently decodable (after reading the common frame header) and also independendly encodable (minus within-frame cost adjustments in the RD loop) to speed-up hardware & software en/decoders if they used multi-threading. Column-based tiling has the added advantage (over other tiling methods) that it minimizes realtime use-case latency, since all threads can start encoding data as soon as the first SB-row worth of data is available to the encoder. There is some test code that does random tile ordering in the decoder, to confirm that each tile is indeed independently decodable from other tiles in the same frame. At tile edges, all contexts assume default values (i.e. 0, 0 motion vector, no coefficients, DC intra4x4 mode), and motion vector search and ordering do not cross tiles in the same frame. t log Tile independence is not maintained between frames ATM, i.e. tile 0 of frame 1 is free to use motion vectors that point into any tile of frame 0. We support 1 (i.e. no tiling), 2 or 4 column-tiles. The loopfilter crosses tile boundaries. I discussed this briefly with Aki and he says that's OK. An in-loop loopfilter would need to do some sync between tile threads, but that shouldn't be a big issue. Resuls: with tiling disabled, we go up slightly because of improved edge use in the intra4x4 prediction. With 2 tiles, we lose about ~1% on derf, ~0.35% on HD and ~0.55% on STD/HD. With 4 tiles, we lose another ~1.5% on derf ~0.77% on HD and ~0.85% on STD/HD. Most of this loss is concentrated in the low-bitrate end of clips, and most of it is because of the loss of edges at tile boundaries and the resulting loss of intra predictors. TODO: - more tiles (perhaps allow row-based tiling also, and max. 8 tiles)? - maybe optionally (for EC purposes), motion vectors themselves should not cross tile edges, or we should emulate such borders as if they were off-frame, to limit error propagation to within one tile only. This doesn't have to be the default behaviour but could be an optional bitstream flag. Change-Id: I5951c3a0742a767b20bc9fb5af685d9892c2c96f
2013-01-29Merge "Segment Skip Flag" into experimentalPaul Wilkins
2013-01-28Segment Skip FlagPaul Wilkins
First step in simplifying the segment mode and segment EOB flags into a simpler segment skip flag that implies 0,0 mv and EOB at position 0. Change-Id: Ib750cac31a7a02dc21082580498efd9f7d8d72a5
2013-01-25Merge "Remove "update_context" variable from VP9_COMP context." into ↵Ronald S. Bultje
experimental
2013-01-24Remove "update_context" variable from VP9_COMP context.Ronald S. Bultje
The variable is always zero. Change-Id: Id5cdbecad543bca465a5b1d471badaec7e112c8d
2013-01-23Adds an error-resilient mode with testDeb Mukherjee
Adds an error-resilient mode where frames can be continued to be decoded even when there are errors (due to network losses) on a prior frame. Specifically, backward updates are turned off and probabilities of various symbols are reset to defaults at the beginning of each frame. Further, the last frame's mvs are not used for the mv reference list, and the sorting of the initial list based on search on previous frames is turned off as well. Also adds a test where an arbitrary set of frames are skipped from decoding to simulate errors. The test verifies (1) that if the error frames are droppable - i.e. frame buffer updates have been turned off - there are no mismatch errors for the remaining frames after the error frames; and (2) if the error-frames are non droppable, there are not only no decoding errors but the mismatch PSNR between the decoder's version of the post-error frames and the encoder's version is at least 20 dB. Change-Id: Ie6e2bcd436b1e8643270356d3a930e8989ff52a5
2013-01-16Start to anonymize reference framesJohn Koleszar
Remove lst_fb_idx, gld_fb_idx, alt_fb_idx, refresh_last_frame, refresh_golden_frame, refresh_alt_ref_frame from common. Gold/Alt are encode side conventions. From the decoder's perspective, we want to be dealing with numbered references. Updates to active_ref 2 signal mode context switches, vestigial from refresh_alt_ref_frame. This needs some clean up to make sense with increased numbers of reference frames, as well as reimplementing the swapping of alt/golden which was previously done using the buffer-to-buffer copy mechanism removed in an earlier commit. Change-Id: I7334445158b7666f9295d2a2dd22aa03f4485f58
2013-01-14Fix compiler warningsYaowu Xu
The warnings caused verify failure with gerrit for several commits Change-Id: I030df8638bd69b8783a3ac58e720ff9f0bfd546c
2013-01-10Merge tx32x32 experiment.Ronald S. Bultje
Change-Id: I615651e4c7b09e576a341ad425cf80c393637833
2013-01-09Merge superblocks64 experiment.Ronald S. Bultje
Change-Id: If6c88752dffdb566f8d4322f135145270716fb8e
2013-01-09New prediction filterAdrian Grange
This patch removes the old pred-filter experiment and replaces it with one that is implemented using the switchable filter framework. If the pred-filter experiment is enabled, three interopolation filters are tested during mode selection; the standard 8-tap interpolation filter, a sharp 8-tap filter and a (new) 8-tap smoothing filter. The 6-tap filter code has been preserved for now and if the enable-6tap experiment is enabled (in addition to the pred-filter experiment) the original 6-tap filter replaces the new 8-tap smooth filter in the switchable mode. The new experiment applies the prediction filter in cases of a fractional-pel motion vector. Future patches will apply the filter where the mv is pel-aligned and also to intra predicted blocks. Change-Id: I08e8cba978f2bbf3019f8413f376b8e2cd85eba4
2013-01-08Merge superblocks (32x32) experiment.Ronald S. Bultje
Change-Id: I0df99742029834a85c4933652b0587cf5b6b2587
2013-01-08Merge vp9-preview changes into experimental branchJohn Koleszar
Incorportate vp9-preview changes by merging master branch into experimental. Conflicts: test/test.mk vp9/common/vp9_filter.c vp9/common/vp9_idctllm.c vp9/common/vp9_invtrans.h vp9/common/vp9_mbpitch.c vp9/common/vp9_rtcd_defs.sh vp9/common/vp9_systemdependent.h vp9/common/vp9_type_aliases.h vp9/common/x86/vp9_asm_stubs.c vp9/common/x86/vp9_subpixel_mmx.asm vp9/decoder/vp9_decodframe.c vp9/decoder/vp9_dequantize.c vp9/decoder/vp9_dequantize.h vp9/decoder/vp9_onyxd_int.h vp9/encoder/vp9_bitstream.c vp9/encoder/vp9_encodeframe.c vp9/encoder/vp9_rdopt.c Change-Id: I17f51c3666d1b59cf1a699f87607cbc5d30a87c5
2013-01-07Remove a few redundant function arguments in encodeframe.c.Ronald S. Bultje
Also reindent a block of code that was misindented after addition of the tx32x32 experiment. Change-Id: Ic3e4aae3effd8a40136da68c9f382af03632ba08
2013-01-07Re-enable support for static_threshold (encode_breakout).Ronald S. Bultje
Change-Id: Ibd7380f478d3127f9db91d0a4fd2fd0dfde961ab
2013-01-0564x64 blocksize support.Ronald S. Bultje
3.2% gains on std/hd, 1.0% gains on hd. Change-Id: I481d5df23d8a4fc650a5bcba956554490b2bd200
2013-01-03New interpolation filter selection algorithmAdrian Grange
Old Scheme: When SWITCHABLE filter selection is enabled the encoder evaluates the use of each interpolation filter type and selects the best one to use at the MB level. A frame- level flag can be set to force the use of a particular filter type for all MBs in a frame if it is more efficient to encode that way. The logic here involved a Q dependent threshold that assumed that the second 8-tap filter was a high-pass filter. However, this requires a trip around the recode loop. If the frame-level flag indicates use of a particular filter, the other filters are not evaluated in the pick_mode loop. New Scheme: Each filter type is evaluated at the MB level and a record of the best filter is kept, irrespective of what filter is signaled at the frame-level. Once all MBs have been encoded, a decision is made as to what frame-level mode to set for the *next* frame. If one filter is used by 80% or more of the MBs, then this filter is forced since it is assumed that this will be more efficient if the next frame has similar characteristics. i.e. there is a one-frame lag between measuring the filter selection and setting the frame-level mode to use. Change-Id: I6a7e7ced8f27e120fafb99db2dc9c6293f8d20f7