320 likes | 499 Views
Homogeneity and Distortion-Based Intra Mode Decision Architecture for H.264/AVC. Guilherme Corrêa 1 , Cláudio Diniz 1 , Daniel Palomino 2 , Roger Porto 2 , Luciano Agostini 2 , Sergio Bampi 1 {grcorrea, cmdiniz, bampi}@inf.ufrgs.br , {danielp.ifm, rogerecp, agostini}@ufpel.edu.br
E N D
Homogeneity and Distortion-Based Intra Mode Decision Architecture for H.264/AVC Guilherme Corrêa1, Cláudio Diniz1, Daniel Palomino2, Roger Porto2, Luciano Agostini2, Sergio Bampi1 {grcorrea, cmdiniz, bampi}@inf.ufrgs.br , {danielp.ifm, rogerecp, agostini}@ufpel.edu.br ¹Informatics Institute – PPGC Federal University of Rio Grande do Sul (UFRGS), Porto Alegre, Brazil 2 Group of Architectures and Integrated Circuits (GACI) Federal University of Pelotas, Pelotas, Brazil ICECS 2010
Outline Introduction Mode Decision in H.264/AVC Fast Mode Decision Developed Architectures Conclusions
Introduction • H.264/AVC: State-of-the-art video coding standard • Predictions performed according to a set of encoding modes • The choice of the best mode is essential for the encoder performance • H.264/AVC reference software applies the RDO (Rate-Distortion Optmization) technique • Encodes for all modes • Compares the costs of all modes in order to choose the best one
H.264/AVCEncoder Q Current Frame (original) T Entropy Coding - Inter-Frame Prediction Motion Estimation Reference Frame Motion Compensation Mode Decision Intra-Frame Prediction Current Frame(reconstructed) T-1 Q-1 Filter +
Intra4x4Modes M M M M M M M M M A A A A A A A A A B B B B B B B B B C C C C C C C C C D D D D D D D D D E E E E E E E E E F F F F F F F F F G G G G G G G G G H H H H H H H H H I I I I I I I I I J J J J J J J J J Average (A..D, I..L) K K K K K K K K K 0 1 2 L L L L L L L L L 3 4 5 6 7 8
Intra16x16andChrominanceModes Vertical Horizontal H H V V DC Plane H H Average (H + V) V V
Outline Introduction Mode Decision in H.264/AVC Fast Mode Decision Developed Architectures Conclusions
EncodingProcess Bit rate (R) Intra/Inter Prediction Residual Generation T/Q EntropyCoding Best Mode Mode Decision DistortionCalculation Add to Prediction T-1/Q-1 Distortion (D) Prediction occurs according to the modes In the RDO technique, the encoding process is fully applied once for each mode Prohibitive number of calculations
ModeDecision(RDO) Bit rate Distortion Lagrange Multiplier Rate-Distortion Cost (J) computed for all modes Optimal results, but high complexity!
Outline Introduction Mode Decision in H.264/AVC Fast Mode Decision Developed Architectures Conclusions
FastIntraModeDecision • Divided in four steps: • Best blocksizedecision (luma) • Best Intra 4x4 Modedecision (luma) • Best Intra 16x16 Modedecision (luma) • Best Intra 8x8 Modedecision (chroma) • Decision (1) is basedonthemacroblock’sheterogeneitylevel • Decision (2), (3) and (4) are basedondistortion
FastIntra Mode Decision Luminance Decision 1: Heterogeneity Yes No Decision 3:Distortion Decision 2:Distortion Mode 0 Mode 0 Mode 1 Mode 2 Mode 3 Mode 1 Mode 2 Mode 4 Mode 5 Mode 6 Mode7 Mode 8 Mode 3 Chrominance Decision 4:Distortion Mode 0 Mode 1 Mode 2 Mode 3
Best Intra 4x4 and Intra 16x16 Modes • Based on the distortion between the original and the predicted blocks • Simulations to evaluate the impact of this decision: • Only I frames • 100 CIF frames • 8 video sequences • Only 4x4 (or only 16x16 blocks) • SAD, SATD and SSD
Best Block Size Decision • Heterogeneous regions small blocks • Homogeneous regions large blocks • (LEE, 2009): • The higher the amount of details of an image, the higher tends to be the residual variation • The higher the residual variation, the higher tends to be the amplitude of low-frequency components in the transformed block
Best BlockSize Decision • DCT Transform • Applied over the macroblock (16x16) • Y = AXAT • 256 elements, but... • Cosine function is symmetric and repeats after each 2π • Reductions to the first trigonometric quadrant led to just 16 elements!
Best BlockSize Decision A matrix (integer approximation) after factorization:
Best BlockSize Decision • (LEE, 2009): coefficients in the first line and in the first column of the MB (except DC) are enough to detect heterogeneity • Simulations to find the best H threshold between I4MB and I16MB • Best result: 2800
Reduction in the # ofCalculations • RDO Intra Mode Decision: 148 full encodings • Proposed Intra Mode Decision: 1 full encoding (add distortion and heterogeneity calculation to the process). • Reduction of 148 times in the number of iterations in the encoding process!
Outline Introduction Mode Decision in H.264/AVC Fast Mode Decision Developed Architectures Conclusions
SAD Architecture Orig(0) - abs Pred(0) + Orig(1) - abs Pred(1) + Orig(2) - abs Pred(2) + Orig(3) - abs Pred(3) + + SAD Orig(4) - abs Pred(4) + Orig(5) - abs Pred(5) + Orig(6) - abs Pred(6) + Orig(7) - abs Pred(7)
HeterogeneityCalc.Architecture INPUT Partial DCT 16x16 256 SELECTOR 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 MS MS MS MS MS MS MS MS MS MS MS MS MS MS MS MS ADDER´S TREE CONTROL 12 OUTPUT BUFFER 24 OUTPUT
IntraMode Decision Architecture Original block SAD 1 Prediction 1 SAD 2 Prediction 2 SAD 3 COMPARE Prediction 3 SAD 4 Prediction 4 Best I4MB SAD 5 Prediction 5 Decision SAD 6 Prediction 6 SAD 7 Prediction 7 SAD 8 Best intramode(s) Prediction 8 SAD 9 Prediction 9 Original block Prediction 1 Prediction 2 Best I16MB Prediction 3 SAD 1 COMPARE Prediction 4 SAD 2 Partial DCT 16x16 Best block size SAD 3 Original block SAD 4
SynthesisResults FPGA Device: XilinxVirtex-5 XC5VLX110T-3
Outline Introduction Mode Decision in H.264/AVC Fast Mode Decision Developed Architectures Conclusions
Conclusions • Independent heuristics for Intra Mode Decision were proposed • Comparison with RDO technique: • Reduction of 148 times in the number of encoding iterations • Bit-rate increase (4% in average) • 0.30 dB PSNR drop • Best results compared with related works • Architectures are capable of processing HD 1080p videos in real time
Homogeneity and Distortion-Based Intra Mode Decision Architecture for H.264/AVC Thankyou! Questions? Guilherme Corrêa1, Cláudio Diniz1, Daniel Palomino2, Roger Porto2, Luciano Agostini2, Sergio Bampi1 {grcorrea, cmdiniz, bampi}@inf.ufrgs.br , {danielp.ifm, rogerecp, agostini}@ufpel.edu.br ¹Informatics Institute – PPGC Federal University of Rio Grande do Sul (UFRGS), Porto Alegre, Brazil 2 Group of Architectures and Integrated Circuits (GACI) Federal University of Pelotas, Pelotas, Brazil ICECS 2010
Best Block Size Decision π/2 π/4 325π/32 = 5π/32 27π/32 π/8 π/16 π/32 π 0 37π/32 59π/32 3π/2 Homogeneity and Distortion-Based Intra Mode Decision Architecture for H.264/AVC • Matrix A calculation generates 256 different elements • Cosine function is symmetric and repeats after each 2π • First quadrant reductions • Example: • Line 13, column 12