Welcome to mirror list, hosted at ThFree Co, Russian Federation.

theoraenc_8h.html « html « libtheora « doc « libtheora-1.1.1 « Libraries - github.com/WolfireGames/overgrowth.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab896db7dc01ba6d930b5a2f70a8b50bccedd7f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
<!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>libtheora: theoraenc.h File Reference</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.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>theoraenc.h File Reference</h1>
<p>The <code>libtheoraenc</code> C encoding API.  
<a href="#_details">More...</a></p>
<code>#include &lt;stddef.h&gt;</code><br/>
<code>#include &lt;ogg/ogg.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="codec_8h_source.html">codec.h</a>&quot;</code><br/>

<p><a href="theoraenc_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#ab915dd90f069a2431454fd62365e9381">_O_THEORA_THEORAENC_H_</a>&nbsp;&nbsp;&nbsp;(1)</td></tr>
<tr><td colspan="2"><div class="groupHeader">th_encode_ctl() codes</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrp652c8d6bf1cea216ce117704a398b5f8"></a><a class="anchor" id="encctlcodes"></a> These are the available request codes for <a class="el" href="group__encfuncs.html#ga3a427f6514dfdc01ea72172c469d51d9" title="Encoder control function.">th_encode_ctl()</a>. By convention, these are even, to distinguish them from the <a class="el" href="theoradec_8h.html#decctlcodes">decoder control codes</a>. Keep any experimental or vendor-specific values above <code>0x8000</code>. </p>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a0165348788e560a19b7c61ae8f0c2283">TH_ENCCTL_SET_HUFFMAN_CODES</a>&nbsp;&nbsp;&nbsp;(0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the Huffman tables to use.  <a href="#a0165348788e560a19b7c61ae8f0c2283"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a3befcdd66678f8d27034f9c4b16d1b9c">TH_ENCCTL_SET_QUANT_PARAMS</a>&nbsp;&nbsp;&nbsp;(2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the quantization parameters to use.  <a href="#a3befcdd66678f8d27034f9c4b16d1b9c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a27e755e15b4b5604c54974b304037a49">TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE</a>&nbsp;&nbsp;&nbsp;(4)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the maximum distance between key frames.  <a href="#a27e755e15b4b5604c54974b304037a49"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a382d685a39a34d8e6ba76b00d804efd8">TH_ENCCTL_SET_VP3_COMPATIBLE</a>&nbsp;&nbsp;&nbsp;(10)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Disables any encoder features that would prevent lossless transcoding back to VP3.  <a href="#a382d685a39a34d8e6ba76b00d804efd8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a9baf5bdd206e80c78a8fd44687e89783">TH_ENCCTL_GET_SPLEVEL_MAX</a>&nbsp;&nbsp;&nbsp;(12)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Gets the maximum speed level.  <a href="#a9baf5bdd206e80c78a8fd44687e89783"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#abd9fbcb6a25a77d991d3620164fe59d6">TH_ENCCTL_SET_SPLEVEL</a>&nbsp;&nbsp;&nbsp;(14)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the speed level.  <a href="#abd9fbcb6a25a77d991d3620164fe59d6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a114b7c552f50b7b8d881a39489af1f61">TH_ENCCTL_GET_SPLEVEL</a>&nbsp;&nbsp;&nbsp;(16)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Gets the current speed level.  <a href="#a114b7c552f50b7b8d881a39489af1f61"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a8bb9b05471c42a09f8684a2583b8a1df">TH_ENCCTL_SET_DUP_COUNT</a>&nbsp;&nbsp;&nbsp;(18)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the number of duplicates of the next frame to produce.  <a href="#a8bb9b05471c42a09f8684a2583b8a1df"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a026502e08fbe1af0a1063f39bd18129c">TH_ENCCTL_SET_RATE_FLAGS</a>&nbsp;&nbsp;&nbsp;(20)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Modifies the default bitrate management behavior.  <a href="#a026502e08fbe1af0a1063f39bd18129c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#aaefb515876b2a180ad5c3120fc584a52">TH_ENCCTL_SET_RATE_BUFFER</a>&nbsp;&nbsp;&nbsp;(22)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the size of the bitrate management bit reservoir as a function of number of frames.  <a href="#aaefb515876b2a180ad5c3120fc584a52"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#ac3751b9c3838888ec2e3f0b0d2823282">TH_ENCCTL_2PASS_OUT</a>&nbsp;&nbsp;&nbsp;(24)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enable pass 1 of two-pass encoding mode and retrieve the first pass metrics.  <a href="#ac3751b9c3838888ec2e3f0b0d2823282"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a4a84f982cdd9a3e3c803a29bbde9df0b">TH_ENCCTL_2PASS_IN</a>&nbsp;&nbsp;&nbsp;(26)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Submits two-pass encoding metric data collected the first encoding pass to the second pass.  <a href="#a4a84f982cdd9a3e3c803a29bbde9df0b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#aac087983fa951b9148c9db6bc2e81ef4">TH_ENCCTL_SET_QUALITY</a>&nbsp;&nbsp;&nbsp;(28)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the current encoding quality.  <a href="#aac087983fa951b9148c9db6bc2e81ef4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a9b969df55ecad1acd1ae207fad42592e">TH_ENCCTL_SET_BITRATE</a>&nbsp;&nbsp;&nbsp;(30)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the current encoding bitrate.  <a href="#a9b969df55ecad1acd1ae207fad42592e"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">TH_ENCCTL_SET_RATE_FLAGS flags</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrp6d70796e675cce22589d15a73cb3a16b"></a><a class="anchor" id="ratectlflags"></a> These are the flags available for use with <a class="el" href="theoraenc_8h.html#a026502e08fbe1af0a1063f39bd18129c" title="Modifies the default bitrate management behavior.">TH_ENCCTL_SET_RATE_FLAGS</a>. </p>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a3e7fab53b902b54135522ba286f45e33">TH_RATECTL_DROP_FRAMES</a>&nbsp;&nbsp;&nbsp;(0x1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Drop frames to keep within bitrate buffer constraints.  <a href="#a3e7fab53b902b54135522ba286f45e33"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a32f9983b344a431334493cefb0b9337c">TH_RATECTL_CAP_OVERFLOW</a>&nbsp;&nbsp;&nbsp;(0x2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Ignore bitrate buffer overflows.  <a href="#a32f9983b344a431334493cefb0b9337c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#ad0d62d9dce542caf5296b03b97e020a6">TH_RATECTL_CAP_UNDERFLOW</a>&nbsp;&nbsp;&nbsp;(0x4)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Ignore bitrate buffer underflows.  <a href="#ad0d62d9dce542caf5296b03b97e020a6"></a><br/></td></tr>
<tr><td colspan="2"><h2>Typedefs</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Encoder state</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrp4ebc85bd8522a8b6128225c02b31c8b7"></a>The following data structure is opaque, and its contents are not publicly defined by this API.</p>
<p>Referring to its internals directly is unsupported, and may break without warning. </p>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The encoder context.  <a href="#af5cc40472b925456d42526a035d66edd"></a><br/></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Functions for encoding</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p><a class="anchor" id="amgrpc58fb8743a7ca83eb895d57e29e032c8"></a>You must link to <code>libtheoraenc</code> and <code>libtheoradec</code> if you use any of the functions in this section.</p>
<p>The functions are listed in the order they are used in a typical encode. The basic steps are:</p>
<ul>
<li>Fill in a <a class="el" href="structth__info.html" title="Theora bitstream information.">th_info</a> structure with details on the format of the video you wish to encode.</li>
<li>Allocate a <a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd" title="The encoder context.">th_enc_ctx</a> handle with <a class="el" href="group__encfuncs.html#gaa91e47bc9dd5f6ee52045bd7b815e5a7" title="Allocates an encoder instance.">th_encode_alloc()</a>.</li>
<li>Perform any additional encoder configuration required with <a class="el" href="group__encfuncs.html#ga3a427f6514dfdc01ea72172c469d51d9" title="Encoder control function.">th_encode_ctl()</a>.</li>
<li>Repeatedly call <a class="el" href="group__encfuncs.html#ga9439d61b566039d194ff782681fbc408" title="Outputs the next header packet.">th_encode_flushheader()</a> to retrieve all the header packets.</li>
<li>For each uncompressed frame:<ul>
<li>Submit the uncompressed frame via <a class="el" href="group__encfuncs.html#gadbe7dd66b411c2d61ab8153c15308750" title="Submits an uncompressed frame to the encoder.">th_encode_ycbcr_in()</a></li>
<li>Repeatedly call <a class="el" href="group__encfuncs.html#ga96d8ac1dda53187455352f99bbb5b04b" title="Retrieves encoded video data packets.">th_encode_packetout()</a> to retrieve any video data packets that are ready.</li>
</ul>
</li>
<li>Call <a class="el" href="group__encfuncs.html#ga36b23d216532231925c4107894204680" title="Frees an allocated encoder instance.">th_encode_free()</a> to release all encoder memory. </li>
</ul>
<br/><br/></div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#gaa91e47bc9dd5f6ee52045bd7b815e5a7">th_encode_alloc</a> (const <a class="el" href="structth__info.html">th_info</a> *_info)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocates an encoder instance.  <a href="group__encfuncs.html#gaa91e47bc9dd5f6ee52045bd7b815e5a7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#ga3a427f6514dfdc01ea72172c469d51d9">th_encode_ctl</a> (<a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *_enc, int _req, void *_buf, size_t _buf_sz)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Encoder control function.  <a href="group__encfuncs.html#ga3a427f6514dfdc01ea72172c469d51d9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#ga9439d61b566039d194ff782681fbc408">th_encode_flushheader</a> (<a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *_enc, <a class="el" href="structth__comment.html">th_comment</a> *_comments, ogg_packet *_op)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Outputs the next header packet.  <a href="group__encfuncs.html#ga9439d61b566039d194ff782681fbc408"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#gadbe7dd66b411c2d61ab8153c15308750">th_encode_ycbcr_in</a> (<a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *_enc, <a class="el" href="codec_8h.html#a343f7cfabad179cc4fe527cf06873f45">th_ycbcr_buffer</a> _ycbcr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Submits an uncompressed frame to the encoder.  <a href="group__encfuncs.html#gadbe7dd66b411c2d61ab8153c15308750"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#ga96d8ac1dda53187455352f99bbb5b04b">th_encode_packetout</a> (<a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *_enc, int _last, ogg_packet *_op)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves encoded video data packets.  <a href="group__encfuncs.html#ga96d8ac1dda53187455352f99bbb5b04b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__encfuncs.html#ga36b23d216532231925c4107894204680">th_encode_free</a> (<a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> *_enc)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees an allocated encoder instance.  <a href="group__encfuncs.html#ga36b23d216532231925c4107894204680"></a><br/></td></tr>
<tr><td colspan="2"><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structth__quant__info.html">th_quant_info</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#a3b1b462989f4e7a5a98e6e697f1a7f7d">TH_VP31_QUANT_INFO</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The quantization parameters used by VP3.  <a href="#a3b1b462989f4e7a5a98e6e697f1a7f7d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structth__huff__code.html">th_huff_code</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="theoraenc_8h.html#aee1f7cb1fa0d3b7cc1d4ca0f17e6ae5e">TH_VP31_HUFF_CODES</a> [TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The Huffman tables used by VP3.  <a href="#aee1f7cb1fa0d3b7cc1d4ca0f17e6ae5e"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>The <code>libtheoraenc</code> C encoding API. </p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ab915dd90f069a2431454fd62365e9381"></a><!-- doxytag: member="theoraenc.h::_O_THEORA_THEORAENC_H_" ref="ab915dd90f069a2431454fd62365e9381" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define _O_THEORA_THEORAENC_H_&nbsp;&nbsp;&nbsp;(1)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a4a84f982cdd9a3e3c803a29bbde9df0b"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_2PASS_IN" ref="a4a84f982cdd9a3e3c803a29bbde9df0b" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_2PASS_IN&nbsp;&nbsp;&nbsp;(26)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Submits two-pass encoding metric data collected the first encoding pass to the second pass. </p>
<p>The first call must be made before the first frame is encoded, and a target bitrate must have already been specified to the encoder. It sets the encoder to pass 2 mode implicitly; this cannot be disabled. The encoder may require reading data from some or all of the frames in advance, depending on, e.g., the reservoir size used in the second pass. You must call this function repeatedly before each frame to provide data until either a) it fails to consume all of the data presented or b) all of the pass 1 data has been consumed. In the first case, you must save the remaining data to be presented after the next frame. You can call this function with a NULL argument to get an upper bound on the number of bytes that will be required before the next frame.</p>
<p>When pass 2 is first enabled, the default bit reservoir is set to the entire file; this gives maximum flexibility but can lead to very high peak rates. You can subsequently set it to another value with <a class="el" href="theoraenc_8h.html#aaefb515876b2a180ad5c3120fc584a52" title="Sets the size of the bitrate management bit reservoir as a function of number of...">TH_ENCCTL_SET_RATE_BUFFER</a> (e.g., to set it to the keyframe interval for non-live streaming), however, you may then need to provide more data before the next frame.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>char[]</code>: A buffer containing the data returned by <a class="el" href="theoraenc_8h.html#ac3751b9c3838888ec2e3f0b0d2823282" title="Enable pass 1 of two-pass encoding mode and retrieve the first pass metrics.">TH_ENCCTL_2PASS_OUT</a> in pass 1. You may pass <code>NULL</code> for <em>_buf</em> to return an upper bound on the number of additional bytes needed before the next frame. The summary data returned at the end of pass 1 must be at the head of the buffer on the first call with a non-<code>NULL</code> <em>_buf</em>, and the placeholder data returned at the start of pass 1 should be omitted. After each call you should advance this buffer by the number of bytes consumed. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>&gt;0</em>&nbsp;</td><td>The number of bytes of metric data required/consumed. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>0</em>&nbsp;</td><td>No more data is required before the next frame. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td>No target bitrate has been set, or the first call was made after the first frame was submitted for encoding. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_ENOTFORMAT</em>&nbsp;</td><td>The data did not appear to be pass 1 from a compatible implementation of this library. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EBADHEADER</em>&nbsp;</td><td>The data was invalid; this may be returned when attempting to read an aborted pass 1 file that still has the placeholder data in place of the summary data. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ac3751b9c3838888ec2e3f0b0d2823282"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_2PASS_OUT" ref="ac3751b9c3838888ec2e3f0b0d2823282" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_2PASS_OUT&nbsp;&nbsp;&nbsp;(24)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Enable pass 1 of two-pass encoding mode and retrieve the first pass metrics. </p>
<p>Pass 1 mode must be enabled before the first frame is encoded, and a target bitrate must have already been specified to the encoder. Although this does not have to be the exact rate that will be used in the second pass, closer values may produce better results. The first call returns the size of the two-pass header data, along with some placeholder content, and sets the encoder into pass 1 mode implicitly. This call sets the encoder to pass 1 mode implicitly. Then, a subsequent call must be made after each call to <a class="el" href="group__encfuncs.html#gadbe7dd66b411c2d61ab8153c15308750" title="Submits an uncompressed frame to the encoder.">th_encode_ycbcr_in()</a> to retrieve the metrics for that frame. An additional, final call must be made to retrieve the summary data, containing such information as the total number of frames, etc. This must be stored in place of the placeholder data that was returned in the first call, before the frame metrics data. All of this data must be presented back to the encoder during pass 2 using <a class="el" href="theoraenc_8h.html#a4a84f982cdd9a3e3c803a29bbde9df0b" title="Submits two-pass encoding metric data collected the first encoding pass to the second...">TH_ENCCTL_2PASS_IN</a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>&lt;tt&gt;char</em>&nbsp;</td><td>*_buf: Returns a pointer to internal storage containing the two pass metrics data. This storage is only valid until the next call, or until the encoder context is freed, and must be copied by the application. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>&gt;=0</em>&nbsp;</td><td>The number of bytes of metric data available in the returned buffer. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(char *)</code>, no target bitrate has been set, or the first call was made after the first frame was submitted for encoding. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a114b7c552f50b7b8d881a39489af1f61"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_GET_SPLEVEL" ref="a114b7c552f50b7b8d881a39489af1f61" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_GET_SPLEVEL&nbsp;&nbsp;&nbsp;(16)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Gets the current speed level. </p>
<p>The default speed level may vary according to encoder implementation, but if this control code is not supported (it returns <a class="el" href="codec_8h.html#a921c47accc17841f220af5a6afb79efe" title="The specified function is not implemented.">TH_EIMPL</a>), the default may be assumed to be the slowest available speed (0). The maximum encoding speed level may be implementation- and encoding mode-specific, and can be obtained via <a class="el" href="theoraenc_8h.html#a9baf5bdd206e80c78a8fd44687e89783" title="Gets the maximum speed level.">TH_ENCCTL_GET_SPLEVEL_MAX</a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The current encoding speed level. 0 is slowest, larger values use less CPU. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9baf5bdd206e80c78a8fd44687e89783"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_GET_SPLEVEL_MAX" ref="a9baf5bdd206e80c78a8fd44687e89783" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_GET_SPLEVEL_MAX&nbsp;&nbsp;&nbsp;(12)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Gets the maximum speed level. </p>
<p>Higher speed levels favor quicker encoding over better quality per bit. Depending on the encoding mode, and the internal algorithms used, quality may actually improve, but in this case bitrate will also likely increase. In any case, overall rate/distortion performance will probably decrease. The maximum value, and the meaning of each value, may change depending on the current encoding mode (VBR vs. constant quality, etc.).</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The maximum encoding speed level. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9b969df55ecad1acd1ae207fad42592e"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_BITRATE" ref="a9b969df55ecad1acd1ae207fad42592e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_BITRATE&nbsp;&nbsp;&nbsp;(30)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the current encoding bitrate. </p>
<p>Once a bitrate is set, the encoder must use a rate-controlled mode for all future frames (this restriction may be relaxed in a future version). If it is set before the headers are emitted, the target bitrate encoded in them will be updated. Due to the buffer delay, the exact bitrate of each section of the encode is not guaranteed. The encoder may have already used more bits than allowed for the frames it has encoded, expecting to make them up in future frames, or it may have used fewer, holding the excess in reserve. The exact transition between the two bitrates is not well-defined by this API, but may be affected by flags set with <a class="el" href="theoraenc_8h.html#a026502e08fbe1af0a1063f39bd18129c" title="Modifies the default bitrate management behavior.">TH_ENCCTL_SET_RATE_FLAGS</a>. After a number of frames equal to the buffer delay, one may expect further output to average at the target bitrate.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>long</code>: The new target bitrate, in bits per second. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>0</em>&nbsp;</td><td>Success. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td>The target bitrate was not positive. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a8bb9b05471c42a09f8684a2583b8a1df"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_DUP_COUNT" ref="a8bb9b05471c42a09f8684a2583b8a1df" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_DUP_COUNT&nbsp;&nbsp;&nbsp;(18)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the number of duplicates of the next frame to produce. </p>
<p>Although libtheora can encode duplicate frames very cheaply, it costs some amount of CPU to detect them, and a run of duplicates cannot span a keyframe boundary. This control code tells the encoder to produce the specified number of extra duplicates of the next frame. This allows the encoder to make smarter keyframe placement decisions and rate control decisions, and reduces CPU usage as well, when compared to just submitting the same frame for encoding multiple times. This setting only applies to the next frame submitted for encoding. You MUST call <a class="el" href="group__encfuncs.html#ga96d8ac1dda53187455352f99bbb5b04b" title="Retrieves encoded video data packets.">th_encode_packetout()</a> repeatedly until it returns 0, or the extra duplicate frames will be lost.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The number of duplicates to produce. If this is negative or zero, no duplicates will be produced. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>, or the number of duplicates is greater than or equal to the maximum keyframe interval. In the latter case, NO duplicate frames will be produced. You must ensure that the maximum keyframe interval is set larger than the maximum number of duplicates you will ever wish to insert prior to encoding. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a0165348788e560a19b7c61ae8f0c2283"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_HUFFMAN_CODES" ref="a0165348788e560a19b7c61ae8f0c2283" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_HUFFMAN_CODES&nbsp;&nbsp;&nbsp;(0)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the Huffman tables to use. </p>
<p>The tables are copied, not stored by reference, so they can be freed after this call. <code>NULL</code> may be specified to revert to the default tables.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code><a class="el" href="structth__huff__code.html" title="A Huffman code for a Theora DCT token.">th_huff_code</a>[<a class="el" href="codec_8h.html#a49bf449eae33c5320f0c308f32c6ae42" title="The number of Huffman tables used by Theora.">TH_NHUFFMAN_TABLES</a>][<a class="el" href="codec_8h.html#a2a44f48084e76a58cae48fb5d47cd422" title="The number of DCT token values in each table.">TH_NDCT_TOKENS</a>]</code> </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td>Encoding has already begun or one or more of the given tables is not full or prefix-free, <em>_buf</em> is <code>NULL</code> and <em>_buf_sz</em> is not zero, or <em>_buf</em> is non-<code>NULL</code> and <em>_buf_sz</em> is not <code>sizeof(<a class="el" href="structth__huff__code.html" title="A Huffman code for a Theora DCT token.">th_huff_code</a>)*<a class="el" href="codec_8h.html#a49bf449eae33c5320f0c308f32c6ae42" title="The number of Huffman tables used by Theora.">TH_NHUFFMAN_TABLES</a>*<a class="el" href="codec_8h.html#a2a44f48084e76a58cae48fb5d47cd422" title="The number of DCT token values in each table.">TH_NDCT_TOKENS</a></code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a27e755e15b4b5604c54974b304037a49"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE" ref="a27e755e15b4b5604c54974b304037a49" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE&nbsp;&nbsp;&nbsp;(4)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the maximum distance between key frames. </p>
<p>This can be changed during an encode, but will be bounded by <code>1&lt;&lt;<a class="el" href="structth__info.html#a693ca4ab11fbc0c3f32594b4bb8766ed" title="The amount to shift to extract the last keyframe number from the granule position...">th_info::keyframe_granule_shift</a></code>. If it is set before encoding begins, <a class="el" href="structth__info.html#a693ca4ab11fbc0c3f32594b4bb8766ed" title="The amount to shift to extract the last keyframe number from the granule position...">th_info::keyframe_granule_shift</a> will be enlarged appropriately.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>ogg_uint32_t</code>: The maximum distance between key frames. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>ogg_uint32_t</code>: The actual maximum distance set. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(ogg_uint32_t)</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aac087983fa951b9148c9db6bc2e81ef4"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_QUALITY" ref="aac087983fa951b9148c9db6bc2e81ef4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_QUALITY&nbsp;&nbsp;&nbsp;(28)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the current encoding quality. </p>
<p>This is only valid so long as no bitrate has been specified, either through the <a class="el" href="structth__info.html" title="Theora bitstream information.">th_info</a> struct used to initialize the encoder or through <a class="el" href="theoraenc_8h.html#a9b969df55ecad1acd1ae207fad42592e" title="Sets the current encoding bitrate.">TH_ENCCTL_SET_BITRATE</a> (this restriction may be relaxed in a future version). If it is set before the headers are emitted, the target quality encoded in them will be updated.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The new target quality, in the range 0...63, inclusive. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>0</em>&nbsp;</td><td>Success. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td>A target bitrate has already been specified, or the quality index was not in the range 0...63. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a3befcdd66678f8d27034f9c4b16d1b9c"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_QUANT_PARAMS" ref="a3befcdd66678f8d27034f9c4b16d1b9c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_QUANT_PARAMS&nbsp;&nbsp;&nbsp;(2)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the quantization parameters to use. </p>
<p>The parameters are copied, not stored by reference, so they can be freed after this call. <code>NULL</code> may be specified to revert to the default parameters.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><a class="el" href="structth__quant__info.html" title="A complete set of quantization parameters.">th_quant_info</a> </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td>Encoding has already begun, <em>_buf</em> is <code>NULL</code> and <em>_buf_sz</em> is not zero, or <em>_buf</em> is non-<code>NULL</code> and <em>_buf_sz</em> is not <code>sizeof(<a class="el" href="structth__quant__info.html" title="A complete set of quantization parameters.">th_quant_info</a>)</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aaefb515876b2a180ad5c3120fc584a52"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_RATE_BUFFER" ref="aaefb515876b2a180ad5c3120fc584a52" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_RATE_BUFFER&nbsp;&nbsp;&nbsp;(22)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the size of the bitrate management bit reservoir as a function of number of frames. </p>
<p>The reservoir size affects how quickly bitrate management reacts to instantaneous changes in the video complexity. Larger reservoirs react more slowly, and provide better overall quality, but require more buffering by a client, adding more latency to live streams. By default, libtheora sets the reservoir to the maximum distance between keyframes, subject to a minimum and maximum limit. This call may be used to increase or decrease the reservoir, increasing or decreasing the allowed temporary variance in bitrate. An implementation may impose some limits on the size of a reservoir it can handle, in which case the actual reservoir size may not be exactly what was requested. The actual value set will be returned.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: Requested size of the reservoir measured in frames. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The actual size of the reservoir set. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>, or rate control is not enabled. The buffer has an implementation defined minimum and maximum size and the value in _buf will be adjusted to match the actual value set. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a026502e08fbe1af0a1063f39bd18129c"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_RATE_FLAGS" ref="a026502e08fbe1af0a1063f39bd18129c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_RATE_FLAGS&nbsp;&nbsp;&nbsp;(20)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Modifies the default bitrate management behavior. </p>
<p>Use to allow or disallow frame dropping, and to enable or disable capping bit reservoir overflows and underflows. See <a class="el" href="theoraenc_8h.html#encctlcodes">the list of available flags</a>. The flags are set by default to <code><a class="el" href="theoraenc_8h.html#a3e7fab53b902b54135522ba286f45e33" title="Drop frames to keep within bitrate buffer constraints.">TH_RATECTL_DROP_FRAMES</a>|<a class="el" href="theoraenc_8h.html#a32f9983b344a431334493cefb0b9337c" title="Ignore bitrate buffer overflows.">TH_RATECTL_CAP_OVERFLOW</a></code>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: Any combination of <a class="el" href="theoraenc_8h.html#ratectlflags">the available flags</a>:</p>
<ul>
<li><a class="el" href="theoraenc_8h.html#a3e7fab53b902b54135522ba286f45e33" title="Drop frames to keep within bitrate buffer constraints.">TH_RATECTL_DROP_FRAMES</a>: Enable frame dropping.</li>
<li><a class="el" href="theoraenc_8h.html#a32f9983b344a431334493cefb0b9337c" title="Ignore bitrate buffer overflows.">TH_RATECTL_CAP_OVERFLOW</a>: Don't bank excess bits for later use.</li>
<li><a class="el" href="theoraenc_8h.html#ad0d62d9dce542caf5296b03b97e020a6" title="Ignore bitrate buffer underflows.">TH_RATECTL_CAP_UNDERFLOW</a>: Don't try to make up shortfalls later. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code> or rate control is not enabled. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="abd9fbcb6a25a77d991d3620164fe59d6"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_SPLEVEL" ref="abd9fbcb6a25a77d991d3620164fe59d6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_SPLEVEL&nbsp;&nbsp;&nbsp;(14)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the speed level. </p>
<p>The current speed level may be retrieved using <a class="el" href="theoraenc_8h.html#a114b7c552f50b7b8d881a39489af1f61" title="Gets the current speed level.">TH_ENCCTL_GET_SPLEVEL</a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: The new encoding speed level. 0 is slowest, larger values use less CPU. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>, or the encoding speed level is out of bounds. The maximum encoding speed level may be implementation- and encoding mode-specific, and can be obtained via <a class="el" href="theoraenc_8h.html#a9baf5bdd206e80c78a8fd44687e89783" title="Gets the maximum speed level.">TH_ENCCTL_GET_SPLEVEL_MAX</a>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation in the current encoding mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a382d685a39a34d8e6ba76b00d804efd8"></a><!-- doxytag: member="theoraenc.h::TH_ENCCTL_SET_VP3_COMPATIBLE" ref="a382d685a39a34d8e6ba76b00d804efd8" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_ENCCTL_SET_VP3_COMPATIBLE&nbsp;&nbsp;&nbsp;(10)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Disables any encoder features that would prevent lossless transcoding back to VP3. </p>
<p>This primarily means disabling block-adaptive quantization and always coding all four luma blocks in a macro block when 4MV is used. It also includes using the VP3 quantization tables and Huffman codes; if you set them explicitly after calling this function, the resulting stream will not be VP3-compatible. If you enable VP3-compatibility when encoding 4:2:2 or 4:4:4 source material, or when using a picture region smaller than the full frame (e.g. a non-multiple-of-16 width or height), then non-VP3 bitstream features will still be disabled, but the stream will still not be VP3-compatible, as VP3 was not capable of encoding such formats. If you call this after encoding has already begun, then the quantization tables and codebooks cannot be changed, but the frame-level features will be enabled or disabled as requested.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: a non-zero value to enable VP3 compatibility, or 0 to disable it (the default). </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>_buf</em>&nbsp;</td><td><code>int</code>: 1 if all bitstream features required for VP3-compatibility could be set, and 0 otherwise. The latter will be returned if the pixel format is not 4:2:0, the picture region is smaller than the full frame, or if encoding has begun, preventing the quantization tables and codebooks from being set. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>TH_EFAULT</em>&nbsp;</td><td><em>_enc_ctx</em> or <em>_buf</em> is <code>NULL</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EINVAL</em>&nbsp;</td><td><em>_buf_sz</em> is not <code>sizeof(int)</code>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>TH_EIMPL</em>&nbsp;</td><td>Not supported by this implementation. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a32f9983b344a431334493cefb0b9337c"></a><!-- doxytag: member="theoraenc.h::TH_RATECTL_CAP_OVERFLOW" ref="a32f9983b344a431334493cefb0b9337c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_RATECTL_CAP_OVERFLOW&nbsp;&nbsp;&nbsp;(0x2)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Ignore bitrate buffer overflows. </p>
<p>If the encoder uses so few bits that the reservoir of available bits overflows, ignore the excess. The encoder will not try to use these extra bits in future frames. At high rates this may cause the result to be undersized, but allows a client to play the stream using a finite buffer; it should normally be enabled. </p>

