Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > e9a2bf4cbad8eb886872edae7c352314 > files > 34

libvpx-devel-1.0.0-1.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>WebM VP8 Codec SDK: vp8_scalable_patterns</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">WebM VP8 Codec SDK</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="samples.html">Sample Code</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">vp8_scalable_patterns </div>  </div>
</div>
<div class="contents">
<div class="textblock"><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  Use of this source code is governed by a BSD-style license</span>
<a name="l00005"></a>00005 <span class="comment"> *  that can be found in the LICENSE file in the root of the source</span>
<a name="l00006"></a>00006 <span class="comment"> *  tree. An additional intellectual property rights grant can be found</span>
<a name="l00007"></a>00007 <span class="comment"> *  in the file PATENTS.  All contributing project authors may</span>
<a name="l00008"></a>00008 <span class="comment"> *  be found in the AUTHORS file in the root of the source tree.</span>
<a name="l00009"></a>00009 <span class="comment"> */</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="comment">/*</span>
<a name="l00013"></a>00013 <span class="comment"> * This is an example demonstrating how to implement a multi-layer VP8</span>
<a name="l00014"></a>00014 <span class="comment"> * encoding scheme based on temporal scalability for video applications</span>
<a name="l00015"></a>00015 <span class="comment"> * that benefit from a scalable bitstream.</span>
<a name="l00016"></a>00016 <span class="comment"> */</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;stdarg.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#define VPX_CODEC_DISABLE_COMPAT 1</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="vpx__encoder_8h.html" title="Describes the encoder algorithm interface to applications.">vpx/vpx_encoder.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="vp8cx_8h.html" title="Provides definitions for using the VP8 encoder algorithm within the vpx Codec Interface.">vpx/vp8cx.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#define interface (vpx_codec_vp8_cx())</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define fourcc    0x30385056</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#define IVF_FILE_HDR_SZ  (32)</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define IVF_FRAME_HDR_SZ (12)</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="keyword">static</span> <span class="keywordtype">void</span> mem_put_le16(<span class="keywordtype">char</span> *mem, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val) {
<a name="l00031"></a>00031     mem[0] = val;
<a name="l00032"></a>00032     mem[1] = val&gt;&gt;8;
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="keyword">static</span> <span class="keywordtype">void</span> mem_put_le32(<span class="keywordtype">char</span> *mem, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val) {
<a name="l00036"></a>00036     mem[0] = val;
<a name="l00037"></a>00037     mem[1] = val&gt;&gt;8;
<a name="l00038"></a>00038     mem[2] = val&gt;&gt;16;
<a name="l00039"></a>00039     mem[3] = val&gt;&gt;24;
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="keyword">static</span> <span class="keywordtype">void</span> die(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) {
<a name="l00043"></a>00043     va_list ap;
<a name="l00044"></a>00044 
<a name="l00045"></a>00045     va_start(ap, fmt);
<a name="l00046"></a>00046     vprintf(fmt, ap);
<a name="l00047"></a>00047     <span class="keywordflow">if</span>(fmt[strlen(fmt)-1] != <span class="charliteral">&#39;\n&#39;</span>)
<a name="l00048"></a>00048         printf(<span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00049"></a>00049     exit(EXIT_FAILURE);
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keywordtype">void</span> die_codec(<a class="code" href="structvpx__codec__ctx.html" title="Codec context structure.">vpx_codec_ctx_t</a> *ctx, <span class="keyword">const</span> <span class="keywordtype">char</span> *s) {
<a name="l00053"></a>00053     <span class="keyword">const</span> <span class="keywordtype">char</span> *detail = <a class="code" href="group__codec.html#ga29273cb552ed1a437fe263c4a0a54300" title="Retrieve detailed error information for codec context.">vpx_codec_error_detail</a>(ctx);
<a name="l00054"></a>00054 
<a name="l00055"></a>00055     printf(<span class="stringliteral">&quot;%s: %s\n&quot;</span>, s, <a class="code" href="group__codec.html#ga4d265df00d42b36a4f0e3eb83fc22c5e" title="Retrieve error synopsis for codec context.">vpx_codec_error</a>(ctx));
<a name="l00056"></a>00056     <span class="keywordflow">if</span>(detail)
<a name="l00057"></a>00057         printf(<span class="stringliteral">&quot;    %s\n&quot;</span>,detail);
<a name="l00058"></a>00058     exit(EXIT_FAILURE);
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 <span class="keyword">static</span> <span class="keywordtype">int</span> read_frame(FILE *f, <a class="code" href="structvpx__image.html" title="Image Descriptor.">vpx_image_t</a> *img) {
<a name="l00062"></a>00062     <span class="keywordtype">size_t</span> nbytes, to_read;
<a name="l00063"></a>00063     <span class="keywordtype">int</span>    res = 1;
<a name="l00064"></a>00064 
<a name="l00065"></a>00065     to_read = img-&gt;<a class="code" href="structvpx__image.html#ac7b7d569142f878155b28141653adcd6">w</a>*img-&gt;<a class="code" href="structvpx__image.html#a9d1070804dfe08cd5becd68d597fee69">h</a>*3/2;
<a name="l00066"></a>00066     nbytes = fread(img-&gt;<a class="code" href="structvpx__image.html#ab6258308ba7a5f4a113348120e20e2ce">planes</a>[0], 1, to_read, f);
<a name="l00067"></a>00067     <span class="keywordflow">if</span>(nbytes != to_read) {
<a name="l00068"></a>00068         res = 0;
<a name="l00069"></a>00069         <span class="keywordflow">if</span>(nbytes &gt; 0)
<a name="l00070"></a>00070             printf(<span class="stringliteral">&quot;Warning: Read partial frame. Check your width &amp; height!\n&quot;</span>);
<a name="l00071"></a>00071     }
<a name="l00072"></a>00072     <span class="keywordflow">return</span> res;
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">void</span> write_ivf_file_header(FILE *outfile,
<a name="l00076"></a>00076                                   <span class="keyword">const</span> <a class="code" href="structvpx__codec__enc__cfg.html" title="Encoder configuration structure.">vpx_codec_enc_cfg_t</a> *cfg,
<a name="l00077"></a>00077                                   <span class="keywordtype">int</span> frame_cnt) {
<a name="l00078"></a>00078     <span class="keywordtype">char</span> header[32];
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     <span class="keywordflow">if</span>(cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a70d62d87aae7d1168746577f14a6dccf" title="Multi-pass Encoding Mode.">g_pass</a> != <a class="code" href="group__encoder.html#gga476c5417f9c15a1dc5d3f68fa44c493fa7b6943a41868e8e26a77e9500f139ca1">VPX_RC_ONE_PASS</a> &amp;&amp; cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a70d62d87aae7d1168746577f14a6dccf" title="Multi-pass Encoding Mode.">g_pass</a> != <a class="code" href="group__encoder.html#gga476c5417f9c15a1dc5d3f68fa44c493fa65da543b956d6a9b1f301ab8cc90d3a7">VPX_RC_LAST_PASS</a>)
<a name="l00081"></a>00081         <span class="keywordflow">return</span>;
<a name="l00082"></a>00082     header[0] = <span class="charliteral">&#39;D&#39;</span>;
<a name="l00083"></a>00083     header[1] = <span class="charliteral">&#39;K&#39;</span>;
<a name="l00084"></a>00084     header[2] = <span class="charliteral">&#39;I&#39;</span>;
<a name="l00085"></a>00085     header[3] = <span class="charliteral">&#39;F&#39;</span>;
<a name="l00086"></a>00086     mem_put_le16(header+4,  0);                   <span class="comment">/* version */</span>
<a name="l00087"></a>00087     mem_put_le16(header+6,  32);                  <span class="comment">/* headersize */</span>
<a name="l00088"></a>00088     mem_put_le32(header+8,  fourcc);              <span class="comment">/* headersize */</span>
<a name="l00089"></a>00089     mem_put_le16(header+12, cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a5c165f5b41ca1158f2883983a2b7709c" title="Width of the frame.">g_w</a>);            <span class="comment">/* width */</span>
<a name="l00090"></a>00090     mem_put_le16(header+14, cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a4132bd89ce85bce7c08f2cc3b6f2b82e" title="Height of the frame.">g_h</a>);            <span class="comment">/* height */</span>
<a name="l00091"></a>00091     mem_put_le32(header+16, cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a6498d378e4c29ef3e22258289e481087" title="Stream timebase units.">g_timebase</a>.<a class="code" href="structvpx__rational.html#a29dd2ab4001377b3aa21885ef969759f">den</a>); <span class="comment">/* rate */</span>
<a name="l00092"></a>00092     mem_put_le32(header+20, cfg-&gt;<a class="code" href="structvpx__codec__enc__cfg.html#a6498d378e4c29ef3e22258289e481087" title="Stream timebase units.">g_timebase</a>.<a class="code" href="structvpx__rational.html#ae7774f21a22c9bef3aa73156c79f4731">num</a>); <span class="comment">/* scale */</span>
<a name="l00093"></a>00093     mem_put_le32(header+24, frame_cnt);           <span class="comment">/* length */</span>
<a name="l00094"></a>00094     mem_put_le32(header+28, 0);                   <span class="comment">/* unused */</span>
<a name="l00095"></a>00095 
<a name="l00096"></a>00096     <span class="keywordflow">if</span>(fwrite(header, 1, 32, outfile));
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 <span class="keyword">static</span> <span class="keywordtype">void</span> write_ivf_frame_header(FILE *outfile,
<a name="l00101"></a>00101                                    <span class="keyword">const</span> <a class="code" href="structvpx__codec__cx__pkt.html" title="Encoder output packet.">vpx_codec_cx_pkt_t</a> *pkt)
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103     <span class="keywordtype">char</span>             header[12];
<a name="l00104"></a>00104     <a class="code" href="group__encoder.html#ga7e711b0a71c65aef8f0faea8bd57b05f" title="Time Stamp Type.">vpx_codec_pts_t</a>  pts;
<a name="l00105"></a>00105 
<a name="l00106"></a>00106     <span class="keywordflow">if</span>(pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a41f395b39516343c1329a4a85a0084f2">kind</a> != <a class="code" href="group__encoder.html#gga28a79375279536526552af3a83d2ed72a2261aae5594289400e812fb1e6b6b0cc">VPX_CODEC_CX_FRAME_PKT</a>)
<a name="l00107"></a>00107         <span class="keywordflow">return</span>;
<a name="l00108"></a>00108 
<a name="l00109"></a>00109     pts = pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a7f97b060a23b7e89fe5b885c0074f696">data</a>.<a class="code" href="structvpx__codec__cx__pkt.html#a81e33bf4408a3983abb16492fee359ff">frame</a>.pts;
<a name="l00110"></a>00110     mem_put_le32(header, pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a7f97b060a23b7e89fe5b885c0074f696">data</a>.<a class="code" href="structvpx__codec__cx__pkt.html#a81e33bf4408a3983abb16492fee359ff">frame</a>.sz);
<a name="l00111"></a>00111     mem_put_le32(header+4, pts&amp;0xFFFFFFFF);
<a name="l00112"></a>00112     mem_put_le32(header+8, pts &gt;&gt; 32);
<a name="l00113"></a>00113 
<a name="l00114"></a>00114     <span class="keywordflow">if</span>(fwrite(header, 1, 12, outfile));
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <span class="keyword">static</span> <span class="keywordtype">int</span> mode_to_num_layers[7] = {2, 2, 3, 3, 3, 3, 5};
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) {
<a name="l00120"></a>00120     FILE                *infile, *outfile[MAX_LAYERS];
<a name="l00121"></a>00121     <a class="code" href="structvpx__codec__ctx.html" title="Codec context structure.">vpx_codec_ctx_t</a>      codec;
<a name="l00122"></a>00122     <a class="code" href="structvpx__codec__enc__cfg.html" title="Encoder configuration structure.">vpx_codec_enc_cfg_t</a>  cfg;
<a name="l00123"></a>00123     <span class="keywordtype">int</span>                  frame_cnt = 0;
<a name="l00124"></a>00124     <a class="code" href="structvpx__image.html" title="Image Descriptor.">vpx_image_t</a>          raw;
<a name="l00125"></a>00125     <a class="code" href="group__codec.html#gada1084710837ad363b92f2379dd2b8d2" title="Algorithm return codes.">vpx_codec_err_t</a>      res;
<a name="l00126"></a>00126     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>         width;
<a name="l00127"></a>00127     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>         height;
<a name="l00128"></a>00128     <span class="keywordtype">int</span>                  frame_avail;
<a name="l00129"></a>00129     <span class="keywordtype">int</span>                  got_data;
<a name="l00130"></a>00130     <span class="keywordtype">int</span>                  flags = 0;
<a name="l00131"></a>00131     <span class="keywordtype">int</span>                  i;
<a name="l00132"></a>00132     <span class="keywordtype">int</span>                  pts = 0;              <span class="comment">// PTS starts at 0</span>
<a name="l00133"></a>00133     <span class="keywordtype">int</span>                  frame_duration = 1;   <span class="comment">// 1 timebase tick per frame</span>
<a name="l00134"></a>00134 
<a name="l00135"></a>00135     <span class="keywordtype">int</span>                  layering_mode = 0;
<a name="l00136"></a>00136     <span class="keywordtype">int</span>                  frames_in_layer[MAX_LAYERS] = {0};
<a name="l00137"></a>00137     <span class="keywordtype">int</span>                  layer_flags[MAX_PERIODICITY] = {0};
<a name="l00138"></a>00138 
<a name="l00139"></a>00139     <span class="comment">// Check usage and arguments</span>
<a name="l00140"></a>00140     <span class="keywordflow">if</span> (argc &lt; 9)
<a name="l00141"></a>00141         die(<span class="stringliteral">&quot;Usage: %s &lt;infile&gt; &lt;outfile&gt; &lt;width&gt; &lt;height&gt; &lt;rate_num&gt; &quot;</span>
<a name="l00142"></a>00142             <span class="stringliteral">&quot; &lt;rate_den&gt; &lt;mode&gt; &lt;Rate_0&gt; ... &lt;Rate_nlayers-1&gt;\n&quot;</span>, argv[0]);
<a name="l00143"></a>00143 
<a name="l00144"></a>00144     width  = strtol (argv[3], NULL, 0);
<a name="l00145"></a>00145     height = strtol (argv[4], NULL, 0);
<a name="l00146"></a>00146     <span class="keywordflow">if</span> (width &lt; 16 || width%2 || height &lt;16 || height%2)
<a name="l00147"></a>00147         die (<span class="stringliteral">&quot;Invalid resolution: %d x %d&quot;</span>, width, height);
<a name="l00148"></a>00148 
<a name="l00149"></a>00149     <span class="keywordflow">if</span> (!sscanf(argv[7], <span class="stringliteral">&quot;%d&quot;</span>, &amp;layering_mode))
<a name="l00150"></a>00150         die (<span class="stringliteral">&quot;Invalid mode %s&quot;</span>, argv[7]);
<a name="l00151"></a>00151     <span class="keywordflow">if</span> (layering_mode&lt;0 || layering_mode&gt;6)
<a name="l00152"></a>00152         die (<span class="stringliteral">&quot;Invalid mode (0..6) %s&quot;</span>, argv[7]);
<a name="l00153"></a>00153 
<a name="l00154"></a>00154     <span class="keywordflow">if</span> (argc != 8+mode_to_num_layers[layering_mode])
<a name="l00155"></a>00155         die (<span class="stringliteral">&quot;Invalid number of arguments&quot;</span>);
<a name="l00156"></a>00156 
<a name="l00157"></a>00157     <span class="keywordflow">if</span> (!<a class="code" href="vpx__image_8h.html#ab80398f28ca880368a922fa979eb66c1" title="Open a descriptor, allocating storage for the underlying image.">vpx_img_alloc</a> (&amp;raw, <a class="code" href="vpx__image_8h.html#a7a30a7bff7400fb83ad45fede5077193af17ce49c9a6efd7c8c8ea8928d4ce26c">VPX_IMG_FMT_I420</a>, width, height, 1))
<a name="l00158"></a>00158         die (<span class="stringliteral">&quot;Failed to allocate image&quot;</span>, width, height);
<a name="l00159"></a>00159 
<a name="l00160"></a>00160     printf(<span class="stringliteral">&quot;Using %s\n&quot;</span>,<a class="code" href="group__codec.html#ga9eee39f450d8cdcf5aba0e2bda6e5aa8" title="Return the name for a given interface.">vpx_codec_iface_name</a>(interface));
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     <span class="comment">// Populate encoder configuration</span>
<a name="l00163"></a>00163     res = <a class="code" href="group__encoder.html#ga9ab8c79623312e9c5d5405d66a788f59" title="Get a default configuration.">vpx_codec_enc_config_default</a>(interface, &amp;cfg, 0);
<a name="l00164"></a>00164     <span class="keywordflow">if</span>(res) {
<a name="l00165"></a>00165         printf(<span class="stringliteral">&quot;Failed to get config: %s\n&quot;</span>, <a class="code" href="group__codec.html#gaaddf5c1f609ef18c7c8800d102fcefa6" title="Convert error number to printable string.">vpx_codec_err_to_string</a>(res));
<a name="l00166"></a>00166         <span class="keywordflow">return</span> EXIT_FAILURE;
<a name="l00167"></a>00167     }
<a name="l00168"></a>00168 
<a name="l00169"></a>00169     <span class="comment">// Update the default configuration with our settings</span>
<a name="l00170"></a>00170     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a5c165f5b41ca1158f2883983a2b7709c" title="Width of the frame.">g_w</a> = width;
<a name="l00171"></a>00171     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4132bd89ce85bce7c08f2cc3b6f2b82e" title="Height of the frame.">g_h</a> = height;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173     <span class="comment">// Timebase format e.g. 30fps: numerator=1, demoninator=30</span>
<a name="l00174"></a>00174     <span class="keywordflow">if</span> (!sscanf (argv[5], <span class="stringliteral">&quot;%d&quot;</span>, &amp;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a6498d378e4c29ef3e22258289e481087" title="Stream timebase units.">g_timebase</a>.<a class="code" href="structvpx__rational.html#ae7774f21a22c9bef3aa73156c79f4731">num</a> ))
<a name="l00175"></a>00175         die (<span class="stringliteral">&quot;Invalid timebase numerator %s&quot;</span>, argv[5]);
<a name="l00176"></a>00176     <span class="keywordflow">if</span> (!sscanf (argv[6], <span class="stringliteral">&quot;%d&quot;</span>, &amp;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a6498d378e4c29ef3e22258289e481087" title="Stream timebase units.">g_timebase</a>.<a class="code" href="structvpx__rational.html#a29dd2ab4001377b3aa21885ef969759f">den</a> ))
<a name="l00177"></a>00177         die (<span class="stringliteral">&quot;Invalid timebase denominator %s&quot;</span>, argv[6]);
<a name="l00178"></a>00178 
<a name="l00179"></a>00179     <span class="keywordflow">for</span> (i=8; i&lt;8+mode_to_num_layers[layering_mode]; i++)
<a name="l00180"></a>00180         <span class="keywordflow">if</span> (!sscanf(argv[i], <span class="stringliteral">&quot;%d&quot;</span>, &amp;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#aba7ceb7a90500a8f76aff89575737f3a" title="Target bitrate for each layer.">ts_target_bitrate</a>[i-8]))
<a name="l00181"></a>00181             die (<span class="stringliteral">&quot;Invalid data rate %s&quot;</span>, argv[i]);
<a name="l00182"></a>00182 
<a name="l00183"></a>00183     <span class="comment">// Real time parameters</span>
<a name="l00184"></a>00184     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a619269f9a6904de58c4790e6806a3905" title="Temporal resampling configuration, if supported by the codec.">rc_dropframe_thresh</a> = 0;
<a name="l00185"></a>00185     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a99c415edb6c6f909a095a57c3430a116" title="Rate control algorithm to use.">rc_end_usage</a>        = <a class="code" href="group__encoder.html#ggaf50e74d91be4cae6f70dfeba5b7410d2a8b02853cb35790d60cc171a11f6c268a">VPX_CBR</a>;
<a name="l00186"></a>00186     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a02a4e2f18fb0fdfff44df8b0d9a99d6c" title="Enable/disable spatial resampling, if supported by the codec.">rc_resize_allowed</a>   = 0;
<a name="l00187"></a>00187     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a1324600e3c63faaa7717e85cf6509dd9" title="Minimum (Best Quality) Quantizer.">rc_min_quantizer</a>    = 4;
<a name="l00188"></a>00188     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a8abdd985d317b720e142335887d737df" title="Maximum (Worst Quality) Quantizer.">rc_max_quantizer</a>    = 63;
<a name="l00189"></a>00189     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad279fbb0a9fe9395340913161e28651a" title="Rate control adaptation undershoot control.">rc_undershoot_pct</a>   = 98;
<a name="l00190"></a>00190     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4f2fbd015c1b1f395cc4a4b03d4ead5f" title="Rate control adaptation overshoot control.">rc_overshoot_pct</a>    = 100;
<a name="l00191"></a>00191     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#aa9e4d6405994ef42d61d478cf6e0d5e0" title="Decoder Buffer Initial Size.">rc_buf_initial_sz</a>   = 500;
<a name="l00192"></a>00192     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#aafde485867e040a58504ad796e79e47f" title="Decoder Buffer Optimal Size.">rc_buf_optimal_sz</a>   = 600;
<a name="l00193"></a>00193     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a61866272bb588cd86d28834f420430f0" title="Decoder Buffer Size.">rc_buf_sz</a>           = 1000;
<a name="l00194"></a>00194 
<a name="l00195"></a>00195     <span class="comment">// Enable error resilient mode</span>
<a name="l00196"></a>00196     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4e17173b66ca0d7dfba9978625d7ba76" title="Enable error resilient modes.">g_error_resilient</a> = 1;
<a name="l00197"></a>00197     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a992668d9e30305f3f7ab2672ea31a890" title="Allow lagged encoding.">g_lag_in_frames</a>   = 0;
<a name="l00198"></a>00198     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a491d67f061dcdb13f60c017563e9d788" title="Keyframe placement mode.">kf_mode</a>           = <a class="code" href="group__encoder.html#gga9f461802aa4db35c04a8b23837987f40a56513f60cbf3434ca0092173005d0ab2">VPX_KF_DISABLED</a>;
<a name="l00199"></a>00199 
<a name="l00200"></a>00200     <span class="comment">// Disable automatic keyframe placement</span>
<a name="l00201"></a>00201     cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a0a7b5444ecb09745cbe8d5af17553846" title="Keyframe minimum interval.">kf_min_dist</a> = cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ae018440136e271743376730413d25a9b" title="Keyframe maximum interval.">kf_max_dist</a> = 1000;
<a name="l00202"></a>00202 
<a name="l00203"></a>00203     <span class="comment">// Temporal scaling parameters:</span>
<a name="l00204"></a>00204     <span class="comment">// NOTE: The 3 prediction frames cannot be used interchangeably due to</span>
<a name="l00205"></a>00205     <span class="comment">// differences in the way they are handled throughout the code. The</span>
<a name="l00206"></a>00206     <span class="comment">// frames should be allocated to layers in the order LAST, GF, ARF.</span>
<a name="l00207"></a>00207     <span class="comment">// Other combinations work, but may produce slightly inferior results.</span>
<a name="l00208"></a>00208     <span class="keywordflow">switch</span> (layering_mode)
<a name="l00209"></a>00209     {
<a name="l00210"></a>00210 
<a name="l00211"></a>00211     <span class="keywordflow">case</span> 0:
<a name="l00212"></a>00212     {
<a name="l00213"></a>00213         <span class="comment">// 2-layers, 2-frame period</span>
<a name="l00214"></a>00214         <span class="keywordtype">int</span> ids[2] = {0,1};
<a name="l00215"></a>00215         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 2;
<a name="l00216"></a>00216         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 2;
<a name="l00217"></a>00217         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 2;
<a name="l00218"></a>00218         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 1;
<a name="l00219"></a>00219         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00220"></a>00220 
<a name="l00221"></a>00221 <span class="preprocessor">#if 1</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span>        <span class="comment">// 0=L, 1=GF, Intra-layer prediction enabled</span>
<a name="l00223"></a>00223         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00224"></a>00224                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> |
<a name="l00225"></a>00225                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a>;
<a name="l00226"></a>00226         layer_flags[1] = <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> | <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> |
<a name="l00227"></a>00227                          <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a>;
<a name="l00228"></a>00228 <span class="preprocessor">#else</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span>        <span class="comment">// 0=L, 1=GF, Intra-layer prediction disabled</span>
<a name="l00230"></a>00230         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00231"></a>00231                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> |
<a name="l00232"></a>00232                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a>;
<a name="l00233"></a>00233         layer_flags[1] = <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> | <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> |
<a name="l00234"></a>00234                          <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> | <a class="code" href="group__vp8__encoder.html#gafb51c67e5743275146bc1fc425727da3" title="Don&#39;t reference the last frame.">VP8_EFLAG_NO_REF_LAST</a>;
<a name="l00235"></a>00235 <span class="preprocessor">#endif</span>
<a name="l00236"></a>00236 <span class="preprocessor"></span>        <span class="keywordflow">break</span>;
<a name="l00237"></a>00237     }
<a name="l00238"></a>00238 
<a name="l00239"></a>00239     <span class="keywordflow">case</span> 1:
<a name="l00240"></a>00240     {
<a name="l00241"></a>00241         <span class="comment">// 2-layers, 3-frame period</span>
<a name="l00242"></a>00242         <span class="keywordtype">int</span> ids[3] = {0,1,1};
<a name="l00243"></a>00243         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 2;
<a name="l00244"></a>00244         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 3;
<a name="l00245"></a>00245         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 3;
<a name="l00246"></a>00246         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 1;
<a name="l00247"></a>00247         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00248"></a>00248 
<a name="l00249"></a>00249         <span class="comment">// 0=L, 1=GF, Intra-layer prediction enabled</span>
<a name="l00250"></a>00250         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00251"></a>00251                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00252"></a>00252                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00253"></a>00253         layer_flags[1] =
<a name="l00254"></a>00254         layer_flags[2] = <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a>  |
<a name="l00255"></a>00255                          <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> |
<a name="l00256"></a>00256                                                 <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a>;
<a name="l00257"></a>00257         <span class="keywordflow">break</span>;
<a name="l00258"></a>00258     }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260     <span class="keywordflow">case</span> 2:
<a name="l00261"></a>00261     {
<a name="l00262"></a>00262         <span class="comment">// 3-layers, 6-frame period</span>
<a name="l00263"></a>00263         <span class="keywordtype">int</span> ids[6] = {0,2,2,1,2,2};
<a name="l00264"></a>00264         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 3;
<a name="l00265"></a>00265         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 6;
<a name="l00266"></a>00266         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 6;
<a name="l00267"></a>00267         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 3;
<a name="l00268"></a>00268         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[2] = 1;
<a name="l00269"></a>00269         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00270"></a>00270 
<a name="l00271"></a>00271         <span class="comment">// 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled</span>
<a name="l00272"></a>00272         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00273"></a>00273                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00274"></a>00274                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00275"></a>00275         layer_flags[3] = <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> |
<a name="l00276"></a>00276                                                 <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a>;
<a name="l00277"></a>00277         layer_flags[1] =
<a name="l00278"></a>00278         layer_flags[2] =
<a name="l00279"></a>00279         layer_flags[4] =
<a name="l00280"></a>00280         layer_flags[5] = <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a>;
<a name="l00281"></a>00281         <span class="keywordflow">break</span>;
<a name="l00282"></a>00282     }
<a name="l00283"></a>00283 
<a name="l00284"></a>00284     <span class="keywordflow">case</span> 3:
<a name="l00285"></a>00285     {
<a name="l00286"></a>00286         <span class="comment">// 3-layers, 4-frame period</span>
<a name="l00287"></a>00287         <span class="keywordtype">int</span> ids[4] = {0,2,1,2};
<a name="l00288"></a>00288         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 3;
<a name="l00289"></a>00289         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 4;
<a name="l00290"></a>00290         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 4;
<a name="l00291"></a>00291         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 2;
<a name="l00292"></a>00292         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[2] = 1;
<a name="l00293"></a>00293         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00294"></a>00294 
<a name="l00295"></a>00295         <span class="comment">// 0=L, 1=GF, 2=ARF, Intra-layer prediction disabled</span>
<a name="l00296"></a>00296         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00297"></a>00297                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00298"></a>00298                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00299"></a>00299         layer_flags[2] = <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00300"></a>00300                          <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a> |
<a name="l00301"></a>00301                          <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a>;
<a name="l00302"></a>00302         layer_flags[1] =
<a name="l00303"></a>00303         layer_flags[3] = <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00304"></a>00304                          <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> | <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> |
<a name="l00305"></a>00305                          <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00306"></a>00306         <span class="keywordflow">break</span>;
<a name="l00307"></a>00307     }
<a name="l00308"></a>00308 
<a name="l00309"></a>00309     <span class="keywordflow">case</span> 4:
<a name="l00310"></a>00310     {
<a name="l00311"></a>00311         <span class="comment">// 3-layers, 4-frame period</span>
<a name="l00312"></a>00312         <span class="keywordtype">int</span> ids[4] = {0,2,1,2};
<a name="l00313"></a>00313         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 3;
<a name="l00314"></a>00314         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 4;
<a name="l00315"></a>00315         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 4;
<a name="l00316"></a>00316         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 2;
<a name="l00317"></a>00317         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[2] = 1;
<a name="l00318"></a>00318         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00319"></a>00319 
<a name="l00320"></a>00320         <span class="comment">// 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled in layer 1,</span>
<a name="l00321"></a>00321         <span class="comment">// disabled in layer 2</span>
<a name="l00322"></a>00322         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00323"></a>00323                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00324"></a>00324                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00325"></a>00325         layer_flags[2] = <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00326"></a>00326                          <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00327"></a>00327         layer_flags[1] =
<a name="l00328"></a>00328         layer_flags[3] = <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00329"></a>00329                          <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> | <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> |
<a name="l00330"></a>00330                          <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00331"></a>00331         <span class="keywordflow">break</span>;
<a name="l00332"></a>00332     }
<a name="l00333"></a>00333 
<a name="l00334"></a>00334     <span class="keywordflow">case</span> 5:
<a name="l00335"></a>00335     {
<a name="l00336"></a>00336         <span class="comment">// 3-layers, 4-frame period</span>
<a name="l00337"></a>00337         <span class="keywordtype">int</span> ids[4] = {0,2,1,2};
<a name="l00338"></a>00338         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 3;
<a name="l00339"></a>00339         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 4;
<a name="l00340"></a>00340         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 4;
<a name="l00341"></a>00341         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 2;
<a name="l00342"></a>00342         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[2] = 1;
<a name="l00343"></a>00343         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00344"></a>00344 
<a name="l00345"></a>00345         <span class="comment">// 0=L, 1=GF, 2=ARF, Intra-layer prediction enabled</span>
<a name="l00346"></a>00346         layer_flags[0] = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>  |
<a name="l00347"></a>00347                          <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> | <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00348"></a>00348                          <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00349"></a>00349         layer_flags[2] = <a class="code" href="group__vp8__encoder.html#ga650ab0baea12be91082226a5cc18776a" title="Don&#39;t reference the alternate reference frame.">VP8_EFLAG_NO_REF_ARF</a> |
<a name="l00350"></a>00350                          <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> | <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>;
<a name="l00351"></a>00351         layer_flags[1] =
<a name="l00352"></a>00352         layer_flags[3] = <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> | <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a>;
<a name="l00353"></a>00353         <span class="keywordflow">break</span>;
<a name="l00354"></a>00354     }
<a name="l00355"></a>00355 
<a name="l00356"></a>00356     <span class="keywordflow">case</span> 6:
<a name="l00357"></a>00357     {
<a name="l00358"></a>00358         <span class="comment">// NOTE: Probably of academic interest only</span>
<a name="l00359"></a>00359 
<a name="l00360"></a>00360         <span class="comment">// 5-layers, 16-frame period</span>
<a name="l00361"></a>00361         <span class="keywordtype">int</span> ids[16] = {0,4,3,4,2,4,3,4,1,4,3,4,2,4,3,4};
<a name="l00362"></a>00362         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>     = 5;
<a name="l00363"></a>00363         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>       = 16;
<a name="l00364"></a>00364         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[0] = 16;
<a name="l00365"></a>00365         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[1] = 8;
<a name="l00366"></a>00366         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[2] = 4;
<a name="l00367"></a>00367         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[3] = 2;
<a name="l00368"></a>00368         cfg.<a class="code" href="structvpx__codec__enc__cfg.html#ad40c30846ef8ef1d8684f10a491ec535" title="Frame rate decimation factor for each layer.">ts_rate_decimator</a>[4] = 1;
<a name="l00369"></a>00369         memcpy(cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>, ids, <span class="keyword">sizeof</span>(ids));
<a name="l00370"></a>00370 
<a name="l00371"></a>00371         layer_flags[0]  = <a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>;
<a name="l00372"></a>00372         layer_flags[1]  =
<a name="l00373"></a>00373         layer_flags[3]  =
<a name="l00374"></a>00374         layer_flags[5]  =
<a name="l00375"></a>00375         layer_flags[7]  =
<a name="l00376"></a>00376         layer_flags[9]  =
<a name="l00377"></a>00377         layer_flags[11] =
<a name="l00378"></a>00378         layer_flags[13] =
<a name="l00379"></a>00379         layer_flags[15] = <a class="code" href="group__vp8__encoder.html#ga602edb6b02a89cb2db7a16d6dffba583" title="Don&#39;t update the last frame.">VP8_EFLAG_NO_UPD_LAST</a> |
<a name="l00380"></a>00380                           <a class="code" href="group__vp8__encoder.html#gab01d066c5236457d345ce1cab4c41d6b" title="Don&#39;t update the golden frame.">VP8_EFLAG_NO_UPD_GF</a>   |
<a name="l00381"></a>00381                           <a class="code" href="group__vp8__encoder.html#ga1cff46a5287e73a620660030d40b9e6c" title="Don&#39;t update the alternate reference frame.">VP8_EFLAG_NO_UPD_ARF</a>  |
<a name="l00382"></a>00382                           <a class="code" href="group__vp8__encoder.html#ga5b91ad179910d4efc23aef66c7b2148b" title="Disable entropy update.">VP8_EFLAG_NO_UPD_ENTROPY</a>;
<a name="l00383"></a>00383         layer_flags[2]  =
<a name="l00384"></a>00384         layer_flags[6]  =
<a name="l00385"></a>00385         layer_flags[10] =
<a name="l00386"></a>00386         layer_flags[14] = 0;
<a name="l00387"></a>00387         layer_flags[4]  =
<a name="l00388"></a>00388         layer_flags[12] = <a class="code" href="group__vp8__encoder.html#gafb51c67e5743275146bc1fc425727da3" title="Don&#39;t reference the last frame.">VP8_EFLAG_NO_REF_LAST</a>;
<a name="l00389"></a>00389         layer_flags[8]  = <a class="code" href="group__vp8__encoder.html#gafb51c67e5743275146bc1fc425727da3" title="Don&#39;t reference the last frame.">VP8_EFLAG_NO_REF_LAST</a> | <a class="code" href="group__vp8__encoder.html#gabb5e95343a2738abef44eca13059da33" title="Don&#39;t reference the golden frame.">VP8_EFLAG_NO_REF_GF</a> |
<a name="l00390"></a>00390                           <a class="code" href="group__vp8__encoder.html#ga5b91ad179910d4efc23aef66c7b2148b" title="Disable entropy update.">VP8_EFLAG_NO_UPD_ENTROPY</a>;
<a name="l00391"></a>00391         <span class="keywordflow">break</span>;
<a name="l00392"></a>00392     }
<a name="l00393"></a>00393 
<a name="l00394"></a>00394     <span class="keywordflow">default</span>:
<a name="l00395"></a>00395         <span class="keywordflow">break</span>;
<a name="l00396"></a>00396     }
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     <span class="comment">// Open input file</span>
<a name="l00399"></a>00399     <span class="keywordflow">if</span>(!(infile = fopen(argv[1], <span class="stringliteral">&quot;rb&quot;</span>)))
<a name="l00400"></a>00400         die(<span class="stringliteral">&quot;Failed to open %s for reading&quot;</span>, argv[1]);
<a name="l00401"></a>00401 
<a name="l00402"></a>00402     <span class="comment">// Open an output file for each stream</span>
<a name="l00403"></a>00403     <span class="keywordflow">for</span> (i=0; i&lt;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>; i++)
<a name="l00404"></a>00404     {
<a name="l00405"></a>00405         <span class="keywordtype">char</span> file_name[512];
<a name="l00406"></a>00406         sprintf (file_name, <span class="stringliteral">&quot;%s_%d.ivf&quot;</span>, argv[2], i);
<a name="l00407"></a>00407         <span class="keywordflow">if</span> (!(outfile[i] = fopen(file_name, <span class="stringliteral">&quot;wb&quot;</span>)))
<a name="l00408"></a>00408             die(<span class="stringliteral">&quot;Failed to open %s for writing&quot;</span>, file_name);
<a name="l00409"></a>00409         write_ivf_file_header(outfile[i], &amp;cfg, 0);
<a name="l00410"></a>00410     }
<a name="l00411"></a>00411 
<a name="l00412"></a>00412     <span class="comment">// Initialize codec</span>
<a name="l00413"></a>00413     <span class="keywordflow">if</span> (<a class="code" href="group__encoder.html#ga3d490a2a9a6acd7c9ef82a603155f3cf" title="Convenience macro for vpx_codec_enc_init_ver()">vpx_codec_enc_init</a> (&amp;codec, interface, &amp;cfg, 0))
<a name="l00414"></a>00414         die_codec (&amp;codec, <span class="stringliteral">&quot;Failed to initialize encoder&quot;</span>);
<a name="l00415"></a>00415 
<a name="l00416"></a>00416     <span class="comment">// Cap CPU &amp; first I-frame size</span>
<a name="l00417"></a>00417     <a class="code" href="group__codec.html#gac1b91e04698c1bd4c0a2b8aa85b08cd2" title="vpx_codec_control wrapper macro">vpx_codec_control</a> (&amp;codec, <a class="code" href="group__vp8__encoder.html#gga6deae3d561c838952552c3d3756322eca953ff0eaa2fcdc2ecd627e449b026853" title="control function to set vp8 encoder cpuused">VP8E_SET_CPUUSED</a>, -6);
<a name="l00418"></a>00418     <a class="code" href="group__codec.html#gac1b91e04698c1bd4c0a2b8aa85b08cd2" title="vpx_codec_control wrapper macro">vpx_codec_control</a> (&amp;codec, <a class="code" href="group__vp8__encoder.html#gga6deae3d561c838952552c3d3756322eca09c69ff4a3aabdb307d4f24027dfc4c1" title="Max data rate for Intra frames.">VP8E_SET_MAX_INTRA_BITRATE_PCT</a>, 600);
<a name="l00419"></a>00419 
<a name="l00420"></a>00420     frame_avail = 1;
<a name="l00421"></a>00421     <span class="keywordflow">while</span> (frame_avail || got_data) {
<a name="l00422"></a>00422         <a class="code" href="group__codec.html#ga6ea348f76b1f8a1fe50e14db684146c6" title="Iterator.">vpx_codec_iter_t</a> iter = NULL;
<a name="l00423"></a>00423         <span class="keyword">const</span> <a class="code" href="structvpx__codec__cx__pkt.html" title="Encoder output packet.">vpx_codec_cx_pkt_t</a> *pkt;
<a name="l00424"></a>00424 
<a name="l00425"></a>00425         flags = layer_flags[frame_cnt % cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>];
<a name="l00426"></a>00426 
<a name="l00427"></a>00427         frame_avail = read_frame(infile, &amp;raw);
<a name="l00428"></a>00428         <span class="keywordflow">if</span> (<a class="code" href="group__encoder.html#gaf990542e2aeb389f05fae3e9c7803639" title="Encode a frame.">vpx_codec_encode</a>(&amp;codec, frame_avail? &amp;raw : NULL, pts,
<a name="l00429"></a>00429                             1, flags, <a class="code" href="group__encoder.html#ga04253cc9ec1146d72fa8bb86bcf32144">VPX_DL_REALTIME</a>))
<a name="l00430"></a>00430             die_codec(&amp;codec, <span class="stringliteral">&quot;Failed to encode frame&quot;</span>);
<a name="l00431"></a>00431 
<a name="l00432"></a>00432         <span class="comment">// Reset KF flag</span>
<a name="l00433"></a>00433         layer_flags[0] &amp;= ~<a class="code" href="group__encoder.html#ga4c4f4e3cbb5225d2c6c050e2d1e948fa">VPX_EFLAG_FORCE_KF</a>;
<a name="l00434"></a>00434 
<a name="l00435"></a>00435         got_data = 0;
<a name="l00436"></a>00436         <span class="keywordflow">while</span> ( (pkt = <a class="code" href="group__encoder.html#gae81cab25d66cf3bc59f1f75f8a5af720" title="Encoded data iterator.">vpx_codec_get_cx_data</a>(&amp;codec, &amp;iter)) ) {
<a name="l00437"></a>00437             got_data = 1;
<a name="l00438"></a>00438             <span class="keywordflow">switch</span> (pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a41f395b39516343c1329a4a85a0084f2">kind</a>) {
<a name="l00439"></a>00439             <span class="keywordflow">case</span> <a class="code" href="group__encoder.html#gga28a79375279536526552af3a83d2ed72a2261aae5594289400e812fb1e6b6b0cc">VPX_CODEC_CX_FRAME_PKT</a>:
<a name="l00440"></a>00440                 <span class="keywordflow">for</span> (i=cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4d105d2470dbfb7210b33d298f1cf1f6" title="Template defining the membership of frames to coding layers.">ts_layer_id</a>[frame_cnt % cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a4ec338780115dd270acf0dac24193474" title="Length of the sequence defining frame layer membership.">ts_periodicity</a>];
<a name="l00441"></a>00441                                               i&lt;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>; i++)
<a name="l00442"></a>00442                 {
<a name="l00443"></a>00443                     write_ivf_frame_header(outfile[i], pkt);
<a name="l00444"></a>00444                     <span class="keywordflow">if</span> (fwrite(pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a7f97b060a23b7e89fe5b885c0074f696">data</a>.<a class="code" href="structvpx__codec__cx__pkt.html#a81e33bf4408a3983abb16492fee359ff">frame</a>.buf, 1, pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a7f97b060a23b7e89fe5b885c0074f696">data</a>.<a class="code" href="structvpx__codec__cx__pkt.html#a81e33bf4408a3983abb16492fee359ff">frame</a>.sz,
<a name="l00445"></a>00445                               outfile[i]));
<a name="l00446"></a>00446                     frames_in_layer[i]++;
<a name="l00447"></a>00447                 }
<a name="l00448"></a>00448                 <span class="keywordflow">break</span>;
<a name="l00449"></a>00449             <span class="keywordflow">default</span>:
<a name="l00450"></a>00450                 <span class="keywordflow">break</span>;
<a name="l00451"></a>00451             }
<a name="l00452"></a>00452             printf (pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a41f395b39516343c1329a4a85a0084f2">kind</a> == <a class="code" href="group__encoder.html#gga28a79375279536526552af3a83d2ed72a2261aae5594289400e812fb1e6b6b0cc">VPX_CODEC_CX_FRAME_PKT</a>
<a name="l00453"></a>00453                     &amp;&amp; (pkt-&gt;<a class="code" href="structvpx__codec__cx__pkt.html#a7f97b060a23b7e89fe5b885c0074f696">data</a>.<a class="code" href="structvpx__codec__cx__pkt.html#a81e33bf4408a3983abb16492fee359ff">frame</a>.flags &amp; <a class="code" href="group__encoder.html#ga7a896eb3bc74f33419e6a9812c60e4c9">VPX_FRAME_IS_KEY</a>)? <span class="stringliteral">&quot;K&quot;</span>:<span class="stringliteral">&quot;.&quot;</span>);
<a name="l00454"></a>00454             fflush (stdout);
<a name="l00455"></a>00455         }
<a name="l00456"></a>00456         frame_cnt++;
<a name="l00457"></a>00457         pts += frame_duration;
<a name="l00458"></a>00458     }
<a name="l00459"></a>00459     printf (<span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00460"></a>00460     fclose (infile);
<a name="l00461"></a>00461 
<a name="l00462"></a>00462     printf (<span class="stringliteral">&quot;Processed %d frames.\n&quot;</span>,frame_cnt-1);
<a name="l00463"></a>00463     <span class="keywordflow">if</span> (<a class="code" href="group__codec.html#ga6ae21d96909660d0ac978b59a863f53b" title="Destroy a codec instance.">vpx_codec_destroy</a>(&amp;codec))
<a name="l00464"></a>00464             die_codec (&amp;codec, <span class="stringliteral">&quot;Failed to destroy codec&quot;</span>);
<a name="l00465"></a>00465 
<a name="l00466"></a>00466     <span class="comment">// Try to rewrite the output file headers with the actual frame count</span>
<a name="l00467"></a>00467     <span class="keywordflow">for</span> (i=0; i&lt;cfg.<a class="code" href="structvpx__codec__enc__cfg.html#a16d4549a30cbd585e3c3056ef873d8c7" title="Number of coding layers.">ts_number_layers</a>; i++)
<a name="l00468"></a>00468     {
<a name="l00469"></a>00469         <span class="keywordflow">if</span> (!fseek(outfile[i], 0, SEEK_SET))
<a name="l00470"></a>00470             write_ivf_file_header (outfile[i], &amp;cfg, frames_in_layer[i]);
<a name="l00471"></a>00471         fclose (outfile[i]);
<a name="l00472"></a>00472     }
<a name="l00473"></a>00473 
<a name="l00474"></a>00474     <span class="keywordflow">return</span> EXIT_SUCCESS;
<a name="l00475"></a>00475 }
<a name="l00476"></a>00476 
</pre></div> </div></div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Jan 30 2012 for WebM VP8 Codec SDK by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>