2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
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.
12 * SvcContext - input parameters and state to encode a multi-layered
16 #ifndef VPX_SVC_CONTEXT_H_
17 #define VPX_SVC_CONTEXT_H_
20 #include "./vpx_encoder.h"
26 typedef enum SVC_LOG_LEVEL {
33 // public interface to svc_command options
34 int spatial_layers; // number of spatial layers
35 int temporal_layers; // number of temporal layers
36 SVC_LOG_LEVEL log_level; // amount of information to display
37 int log_print; // when set, printf log messages instead of returning the
38 // message with svc_get_message
40 // private storage for vpx_svc_encode
46 * options are supplied as a single string separated by spaces
47 * Format: encoding-mode=<i|ip|alt-ip|gf>
48 * layers=<layer_count>
49 * scaling-factors=<n1>/<d1>,<n2>/<d2>,...
50 * quantizers=<q1>,<q2>,...
52 vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options);
55 * Set SVC quantizer values
56 * values comma separated, ordered from lowest resolution to highest
57 * e.g., "60,53,39,33,27"
59 vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
60 const char *quantizer_values);
63 * Set SVC scale factors
64 * values comma separated, ordered from lowest resolution to highest
65 * e.g., "4/16,5/16,7/16,11/16,16/16"
67 vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
68 const char *scale_factors);
71 * initialize SVC encoding
73 vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
74 vpx_codec_iface_t *iface,
75 vpx_codec_enc_cfg_t *cfg);
77 * encode a frame of video with multiple layers
79 vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
80 struct vpx_image *rawimg, vpx_codec_pts_t pts,
81 int64_t duration, int deadline);
84 * finished with svc encoding, release allocated resources
86 void vpx_svc_release(SvcContext *svc_ctx);
89 * dump accumulated statistics and reset accumulated values
91 const char *vpx_svc_dump_statistics(SvcContext *svc_ctx);
94 * get status message from previous encode
96 const char *vpx_svc_get_message(const SvcContext *svc_ctx);
99 * return size of encoded data to be returned by vpx_svc_get_buffer.
100 * it needs to be called before vpx_svc_get_buffer.
102 size_t vpx_svc_get_frame_size(const SvcContext *svc_ctx);
105 * return buffer with encoded data. encoder will maintain a list of frame
106 * buffers. each call of vpx_svc_get_buffer() will return one frame.
108 void *vpx_svc_get_buffer(SvcContext *svc_ctx);
111 * return size of two pass rate control stats data to be returned by
112 * vpx_svc_get_rc_stats_buffer
114 size_t vpx_svc_get_rc_stats_buffer_size(const SvcContext *svc_ctx);
117 * return buffer two pass of rate control stats data
119 char *vpx_svc_get_rc_stats_buffer(const SvcContext *svc_ctx);
122 * return spatial resolution of the specified layer
124 vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
127 unsigned int *height);
129 * return number of frames that have been encoded
131 int vpx_svc_get_encode_frame_count(const SvcContext *svc_ctx);
134 * return 1 if last encoded frame was a keyframe
136 int vpx_svc_is_keyframe(const SvcContext *svc_ctx);
139 * force the next frame to be a keyframe
141 void vpx_svc_set_keyframe(SvcContext *svc_ctx);
147 #endif // VPX_SVC_CONTEXT_H_