</div>
</div>
<a class="anchor" id="ad0d62d9dce542caf5296b03b97e020a6"></a><!-- doxytag: member="theoraenc.h::TH_RATECTL_CAP_UNDERFLOW" ref="ad0d62d9dce542caf5296b03b97e020a6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_RATECTL_CAP_UNDERFLOW&nbsp;&nbsp;&nbsp;(0x4)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Ignore bitrate buffer underflows. </p>
<p>If the encoder uses so many bits that the reservoir of available bits underflows, ignore the deficit. The encoder will not try to make up these extra bits in future frames. At low rates this may cause the result to be oversized; it should normally be disabled. </p>

</div>
</div>
<a class="anchor" id="a3e7fab53b902b54135522ba286f45e33"></a><!-- doxytag: member="theoraenc.h::TH_RATECTL_DROP_FRAMES" ref="a3e7fab53b902b54135522ba286f45e33" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TH_RATECTL_DROP_FRAMES&nbsp;&nbsp;&nbsp;(0x1)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Drop frames to keep within bitrate buffer constraints. </p>
<p>This can have a severe impact on quality, but is the only way to ensure that bitrate targets are met at low rates during sudden bursts of activity. </p>

</div>
</div>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="af5cc40472b925456d42526a035d66edd"></a><!-- doxytag: member="theoraenc.h::th_enc_ctx" ref="af5cc40472b925456d42526a035d66edd" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a> <a class="el" href="theoraenc_8h.html#af5cc40472b925456d42526a035d66edd">th_enc_ctx</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The encoder context. </p>

</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="aee1f7cb1fa0d3b7cc1d4ca0f17e6ae5e"></a><!-- doxytag: member="theoraenc.h::TH_VP31_HUFF_CODES" ref="aee1f7cb1fa0d3b7cc1d4ca0f17e6ae5e" args="[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="structth__huff__code.html">th_huff_code</a> <a class="el" href="theoraenc_8h.html#aee1f7cb1fa0d3b7cc1d4ca0f17e6ae5e">TH_VP31_HUFF_CODES</a>[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The Huffman tables used by VP3. </p>

</div>
</div>
<a class="anchor" id="a3b1b462989f4e7a5a98e6e697f1a7f7d"></a><!-- doxytag: member="theoraenc.h::TH_VP31_QUANT_INFO" ref="a3b1b462989f4e7a5a98e6e697f1a7f7d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="structth__quant__info.html">th_quant_info</a> <a class="el" href="theoraenc_8h.html#a3b1b462989f4e7a5a98e6e697f1a7f7d">TH_VP31_QUANT_INFO</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The quantization parameters used by VP3. </p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 28 Sep 2009 for libtheora by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>