\doxysection{codec.\+h}
\label{codec_8h_source}\index{codec.h@{codec.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/********************************************************************}}
\DoxyCodeLine{00002\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ THIS\ FILE\ IS\ PART\ OF\ THE\ OggTheora\ SOFTWARE\ CODEC\ SOURCE\ CODE.\ \ \ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ USE,\ DISTRIBUTION\ AND\ REPRODUCTION\ OF\ THIS\ LIBRARY\ SOURCE\ IS\ \ \ \ \ *}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ GOVERNED\ BY\ A\ BSD-\/STYLE\ SOURCE\ LICENSE\ INCLUDED\ WITH\ THIS\ SOURCE\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ IN\ 'COPYING'.\ PLEASE\ READ\ THESE\ TERMS\ BEFORE\ DISTRIBUTING.\ \ \ \ \ \ \ *}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ THE\ Theora\ SOURCE\ CODE\ IS\ COPYRIGHT\ (C)\ 2002-\/2009\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ by\ the\ Xiph.Org\ Foundation\ https://www.xiph.org/\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ ********************************************************************}}
\DoxyCodeLine{00012\ \textcolor{comment}{}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ \ function:}}
\DoxyCodeLine{00014\ \textcolor{comment}{}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ ********************************************************************/}}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \textcolor{preprocessor}{\#if\ !defined(OGG\_THEORA\_CODEC\_HEADER)}}
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#\ define\ OGG\_THEORA\_CODEC\_HEADER\ (1)}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#\ include\ <ogg/ogg.h>}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{preprocessor}{\#if\ defined(\_\_cplusplus)}}
\DoxyCodeLine{00069\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00070\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00077\ \textcolor{preprocessor}{\#define\ TH\_EFAULT\ \ \ \ \ (-\/1)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00079\ \textcolor{preprocessor}{\#define\ TH\_EINVAL\ \ \ \ \ (-\/10)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00081\ \textcolor{preprocessor}{\#define\ TH\_EBADHEADER\ (-\/20)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00083\ \textcolor{preprocessor}{\#define\ TH\_ENOTFORMAT\ (-\/21)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00085\ \textcolor{preprocessor}{\#define\ TH\_EVERSION\ \ \ (-\/22)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00087\ \textcolor{preprocessor}{\#define\ TH\_EIMPL\ \ \ \ \ \ (-\/23)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00089\ \textcolor{preprocessor}{\#define\ TH\_EBADPACKET\ (-\/24)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00093\ \textcolor{preprocessor}{\#define\ TH\_DUPFRAME\ \ \ (1)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00100\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{enum}\{}
\DoxyCodeLine{00103\ \ \ TH\_CS\_UNSPECIFIED,}
\DoxyCodeLine{00105\ \ \ TH\_CS\_ITU\_REC\_470M,}
\DoxyCodeLine{00107\ \ \ TH\_CS\_ITU\_REC\_470BG,}
\DoxyCodeLine{00109\ \ \ TH\_CS\_NSPACES}
\DoxyCodeLine{00110\ \}th\_colorspace;}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00116\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{enum}\{}
\DoxyCodeLine{00120\ \ \ TH\_PF\_420,}
\DoxyCodeLine{00122\ \ \ TH\_PF\_RSVD,}
\DoxyCodeLine{00126\ \ \ TH\_PF\_422,}
\DoxyCodeLine{00129\ \ \ TH\_PF\_444,}
\DoxyCodeLine{00131\ \ \ TH\_PF\_NFORMATS}
\DoxyCodeLine{00132\ \}th\_pixel\_fmt;}
\DoxyCodeLine{00133\ }
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00144\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}\{}
\DoxyCodeLine{00146\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ \ width;}
\DoxyCodeLine{00148\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ \ height;}
\DoxyCodeLine{00150\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ \ stride;}
\DoxyCodeLine{00152\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ *data;}
\DoxyCodeLine{00153\ \}th\_img\_plane;}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00170\ \textcolor{keyword}{typedef}\ th\_img\_plane\ th\_ycbcr\_buffer[3];}
\DoxyCodeLine{00171\ }
\DoxyCodeLine{00206\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}\{}
\DoxyCodeLine{00210\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ version\_major;}
\DoxyCodeLine{00211\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ version\_minor;}
\DoxyCodeLine{00212\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ version\_subminor;}
\DoxyCodeLine{00216\ \ \ ogg\_uint32\_t\ \ frame\_width;}
\DoxyCodeLine{00219\ \ \ ogg\_uint32\_t\ \ frame\_height;}
\DoxyCodeLine{00222\ \ \ ogg\_uint32\_t\ \ pic\_width;}
\DoxyCodeLine{00225\ \ \ ogg\_uint32\_t\ \ pic\_height;}
\DoxyCodeLine{00229\ \ \ ogg\_uint32\_t\ \ pic\_x;}
\DoxyCodeLine{00237\ \ \ ogg\_uint32\_t\ \ pic\_y;}
\DoxyCodeLine{00242\ \ \ ogg\_uint32\_t\ \ fps\_numerator;}
\DoxyCodeLine{00243\ \ \ ogg\_uint32\_t\ \ fps\_denominator;}
\DoxyCodeLine{00254\ \ \ ogg\_uint32\_t\ \ aspect\_numerator;}
\DoxyCodeLine{00255\ \ \ ogg\_uint32\_t\ \ aspect\_denominator;}
\DoxyCodeLine{00258\ \ \ th\_colorspace\ colorspace;}
\DoxyCodeLine{00260\ \ \ th\_pixel\_fmt\ \ pixel\_fmt;}
\DoxyCodeLine{00264\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ target\_bitrate;}
\DoxyCodeLine{00270\ \ \ \textcolor{comment}{/*Currently\ this\ is\ set\ so\ that\ a\ qi\ of\ 0\ corresponds\ to\ distortions\ of\ 24}}
\DoxyCodeLine{00271\ \textcolor{comment}{\ \ \ \ \ times\ the\ JND,\ and\ each\ increase\ by\ 16\ halves\ that\ value.}}
\DoxyCodeLine{00272\ \textcolor{comment}{\ \ \ \ This\ gives\ us\ fine\ discrimination\ at\ low\ qualities,\ yet\ effective\ rate}}
\DoxyCodeLine{00273\ \textcolor{comment}{\ \ \ \ \ control\ at\ high\ qualities.}}
\DoxyCodeLine{00274\ \textcolor{comment}{\ \ \ \ The\ qi\ value\ 63\ is\ special,\ however.}}
\DoxyCodeLine{00275\ \textcolor{comment}{\ \ \ \ For\ this,\ the\ highest\ quality,\ we\ use\ one\ half\ of\ a\ JND\ for\ our\ threshold.}}
\DoxyCodeLine{00276\ \textcolor{comment}{\ \ \ \ Due\ to\ the\ lower\ bounds\ placed\ on\ allowable\ quantizers\ in\ Theora,\ we\ will}}
\DoxyCodeLine{00277\ \textcolor{comment}{\ \ \ \ \ not\ actually\ be\ able\ to\ achieve\ quality\ this\ good,\ but\ this\ should}}
\DoxyCodeLine{00278\ \textcolor{comment}{\ \ \ \ \ provide\ as\ close\ to\ visually\ lossless\ quality\ as\ Theora\ is\ capable\ of.}}
\DoxyCodeLine{00279\ \textcolor{comment}{\ \ \ \ We\ could\ lift\ the\ quantizer\ restrictions\ without\ breaking\ VP3.1}}
\DoxyCodeLine{00280\ \textcolor{comment}{\ \ \ \ \ compatibility,\ but\ this\ would\ result\ in\ quantized\ coefficients\ that\ are}}
\DoxyCodeLine{00281\ \textcolor{comment}{\ \ \ \ \ too\ large\ for\ the\ current\ bitstream\ to\ be\ able\ to\ store.}}
\DoxyCodeLine{00282\ \textcolor{comment}{\ \ \ \ We'd\ have\ to\ redesign\ the\ token\ syntax\ to\ store\ these\ large\ coefficients,}}
\DoxyCodeLine{00283\ \textcolor{comment}{\ \ \ \ \ which\ would\ make\ transcoding\ complex.*/}}
\DoxyCodeLine{00284\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ quality;}
\DoxyCodeLine{00298\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ keyframe\_granule\_shift;}
\DoxyCodeLine{00299\ \}th\_info;}
\DoxyCodeLine{00300\ }
\DoxyCodeLine{00325\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }th\_comment\{}
\DoxyCodeLine{00327\ \ \ \textcolor{keywordtype}{char}\ **user\_comments;}
\DoxyCodeLine{00329\ \ \ \textcolor{keywordtype}{int}\ \ \ *comment\_lengths;}
\DoxyCodeLine{00331\ \ \ \textcolor{keywordtype}{int}\ \ \ \ comments;}
\DoxyCodeLine{00334\ \ \ \textcolor{keywordtype}{char}\ \ *vendor;}
\DoxyCodeLine{00335\ \}th\_comment;}
\DoxyCodeLine{00336\ }
\DoxyCodeLine{00337\ }
\DoxyCodeLine{00338\ }
\DoxyCodeLine{00340\ \textcolor{keyword}{typedef}\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ th\_quant\_base[64];}
\DoxyCodeLine{00341\ }
\DoxyCodeLine{00343\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}\{}
\DoxyCodeLine{00345\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ nranges;}
\DoxyCodeLine{00348\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ \ *sizes;}
\DoxyCodeLine{00351\ \ \ \textcolor{keyword}{const}\ th\_quant\_base\ *base\_matrices;}
\DoxyCodeLine{00352\ \}th\_quant\_ranges;}
\DoxyCodeLine{00353\ }
\DoxyCodeLine{00411\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}\{}
\DoxyCodeLine{00413\ \ \ ogg\_uint16\_t\ \ \ \ dc\_scale[64];}
\DoxyCodeLine{00415\ \ \ ogg\_uint16\_t\ \ \ \ ac\_scale[64];}
\DoxyCodeLine{00417\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ loop\_filter\_limits[64];}
\DoxyCodeLine{00419\ \ \ th\_quant\_ranges\ qi\_ranges[2][3];}
\DoxyCodeLine{00420\ \}th\_quant\_info;}
\DoxyCodeLine{00421\ }
\DoxyCodeLine{00422\ }
\DoxyCodeLine{00423\ }
\DoxyCodeLine{00425\ \textcolor{preprocessor}{\#define\ TH\_NHUFFMAN\_TABLES\ (80)}\textcolor{preprocessor}{}}
\DoxyCodeLine{00427\ \textcolor{preprocessor}{\#define\ TH\_NDCT\_TOKENS\ \ \ \ \ (32)}}
\DoxyCodeLine{00428\ }
\DoxyCodeLine{00440\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}\{}
\DoxyCodeLine{00443\ \ \ ogg\_uint32\_t\ pattern;}
\DoxyCodeLine{00446\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ nbits;}
\DoxyCodeLine{00447\ \}th\_huff\_code;}
\DoxyCodeLine{00448\ }
\DoxyCodeLine{00449\ }
\DoxyCodeLine{00450\ }
\DoxyCodeLine{00464\ \textcolor{keyword}{extern}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *th\_version\_string(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00474\ \textcolor{keyword}{extern}\ ogg\_uint32\_t\ th\_version\_number(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00484\ \textcolor{keyword}{extern}\ ogg\_int64\_t\ th\_granule\_frame(\textcolor{keywordtype}{void}\ *\_encdec,ogg\_int64\_t\ \_granpos);}
\DoxyCodeLine{00496\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{double}\ th\_granule\_time(\textcolor{keywordtype}{void}\ *\_encdec,ogg\_int64\_t\ \_granpos);}
\DoxyCodeLine{00506\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{int}\ th\_packet\_isheader(ogg\_packet\ *\_op);}
\DoxyCodeLine{00517\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{int}\ th\_packet\_iskeyframe(ogg\_packet\ *\_op);}
\DoxyCodeLine{00519\ }
\DoxyCodeLine{00520\ }
\DoxyCodeLine{00532\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_info\_init(th\_info\ *\_info);}
\DoxyCodeLine{00537\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_info\_clear(th\_info\ *\_info);}
\DoxyCodeLine{00538\ }
\DoxyCodeLine{00543\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_comment\_init(th\_comment\ *\_tc);}
\DoxyCodeLine{00553\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_comment\_add(th\_comment\ *\_tc,\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\_comment);}
\DoxyCodeLine{00564\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_comment\_add\_tag(th\_comment\ *\_tc,\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\_tag,}
\DoxyCodeLine{00565\ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\_val);}
\DoxyCodeLine{00581\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{char}\ *th\_comment\_query(th\_comment\ *\_tc,\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\_tag,\textcolor{keywordtype}{int}\ \_count);}
\DoxyCodeLine{00589\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{int}\ th\_comment\_query\_count(th\_comment\ *\_tc,\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\_tag);}
\DoxyCodeLine{00595\ \textcolor{keyword}{extern}\ \textcolor{keywordtype}{void}\ th\_comment\_clear(th\_comment\ *\_tc);}
\DoxyCodeLine{00598\ }
\DoxyCodeLine{00599\ }
\DoxyCodeLine{00600\ }
\DoxyCodeLine{00601\ \textcolor{preprocessor}{\#if\ defined(\_\_cplusplus)}}
\DoxyCodeLine{00602\ \}}
\DoxyCodeLine{00603\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00604\ }
\DoxyCodeLine{00605\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{/*\ OGG\_THEORA\_CODEC\_HEADER\ */}\textcolor{preprocessor}{}}

\end{DoxyCode}
