summaryrefslogtreecommitdiff
path: root/vpx
diff options
context:
space:
mode:
authorMinghai Shang <minghai@google.com>2014-06-25 10:36:24 -0700
committerMinghai Shang <minghai@google.com>2014-06-25 10:36:24 -0700
commit41b451eb1f32b8f5e29fc57150fb7c05a04d78d7 (patch)
tree567c6302190ff2fed8200571bb58f04fa6bd3651 /vpx
parente319e4bfa6b54fb66b6fbc90923d0a96fd8900d9 (diff)
downloadlibvpx-41b451eb1f32b8f5e29fc57150fb7c05a04d78d7.tar
libvpx-41b451eb1f32b8f5e29fc57150fb7c05a04d78d7.tar.gz
libvpx-41b451eb1f32b8f5e29fc57150fb7c05a04d78d7.tar.bz2
libvpx-41b451eb1f32b8f5e29fc57150fb7c05a04d78d7.zip
[spatial svc]Remove key frame quantizer settings since key frame is decided by rate control
Change-Id: I7eda0f5e678034f0e9c2ab481c517d2e9b280eb5
Diffstat (limited to 'vpx')
-rw-r--r--vpx/src/svc_encodeframe.c57
-rw-r--r--vpx/svc_context.h3
2 files changed, 10 insertions, 50 deletions
diff --git a/vpx/src/svc_encodeframe.c b/vpx/src/svc_encodeframe.c
index 4efba9c00..8cf003b36 100644
--- a/vpx/src/svc_encodeframe.c
+++ b/vpx/src/svc_encodeframe.c
@@ -59,14 +59,11 @@ typedef struct FrameData {
typedef struct SvcInternal {
char options[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_options
char quantizers[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_quantizers
- char quantizers_keyframe[OPTION_BUFFER_SIZE]; // set by
- // vpx_svc_set_quantizers
char scale_factors[OPTION_BUFFER_SIZE]; // set by vpx_svc_set_scale_factors
// values extracted from option, quantizers
int scaling_factor_num[VPX_SS_MAX_LAYERS];
int scaling_factor_den[VPX_SS_MAX_LAYERS];
- int quantizer_keyframe[VPX_SS_MAX_LAYERS];
int quantizer[VPX_SS_MAX_LAYERS];
// accumulated statistics
@@ -215,8 +212,7 @@ static vpx_codec_err_t set_option_encoding_mode(SvcContext *svc_ctx,
}
static vpx_codec_err_t parse_quantizer_values(SvcContext *svc_ctx,
- const char *quantizer_values,
- const int is_keyframe) {
+ const char *quantizer_values) {
char *input_string;
char *token;
const char *delim = ",";
@@ -227,11 +223,6 @@ static vpx_codec_err_t parse_quantizer_values(SvcContext *svc_ctx,
SvcInternal *const si = get_svc_internal(svc_ctx);
if (quantizer_values == NULL || strlen(quantizer_values) == 0) {
- if (is_keyframe) {
- // If there non settings for key frame, we will apply settings from
- // non key frame. So just simply return here.
- return VPX_CODEC_INVALID_PARAM;
- }
input_string = strdup(DEFAULT_QUANTIZER_VALUES);
} else {
input_string = strdup(quantizer_values);
@@ -252,12 +243,7 @@ static vpx_codec_err_t parse_quantizer_values(SvcContext *svc_ctx,
} else {
q = 0;
}
- if (is_keyframe) {
- si->quantizer_keyframe[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers]
- = q;
- } else {
- si->quantizer[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers] = q;
- }
+ si->quantizer[i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers] = q;
}
if (res == VPX_CODEC_OK && found != svc_ctx->spatial_layers) {
svc_log(svc_ctx, SVC_LOG_ERROR,
@@ -342,7 +328,6 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) {
char *option_name;
char *option_value;
char *input_ptr;
- int is_keyframe_qaunt_set = 0;
vpx_codec_err_t res = VPX_CODEC_OK;
if (options == NULL) return VPX_CODEC_OK;
@@ -368,17 +353,8 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) {
res = parse_scale_factors(svc_ctx, option_value);
if (res != VPX_CODEC_OK) break;
} else if (strcmp("quantizers", option_name) == 0) {
- res = parse_quantizer_values(svc_ctx, option_value, 0);
- if (res != VPX_CODEC_OK) break;
- if (!is_keyframe_qaunt_set) {
- SvcInternal *const si = get_svc_internal(svc_ctx);
- memcpy(get_svc_internal(svc_ctx)->quantizer_keyframe, si->quantizer,
- sizeof(si->quantizer));
- }
- } else if (strcmp("quantizers-keyframe", option_name) == 0) {
- res = parse_quantizer_values(svc_ctx, option_value, 1);
+ res = parse_quantizer_values(svc_ctx, option_value);
if (res != VPX_CODEC_OK) break;
- is_keyframe_qaunt_set = 1;
} else {
svc_log(svc_ctx, SVC_LOG_ERROR, "invalid option: %s\n", option_name);
res = VPX_CODEC_INVALID_PARAM;
@@ -401,19 +377,13 @@ vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options) {
}
vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
- const char *quantizers,
- const int is_for_keyframe) {
+ const char *quantizers) {
SvcInternal *const si = get_svc_internal(svc_ctx);
if (svc_ctx == NULL || quantizers == NULL || si == NULL) {
return VPX_CODEC_INVALID_PARAM;
}
- if (is_for_keyframe) {
- strncpy(si->quantizers_keyframe, quantizers, sizeof(si->quantizers));
- si->quantizers_keyframe[sizeof(si->quantizers_keyframe) - 1] = '\0';
- } else {
- strncpy(si->quantizers, quantizers, sizeof(si->quantizers));
- si->quantizers[sizeof(si->quantizers) - 1] = '\0';
- }
+ strncpy(si->quantizers, quantizers, sizeof(si->quantizers));
+ si->quantizers[sizeof(si->quantizers) - 1] = '\0';
return VPX_CODEC_OK;
}
@@ -460,13 +430,9 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
return VPX_CODEC_INVALID_PARAM;
}
- res = parse_quantizer_values(svc_ctx, si->quantizers, 0);
+ res = parse_quantizer_values(svc_ctx, si->quantizers);
if (res != VPX_CODEC_OK) return res;
- res = parse_quantizer_values(svc_ctx, si->quantizers_keyframe, 1);
- if (res != VPX_CODEC_OK)
- memcpy(si->quantizer_keyframe, si->quantizer, sizeof(si->quantizer));
-
res = parse_scale_factors(svc_ctx, si->scale_factors);
if (res != VPX_CODEC_OK) return res;
@@ -741,13 +707,8 @@ static void set_svc_parameters(SvcContext *svc_ctx,
layer_index = layer + VPX_SS_MAX_LAYERS - si->layers;
if (codec_ctx->config.enc->g_pass == VPX_RC_ONE_PASS) {
- if (vpx_svc_is_keyframe(svc_ctx)) {
- svc_params.min_quantizer = si->quantizer_keyframe[layer_index];
- svc_params.max_quantizer = si->quantizer_keyframe[layer_index];
- } else {
- svc_params.min_quantizer = si->quantizer[layer_index];
- svc_params.max_quantizer = si->quantizer[layer_index];
- }
+ svc_params.min_quantizer = si->quantizer[layer_index];
+ svc_params.max_quantizer = si->quantizer[layer_index];
} else {
svc_params.min_quantizer = codec_ctx->config.enc->rc_min_quantizer;
svc_params.max_quantizer = codec_ctx->config.enc->rc_max_quantizer;
diff --git a/vpx/svc_context.h b/vpx/svc_context.h
index 058ee2094..888b2d5be 100644
--- a/vpx/svc_context.h
+++ b/vpx/svc_context.h
@@ -64,8 +64,7 @@ vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options);
* e.g., "60,53,39,33,27"
*/
vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
- const char *quantizer_values,
- const int is_for_keyframe);
+ const char *quantizer_values);
/**
* Set SVC scale factors