spec.tex

来自「mediastreamer2是开源的网络传输媒体流的库」· TEX 代码 · 共 1,662 行 · 第 1/5 页

TEX
1,662
字号
\documentclass[9pt,letterpaper]{book}\usepackage{latexsym}\usepackage{amssymb}\usepackage{amsmath}\usepackage{bm}\usepackage{textcomp}\usepackage{graphicx}\usepackage{booktabs}\usepackage{tabularx}\usepackage{longtable}\usepackage{ltablex}\usepackage{wrapfig}\usepackage[pdfpagemode=None,pdfstartview=FitH,pdfview=FitH,colorlinks=true]% {hyperref}\newtheorem{theorem}{Theorem}[section]\newcommand{\idx}[1]{{\ensuremath{\mathit{#1}}}}\newcommand{\qti}{\idx{qti}}\newcommand{\qtj}{\idx{qtj}}\newcommand{\pli}{\idx{pli}}\newcommand{\plj}{\idx{plj}}\newcommand{\qi}{\idx{qi}}\newcommand{\ci}{\idx{ci}}\newcommand{\bmi}{\idx{bmi}}\newcommand{\bmj}{\idx{bmj}}\newcommand{\qri}{\idx{qri}}\newcommand{\qrj}{\idx{qrj}}\newcommand{\hti}{\idx{hti}}\newcommand{\sbi}{\idx{sbi}}\newcommand{\bi}{\idx{bi}}\newcommand{\bj}{\idx{bj}}\newcommand{\mbi}{\idx{mbi}}\newcommand{\mbj}{\idx{mbj}}\newcommand{\mi}{\idx{mi}}\newcommand{\cbi}{\idx{cbi}}\newcommand{\qii}{\idx{qii}}\newcommand{\ti}{\idx{ti}}\newcommand{\tj}{\idx{tj}}\newcommand{\rfi}{\idx{rfi}}\newcommand{\zzi}{\idx{zzi}}\newcommand{\ri}{\idx{ri}}%This somewhat odd construct ensures that \bitvar{\qi}, etc., will set the% qi in bold face, even though it is in a \mathit font, yet \bitvar{VAR} will% set VAR in a bold, roman font.\newcommand{\bitvar}[1]{\ensuremath{\mathbf{\bm{#1}}}}\newcommand{\locvar}[1]{\ensuremath{\mathrm{#1}}}\newcommand{\term}[1]{{\em #1}}\newcommand{\bin}[1]{\ensuremath{\mathtt{b#1}}}\newcommand{\hex}[1]{\ensuremath{\mathtt{0x#1}}}\newcommand{\ilog}{\ensuremath{\mathop{\mathrm{ilog}}\nolimits}}\newcommand{\round}{\ensuremath{\mathop{\mathrm{round}}\nolimits}}\newcommand{\sign}{\ensuremath{\mathop{\mathrm{sign}}\nolimits}}\newcommand{\lflim}{\ensuremath{\mathop{\mathrm{lflim}}\nolimits}}%Section-based table, figure, and equation numbering.\numberwithin{equation}{chapter}\numberwithin{figure}{chapter}\numberwithin{table}{chapter}\keepXColumns\pagestyle{headings}\bibliographystyle{alpha}\title{Theora I Specification}\author{Xiph.org Foundation}\date{\today}\begin{document}\frontmatter\begin{titlepage}\maketitle\end{titlepage}\thispagestyle{empty}\cleardoublepage\pagenumbering{roman}\thispagestyle{plain}\tableofcontents\cleardoublepage\thispagestyle{plain}\listoffigures\cleardoublepage\thispagestyle{plain}\listoftables\cleardoublepage\thispagestyle{plain}\markboth{{\sc Notation and Conventions}}{{\sc Notation and Conventions}}\chapter*{Notation and Conventions}All parameters either passed in or out of a decoding procedure are given in \bitvar{bold\ face}.The prefix \bin{} indicates that the following value is to be interpreted as a binary number (base 2).\begin{verse}{\bf Example:} The value \bin{1110100} is equal to the decimal value 116.\end{verse}The prefix \hex{} indicates the the following value is to be interpreted as a hexadecimal number (base 16).\begin{verse}{\bf Example:} The value \hex{74} is equal to the decimal value 116.\end{verse}All arithmetic defined by this specification is exact.However, any real numbers that do arise will always be converted back to integers again in short order.The entire specification can be implemented using only normal integer operations.All operations are to be implemented with sufficiently large integers so that overflow cannot occur.Where the result of a computation is to be truncated to a fixed-sized binary representation, this will be explicitly noted.The size given for all variables is the maximum number of bits needed to store any value in that variable.Intermediate computations involving that variable may require more bits.The following operators are defined:\begin{description}\item[$|a|$]The absolute value of a number $a$.\begin{align*}|a| & = \left\{\begin{array}{ll}-a, & a < 0 \\a, & a \ge 0\end{array}\right.\end{align*}\item[$a*b$]Multiplication of a number $a$ by a number $b$.\item[$\frac{a}{b}$]Exact division of a number $a$ by a number $b$, producing a potentially non-integer result.\item[$\left\lfloor a\right\rfloor$] The largest integer less than or equal to a real number $a$.\item[$\left\lceil a\right\rceil$]The smallest integer greater than or equal to a real number $a$.\item[$a//b$]Integer division of $a$ by $b$.\begin{align*}a//b & = \left\{\begin{array}{ll}\left\lceil\frac{a}{b}\right\rceil, & a < 0 \\\left\lfloor\frac{a}{b}\right\rfloor, & a \ge 0\end{array}\right.\end{align*}\item[$a\%b$]The remainder from the integer division of $a$ by $b$.\begin{align*}a\%b & = a-|b|*\left\lfloor\frac{a}{|b|}\right\rfloor\end{align*}Note that with this definition, the result is always non-negative and less than $|b|$.\item[$a<<b$]The value obtained by left-shifting the two's complement integer $a$ by $b$ bits.For purposes of this specification, overflow is ignored, and so this is equivalent to integer multiplication of $a$ by $2^b$.\item[$a>>b$]The value obtained by right-shifting the two's complement integer $a$ by $b$ bits, filling in the leftmost bits of the new value with $0$ if $a$ is non-negative and $1$ if $a$ is negative.This is {\em not} equivalent to integer division of $a$ by $2^b$.Instead,\begin{align*}a>>b & = \left\lfloor\frac{a}{2^b}\right\rfloor.\end{align*}\item[$\round(a)$]Rounds a number $a$ to the nearest integer, with ties rounded away from $0$.\begin{align*}\round(a) = \left\{\begin{array}{ll}\lceil a-\frac{1}{2}\rceil   & a \le 0 \\\lfloor a+\frac{1}{2}\rfloor & a > 0\end{array}\right.\end{align*}\item[$\sign(a)$]Returns the sign of a given number.\begin{align*}\sign(a) = \left\{\begin{array}{ll}-1 & a < 0 \\0  & a = 0 \\1  & a > 0\end{array}\right.\end{align*}\item[$\ilog(a)$]The minimum number of bits required to store a positive integer $a$ in two's complement notation, or $0$ for a non-positive integer $a$.\begin{align*}\ilog(a) = \left\{\begin{array}{ll}0, & a \le 0 \\\left\lfloor\log_2{a}\right\rfloor+1, & a > 0\end{array}\right.\end{align*}\begin{verse}{\bf Examples:}\begin{itemize}\item $\ilog(-1)=0$\item $\ilog(0)=0$\item $\ilog(1)=1$\item $\ilog(2)=2$\item $\ilog(3)=2$\item $\ilog(4)=3$\item $\ilog(7)=3$\end{itemize}\end{verse}\item[$\min(a,b)$]The minimum of two numbers $a$ and $b$.\item[$\max(a,b)$]The maximum of two numbers $a$ and $b$.\end{description}\cleardoublepage\thispagestyle{plain}\markboth{{\sc Key words}}{{\sc Key words}}\chapter*{Key words}%We can't rewrite this, because this is text required by RFC 2119, so we use% some emergency stretching to get it typeset properly.\setlength{\emergencystretch}{2em}The key words ``MUST'', ``MUST NOT'', ``REQUIRED'', ``SHALL'', ``SHALL NOT'', ``SHOULD'', ``SHOULD NOT'', ``RECOMMENDED'', ``MAY'', and ``OPTIONAL'' in this document are to be intrepreted as described in RFC 2119 \cite{rfc2119}.\par\setlength{\emergencystretch}{0em}Where such assertions are placed on the contents of a Theora bitstream itself, implementations should be prepared to encounter bitstreams that do not follow these requirements.An application's behavior in the presecence of such non-conforming bitstreams is not defined by this specification, but any reasonable method of handling  them MAY be used.By way of example, applications MAY discard the current frame, retain the current output thus far, or attempt to continue on by assuming some default values for the erroneous bits.When such an error occurs in the bitstream headers, an application MAY refuse to decode the entire stream.An application SHOULD NOT allow such non-conformant bitstreams to overflow buffers and potentially execute arbitrary code, as this represents a serious security risk.An application MUST, however, ensure any bits marked as reserved have the value zero, and refuse to decode the stream if they do not.These are used as place holders for future bitstream features with which the current bitstream is forward-compatible.Such features may not increment the bitstream version number, and can only be recognized by checking the value of these reserved bits.\cleardoublepage\mainmatter\pagenumbering{arabic}\setcounter{page}{1}\chapter{Introduction}Theora is a general purpose, lossy video codec.It is based on the VP3 video codec produced by On2 Technologies (\url{http://www.on2.com/}).On2 donated the VP3.1 source code to the Xiph.org Foundation and released it under a BSD-like license.On2 also made an irrevocable, royalty-free license grant for any patent claims it might have over the software and any derivatives.No formal specification exists for the VP3 format beyond this source code, however Mike Melanson maintains a detailed description \cite{Mel04}.Portions of this specification were adopted from that text with permission.\section{VP3 and Theora}Theora contains a superset of the features that were available in the original VP3 codec.Content encoded with VP3.1 can be losslessly transcoded into the Theora format.Theora content cannot, in general, be losslessly transcoded into the VP3 format.If a feature is not available in the original VP3 format, this is mentioned when that feature is defined.A complete list of these features appears in Appendix~\ref{app:vp3-compat}.%TODO: VP3 - theora comparison in appendix\section{Video Formats}Theora I currently supports progressive video data of arbitrary dimensions at a constant frame rate in one of several $Y'C_bC_r$ color spaces.The precise definition the supported color spaces appears in Section~\ref{sec:colorspaces}.Three different chroma subsampling formats are supported: 4:2:0, 4:2:2, and 4:4:4.The precise details of each of these formats and their sampling locations are described in Section~\ref{sec:pixfmts}.The Theora I format does not support interlaced material, variable frame rates, bit-depths larger than 8 bits per component, nor alternate color spaces such as RGB or arbitrary multi-channel spaces.Black and white content can be efficiently encoded, however, because the uniform chroma planes compress well.Support for interlaced material is planned for a future version.\begin{verse}{\bf Note:} Infrequently changing frame rates---as when film and video sequences are cut together---can be supported in the Ogg container format by chaining several Theora streams together.\end{verse}Support for increased bit depths or additional color spaces is not planned.\section{Classification}Theora I is a block-based lossy transform codec that utilizes an $8\times 8$ Type-II Discrete Cosine Transform and block-based motion compensation.This places it in the same class of codecs as MPEG-1, -2, -4, and H.263.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?