1. 18 May, 2017 1 commit
    • paulwilkins's avatar
      Changes to modified error. · 5680b451
      paulwilkins authored
      The modified error was a derivative of the "coded_error"
      that was used to allocate bits between different frames on the
      assumption that the allocation should be linear in terms of this
      modified error.  I.e. a frame with double the modified error score
      should all things being equal get double the number of bits. The
      code also included upper and lower caps derived from input
      VBR parameters.
      This patch improves the initial calculation of the clip mean error
      (now called "mean_mod_score" as it is no longer a prediction error)
      used as the midpoint for the rate distribution function and normalizes
      the output "modified scores" scores such that 1.0 indicates a frame
      in the middle of the distribution.  The VBR upper and lower caps are
      then applied directly to a  frame's normalized score.
      This refactoring is intended to make it easier to drop in alternative
      distribution functions or to base the rate allocation on a corpus wide
      midpoint (rather than the clip mean).
      Change-Id: I4fb09de637e93566bfc4e022b2e7d04660817195
  2. 17 May, 2017 1 commit
    • paulwilkins's avatar
      Experiment. Store first pass errors as per MB values. · 42e5073f
      paulwilkins authored
      Most existing first pass stats are stored in a form normalized to a
      macro-block scale. However the error scores for intra / inter etc were
      stored as frame level values but mainly used as MB level values.
      This change  fixes that. Normalized per MB values make comparisons
      between different formats easier and in any case this is usually what is
      An change in results should be limited to slight differences in rounding.
      *** Change after patch 8 +2 requiring new approval.
      Final pre-submit testing showed  one 4K clip with above expected change.
      Investigation showed this was due to a value used to test for ultra low intra
      complexity in key frame detection. This was a per frame not per MB value but
      also did not scale with frame size. Replacement with a small per MB value
      (based on original per frame value and cif frame size) resolved the KF detection
      Also converted kf_group_error_left to a double in line with other error values
      to reduce rounding problems in KF group bit allocation
      All clips and sets now show nominal (or 0) change as expected.
      Change-Id: Ic2d57980398c99ade2b7380e3e6ca6b32186901f
  3. 20 Feb, 2017 1 commit
  4. 15 Feb, 2017 1 commit
    • paulwilkins's avatar
      Additional first pass stats. · 945ccfee
      paulwilkins authored
      Added counts that split the intra coded blocks into low and high variance.
      Change-Id: Ic540144b34d5141659081bb22f7ee16fd6861f14
  5. 24 Jan, 2017 1 commit
  6. 07 Dec, 2016 1 commit
    • Yunqing Wang's avatar
      Remove an unused first pass statistic · 39402038
      Yunqing Wang authored
      One of the first pass stats "new_mv_count" is no longer used in VP9,
      and is removed. This also makes it easy to implement a multi-threaded
      first pass. This change doesn't affect the coding performance, which
      has been verified by borg tests.
      Change-Id: I4c7c7bf9465fda838eb230814ef0c631c068c903
  7. 10 Aug, 2016 1 commit
  8. 02 Aug, 2016 1 commit
  9. 07 Jul, 2016 1 commit
    • paulwilkins's avatar
      Noise energy Experiment in first pass. · 2580e7d6
      paulwilkins authored
      Use a measure of noise energy to adjust Q estimate and
      arf filter strength.
      Gains 0.3-0.5% on Lowres and |Netflix sets.
      Hdres and Midres neutral.
      Change-Id: Ic0de552e7b6763e70eeeaa3651619831b423e151
  10. 03 Jun, 2016 3 commits
    • paulwilkins's avatar
      Removed unused data structure. · f9865d17
      paulwilkins authored
      Removed unused element from TWOPASS data structure.
      Change-Id: I9b662fd8eea727a7978055bc14f7c7328f048a5e
    • paulwilkins's avatar
      Adjustment calculation of active worst quality. · cd700e1a
      paulwilkins authored
      Added a factor based on the bit spend in the last arf group vs the
      target to adjust the choice of the active worst quality in subsequent
      Helps clips where previously there was a big overshoot or undershoot
      to adapt and get closer to the target rate.
      Change-Id: I67034b801679b99024409489a2273ea6fe23b8e6
    • paulwilkins's avatar
      Remove gf_zeromotion_pct. · 4328b085
      paulwilkins authored
      The use of this value is preventing rate adjustment on clips
      or sections that have very little motion but high noise and
      this can give rise to some sections with massive overshoot.
      Change-Id: I9a65c7c1148dc5d3a7d8b23e50fc1733f3661621
  11. 09 Apr, 2016 1 commit
    • Debargha Mukherjee's avatar
      Step towards making the 2-pass cq mode perceptual · c47c460f
      Debargha Mukherjee authored
      Uses a metric on fraction of smooth blocks derived from first pass
      stats in a frame to adjust down the cq_level modestly in the cq mode.
      The current implementation does not add much complexity, and is
      fairly light in the adaptation.
      Change-Id: Ic484e810d5bd51b7bb6b8945f378c7c3d9d27053
  12. 29 Aug, 2015 1 commit
  13. 08 Jul, 2015 1 commit
    • paulwilkins's avatar
      Change speed and rd features for formatting bars. · a126b6ce
      paulwilkins authored
      Change speed features / behavior for split mode when there
      is an internal active edge (e.g. formatting bars).
      Remove some threshold constraints in rd code near the active
      edge of the image.
      Add some plumbing for left and right active edge detection.
      Patch set 5. Limit rd pass through for sub 8x8 to internal active edges.
      This takes away any speed penalty for most clips but keeps the enhanced
      edge coding for the more critical case of internal image edges
      Change-Id: If644e4762874de4fe9cbb0a66211953fa74c13a5
  14. 09 Jun, 2015 2 commits
    • Paul Wilkins's avatar
      Changes to active maxq calculation in two pass. · faf8c63b
      Paul Wilkins authored
      Some initial experiments into discounting dead zone
      formating bars and intra skip blocks (common in some
      types of animation and graphics) in the calculation of
      the active max Q for each ARF/GF group.
      TODO: check for vertical formating bars and validate the
      horizontal bar at the bottom edge of the image.
      As expected, this change as it stands, does not make much
      difference for the natural videos in the std-hd and derf sets.
      However, for the yt and yt hd set there is a significant rise
      in the average PSNR with overall PSNR and SSIM remaining
      The mean rise for the YT-HD test set was > 6%. This is mainly
      because the change allows Q to drop further on titles and
      other graphics sections where spending a small number of
      extra bits gives a sharp rise in PSNR.
      Change-Id: I3f878ae91fc1854312d7ecf9fa792c17bc1aa6b7
    • Paul Wilkins's avatar
      Enable more split modes for animated content. · 4a28da58
      Paul Wilkins authored
      For content that is identified as likely to contain some
      animation or graphics content, increase the availability
      of split modes for good quality speeds 1-3.
      On a problem test animation clip this improves metrics
      results by about 0.25 db and makes a noticeable difference
      visually. It also causes a small drop in file size (~0.5%) but
      a rise in encode time of about 5-6% at speed  2.
      For more normal content it should have no effect.
      Change-Id: Ic4cd9a8de065af9f9402f4477a17442aebf0e439
  15. 04 Jun, 2015 1 commit
    • Paul Wilkins's avatar
      Animation and dead zone detection. · 668e8045
      Paul Wilkins authored
      Adds code to detect dead zone bars at the top and bottom
      of reformatted letterbox video (note that the code only
      looks at the top of the image and assumes any dead zone
      is symmetrical).  Use of this to adapt rate control etc.
      will follow in a subsequent patch.
      Also counts other blocks (excluding the dead zone) that
      have no intra signal. The presence of a significant
      number of such blocks can be used as a identify that the frame
      may be artificial (e.g.  animation, screen capture, graphics).
      This patch contains plumbing only and does not use
      the signal.
      Change-Id: I59bc93529cd4065416cef773e405fda3ae006a20
  16. 20 May, 2015 1 commit
    • paulwilkins's avatar
      Fast feedback of bits on undershoot. · 883fdd45
      paulwilkins authored
      This patch provides a partial rapid feedback of bits
      resulting from extreme undershoot.
      Some  improvement on some problem animated material
      but in its current form only a small impact on the metrics results
      of our standard test sets.
      Change-Id: Ie03036ea8123bc2553437cb8c8c9e7a9fc5dac5d
  17. 10 Feb, 2015 1 commit
    • Adrian Grange's avatar
      Auto-adaptive encoder frame resizing logic · 23ebacdb
      Adrian Grange authored
      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:
      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
  18. 26 Jan, 2015 1 commit
    • Paul Wilkins's avatar
      Adjust active maxq for GF groups. · fd070220
      Paul Wilkins authored
      Currently disabled by default: enabled using
      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
  19. 21 Nov, 2014 1 commit
    • Paul Wilkins's avatar
      Add adaptive midpoint for AQ1. · fc47c5d6
      Paul Wilkins authored
      Make the midpoint variance used in AQ mode 1 segmentation
      depend on the overall complexity of the frame in two pass.
      Change-Id: I452814ec57f7a32352e41bb250e78066abe952dd
  20. 06 Nov, 2014 1 commit
    • Paul Wilkins's avatar
      Add intra complexity and brightness weight to first pass. · 5e935126
      Paul Wilkins authored
      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
  21. 13 Oct, 2014 1 commit
    • Paul Wilkins's avatar
      Add adaptation option for VBR. · f7f0eaa5
      Paul Wilkins authored
      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
      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
      (Rebase of If25a2449a415449c150acff23df713e9598d64c9
      to resolve a auto-merge error)
      Change-Id: Iec4e1613ef0d067454751d8220edb7058dfbd816
  22. 10 Oct, 2014 2 commits
    • Alex Converse's avatar
      Revert "Add adaptation option for VBR." · a90255c3
      Alex Converse authored
      This reverts commit 869d4ca5.
      This breaks the build via conflict with
      Change-Id: If544b99e367a449452834eb8cce600f58c34ec0d
    • Paul Wilkins's avatar
      Add adaptation option for VBR. · 869d4ca5
      Paul Wilkins authored
      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
      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
      Change-Id: If25a2449a415449c150acff23df713e9598d64c9
  23. 09 Oct, 2014 1 commit
    • Yunqing Wang's avatar
      Allow mode search breakout at very low prediction errors · e18edd5e
      Yunqing Wang authored
      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
  24. 18 Sep, 2014 1 commit
    • Paul Wilkins's avatar
      Substantial reworking of code for arf and kf groups. · c389b37b
      Paul Wilkins authored
      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
      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
  25. 22 Aug, 2014 1 commit
  26. 04 Aug, 2014 1 commit
  27. 28 Jul, 2014 1 commit
  28. 17 Jul, 2014 1 commit
  29. 16 Jul, 2014 1 commit
    • Paul Wilkins's avatar
      Changes to rd balance and multi-arf bug fix. · b691230d
      Paul Wilkins authored
      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
  30. 15 Jul, 2014 1 commit
  31. 01 Jul, 2014 1 commit
  32. 24 Jun, 2014 2 commits
    • Paul Wilkins's avatar
      Dual ARF changes: Buffer index selection. · 60244ec1
      Paul Wilkins authored
      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
    • Paul Wilkins's avatar
      Experiment for mid group second arf. · 2e430cba
      Paul Wilkins authored
      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
  33. 12 Jun, 2014 1 commit
  34. 06 Jun, 2014 1 commit
    • Adrian Grange's avatar
      Revert "Removing this_frame_stats member from TWO_PASS struct." · a4f74792
      Adrian Grange authored
      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 3f95a230
      Change-Id: Icd8e14b3d7dd733590ada12e619b9dce95b6b0f5
  35. 28 May, 2014 1 commit