WebM VP8 Codec SDK
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
vpx
vpx_encoder.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
*
4
* Use of this source code is governed by a BSD-style license
5
* that can be found in the LICENSE file in the root of the source
6
* tree. An additional intellectual property rights grant can be found
7
* in the file PATENTS. All contributing project authors may
8
* be found in the AUTHORS file in the root of the source tree.
9
*/
10
11
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
31
#ifndef VPX_ENCODER_H
32
#define VPX_ENCODER_H
33
#include "
vpx_codec.h
"
34
38
#define VPX_TS_MAX_PERIODICITY 16
39
41
#define VPX_TS_MAX_LAYERS 5
42
44
#define MAX_PERIODICITY VPX_TS_MAX_PERIODICITY
45
47
#define MAX_LAYERS VPX_TS_MAX_LAYERS
48
57
#define VPX_ENCODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION)
69
#define VPX_CODEC_CAP_PSNR 0x10000
76
#define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000
77
78
86
#define VPX_CODEC_USE_PSNR 0x10000
87
#define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000
95
typedef struct vpx_fixed_buf
96
{
97
void
*buf;
98
size_t
sz;
99
}
vpx_fixed_buf_t
;
107
typedef
int64_t
vpx_codec_pts_t
;
108
109
117
typedef
uint32_t
vpx_codec_frame_flags_t
;
118
#define VPX_FRAME_IS_KEY 0x1
119
#define VPX_FRAME_IS_DROPPABLE 0x2
122
#define VPX_FRAME_IS_INVISIBLE 0x4
124
#define VPX_FRAME_IS_FRAGMENT 0x8
133
typedef uint32_t vpx_codec_er_flags_t;
134
#define VPX_ERROR_RESILIENT_DEFAULT 0x1
136
#define VPX_ERROR_RESILIENT_PARTITIONS 0x2
151
enum vpx_codec_cx_pkt_kind
152
{
153
VPX_CODEC_CX_FRAME_PKT
,
154
VPX_CODEC_STATS_PKT
,
155
VPX_CODEC_PSNR_PKT
,
156
VPX_CODEC_CUSTOM_PKT
= 256
157
};
158
159
165
typedef
struct
vpx_codec_cx_pkt
166
{
167
enum
vpx_codec_cx_pkt_kind
kind
;
168
union
169
{
170
struct
171
{
172
void
*
buf
;
173
size_t
sz
;
174
vpx_codec_pts_t
pts
;
176
unsigned
long
duration
;
178
vpx_codec_frame_flags_t
flags
;
179
int
partition_id
;
186
}
frame
;
187
struct
vpx_fixed_buf
twopass_stats
;
188
struct
vpx_psnr_pkt
189
{
190
unsigned
int
samples
[4];
191
uint64_t
sse
[4];
192
double
psnr
[4];
193
}
psnr
;
194
struct
vpx_fixed_buf
raw
;
196
/* This packet size is fixed to allow codecs to extend this
197
* interface without having to manage storage for raw packets,
198
* i.e., if it's smaller than 128 bytes, you can store in the
199
* packet list directly.
200
*/
201
char
pad
[128 -
sizeof
(
enum
vpx_codec_cx_pkt_kind
)];
202
}
data
;
203
}
vpx_codec_cx_pkt_t
;
210
typedef
struct
vpx_rational
211
{
212
int
num
;
213
int
den
;
214
}
vpx_rational_t
;
218
enum
vpx_enc_pass
219
{
220
VPX_RC_ONE_PASS
,
221
VPX_RC_FIRST_PASS
,
222
VPX_RC_LAST_PASS
223
};
224
225
227
enum
vpx_rc_mode
228
{
229
VPX_VBR
,
230
VPX_CBR
,
231
VPX_CQ
232
};
233
234
243
enum
vpx_kf_mode
244
{
245
VPX_KF_FIXED
,
246
VPX_KF_AUTO
,
247
VPX_KF_DISABLED
= 0
248
};
249
250
258
typedef
long
vpx_enc_frame_flags_t
;
259
#define VPX_EFLAG_FORCE_KF (1<<0)
268
typedef struct vpx_codec_enc_cfg
269
{
270
/*
271
* generic settings (g)
272
*/
273
281
unsigned
int
g_usage;
282
283
290
unsigned
int
g_threads;
291
292
301
unsigned
int
g_profile;
312
unsigned
int
g_w;
313
314
322
unsigned
int
g_h;
323
324
337
struct
vpx_rational
g_timebase;
338
339
346
vpx_codec_er_flags_t
g_error_resilient;
347
348
354
enum
vpx_enc_pass
g_pass;
355
356
369
unsigned
int
g_lag_in_frames;
370
371
372
/*
373
* rate control settings (rc)
374
*/
375
392
unsigned
int
rc_dropframe_thresh;
393
394
402
unsigned
int
rc_resize_allowed;
403
404
411
unsigned
int
rc_resize_up_thresh;
412
413
420
unsigned
int
rc_resize_down_thresh;
421
422
431
enum
vpx_rc_mode
rc_end_usage;
432
433
439
struct
vpx_fixed_buf
rc_twopass_stats_in;
440
441
446
unsigned
int
rc_target_bitrate;
447
448
449
/*
450
* quantizer settings
451
*/
452
453
462
unsigned
int
rc_min_quantizer;
463
464
473
unsigned
int
rc_max_quantizer;
474
475
476
/*
477
* bitrate tolerance
478
*/
479
480
491
unsigned
int
rc_undershoot_pct;
492
493
504
unsigned
int
rc_overshoot_pct;
505
506
507
/*
508
* decoder buffer model parameters
509
*/
510
511
521
unsigned
int
rc_buf_sz;
522
523
531
unsigned
int
rc_buf_initial_sz;
532
533
541
unsigned
int
rc_buf_optimal_sz;
542
543
544
/*
545
* 2 pass rate control parameters
546
*/
547
548
557
unsigned
int
rc_2pass_vbr_bias_pct;
565
unsigned
int
rc_2pass_vbr_minsection_pct;
566
567
573
unsigned
int
rc_2pass_vbr_maxsection_pct;
574
575
576
/*
577
* keyframing settings (kf)
578
*/
579
586
enum
vpx_kf_mode
kf_mode;
587
588
596
unsigned
int
kf_min_dist;
597
598
606
unsigned
int
kf_max_dist;
607
608
/*
609
* Temporal scalability settings (ts)
610
*/
611
616
unsigned
int
ts_number_layers;
617
622
unsigned
int
ts_target_bitrate[
VPX_TS_MAX_LAYERS
];
623
629
unsigned
int
ts_rate_decimator[
VPX_TS_MAX_LAYERS
];
630
638
unsigned
int
ts_periodicity;
639
647
unsigned
int
ts_layer_id[
VPX_TS_MAX_PERIODICITY
];
648
}
vpx_codec_enc_cfg_t
;
677
vpx_codec_err_t
vpx_codec_enc_init_ver
(
vpx_codec_ctx_t
*ctx,
678
vpx_codec_iface_t
*iface,
679
vpx_codec_enc_cfg_t
*cfg,
680
vpx_codec_flags_t
flags,
681
int
ver);
682
683
688
#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
689
vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
690
691
716
vpx_codec_err_t
vpx_codec_enc_init_multi_ver
(
vpx_codec_ctx_t
*ctx,
717
vpx_codec_iface_t
*iface,
718
vpx_codec_enc_cfg_t
*cfg,
719
int
num_enc,
720
vpx_codec_flags_t
flags,
721
vpx_rational_t
*dsf,
722
int
ver);
723
724
729
#define vpx_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \
730
vpx_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \
731
VPX_ENCODER_ABI_VERSION)
732
733
753
vpx_codec_err_t
vpx_codec_enc_config_default
(
vpx_codec_iface_t
*iface,
754
vpx_codec_enc_cfg_t
*cfg,
755
unsigned
int
usage);
756
757
772
vpx_codec_err_t
vpx_codec_enc_config_set
(
vpx_codec_ctx_t
*ctx,
773
const
vpx_codec_enc_cfg_t
*cfg);
774
775
787
vpx_fixed_buf_t
*
vpx_codec_get_global_headers
(
vpx_codec_ctx_t
*ctx);
788
789
790
#define VPX_DL_REALTIME (1)
792
#define VPX_DL_GOOD_QUALITY (1000000)
794
#define VPX_DL_BEST_QUALITY (0)
832
vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
833
const
vpx_image_t
*img,
834
vpx_codec_pts_t pts,
835
unsigned
long
duration,
836
vpx_enc_frame_flags_t flags,
837
unsigned
long
deadline);
838
882
vpx_codec_err_t
vpx_codec_set_cx_data_buf
(
vpx_codec_ctx_t
*ctx,
883
const
vpx_fixed_buf_t
*
buf
,
884
unsigned
int
pad_before,
885
unsigned
int
pad_after);
886
887
911
const
vpx_codec_cx_pkt_t
*
vpx_codec_get_cx_data
(
vpx_codec_ctx_t
*ctx,
912
vpx_codec_iter_t
*iter);
913
914
927
const
vpx_image_t
*
vpx_codec_get_preview_frame
(
vpx_codec_ctx_t
*ctx);
928
929
932
#endif
933
#ifdef __cplusplus
934
}
935
#endif
Generated by
1.8.3.1