Skip to content
  • Ronald S. Bultje's avatar
    Improved coding using 8x8 transform · f64725a0
    Ronald S. Bultje authored
    In summary, this commit encompasses a series of changes in attempt to
    improve the 8x8 transform based coding to help overall compression
    quality, please refer to the detailed commit history below for what
    are the rationale underly the series of changes:
    
    a. A frame level flag to indicate if 8x8 transform is used at all.
    b. 8x8 transform is not used for key frames and small image size.
    c. On inter coded frame, macroblocks using modes B_PRED, SPLIT_MV
    and I8X8_PRED are forced to using 4x4 transform based coding, the
    rest uses 8x8 transform based coding.
    d. Encoder and decoder has the same assumption on the relationship
    between prediction modes and transform size, therefore no signaling
    is encoded in bitstream.
    e. Mode decision process now calculate the rate and distortion scores
    using their respective transforms.
    
    Overall test results:
    1. HD set
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/HD_t8x8_20120206.html
    (avg psnr: 3.09% glb psnr: 3.22%, ssim: 3.90%)
    2. Cif set:
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/cif_t8x8_20120206.html
    (avg psnr: -0.03%, glb psnr: -0.02%, ssim: -0.04%)
    It should be noted here, as 8x8 transform coding itself is disabled
    for cif size clips, the 0.03% loss is purely from the 1 bit/frame
    flag overhead on if 8x8 transform is used or not for the frame.
    
    ---patch history for future reference---
    Patch 1:
    this commit tries to select transform size based on macroblock
    prediction mode. If the size of a prediction mode is 16x16, then
    the macroblock is forced to use 8x8 transform. If the prediction
    mode is B_PRED, SPLITMV or I8X8_PRED, then the macroblock is forced
    to use 4x4 transform. Tests on the following HD clips showed mixed
    results: (all hd clips only used first 100 frames in the test)
    
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/hdmodebased8x8.html
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/hdmodebased8x8_log.html
    
    while the results are mixed and overall negative, it is interesting to
    see 8x8 helped a few of the clips.
    
    Patch 2:
    this patch tries to hard-wire selection of transform size based on
    prediction modes without using segmentation to signal the transform size.
    encoder and decoder both takes the same assumption that all macroblocks
    use 8x8 transform except when prediciton mode is B_PRED, I8X8_PRED or
    SPLITMV. Test results are as follows:
    
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/cifmodebase8x8_0125.html
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/hdmodebased8x8_0125log.html
    
    Interestingly, by removing the overhead or coding the segmentation, the
    results on this limited HD set have turn positive on average.
    
    Patch 3:
    this patch disabled the usage of 8x8 transform on key frames, and kept the
    logic from patch 2 for inter frames only. test results on HD set turned
    decidedly positive with 8x8 transform enabled on inter frame with 16x16
    prediction modes: (avg psnr: .81% glb psnr: .82 ssim: .55%)
    
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/hdintermode8x8_0125.html
    results on cif set still negative overall
    
    Patch 4:
    continued from last patch, but now in mode decision process, the rate and
    distortion estimates are computed based on 8x8 transform results for MBs
    with modes associated with 8x8 transform. This patch also fixed a problem
    related to segment based eob coding when 8x8 transform is used. The patch
    significantly improved the results on HD clips:
    
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/hd8x8RDintermode.html
    (avg psnr: 2.70% glb psnr: 2.76% ssim: 3.34%)
    results on cif also improved, though they are still negative compared to
    baseline that uses 4x4 transform only:
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/cif8x8RDintermode.html
    (avg psnr: -.78% glb psnr: -.86% ssim: -.19%)
    
    Patch 5:
    This patch does 3 things:
    a. a bunch of decoder bug fixes, encodings and decodings were verified
    to have matched recon buffer on a number of encodes on cif size mobile and
    hd version of _pedestrian.
    b. the patch further improved the rate distortion calculation of MBS that
    use 8x8 transform. This provided some further gain on compression.
    c. the patch also got the experimental work SEG_LVL_EOB to work with 8x8
    transformed macroblock, test results indicates it improves the cif set
    but hurt the HD set slightly.
    
    Tests results on HD clips:
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/HD_t8x8_20120201.html
    (avg psnr: 3.19% glb psnr: 3.30% ssim: 3.93%)
    
    Test results on cif clips:
    http://www.corp.google.com/~yaowu/no_crawl/t8x8/cif_t8x8_20120201.html
    (avg psnr: -.47% glb psnr: -.51% ssim: +.28%)
    
    Patch 6:
    Added a frame level flag to indicate if 8x8 transform is allowed at all.
    temporarily the decision is based on frame size, can be optimized later
    one. This get the cif results to basically unchanged, with one bit per
    frame overhead on both cif and hd clips.
    
    Patch 8:
    Rebase and Merge to head by PGW.
    Fixed some suspect 4s that look like hey should be 64s in regard
    to segmented EOB. Perhaps #defines would be bette.
    Bulit and tested without T8x8 enabled and produces unchanged
    output.
    
    Patch 9:
    Corrected misalligned code/decode of "txfm_mode" bit.
    Limited testing for correct encode and decode with
    T8x8 configured on derf clips.
    
    Change-Id: I156e1405d25f81579d579dff8ab9af53944ec49c
    f64725a0