1. 26 Jun, 2015 1 commit
    • Yaowu Xu's avatar
      Fixed a variance calculation · 9f14bbfd
      Yaowu Xu authored
      This commit fixed a mistake in variance calculation.
      
      Thanks to Xintong for spotting the error.
      
      Change-Id: Ia285fc0128c00f0234a73b0a7eba6adc88b8a7de
      9f14bbfd
  2. 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
      neutral.
      
      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
      faf8c63b
    • 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
      4a28da58
  3. 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
      668e8045
  4. 26 May, 2015 2 commits
  5. 20 May, 2015 2 commits
    • 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
      883fdd45
    • paulwilkins's avatar
      Fix issues with mixed ARF and GF groups. · ade9693a
      paulwilkins authored
      This patch addresses two issues that can occur when the
      encoder chooses to use a mixture of ARF and GF groups.
      
      The first issue relates to a failure to reset the "ARF active" flag
      correctly when transitioning from coding ARF groups to coding
      GF groups. This caused some golden frames to be  encoded
      with an incorrect bit rate target as if they were ARF overlay frames.
      
      The second issue relates to the encoding of a single short GF group
      just before a key frame.  Where the last group before a key frame
      is an ARF group we expect the final frame before the key frame  to
      be an low data rate overlay frame. However, when the last  group
      is a GF group, the final frame before the key frame should be a normal
      frame with a normal bit allocation. This issue had the potential to cause
      a single poorly coded frame just before a key frame. If that key frame
      were a forced key frame rather than a real scene cut, this might cause
      pulsing.
      
      Change-Id: Idf1eb5eaf63a231495a74de7899236e1ead9fb00
      ade9693a
  6. 15 May, 2015 1 commit
  7. 13 May, 2015 1 commit
    • Johann's avatar
      Relocate memory operations for common code · 1d7ccd53
      Johann authored
      With the sad functions, and hopefully the variance functions soon,
      moving to the vpx_dsp location, place the defines used in the
      reference C code in a common location.
      
      Change-Id: I4c8ce7778eb38a0a3ee674d2f1c488eda01cfeca
      1d7ccd53
  8. 01 May, 2015 1 commit
    • paulwilkins's avatar
      Adjust ARF min and max interval. · e0786c28
      paulwilkins authored
      Previously limit on max interval  set to 0.5 seconds.
      Though this helped some low frame rate material it
      appears to be a bit too aggressive for some 24 and 25 fps
      content. This patch relaxes the limit to 0.75 seconds.
      
      The patch also adds a new minimum interval variable
      to replace the current hard wired value. This allows us
      to impose a limit on the maximum number of primary
      arfs per second for high frame rate (e.g. 50 & 60fps)
      content. This is to address concerns regarding playback
      performance on some platforms if there is a high base
      frame rate and very frequent arfs.
      
      Change-Id: I373e8b6b2a8ef522eced6c6d2cceb234ff763fcf
      e0786c28
  9. 21 Apr, 2015 2 commits
    • Scott LaVarnway's avatar
      Revert "Remove mi_grid_* structures." · 8b17f7f4
      Scott LaVarnway authored
      (see I3a05cf1610679fed26e0b2eadd315a9ae91afdd6)
      
      For the test clip used, the decoder performance improved by ~2%.
      This is also an intermediate step towards adding back the
      mode_info streams.
      
      Change-Id: Idddc4a3f46e4180fbebddc156c4bbf177d5c2e0d
      8b17f7f4
    • paulwilkins's avatar
      Modified test for auto key frame detection. · 3606b781
      paulwilkins authored
      The existing test was triggering a lot of false positives on some types
      of animated material with very plain backgrounds. These were triggering
      code designed to catch key frames in letter box format clips.
      
      This patch tightens up the criteria and imposes a minimum requirement
      on the % blocks coded intra in the first pass and the ratio between the
      % coded intra and the modified inter % after discounting neutral (flat)
      blocks that are coded equally well either way.
      
      On a particular problem animation clip this change eliminated a large
      number of false positives including some cases where the old code
      selected kf several times in a row. Marginal false negatives are less
      damaging typically to compression and in the problem clip there are now
      a couple of cases where "visual" scene cuts are ignored because of well
      correlated content across the scene cut.
      
      Replaced some magic numbers related to this with #defines and added
      explanatory comments.
      
      Change-Id: Ia3d304ac60eb7e4323e3817eaf83b4752cd63ecf
      3606b781
  10. 16 Apr, 2015 1 commit
    • paulwilkins's avatar
      Limit arf interval for low fpf clips. · effd974b
      paulwilkins authored
      This patch limits  the maximum arf interval length to
      approximately half a second. In some low fps animations in
      particular the existing code was selecting an overly long interval
      which was hurting visual quality. For a sample problem test clip
      (360P animation , 15fps, ~200Kbit/s) this change also improved
      metrics by >0.5 db.
      
      There may be some clips where this hurts metrics a little, but the
      worst case impact visually is likely to be less than having an
      interval that is much too long. On more normal material at 24
      fps or higher, the impact is likely to be nil/minimal.
      
      Change-Id: Id8b57413931a670c861213ea91d7cc596375a297
      effd974b
  11. 07 Apr, 2015 1 commit
    • Debargha Mukherjee's avatar
      Improve accuracy of rate control in CQ mode · 60bd744c
      Debargha Mukherjee authored
      Modifies a special handling that improves rate control accuracy in
      the constrained quality mode, when the undershoot and overshoot
      limits are set tighter.
      
      Change-Id: If62103f0ef3ed1cac92807400678c93da50cf046
      60bd744c
  12. 23 Mar, 2015 1 commit
    • paulwilkins's avatar
      Enable group adaptive max q by default. · 691ec45b
      paulwilkins authored
      Set the GF group adaptive max Q compile flag to 1 by default.
      
      This change has a quite big visual impact in some clips and also
      contributes to tighter rate control.
      
      For short test clips that have consistent content the impact is
      quite small on metrics but for more varied long form clips there is
      a drop in overal psnr but a sharp rise in average psnr caused by
      greater expenditure on some easier sections and tighter rate clipping
      in hard sections.
      
      In chunck'ed encodes some of the effect will already be present due
      to the independent rate control in each chunk but this change takes
      the control down to a smaller scale.
      
      yt hd +10.67%, - 3.77%, -1.56%
      yt +9.654%, - 3.6%, - 1.82%
      std hd +0.25%, -0.85%, -0.42%
      derf +0.25%, - 1.1%. - 0.87%
      
      Change-Id: Ibbc39b800d99d053939f4c6712d715124082843e
      691ec45b
  13. 20 Mar, 2015 1 commit
    • paulwilkins's avatar
      Revised rd adjustment for variance. · 7e234b92
      paulwilkins authored
      Revised adjustment for rd based on source complexity.
      Two cases:
      
      1) Bias against low variance intra predictors
      when the actual source variance is higher.
      
      2) When the source variance is very low to give a slight
      bias against predictors that might introduce false texture
      or features.
      
      The impact on metrics of this change across the test sets is
      small and mixed.
      
      derf -0.073%, -0.049%, -0.291%
      std hd -0.093%, -0.1%, -0.557%
      yt  +0.186%, +0.04%, - 0.074%
      ythd +0.625%, + 0.563%, +0.584%
      
      Medium to strong psycho-visual improvements in some
      problem clips.
      
      This feature and intra weight on GF group length now
      turned on by default.
      
      Change-Id: Idefc8b633a7b7bc56c42dbe19f6b2f872d73851e
      7e234b92
  14. 11 Mar, 2015 1 commit
    • paulwilkins's avatar
      Shorten GF/arf interval in hard scenes. · b29c48b0
      paulwilkins authored
      This patch accounts in the first pass stats for blocks that
      while not coded as intra, are complex and have an intra error /
      best error ratio below a threshold.
      
      The modification shortens the GF arf interval for a particular
      class of content that contains a lot of blocks matching the
      above criteria. (In one short problem test sequence the average
      interval dropped from about 14-15 to 10-11)
      
      The change results in small net gains in metrics results for the
      Yt(~0.2%) and yt-hd (~0.5%) sets and is approximately neutral
      for the other test sets.
      
      The change is currently shielded by a flag and off by default
      pending verification that it does not cause other regressions
      in tests on a wider YT test set.
      
      Change-Id: I6b803daa6a4ac09a6f428fb3a18be1ecedd974b7
      b29c48b0
  15. 09 Mar, 2015 1 commit
    • paulwilkins's avatar
      Allow q adjustment for VPX_CQ and VPX_CBR. · 2cff9c4e
      paulwilkins authored
      Adjustment previously only enabled in VBR mode.
      
      This patch allows adjustment of min and max q for CBR
      and adjustment of max q only for CQ mode.
      
      Change-Id: Id5e583f3d50453cd544fc57249acacd946457482
      2cff9c4e
  16. 04 Mar, 2015 2 commits
    • Adrian Grange's avatar
      Small rationalization of code in vp9_first_pass · fed9e1fe
      Adrian Grange authored
      Change-Id: I87cc0e038171c60a957298827e312fead500f7fb
      fed9e1fe
    • Adrian Grange's avatar
      Make encoder buffer allocation dynamic · 3807dd82
      Adrian Grange authored
      Frame buffers are now allocated dynamically on-demand.
      
      Entries in the reference frame map, cm->ref_frame_map,
      may now be set to -1 (INVALID_IDX) to indicate that
      there is not a valid reference buffer in that "slot".
      
      All slots in the reference frame map are now initialized
      to the empty state (-1) and each buffer is initialized
      to have a reference count of 0.
      
      Change-Id: Id1afe98de98db4ae8b2dfefed7889c3b28c68582
      3807dd82
  17. 23 Feb, 2015 1 commit
    • paulwilkins's avatar
      Account for rate error in GF group Q calculation. · 8d7f53f0
      paulwilkins authored
      When GF group adaptive maxQ is enabled this patch accounts
      somewhat for accumulated error in the rate control.
      
      This improves accuracy quite a bit on many clips especially
      when there is  overshoot.
      
      Examples when the overshoot and undershoot command line
      parameters are set to 100:
      
      Hall @ 1200 overshoot is reduced from 67-24%.
      Akiyo @ 400 undershoot is reduced from 28%-15%.
      
      Setting a lower value for undershoot or overshoot still
      reduces the error further.
      
      Impact on metrics is mixed with some gains in average psnr
      but generally a little lower (e.g. 0.5%) on overall and ssim.
      
      The GF group adaptation is still off by default in this patch.
      Compared to with the head, enabling this mode now gives
      big average psnr gains on the YT sets (e.g. YT_HD >11.2%),
      a drop in overall PSNR (YT-HD 3.9%) and a smaller drop or
      neutral for SSIM.
      
      Change-Id: If4b32cd0740d3fb941317b374f9c2951954eee90
      8d7f53f0
  18. 19 Feb, 2015 1 commit
  19. 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:
        --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
      23ebacdb
  20. 31 Jan, 2015 1 commit
    • hkuang's avatar
      Try again to merge branch 'frame-parallel' into master branch. · be6aeada
      hkuang authored
      In frame parallel decode, libvpx decoder decodes several frames on all
      cpus in parallel fashion. If not being flushed, it will only return frame
      when all the cpus are busy. If getting flushed, it will return all the
      frames in the decoder. Compare with current serial decode mode in which
      libvpx decoder is idle between decode calls, libvpx decoder is busy
      between decode calls.
      
      Current frame parallel decode will only speed up the decoding for frame
      parallel encoded videos. For non frame parallel encoded videos, frame
      parallel decode is slower than serial decode due to lack of loopfilter
      worker thread.
      
      There are still some known issues that need to be addressed. For example:
      decode frame parallel videos with segmentation enabled is not right sometimes.
      
      * frame-parallel:
        Add error handling for frame parallel decode and unit test for that.
        Fix a bug in frame parallel decode and add a unit test for that.
        Add two test vectors to test frame parallel decode.
        Add key frame seeking to webmdec and webm_video_source.
        Implement frame parallel decode for VP9.
        Increase the thread test range to cover 5, 6, 7, 8 threads.
        Fix a bug in adding frame parallel unit test.
        Add VP9 frame-parallel unit test.
        Manually pick "Make the api behavior conform to api spec." from master branch.
        Move vp9_dec_build_inter_predictors_* to decoder folder.
        Add segmentation map array for current and last frame segmentation.
        Include the right header for VP9 worker thread.
        Move vp9_thread.* to common.
        ctrl_get_reference does not need user_priv.
        Seperate the frame buffers from VP9 encoder/decoder structure.
        Revert "Revert "Revert "Revert 3 patches from Hangyu to get Chrome to build:"""
       Conflicts:
             test/codec_factory.h
             test/decode_test_driver.cc
             test/decode_test_driver.h
             test/invalid_file_test.cc
             test/test-data.sha1
             test/test.mk
             test/test_vectors.cc
             vp8/vp8_dx_iface.c
             vp9/common/vp9_alloccommon.c
             vp9/common/vp9_entropymode.c
             vp9/common/vp9_loopfilter_thread.c
             vp9/common/vp9_loopfilter_thread.h
             vp9/common/vp9_mvref_common.c
             vp9/common/vp9_onyxc_int.h
             vp9/common/vp9_reconinter.c
             vp9/decoder/vp9_decodeframe.c
             vp9/decoder/vp9_decodeframe.h
             vp9/decoder/vp9_decodemv.c
             vp9/decoder/vp9_decoder.c
             vp9/decoder/vp9_decoder.h
             vp9/encoder/vp9_encoder.c
             vp9/encoder/vp9_pickmode.c
             vp9/encoder/vp9_rdopt.c
             vp9/vp9_cx_iface.c
             vp9/vp9_dx_iface.c
      
      This reverts commit a18da976.
      
      Change-Id: I361442ffec1586d036ea2e0ee97ce4f077585f02
      be6aeada
  21. 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
      #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
      fd070220
  22. 23 Jan, 2015 1 commit
  23. 21 Jan, 2015 1 commit
    • Paul Wilkins's avatar
      Bug when last group before forced key frame is short. · 0bff1efc
      Paul Wilkins authored
      Just before a forced key frame we often get a foreshortened
      arf/gf group. In such a case, we do not want to update
      rc->last_boosted_qindex, which is used to define the Q range
      for the forced key frame itself.
      
      This gives a small average metrics gain for the YT and YT-HD sets
      (eg. YT SSIM +0.141%).
      
      Change-Id: Ie06698bc4f249e87183b8f8fb27ff8f3fde216d9
      0bff1efc
  24. 25 Nov, 2014 1 commit
    • Yunqing Wang's avatar
      vp9_ethread: modify VP9_COMP structure · edbd61e1
      Yunqing Wang authored
      This patch modified struct VP9_COMP. Created a struct ThreadData
      to include data that need to be copied for each thread. In
      multiple thread case, one thread processes one tile. all threads
      share one copy of VP9_COMP,
      (refer to VP9_COMP *cpi in the code)
      but each thread has its own copy of ThreadData,
      (refer to ThreadData *td in the code).
      Therefore, within the scope of encode_tiles(), both cpi and td
      need to be passed as function parameters.
      
      In single thread case, the FRAME_COUNTS pointer in ThreadData
      points to "counts" in VP9_COMMON.
      
      Change-Id: Ib37908b2d8e2c0f4f9c18f38017df5ce60e8b13e
      edbd61e1
  25. 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
      fc47c5d6
  26. 20 Nov, 2014 2 commits
  27. 14 Nov, 2014 1 commit
  28. 13 Nov, 2014 2 commits
    • Adrian Grange's avatar
      Prepare for dynamic frame resizing in the recode loop · 0d085ebc
      Adrian Grange authored
      Prepare for the introduction of frame-size change
      logic into the recode loop.
      
      Separated the speed dependent features into
      separate static and dynamic parts, the latter being
      those features that are dependent on the frame size.
      
      Change-Id: Ia693e28c5cf069a1a7bf12e49ecf83e440e1d313
      0d085ebc
    • Paul Wilkins's avatar
      Fix 32 bit build emms problem. · b9c4f9a7
      Paul Wilkins authored
      Add extra vp9_clear_system_state() calls to fix
      double / mmx issue introduced into first pass
      code for 32 bit builds.
      
      Change-Id: I84cd2986b80d83650a091ab25c43755efeb82e03
      b9c4f9a7
  29. 07 Nov, 2014 1 commit
    • Paul Wilkins's avatar
      AQ1 - remove first pass weights. · 31b6d7c1
      Paul Wilkins authored
      Removed redundant weighting function tied for AQ1 from first
      pass code.
      
      Improvment in baseline AQ1 results:-
      Derf  opsnr +0.142% SSIm +0.258%
      YT  opsnr +0.173% SSIm +0.3%
      
      Change-Id: I16ef91caf2d7f302cd5940cc5e2626d48ebcb212
      31b6d7c1
  30. 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
      5e935126
  31. 28 Oct, 2014 1 commit
    • Paul Wilkins's avatar
      Relax maximum Q for extreme overshoot. · 422d7bc9
      Paul Wilkins authored
      Added code to relax the active maximum Q in response
      to extreme local overshoot to reduce bandwidth peaks.
      
      The impact is small in metrics terms, but it this helps reduce
      bandwidth spikes and overall overshoot in a number of
      clips in our tests sets (especially the YT test set).
      
      In particular this should help prevent very big spikes where a clip
      is mainly easy but has a short hard section. In such a case a choice
      of maximum Q for the clip as a whole may allow us to hit the overall
      target rate but give some extreme spikes. The chunked encoding in YT
      mitigates this problem but it can show up where a longer clip is
      coded as a single chunk.
      
      Change-Id: I213d09950ccb8489d10adf00fda1e53235b39203
      422d7bc9
  32. 23 Oct, 2014 1 commit
    • Adrian Grange's avatar
      Move frame re-sizing into the recode loop · 65753eeb
      Adrian Grange authored
      The point at which frames are scaled to their
      coded dimensions is moved into the re-code loop.
      
      This is in preparation for a further patch that
      will add logic into the re-code loop to reduce
      the coded frame size if the encoder is struggling
      to hit the target data rate at the native frame
      size.
      
      Change-Id: Ie4131f5ec6fb93148879f6ce96123296442bf2d1
      65753eeb
  33. 17 Oct, 2014 1 commit
    • Paul Wilkins's avatar
      Alter adjustment of two pass GF/ARF boost with Q. · f0c3da93
      Paul Wilkins authored
      Delete gfboost_qadjust() and move Q based adjustment
      into calc_frame_boost(). Also remove clamping. Making
      the adjustment here means that it influences not just the
      boost level but also the selection of the GF/ARF interval.
      
      This change gives a small average gain in PSNR but
      larger gains in SSIM, especially for harder std-hd set (1.5%)
      
      Change-Id: I3aa81b8feccaeff93d915e19fb9cf5cd64c86327
      f0c3da93