1. 11 Aug, 2017 2 commits
    • Yunqing Wang's avatar
      Revert "Refactor and generalise OBMC prediction code" · d565529d
      Yunqing Wang authored
      This reverts commit 29824a42.
      
      Unit test failure was seen.
      AV1/AVxEncoderThreadLSTest.EncoderResultTest/2
      AV1/TileIndependenceTestLarge.MD5Match/2
      
      Change-Id: I836b6ef8b8eeac45014a439d1f5d4d45d17110f9
      d565529d
    • Sarah Parker's avatar
      Fix inter path for mrc-tx · de6f072e
      Sarah Parker authored
      A speed feature was causing the rdloop to skip trying
      MRC_DCT. I've disabled that speed feature when mrc-tx
      is enabled and MRC_DCT is allowed for inter blocks.
      
      Change-Id: I0affa5f26465539414b2957f8ff983f718863ef1
      de6f072e
  2. 10 Aug, 2017 3 commits
    • Urvang Joshi's avatar
      Remove PALETTE flag · c6300aa1
      Urvang Joshi authored
      This experiment is now adopted as it was cleared by Tapas.
      
      Note: Palette use can still be controlled by command-line option
      "--tune-content=..." in 'aomenc'.
      
      Change-Id: I832f49f20f60c34bdef5b424755849c496687e87
      c6300aa1
    • Urvang Joshi's avatar
      Make palette work correctly with chroma sub8x8 blocks. · c9e71d4d
      Urvang Joshi authored
      The problem was that some functions were using scale_chroma_bsize()
      function to turn sub-8x8 'bsize' to 8x8 'bsize', and then the modified
      'bsize' was being passed to rd_pick_intra_sbuv_mode() for example.
      
      In such cases, we cannot rely on the 'bsize' value passed to the
      function; instead, we need to look at the original mbmi->sb_type
      directly.
      
      Also:
      - Added created a common function can_use_palette() to refactor this
      logic into one place.
      - Added more asserts to easily catch such coding errors in future.
      
      BUG=aomedia:688
      
      Change-Id: I2e9f20c8c5fbc4b3ff41b703a91a02758c3c632f
      c9e71d4d
    • James Zern's avatar
      cosmetics,rdopt.c: fix some typos · 89a015b2
      James Zern authored
      Change-Id: I558106e3e415cbcbb6673d24349daed48b616034
      89a015b2
  3. 09 Aug, 2017 2 commits
    • Rupert Swarbrick's avatar
      Refactor and generalise OBMC prediction code · 29824a42
      Rupert Swarbrick authored
      When doing OBMC prediction, the code must iterate over the blocks
      above or to the left of the current block. In reconinter.c and
      rdopt.c, there are several pieces of code that do this. These all work
      in roughly the same way, iterating over the xd->mi array (although
      some are written with for loops and others with do/while). To visit
      each neighbouring block exactly once, each of these loops used an
      "mi_step" variable which was set to the width or height of the
      neighbouring block in mi-units and the loop counter got incremented by
      mi_step to jump to the next block.
      
      This patch unifies the code slightly (just using for loops) and
      simplifies it when the CHROMA_SUB8X8 experiment is enabled. In this
      case, chroma information is stored in the bottom right block of each
      8x8 pixel region. That is, if a block has width 4 and an even mi_col,
      the chroma information we need is actually found in the block
      immediately to its right.
      
      The existing code implemented this by bumping the current column or
      row counter (usually mi_col_offset or mi_row_offset) and duplicating
      the first part of the loop body to do it again with the new
      counter. It also had to double mi_step to avoid visiting the next-door
      block again.
      
      The new code essentially just uses the "continue" keyword to restart
      the loop. There's a little more book-keeping required: we might have
      to increment "ilimit", the maximum loop index, to ensure we don't exit
      the loop too early.
      
      The result is hopefully easier to read, but it's also more general (in
      the CHROMA_SUB8X8 case). The existing code assumed the current block
      never had width or height below 8 and thus mi_col and mi_row were
      always even. As such, whenever the neighbouring block had a width or
      height of 4, we knew that we needed to skip to the next neighbouring
      block to get the required chroma information. This version of the code
      can deal with the current block being smaller. The main difference is
      that it decides whether to skip forward by examining the parity of
      (mi_col + i) or (mi_row + i).
      
      This change will be needed for 16x4/4x16 block support.
      
      Change-Id: I39c1bbc00a6e2ad1ac17b8eed3980a8bcc040074
      29824a42
    • Rupert Swarbrick's avatar
      ext-partition-types: Don't allow 4:1 blocks to use palettes · 6f9cd946
      Rupert Swarbrick authored
      Since there are no CDFs set up for palettes for 4:1/1:4 blocks, we
      should make sure we don't try to use them. Without this patch,
      write_palette_mode_info gets called with a bsize of BLOCK_32X8 and
      reads (and writes) off the end of the palette_y_size_cdf array.
      
      This patch avoids calling it in this context and adds an assertion to
      make sure we don't read off the end of the array in future.
      
      The patch also adds the corresponding logic to rdopt.c.
      
      Change-Id: I4d9aea982d057e305a6b578f35457eada819d38f
      6f9cd946
  4. 08 Aug, 2017 2 commits
  5. 04 Aug, 2017 2 commits
    • Sarah Parker's avatar
      Avoid using MRC_DCT when the mask produced is invalid · c5ccd4ca
      Sarah Parker authored
      If the mask is invalid, do not allow the encoder to select MRC_DCT.
      Currently the mask is invalid if it is all 1 or all 0, but these
      criteria will likely expand in a future patch.
      
      Change-Id: I77230ea8357bfdb2bf1e6338903d44bbf1db22d1
      c5ccd4ca
    • Yushin Cho's avatar
      New experiment, CDEF-DIST · c49177e4
      Yushin Cho authored
      Distortion metric that is currently used for CDEF is also used for
      distortion of luma channel during RDO-based mode decision.
      
      This experiment works on the top of 'dist-8x8' experiment.
      
      The BD-Rate change by this experiment for three frames of
      objective-1-fast in AWCY is:
      
        PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
      1.1589 | -2.0036 | -1.9620 |  -0.0076 | -1.4145 | -1.4561 |    -0.6410
      
      Change-Id: I1142fe2f186f4ed86e4d33468e00b84e30b20233
      c49177e4
  6. 03 Aug, 2017 2 commits
    • Sarah Parker's avatar
      Add macros to turn off inter and intra mrc_dct separately · 2e08d96d
      Sarah Parker authored
      This will aid in testing different masking methods for inter
      and intra blocks.
      
      Change-Id: Ic038da77e55405e3303177e6cd260bd5e19311c1
      2e08d96d
    • hui su's avatar
      Calculate coeff token cost from CDF · c0cf71df
      hui su authored
      AWCY results:
      PSNR	PSNR HVS  SSIM	CIEDE 2000
      -0.09	-0.04	  -0.02	  -0.03
      
      On Google testsets:
      lowres  -0.18%
      midres  -0.20%
      
      Above results are obtained with
      --disable-ext-refs --disable-dual-filter --disable-loop-restoration
      --disable-global-motion --disable-warped-motion
      
      Change-Id: Iba58d5e5ec9a65d0afba29609aa2e379a80d7236
      c0cf71df
  7. 01 Aug, 2017 1 commit
    • Zoe Liu's avatar
      Add encoder support to ALTREF2 · e9b15e2b
      Zoe Liu authored
      This CL adds the use of ALTREF2_FRAME to both single / comp reference
      prediction at the encoder side. In particular, the encoder keeps the
      distant altref as ALTREF, and uses the internal extra altrefs to
      refresh ALTREF2.
      
      Compared with the baseline (ext_tx and global_motion disabled simply
      for speed concern):
      (a) lowres: avg_psnr -0.395% ovr_psnr -0.393% ssim -0.329%
      (b) midres: avg_psnr -0.419% ovr_psnr -0.431% ssim -0.444%
      (c) AWCY High Latency:
         PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
      -0.6661 | -0.5988 | -0.6669 |  -0.6993 | -0.6988 | -0.7303 | -0.6051
      (d) AWCY Low Latency:
        PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
      0.0720 | -0.0505 |  0.1501 |   0.0670 | 0.0842 |  0.0517 |     0.0158
      
      TODO list:
      (1) To have altref2 incorporated with ext-comp-refs;
      (2) To have altref2 fully work with new-multisymbol;
      (3) To re-collect the initial default probs/cdfs;
      (4) To tune the encoder gf group structure design for altref2.
      
      Change-Id: I6ad63fd65afa903d3bba20acdb68e3b67acf7fdf
      e9b15e2b
  8. 31 Jul, 2017 4 commits
    • Zoe Liu's avatar
      Fix a build error when ext-tx is off · 4508d880
      Zoe Liu authored
      Change-Id: I1cf27c41749c8f66eaa0ec828a1fd5d8ef7dd94e
      4508d880
    • Zoe Liu's avatar
      Fix build warnings when global_motion is off · bc030eea
      Zoe Liu authored
      Change-Id: I69f042e6da5a4b5e4a18853c5f15532dfef0204a
      bc030eea
    • Yue Chen's avatar
      Move mode costs that can be updated inside a frame to MACROBLOCK · b23d00a0
      Yue Chen authored
      It is a refactoring patch, which aims to make the code ready for
      implementation of in-frame mode cost update in RDO.
      Also add mode cost update per sb row, but it won't affect coding
      results because cdf update in RDO is not there.
      Mode cost arrays are moved to MACROBLOCK because in multi-thread
      coding, threads share the same AV1_COMP.
      
      This patch does not have impact on coding results.
      
      Change-Id: I2e8f7d7d066b23ebfbfc998269023781f359a6ff
      b23d00a0
    • Yue Chen's avatar
      motion_var: computer motion_mode_cost from cdf · bdc8dab2
      Yue Chen authored
      Initialize mode cost using frame-level cdf.
      Also in rd selection stage, cdf is updated per 64x64.
      Performance gain 0.20%
      
      Still suboptimal since in real bitstream packing, cdf is updated
      per symbol. Per symbol update in RDO is work in progress.
      
      Change-Id: I5062af91d8b00e5bf4c08abd0a7bfb0e5b27a619
      bdc8dab2
  9. 29 Jul, 2017 1 commit
    • David Michael Barr's avatar
      [CFL] Uniform Q3 alpha grid with extent [-2, 2] · f6eaa159
      David Michael Barr authored
      Expand the range of alpha to [-2, 2] in Q3.
      Jointly signal the signs, including zeros.
      Use the signs to give context for each quadrant
      and half-axis. The (0, 0) point is excluded.
      Symmetry in alpha_u == alpha_v yields 6 contexts.
      
      Results on Subset1 (Compared to 9136ab7d with CFL enabled)
      
         PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
      -0.0792 | -0.7535 | -0.7574 |  -0.0639 | -0.0843 | -0.0665 |    -0.3324
      
      Change-Id: I250369692e92a91d9c8d174a203d441217d15063
      Signed-off-by: default avatarDavid Michael Barr <b@rr-dav.id.au>
      f6eaa159
  10. 28 Jul, 2017 3 commits
    • Yushin Cho's avatar
      Fix dist_8x8 broken with 3bce7547 · a4817a6b
      Yushin Cho authored
      The commit 3bce7547 has introduced an another early-exit based on MSE distortion
      in transform domain, which enables skipping trellis coding and
      calling av1_dist_block() in block_rd_txfm() and skipping trellis coding in av1_tx_block_rd_b().
      
      However, with dist-8x8, the early-exit for sub8x8 tx block in a partition >= 8x8 in plane 0
      is disabled because that the reference distortion metric
      (which would be non-MSE and applied to 8x8 or larger) can not be compared to
      MSE distortions of sub8x8 tx blocks.
      
      Change-Id: I46ada7c90a869d23fc0f0166a01dfdc5392af311
      a4817a6b
    • Luc Trudeau's avatar
      [CFL] New UV_PREDICTION_MODE for CFL · 6e1cd787
      Luc Trudeau authored
      CfL is now an independent mode.
      
      Results on Subset1 (Compared to 4266a7ed with CFL enabled)
      
         PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
      -0.1645 | -0.4017 |  0.2475 |  -0.1851 | -0.2179 | -0.2338 |    -0.2897
      
      Change-Id: I2e86e7ea7bfc12bb1d763e70a136ca992d57a3c5
      6e1cd787
    • Jingning Han's avatar
      Conditionally skip inverse transform in transform block RD · 1a7f0a8c
      Jingning Han authored
      When the lower bound of a transform block rate-distortion cost is
      above the current best rd cost, the only possibility that this
      particular coding mode will be chosen is to fall back to all skip
      mode. Hence there is no need to estimate the transform block rate
      cost, distortion, etc. Obtain the sum of squared distance between
      the prediction and the source would be sufficient.
      
      This speeds up the encoding process by 5% - 10%.
      
      Change-Id: I728728c3a42aafefd34641f0be69b3e2a9b9bbb2
      1a7f0a8c
  11. 26 Jul, 2017 4 commits
    • Jingning Han's avatar
      Reduce best rdcost value in transform partition search · 16a9df75
      Jingning Han authored
      Adaptively reduce the best rate-distortion cost value in the
      recursive transform block partition search. For bus CIF at 1000 kbps
      this reduces the encoding time from 1864 seconds to 1756 seconds,
      about 6% speed up.
      
      Change-Id: I5433a1825c0f8b13fcc5ab7e19713a98969d53fc
      16a9df75
    • Yue Chen's avatar
      rect_tx_ext: work with var_tx · d6bdd46b
      Yue Chen authored
      Change-Id: Ie2c34490dc50cb242bcd701308e6b55243883b15
      d6bdd46b
    • Luc Trudeau's avatar
      [CFL] UV_PREDICTION_MODE · d6d9eeeb
      Luc Trudeau authored
      A separate prediction mode struct is added to allow
      for uv-only modes (like CfL). Note: CfL will be
      added as a separate mode in an upcoming commit.
      
      Results on Subset1 (Compared to 4266a7ed with CfL enabled)
        PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
      0.0000 |  0.0000 |  0.0000 |   0.0000 | 0.0000 |  0.0000 |     0.0000
      
      Change-Id: Ie80711c641c97f745daac899eadce6201ed97fcc
      d6d9eeeb
    • Jingning Han's avatar
      Optimize transform block rate-distortion search · 3bce7547
      Jingning Han authored
      The soft coefficient optimization process would monotonically
      increase the transform block distortion and decrease the
      coefficient rate cost. Such observation provides a lower bound
      on the rate-distortion cost for the given transform block. This
      commit compares this lower bound against the best available
      rate-distortion cost value and skips unnecessary optimization
      process. It speeds up the baseline encoding process by 15%.
      
      Change-Id: Ida8098a2820cef60d59ec1e72f0bbb1acbd98165
      3bce7547
  12. 25 Jul, 2017 2 commits
    • Yushin Cho's avatar
      Fix that matching { and } can be searched in inter mode decision · 67dda51a
      Yushin Cho authored
      Because #if ... #else ... put the '{' on the same line, dangling { or } occurs,
      which causes automatic syntax analyzer, such as 'Ctrl-Shifht-P' in Eclipse
      or '%' of vi, fail to find matching { and }.
      
      For some developers, this can make quick reading and/or understaning blocks of code
      almost impossible.
      
      Three function or blocks are repaird.
      1. av1_rd_pick_inter_mode_sb() {...}
      
      2. for (midx = 0; midx < MAX_MODES; ++midx) {...}
         in av1_rd_pick_inter_mode_sb()
      
      3. handle_inter_mode() {...}
      
      Change-Id: Ib5ac63b8c7f9870a491fac337ae3f58c57ce5e46
      67dda51a
    • Jingning Han's avatar
      Account for the 64x64 proc block constrain in obmc masking · 440d4254
      Jingning Han authored
      Make the codec account for the 64x64 processing unit constraint
      when producing the mask for overlapped filter.
      
      Change-Id: I3e596492ae522abe678369b0c9710441549e817e
      440d4254
  13. 24 Jul, 2017 1 commit
    • Luc Trudeau's avatar
      [CFL] Fix rare overflow in distortion computation · 4c5df105
      Luc Trudeau authored
      Worst case SSE for a 12-bit 64x64 block requires 48 bits
      (2*(12+log(64)+log(64))). As such, the dist variable must
      be int64.
      
      Results on Subset1 (compared to 19b5c8fa with CfL enabled)
      
        PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
      0.0030 |  0.0001 |  0.0100 |   0.0026 | 0.0024 | -0.0008 |     0.0028
      
      Change-Id: I1364c089c223b96daed942175a915fed0f6f1023
      4c5df105
  14. 20 Jul, 2017 3 commits
    • Zoe Liu's avatar
      Add support to the experiment of altref2 · 97ad058e
      Zoe Liu authored
      This CL adds an extra alt-ref reference frame, namely ALTREF2_FRAME,
      and designs the contexts for ALTREF2_FRAME.
      
      Change-Id: I12fe8629b868aebf6c2b54260fca5abc38f90ae6
      97ad058e
    • Sarah Parker's avatar
      Add new MRC_DCT tx type · 53f93dbd
      Sarah Parker authored
      This adds the new transform to the list of possible transforms.
      The impact on performance is in the noise range because the transform
      implementation currently performs DCT as a placeholder. This transform
      will initially only have an implementation for TX_32X32 and it is
      skipped in the tx search for smaller transform sizes.
      
      Change-Id: Iab2faddc525b478ca06972a753428a4f4ef53ac6
      53f93dbd
    • Yushin Cho's avatar
      New experiment DIST_8x8 · b7b60c57
      Yushin Cho authored
      A framework for computing a distortion at 8x8 luma block level
      during RDO-based mode decision search. New 8x8 distortion metric can
      be plugged in by way of this tool.
      
      Existing daala_dist now uses this experiment as well.
      Other possible applications that can make use of this experiment would be
      a distortion meric, which should apply at 8x8 pixels such as PSNR-HVS, SSIM, or etc.
      
      A rd_cost for final coding mode decision for a super block is
      computed for a partition size 8x8 or larger. For a block larger than 8x8,
      a distortion of each 8x8 block is independently computed then summed up.
      
      The rd_cost for 8x8 block with new 8x8 distortion metric is computed
      only when the mode decision of its sub8x8 blocks are completed.
      However, MSE distortion metric is used with sub8x8 mode decision. Thus,
      early termination is also determined with the MSE based rd_cost.
      Because the best rd_cost (i.e. the reference rd_cost) during sub8x8 prediction
      or sub8x8 tx is based on new 8x8 distortion while each sub8x8 uses MSE,
      the existing early termination cannot be used (And this can be the one of possible reason
      for the BD-Rate change with this revision).
      
      For a sub8x8 prediction, prediction mode for each sub8x8 block of a 8x8 block is
      decided with existing MSE and then av1_dist_8x8() is applied to the 8x8 pixels.
      (There is also av1_dist_8x8_diff, which can input diff signal directly)
      
      For a sub8x8 tx in a block larger than 8x8, instead of computing MSE distortion for
      each sub8x8 tx block, we wait until all sub8x8 tx blocks are encoded before av1_dist_8x8()
      is applied to 8x8 pixels.
      
      Sub8x8 prediction and transformas were most of tricky parts in this change.
      Two kind of distortions, for a) predicted pixels and b) decoded pixels
      (i.e. predicted + possible reconstructed residue), are always computed during RDO.
      In order to access those two signals a) and b) for a 8x8 block after
      its sub8x8 mode decision is finished, a) and b) need be properly stored for later retrieval.
      
      The CB4X4 makes the task of accessing a) and b) signals for sub8x8 block further difficult,
      since the intermediate data (i.e. a and/or b) for sub8x8 block
      are not easily accessible outside of current partition unless reconstruced
      with decided coding modes.
      
      Change-Id: If60301a890c0674a3de1d8206965bbd6a6495bb7
      b7b60c57
  15. 19 Jul, 2017 1 commit
    • Jingning Han's avatar
      Rework txk_type indexing system for chroma component · 19b5c8fa
      Jingning Han authored
      Use the row and column indexes to fetch txk_type, which allows the
      chroma components to derive the tx type from the corresponding luma
      components. It improves the coding performance of txk-sel by 0.18%.
      
      Change-Id: I3f4bca5839e13ae95e51053e76cd86fe58202ac9
      19b5c8fa
  16. 17 Jul, 2017 1 commit
  17. 14 Jul, 2017 3 commits
    • Yunqing Wang's avatar
      Sample selection in warped motion · 1bc82866
      Yunqing Wang authored
      Added a sample selection process in warped motion.
      1. Gather more samples including multiple rows on the top, multiple
      columns on the left, and the upper-right block.
      2. Sort samples by the MV difference between the neighbour's MV and
      the current block's MV. Trim the samples with considerably large MV
      difference.
      
      Borg test result:
                   avg_psnr ovr_psnr ssim
      cam_lowres:  -0.241   -0.243  -0.376
      lowres:      -0.104   -0.110  -0.179
      
      The changes are wrapped in WARPED_MOTION_SORT_SAMPLES macro.
      
      Change-Id: I2730bb31a0a3ad28215ccd16fd6da0ea8b2ed404
      1bc82866
    • hui su's avatar
      refactor get_tx_type() · 45b6475e
      hui su authored
      Change-Id: I2888bd8905253e02e3ac74597275cf56e5142d29
      45b6475e
    • David Michael Barr's avatar
      [CFL] Move alpha picking code to rdopt.c · 2510f64e
      David Michael Barr authored
      This simplifies the path from rd_pick_intra_sbuv_mode()
      
      Results on Subset1 (compared to  dff41923 with CfL enabled)
      
        PSNR | PSNR Cb | PSNR Cr | PSNR HVS |   SSIM | MS SSIM | CIEDE 2000
      0.0000 |  0.0000 |  0.0000 |   0.0000 | 0.0000 |  0.0000 |     0.0000
      
      Change-Id: I0bade9d347c626a78ba7077b960afdb318ecca69
      Signed-off-by: default avatarDavid Michael Barr <b@rr-dav.id.au>
      2510f64e
  18. 13 Jul, 2017 2 commits
  19. 12 Jul, 2017 1 commit
    • hui su's avatar
      Automatically turn on/off screen content tools · d9a812bd
      hui su authored
      Turn "allow_screen_content_tools" on when the source video has many blocks
      with only few different colors. The automatic detection is enabled by
      defualt (or with command line flag "--tune-content=default"). With
      "--tune-content=screen", the screen content tools are always turned on.
      
      On the screen_content test set, the "default" setting is less than 0.3%
      worse than the "screen" setting on keyframe encoding.
      
      Change-Id: Iac7ab8952c96531d1fae84da1823291f5987519c
      d9a812bd