summaryrefslogtreecommitdiff
path: root/vpx
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2014-02-06 09:23:17 -0800
committerMarco Paniconi <marpan@google.com>2014-02-06 09:24:45 -0800
commit4864ab21b0679270bd41c280489a8493bcf8c4ee (patch)
tree2bf295f4311f473b2099bec757396e113c83af26 /vpx
parent9602ed8808498c0bdc176ec4ffc60654860f12ec (diff)
downloadlibvpx-4864ab21b0679270bd41c280489a8493bcf8c4ee.tar
libvpx-4864ab21b0679270bd41c280489a8493bcf8c4ee.tar.gz
libvpx-4864ab21b0679270bd41c280489a8493bcf8c4ee.tar.bz2
libvpx-4864ab21b0679270bd41c280489a8493bcf8c4ee.zip
Layer based rate control for CBR mode.
This patch adds a buffer-based rate control for temporal layers, under CBR mode. Added vpx_temporal_scalable_patters.c encoder for testing temporal layers, for both vp9 and vp8 (replaces the old vp8_scalable_patterns). Updated datarate unittest with tests for temporal layer rate-targeting. Change-Id: I8900a854288b9354d9c697cfeb0243a9fd6790b1
Diffstat (limited to 'vpx')
-rw-r--r--vpx/src/svc_encodeframe.c4
-rw-r--r--vpx/vp8cx.h12
-rw-r--r--vpx/vpx_encoder.h39
3 files changed, 33 insertions, 22 deletions
diff --git a/vpx/src/svc_encodeframe.c b/vpx/src/svc_encodeframe.c
index 810e881c8..12f7166c3 100644
--- a/vpx/src/svc_encodeframe.c
+++ b/vpx/src/svc_encodeframe.c
@@ -499,6 +499,7 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
// modify encoder configuration
enc_cfg->ss_number_layers = si->layers;
+ enc_cfg->ts_number_layers = 1; // Temporal layers not used in this encoder.
enc_cfg->kf_mode = VPX_KF_DISABLED;
enc_cfg->g_pass = VPX_RC_ONE_PASS;
// Lag in frames not currently supported
@@ -691,7 +692,8 @@ static void set_svc_parameters(SvcContext *svc_ctx,
SvcInternal *const si = get_svc_internal(svc_ctx);
memset(&svc_params, 0, sizeof(svc_params));
- svc_params.layer = si->layer;
+ svc_params.temporal_layer = 0;
+ svc_params.spatial_layer = si->layer;
svc_params.flags = si->enc_frame_flags;
layer = si->layer;
diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
index 829490f73..d0ac1afc8 100644
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -194,7 +194,8 @@ enum vp8e_enc_control_id {
VP9E_SET_AQ_MODE,
VP9E_SET_SVC,
- VP9E_SET_SVC_PARAMETERS
+ VP9E_SET_SVC_PARAMETERS,
+ VP9E_SET_SVC_LAYER_ID
};
/*!\brief vpx 1-D scaling mode
@@ -285,7 +286,8 @@ typedef enum {
typedef struct vpx_svc_parameters {
unsigned int width; /**< width of current spatial layer */
unsigned int height; /**< height of current spatial layer */
- int layer; /**< current layer number - 0 = base */
+ int spatial_layer; /**< current spatial layer number - 0 = base */
+ int temporal_layer; /**< current temporal layer number - 0 = base */
int flags; /**< encode frame flags */
int max_quantizer; /**< max quantizer for current layer */
int min_quantizer; /**< min quantizer for current layer */
@@ -295,6 +297,11 @@ typedef struct vpx_svc_parameters {
int alt_fb_idx; /**< alt reference frame frame buffer index */
} vpx_svc_parameters_t;
+typedef struct vpx_svc_layer_id {
+ int spatial_layer_id;
+ int temporal_layer_id;
+} vpx_svc_layer_id_t;
+
/*!\brief VP8 encoder control function parameter type
*
* Defines the data types that VP8E control functions take. Note that
@@ -316,6 +323,7 @@ VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, vpx_svc_parameters_t *)
+VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h
index 347388551..1d9f0c9b7 100644
--- a/vpx/vpx_encoder.h
+++ b/vpx/vpx_encoder.h
@@ -604,47 +604,48 @@ extern "C" {
* Spatial scalability settings (ss)
*/
- /*!\brief Number of coding layers (spatial)
+ /*!\brief Number of spatial coding layers.
*
- * This value specifies the number of coding layers to be used.
+ * This value specifies the number of spatial coding layers to be used.
*/
unsigned int ss_number_layers;
- /*!\brief Number of coding layers
+ /*!\brief Number of temporal coding layers.
*
- * This value specifies the number of coding layers to be used.
+ * This value specifies the number of temporal layers to be used.
*/
unsigned int ts_number_layers;
- /*!\brief Target bitrate for each layer
+ /*!\brief Target bitrate for each temporal layer.
*
- * These values specify the target coding bitrate for each coding layer.
+ * These values specify the target coding bitrate to be used for each
+ * temporal layer.
*/
unsigned int ts_target_bitrate[VPX_TS_MAX_LAYERS];
- /*!\brief Frame rate decimation factor for each layer
+ /*!\brief Frame rate decimation factor for each temporal layer.
*
* These values specify the frame rate decimation factors to apply
- * to each layer.
+ * to each temporal layer.
*/
unsigned int ts_rate_decimator[VPX_TS_MAX_LAYERS];
- /*!\brief Length of the sequence defining frame layer membership
+ /*!\brief Length of the sequence defining frame temporal layer membership.
*
* This value specifies the length of the sequence that defines the
- * membership of frames to layers. For example, if ts_periodicity=8 then
- * frames are assigned to coding layers with a repeated sequence of
- * length 8.
- */
+ * membership of frames to temporal layers. For example, if the
+ * ts_periodicity = 8, then the frames are assigned to coding layers with a
+ * repeated sequence of length 8.
+ */
unsigned int ts_periodicity;
- /*!\brief Template defining the membership of frames to coding layers
+ /*!\brief Template defining the membership of frames to temporal layers.
*
- * This array defines the membership of frames to coding layers. For a
- * 2-layer encoding that assigns even numbered frames to one layer (0)
- * and odd numbered frames to a second layer (1) with ts_periodicity=8,
- * then ts_layer_id = (0,1,0,1,0,1,0,1).
- */
+ * This array defines the membership of frames to temporal coding layers.
+ * For a 2-layer encoding that assigns even numbered frames to one temporal
+ * layer (0) and odd numbered frames to a second temporal layer (1) with
+ * ts_periodicity=8, then ts_layer_id = (0,1,0,1,0,1,0,1).
+ */
unsigned int ts_layer_id[VPX_TS_MAX_PERIODICITY];
} vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */