📄 vp3-format.txt
字号:
discard up predictor pred = (53 * ur.dc) + (75 * l.dc) -------------------------- 128 1 0 0 0 up-left predictor available: pred = ul.dc 1 0 0 1 up-left, left predictors available: discard up-left predictor pred = l.dc 1 0 1 0 up-left, up-right predictors available: pred = (ul.dc + ur.dc) --------------- 2 1 0 1 1 up-left, up-right, left predictors available: discard up-left predictor pred = (53 * ur.dc) + (75 * l.dc) -------------------------- 128 1 1 0 0 up-left, up predictors available: discard up-left pred = u.dc 1 1 0 1 up-left, up, left predictors available: pred = (-26 * ul.dc + 29 * u.dc + 29 * l.dc) ------------------------------------- 32 1 1 1 0 up-left, up, up-right predictors available: pred = (3 * ul.dc + 10 * u.dc + 3 * ur.dc) ----------------------------------- 16 1 1 1 1 all 4 predictors available: discard up-right predictor pred = (-26 * ul.dc + 29 * u.dc + 29 * l.dc) ------------------------------------- 32Note that this final prediction case ([ul u l]) risks outranging. Thedifference of the predicted DC is checked against u.dc, l.dc, and ul.dc,in that order, and if the difference is greater than 128 in any case,the predictor is assigned as that DC coefficient. In pseudocode: if (ABSOLUTE_VALUE(pred - u.dc) > 128) pref = u.dc else if (ABSOLUTE_VALUE(pred - l.dc) > 128) pref = l.dc else if (ABSOLUTE_VALUE(pred - ul.dc) > 128) pref = ul.dcThe predicted value is, at long last, added to the fragment's decoded DCcoefficient. Finally, the new DC coefficient is saved as the frametype's auxiliary predictor. For example, if this fragment is coded as amotion residual from the previous frame, save the fragment's DCcoefficient as the previous frame auxiliary predictor.[still need to mention precise rounding considerations, a.k.a, theHIGHTBITDUPPED() macro]Reconstructing The Frame------------------------rough outline: - foreach fragment: - if motion vector - copy motion fragment from appropriate frame into current frame (don't forget to account for unrestricted motion vectors) - dequantize fragment coefficients - run coefficients through inverse DCT - if INTRA coded fragment - output transformed coefficients - else - apply transformed residual to motion fragment [not finished]Theora Specification--------------------The Theora project leverages the VP3 codec into a new video codingsystem. The algorithm and bitstream format are the same as VP3 with afew minor differences:1) The frame orientation is reversed-- VP3 is coded from bottom to topwhile Theora video is coded from top to bottom.[nope-- only true in the first few alpha releases; final Theora spec willbe upside-down, the same as VP3]2) Variable histograms-- VP3 uses a hardcoded set of histograms for DCTcoefficient coding (described in section "Unpacking The DCTCoefficients"). Theora packs the histogram information in the header ofthe transport format (which is meant to be Ogg, but can probably becoerced into a variety of other multimedia container formats).3) Variable quantization-- As with the histograms, Theora codes thequantization tables and quality thresholds (described in section"Initializing The Quantization Matrices") into the header.4) [special VLRLC case for encoding unusually large runs of blocks;necessary for HD resolutions][still need coding format of histogram and quantizer information]Appendix A: VP31 Quantization Matrices And Scale Factors--------------------------------------------------------The following quantization matrices and scale factor tables are hardcodedinto the VP31 coding standard. These tables can vary according to thesetup information transported along with a Theora file.Base quantization matrix for golden frame Y fragments (note that this is the same as JPEG): 16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 14 17 22 29 51 87 80 62 18 22 37 58 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99Base quantization matrix for golden frame C fragments (note that this is the same as JPEG): 17 18 24 47 99 99 99 99 18 21 26 66 99 99 99 99 24 26 56 99 99 99 99 99 47 66 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99Base quantization matrix for interframe Y and C fragments: 16 16 16 20 24 28 32 40 16 16 20 24 28 32 40 48 16 20 24 28 32 40 48 64 20 24 28 32 40 48 64 64 24 28 32 40 48 64 64 64 28 32 40 48 64 64 64 96 32 40 48 64 64 64 96 128 40 48 64 64 64 96 128 128DC coefficient scale factor table: 220 200 190 180 170 170 160 160 150 150 140 140 130 130 120 120 110 110 100 100 90 90 90 80 80 80 70 70 70 60 60 60 60 50 50 50 50 40 40 40 40 40 30 30 30 30 30 30 30 20 20 20 20 20 20 20 20 10 10 10 10 10 10 10AC coefficient scale factor table: 500 450 400 370 340 310 285 265 245 225 210 195 185 180 170 160 150 145 135 130 125 115 110 107 100 96 93 89 85 82 75 74 70 68 64 60 57 56 52 50 49 45 44 43 40 38 37 35 33 32 30 29 28 25 24 22 21 19 18 17 15 13 12 10Appendix B: Macroblock Coding Mode Alphabets--------------------------------------------These are the 6 pre-defined alphabets used to decode macroblock codingmode information:Alphabet 1: index coding mode ----- ----------- 0 MODE_INTER_LAST_MV 1 MODE_INTER_PRIOR_LAST 2 MODE_INTER_PLUS_MV 3 MODE_INTER_NO_MV 4 MODE_INTRA 5 MODE_USING_GOLDEN, 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMVAlphabet 2: index coding mode ----- ----------- 0 MODE_INTER_LAST_MV 1 MODE_INTER_PRIOR_LAST 2 MODE_INTER_NO_MV 3 MODE_INTER_PLUS_MV 4 MODE_INTRA 5 MODE_USING_GOLDEN 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMVAlphabet 3: index coding mode ----- ----------- 0 MODE_INTER_LAST_MV 1 MODE_INTER_PLUS_MV 2 MODE_INTER_PRIOR_LAST 3 MODE_INTER_NO_MV 4 MODE_INTRA 5 MODE_USING_GOLDEN 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMV Alphabet 4: index coding mode ----- ----------- 0 MODE_INTER_LAST_MV 1 MODE_INTER_PLUS_MV 2 MODE_INTER_NO_MV 3 MODE_INTER_PRIOR_LAST 4 MODE_INTRA 5 MODE_USING_GOLDEN 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMVAlphabet 5: index coding mode ----- ----------- 0 MODE_INTER_NO_MV 1 MODE_INTER_LAST_MV 2 MODE_INTER_PRIOR_LAST 3 MODE_INTER_PLUS_MV 4 MODE_INTRA 5 MODE_USING_GOLDEN 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMV Alphabet 6: index coding mode ----- ----------- 0 MODE_INTER_NO_MV 1 MODE_USING_GOLDEN 2 MODE_INTER_LAST_MV 3 MODE_INTER_PRIOR_LAST 4 MODE_INTER_PLUS_MV 5 MODE_INTRA 6 MODE_GOLDEN_MV 7 MODE_INTER_FOURMVAppendix C: DCT Coefficient VLC Tables--------------------------------------- VP31 tables are hardcoded- Theora tables are transported with video stream[not finished]Appendix D: The VP3 IDCT------------------------[not finished]Acknowledgements----------------Thanks to Michael Niedermayer (michaelni at gmx dot at) for peer review,corrections, and recommendations for improvement.Dan Miller (dan at on2 dot com) for clarifications on pieces of theformat.Timothy B. Terriberry (tterribe at vt dot edu) for clarification about thedifferences between VP3 and Theora, detailed explanation of motion vector mechanics.References----------Tables necessary for decoding VP3:http://mplayerhq.hu/cgi-bin/cvsweb.cgi/~checkout~/ffmpeg/libavcodec/vp3data.h?content-type=text/x-cvsweb-markup&cvsroot=FFMpegOfficial VP3 site:http://www.vp3.com/Theora, based on VP3:http://www.theora.org/On2, creators of the VP3 format:http://www.on2.com/ChangeLog---------v0.5: December 8, 2004- reworked section "Reversing The DC Prediction" to include a tabular representation of all 16 prediction modesv0.4: March 2, 2004- renamed and expanded section "Initializing The Quantization Matrices"- outlined section "Reconstructing The Frame"- moved Theora Differences Appendix to its own section entitled "TheoraSpecification"- added Appendix: Quantization Matrices And Scale Factors- added Appendix: DCT Coefficient VLC Tablesv0.3: February 29, 2004- expanded section "Unpacking The Macroblock Coding Mode Information"- expanded section "Unpacking The Macroblock Motion Vectors"- added Appendix: Macroblock Coding Mode Alphabetsv0.2: October 9, 2003- expanded section "Reversing the DC Prediction"- added Appendix: Theora Differencesv0.1: June 17, 2003- initial release, nowhere near complete
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -