[spatial svc] Use string for quantizers and scale-factors option in the test app
[platform/upstream/libvpx.git] / vpx / svc_context.h
1 /*
2  *  Copyright (c) 2013 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 /**
12  * SvcContext - input parameters and state to encode a multi-layered
13  * spatial SVC frame
14  */
15
16 #ifndef VPX_SVC_CONTEXT_H_
17 #define VPX_SVC_CONTEXT_H_
18
19 #include "./vp8cx.h"
20 #include "./vpx_encoder.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 typedef enum SVC_LOG_LEVEL {
27   SVC_LOG_ERROR,
28   SVC_LOG_INFO,
29   SVC_LOG_DEBUG
30 } SVC_LOG_LEVEL;
31
32 typedef struct {
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
39
40   // private storage for vpx_svc_encode
41   void *internal;
42 } SvcContext;
43
44 /**
45  * Set SVC options
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>,...
51  */
52 vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options);
53
54 /**
55  * initialize SVC encoding
56  */
57 vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
58                              vpx_codec_iface_t *iface,
59                              vpx_codec_enc_cfg_t *cfg);
60 /**
61  * encode a frame of video with multiple layers
62  */
63 vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
64                                struct vpx_image *rawimg, vpx_codec_pts_t pts,
65                                int64_t duration, int deadline);
66
67 /**
68  * finished with svc encoding, release allocated resources
69  */
70 void vpx_svc_release(SvcContext *svc_ctx);
71
72 /**
73  * dump accumulated statistics and reset accumulated values
74  */
75 const char *vpx_svc_dump_statistics(SvcContext *svc_ctx);
76
77 /**
78  *  get status message from previous encode
79  */
80 const char *vpx_svc_get_message(const SvcContext *svc_ctx);
81
82 /**
83  * return spatial resolution of the specified layer
84  */
85 vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
86                                              int layer,
87                                              unsigned int *width,
88                                              unsigned int *height);
89
90 #ifdef __cplusplus
91 }  // extern "C"
92 #endif
93
94 #endif  // VPX_SVC_CONTEXT_H_