summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_firstpass.h
AgeCommit message (Collapse)Author
2015-02-10Auto-adaptive encoder frame resizing logicAdrian Grange
Note: This feature is still in development. Add an option for the encoder to decide the resolution at which to encode each frame. Each KF/GF/ARF goup is tested to see if it would be better encoded at a lower resolution. At present, each KF/GF/ARF is coded first at full-size and if the coded size exceeds a threshold (twice target data rate) at the maximum active Q then the entire group is encoded at lower resolution. This feature is enabled in vpxenc by setting: --resize-allowed=1 In addition, if the vpxenc command line also specifies valid frame dimensions using: --resize-width=XXXX & --resize_height=YYYY then *all* frames will be encoded at this resolution. Change-Id: I13f341e0a82512f9e84e144e0f3b5aed8a65402b
2015-01-26Adjust active maxq for GF groups.Paul Wilkins
Currently disabled by default: enabled using #define GROUP_ADAPTIVE_MAXQ In this patch the active max Q is adjusted for each GF group based on the vbr bit allocation and raw first pass group error. This will tend to give a lower q for easy sections and a higher value for very hard sections. As such it is expected to improve quality in some of the easier sections where quality issues have been reported. This change tends to hurt overall psnr but help average psnr. SSIM also shows a small gain. Average results for derf, yt, std-hd and yt-hd test sets were as follows (%change for average psnr, overal psnr and ssim):- derf +0.291, - 0.252, -0.021 yt +6.466, -1.436, +0.552 std-hd +0.490, +0.014, +0.380 yt-hd +5.565, - 1.573, +0.099 Change-Id: Icc015499cebbf2a45054a05e8e31f3dfb43f944a
2014-11-20Add adaptive midpoint for AQ1.Paul Wilkins
Make the midpoint variance used in AQ mode 1 segmentation depend on the overall complexity of the frame in two pass. Change-Id: I452814ec57f7a32352e41bb250e78066abe952dd
2014-11-06Add intra complexity and brightness weight to first pass.Paul Wilkins
The aim of this patch is to apply a positive weighting to frames that have a significant number of blocks that are of low spatial complexity and are dark. The rationale behind this is that artifacts tend to be more visible in such frames. In this patch the weight is only applied in regard to the distribution of bits between frames. Hence if all the frames share similar characteristics (as is the case for most of our short test clips) there will be little or no net effect. However, the effect can be seen on some longer form test content. For example Tears of steel baseline test: 2323.09 Kbit/s opsnr 39.915 ssim 74.729 With this patch:- 2213.34 Kbit/s opsnr 39.963 ssim 74.808 (Sligtly better metrics and about 5% smaller) The weighting may well need some further tuning along side changes to the aq modes. Change-Id: Ieced379bca03938166ab87b2b97f55d94948904c
2014-10-13Add adaptation option for VBR.Paul Wilkins
Allow min and maxQ to creep when the undershoot or overshoot exceeds thresholds controlled by the command line under_shoot_pct and over_shoot_pct values. Default is 100%,100% which ~disables adaptation. Derf results for example undershoot% / overshoot%:- Head:- Mean abs (%rate error) = 14.4% This check in:- 25%/25% - Mean abs (%rate error) = 6.7% PSNR hit -1% SSIM -0.1% 5% / 5% - Mean abs (%rate error) = 2.2% PSNR hit -3.3% SSIM - 1.1% Most of the remaining error and most of the quality hit is at extreme data rates. The adaptation code still has an exception for material that is in effect static so that we don't over adjust and over spend on YT slide show type content. (Rebase of If25a2449a415449c150acff23df713e9598d64c9 to resolve a auto-merge error) Change-Id: Iec4e1613ef0d067454751d8220edb7058dfbd816
2014-10-10Revert "Add adaptation option for VBR."Alex Converse
This reverts commit 869d4ca51957614dcf5093ebb9e322cc8a8405ca. This breaks the build via conflict with e18edd5eb651f9b7563cbd829744807402bfe0d8. Change-Id: If544b99e367a449452834eb8cce600f58c34ec0d
2014-10-10Merge "Add adaptation option for VBR."Paul Wilkins
2014-10-10Add adaptation option for VBR.Paul Wilkins
Allow min and maxQ to creep when the undershoot or overshoot exceeds thresholds controlled by the command line under_shoot_pct and over_shoot_pct values. Default is 100%,100% which ~disables adaptation. Derf results for example undershoot% / overshoot%:- Head:- Mean abs (%rate error) = 14.4% This check in:- 25%/25% - Mean abs (%rate error) = 6.7% PSNR hit -1% SSIM -0.1% 5% / 5% - Mean abs (%rate error) = 2.2% PSNR hit -3.3% SSIM - 1.1% Most of the remaining error and most of the quality hit is at extreme data rates. The adaptation code still has an exception for material that is in effect static so that we don't over adjust and over spend on YT slide show type content. Change-Id: If25a2449a415449c150acff23df713e9598d64c9
2014-10-08Allow mode search breakout at very low prediction errorsYunqing Wang
In model_rd_for_sb function, the spatial domain SSE and variance are checked to see if transform coefficients are quantized to 0. Besides that, this patch adds another set of thresholds that are much more strict. These thresholds are used to conduct a partition block level check to measure if all its TX blocks are skippable for YUV planes. If it is true, x->skip is set for this partition block, and thus its mode search is terminated. This speeds up the encoding at very low prediction error case, such as screen sharing application. This patch covers what rd_encode_breakout_test() does, so that function is removed. Borg test at speed 3 shows: For stdhd set, psnr: +0.008%, ssim: +0.014%; For derf set, psnr: +0.018%, ssim: +0.025%. No noticeable speed change. Change-Id: I4e5f15cf10016a282a68e35175ff854b28195944
2014-09-18Substantial reworking of code for arf and kf groups.Paul Wilkins
Substantial restructuring of the way we estimate the rate of decay in prediction quality and determine the arf interval and amount of boost used. Also other changes to support moving to a lower first pass Q which exposes some new features and allows us to better distinguish genuinely static blocks from low motion or noisy blocks. Net gains now visible on all the test sets with std-hd PSNR up 1.87%. There are still some bad outlier cases but most of these are low motion or slide show type content where the metrics are already high at any given rate. The best + case is up by more than 10%. Change-Id: I18e25170053bdf3188f493ff8062f48a74515815
2014-08-22Removing source field from VP9_COMP.Dmitry Kovalev
Using local variables instead. Change-Id: I68737f7e392b81492ffd3ef2c2ff9afbf55fb097
2014-08-04Store first pass motion vector directionsPengchong Jin
Re-organize the one-byte structure for 16x16 first pass block. Add bits to indicate motion vector directions. Change-Id: Id10754ba343dfc712c7fed5bcc85c67fa0bbcb89
2014-07-28Store block-wise statistics obtained in the first passPengchong Jin
Change-Id: I9956db2ba2f7d28f484daaf5022d8d1ef5db473c
2014-07-17Merge "Fixed a bug of setting wrong first pass mb stats pointer"Pengchong Jin
2014-07-17Fixed a bug of setting wrong first pass mb stats pointerPengchong Jin
The bug sets the wrong pointer to the first pass mb stats if the encoder does the re-coding in the second pass. Change-Id: I8a11f45dd7dceb38de814adec24cecccae370d00
2014-07-17Merge "Changes to rd balance and multi-arf bug fix."Paul Wilkins
2014-07-16Changes to rd balance and multi-arf bug fix.Paul Wilkins
2 pass only change to calculation of rd mult based on Q. Make a small adjustment based on frame type and also replace adjustment based on iifactor with an one based on the ambient GF/ARF boost level. Also fix multi arf bug / issue. Overall these change give an slight improvement in ssim but hurt psnr a little. Change-Id: I5e1751e3ff5390a26f543d7855059e6fbcce105e
2014-07-14Rewrite functions related to first pass block statsPengchong Jin
Change-Id: I28679f88e2911b06eef5cbc83ecb62b8c69e4c53
2014-07-01Store/read 16x16 block statistics obtained from the first passPengchong Jin
Add a conditional compile flag for this feature. Also add a switch to enable the encoder to use these statistics in the second pass. Currently, the switch is turned off. Change-Id: Ia1c858c35ec90e36f19f5cffe156b97ddaa04922
2014-06-24Dual ARF changes: Buffer index selection.Paul Wilkins
Add indirection to the section of buffer indices. This is to help simplify things in the future if we have other codec features that switch indices. Limit the max GF interval for static sections to fit the gf_group structures. Change-Id: I38310daaf23fd906004c0e8ee3e99e15570f84cb
2014-06-24Experiment for mid group second arf.Paul Wilkins
This patch implements a mechanism for inserting a second arf at the mid position of arf groups. It is currently disabled by default using the flag multi_arf_enabled. Results are currently down somewhat in initial testing if multi-arf is enabled. Most of the loss is attributable to the fact that code to preserve the previous golden frame (in the arf buffer) in cases where we are coding an overlay frame, is currently disabled in the multi-arf case. Change-Id: I1d777318ca09f147db2e8c86d7315fe86168c865
2014-06-12Removing unused ssim_weighted_pred_err field from FIRSTPASS_STATS.Dmitry Kovalev
Change-Id: Ia8c7e3905ac21732cb6b8099eaf8df72c7e36b73
2014-06-06Revert "Removing this_frame_stats member from TWO_PASS struct."Adrian Grange
Use of stack frame variable "fps" beyond the lifetime of the function. fps is sent as a paremeter to output_stats and stored in the packet holding this encoded frame. This has scope beyond the lifetime of the calling function. This reverts commit 3f95a230c7e54104201b3f6c577dfa9251b4642a Change-Id: Icd8e14b3d7dd733590ada12e619b9dce95b6b0f5
2014-05-27Removing this_frame_stats member from TWO_PASS struct.Dmitry Kovalev
Change-Id: Id8877fad1f1e88b145e7c40c43174109b9c4f373
2014-05-23Further first pass allocation changes.Paul Wilkins
Further changes to first pass allocation for gf/arf groups. Three variables removed from TWO_PASS structure as only now used locally. Dont adjust gf_group_bits in the post encode update as this will no longer have any effect. Change-Id: Iff89b225db923fc856f5d2aedbc899f1d7d68b55
2014-05-23Re-factor bit allocation in first pass.Paul Wilkins
Restructuring to allocate the bits for each frame in a GF group at the time the group is defined. At the moment the allocation closely mirrors what we had before. Also changes the default rate adjustment method to LONG_TERM_VBR_CORRECTION. Change-Id: Ie5793c46c6b9c888cead5d8790792efd7d60b7c1
2014-05-22Cleaning up vp9_init_second_pass().Dmitry Kovalev
modified_error_total from TWO_PASS struct is not required anymore. Change-Id: I0e07cac1e6d1b6a78418116be725bcd72bfbd847
2014-05-20Merge "Cosmetic clean up."Paul Wilkins
2014-05-19Cosmetic clean up.Paul Wilkins
Use type TWO_PASS instead of "struct twopass". Change-Id: I9d92920893bd436537b2ca19e9c9d355cca56c7c
2014-05-15Removing unused fields from twopass_rc struct.Dmitry Kovalev
Change-Id: Iaece070e9d1305ac3d8df9d3431fefa6e20ac0ec
2014-04-09Cleaning up vp9_twopass_worst_quality().Dmitry Kovalev
Change-Id: Ie144e9ece57f2d59c230704a2f166bda1042adeb
2014-04-02Rate ctrl changes to track target bitrates closerDeb Mukherjee
Turns off the DISABLE_RC_LONG_TERM_MEM macro and makes other changes in the way the bits are updated, to make 2-pass rate control track target bitrates closer. Change-Id: I5f3be4b11c2908e6a9a9a1dd4fcf4e65531c44d8
2014-03-28[svc] Fix SvcTest.SecondPassEncode failureMinghai Shang
Root cause is the different default register length between x86 and x64 platform. Change spatial_layer_id to long long. Change-Id: If1a5972365c7a59f7e76cb4fd714610f3d48a8ff
2014-03-19[svc] Finalize spatial svc first pass rate controlMinghai Shang
1. Save stats for each spatial layer 2. Add frame buffer management for svc first pass rc 3. Set default spatial layer to 1 4. Flush encoder at the end of stream in test app This only supports spatial svc. Change-Id: Ia89cfa87bb6394e6c0405b921d86c426d0a0c9ae
2014-03-10Moving static_scene_max_gf_interval to RATE_CONTROL struct.Dmitry Kovalev
Change-Id: Id63e114a8f0615dbafd6a816019cdebffb983d2c
2014-03-06Adding const to FIRSTPASS_STATS pointers.Dmitry Kovalev
Change-Id: Ia94d757de1d1b24609128cd40e68558078f50a38
2014-03-02vp9_firstpass.c: remove unused functions & paramsYaowu Xu
Change-Id: I111c5bd0dd47db7b1f6952c18056bee548bb42e9
2014-02-11Removes active_worst_quality feedbackDeb Mukherjee
Removes certain cases of feedback of active_worst_quality, and removes it from the RATE_CONTROL structure. Now active worst quality is expected to be computed locally in the q picking function during the encode. Making temporal filter strength depend on avg_frame_qindex rather than on active_worst_quality actually improves performance esp. for yt. derf: +0.038% yt: +0.359% Change-Id: I1fe5a343034b55af9322289165321f00ac0827b1
2014-02-10Further one-pass vbr rate control changesDeb Mukherjee
Some parameter changes and fixes on one-pass rate control. derfraw300 is now only 10% below 2-pass speed 0 rate control. Change-Id: I1940eef8a5a035dc18e71b880d5e00cabd1f01b9
2014-02-05Moving twopass_rc and FIRSTPASS_STATS to vp9_firstpass.h.Dmitry Kovalev
Change-Id: I5c942ee1a04eb0d7f2ae7ba8ea8ce47e666550c5
2014-02-05One-pass rate control cleanups/fixes/refactoringDeb Mukherjee
Inlcudes a number cleanups: 1. Moves the one-pass pre-encode parameter setting functions to vp9_ratectrl.c 2. Deprecates per_frame_bandwidth in RATE_CONTROL structure 3. Removes target_bandwidth in cpi structure since it is not used. 4. Various renaming of functions There is no bit-stream change in 2-pass, one-pass cbr and one-pass vbr modes. Change-Id: Ifd9916bf4d485b7d04c5f52044ffe6703254ccbd
2014-01-23vp9/encoder: add extern "C" to headersJames Zern
Change-Id: I4f51ce859a97bf1b8fd2b37ac585b7c643232b69
2014-01-10Don't use gf_update by default for 1-pass CBR.Marco Paniconi
Change-Id: I5df6abceb0a2a69706feadeb820b593cae88f573
2013-12-19Begin refactor of frame schedule in rate controlDeb Mukherjee
Various cleanups and streamlining of interfaces as precursor to further advancements in rate control. Pre-encode parameter setting for different use cases: One-pass, first of 2-pass, second of 2-pass, and Svc are separated out. There is no change in output with this change. Change-Id: Ied8ca7d84d610993776aa30ef263fe20452e0e3e
2013-10-07cpplint errors in vp9_onyx_if.hJim Bankoski
Slightly bigger change -> broke up encode_frame_to_datarate, lots of line length fixes. Change-Id: I7c53325e954de130f3fe1a6656626efc6705be82
2013-02-21Code cleanup.Dmitry Kovalev
Removing redundant 'extern' keywords. Moving VP9DX_BOOL_DECODER from .h to .c file. Change-Id: I5a3056cb3d33db7ed3c3f4629675aa8e21014e66
2012-12-18Use standard integer types for pixel values and coefficients.Ronald S. Bultje
For coefficients, use int16_t (instead of short); for pixel values in 16-bit intermediates, use uint16_t (instead of unsigned short); for all others, use uint8_t (instead of unsigned char). Change-Id: I3619cd9abf106c3742eccc2e2f5e89a62774f7da
2012-11-30google style guide include guardsJim Bankoski
Change-Id: I2c252f3ddcc99e96c1f5d3dab8bcb25a2a3637ea
2012-11-27Add vp9_ prefix to all vp9 filesJohn Koleszar
Support for gyp which doesn't support multiple objects in the same static library having the same basename. Change-Id: Ib947eefbaf68f8b177a796d23f875ccdfa6bc9dc