summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorAdrian Grange <agrange@google.com>2014-02-12 11:14:10 -0800
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-02-12 11:14:10 -0800
commit4618952a59ce48eb5b262cfe8c3b883bb1608850 (patch)
treef5fc80a2d7ea67c678d8b71b3c68d246b607355c /vp9
parent3602c4312d13138599d7b66be4f74922bf6f658e (diff)
parent896a9ab934aaf51ddff7b752701e1a08516561fb (diff)
downloadlibvpx-4618952a59ce48eb5b262cfe8c3b883bb1608850.tar
libvpx-4618952a59ce48eb5b262cfe8c3b883bb1608850.tar.gz
libvpx-4618952a59ce48eb5b262cfe8c3b883bb1608850.tar.bz2
libvpx-4618952a59ce48eb5b262cfe8c3b883bb1608850.zip
Merge "Minor cleanup."
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_onyx_if.c15
-rw-r--r--vp9/vp9_cx_iface.c38
2 files changed, 21 insertions, 32 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 88cf73c57..9f4d47bdd 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1474,7 +1474,7 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
if (cpi->initial_width) {
// Increasing the size of the frame beyond the first seen frame, or some
- // otherwise signalled maximum size, is not supported.
+ // otherwise signaled maximum size, is not supported.
// TODO(jkoleszar): exit gracefully.
assert(cm->width <= cpi->initial_width);
assert(cm->height <= cpi->initial_height);
@@ -1489,14 +1489,13 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
cpi->speed = cpi->oxcf.cpu_used;
if (cpi->oxcf.lag_in_frames == 0) {
- // force to allowlag to 0 if lag_in_frames is 0;
+ // Force allow_lag to 0 if lag_in_frames is 0.
cpi->oxcf.allow_lag = 0;
} else if (cpi->oxcf.lag_in_frames > MAX_LAG_BUFFERS) {
- // Limit on lag buffers as these are not currently dynamically allocated
+ // Limit on lag buffers as these are not currently dynamically allocated.
cpi->oxcf.lag_in_frames = MAX_LAG_BUFFERS;
}
- // YX Temp
#if CONFIG_MULTIPLE_ARF
vp9_zero(cpi->alt_ref_source);
#else
@@ -3954,11 +3953,11 @@ int vp9_set_size_literal(VP9_PTR comp, unsigned int width,
cm->width = width;
if (cm->width * 5 < cpi->initial_width) {
cm->width = cpi->initial_width / 5 + 1;
- printf("Warning: Desired width too small, changed to %d \n", cm->width);
+ printf("Warning: Desired width too small, changed to %d\n", cm->width);
}
if (cm->width > cpi->initial_width) {
cm->width = cpi->initial_width;
- printf("Warning: Desired width too large, changed to %d \n", cm->width);
+ printf("Warning: Desired width too large, changed to %d\n", cm->width);
}
}
@@ -3966,11 +3965,11 @@ int vp9_set_size_literal(VP9_PTR comp, unsigned int width,
cm->height = height;
if (cm->height * 5 < cpi->initial_height) {
cm->height = cpi->initial_height / 5 + 1;
- printf("Warning: Desired height too small, changed to %d \n", cm->height);
+ printf("Warning: Desired height too small, changed to %d\n", cm->height);
}
if (cm->height > cpi->initial_height) {
cm->height = cpi->initial_height;
- printf("Warning: Desired height too large, changed to %d \n", cm->height);
+ printf("Warning: Desired height too large, changed to %d\n", cm->height);
}
}
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index ece6d5280..f5d5b2416 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -222,7 +222,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz);
FIRSTPASS_STATS *stats;
- if (!cfg->rc_twopass_stats_in.buf)
+ if (cfg->rc_twopass_stats_in.buf == NULL)
ERROR("rc_twopass_stats_in.buf not set.");
if (cfg->rc_twopass_stats_in.sz % packet_sz)
@@ -419,7 +419,7 @@ static vpx_codec_err_t vp9e_set_config(vpx_codec_alg_priv_t *ctx,
res = validate_config(ctx, cfg, &ctx->vp8_cfg);
- if (!res) {
+ if (res == VPX_CODEC_OK) {
ctx->cfg = *cfg;
set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg);
vp9_change_config(ctx->cpi, &ctx->oxcf);
@@ -439,8 +439,7 @@ static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx,
#define MAP(id, var) case id: *(RECAST(id, arg)) = var; break
- if (!arg)
- return VPX_CODEC_INVALID_PARAM;
+ if (arg == NULL) return VPX_CODEC_INVALID_PARAM;
switch (ctrl_id) {
MAP(VP8E_GET_LAST_QUANTIZER, vp9_get_quantizer(ctx->cpi));
@@ -482,7 +481,7 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
res = validate_config(ctx, &ctx->cfg, &xcfg);
- if (!res) {
+ if (res == VPX_CODEC_OK) {
ctx->vp8_cfg = xcfg;
set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg);
vp9_change_config(ctx->cpi, &ctx->oxcf);
@@ -501,12 +500,10 @@ static vpx_codec_err_t vp9e_common_init(vpx_codec_ctx_t *ctx) {
VP9_PTR optr;
- if (!ctx->priv) {
+ if (ctx->priv == NULL) {
priv = calloc(1, sizeof(struct vpx_codec_alg_priv));
- if (!priv) {
- return VPX_CODEC_MEM_ERROR;
- }
+ if (priv == NULL) return VPX_CODEC_MEM_ERROR;
ctx->priv = &priv->base;
ctx->priv->sz = sizeof(*ctx->priv);
@@ -543,21 +540,19 @@ static vpx_codec_err_t vp9e_common_init(vpx_codec_ctx_t *ctx) {
priv->cx_data = malloc(priv->cx_data_sz);
- if (!priv->cx_data) {
- return VPX_CODEC_MEM_ERROR;
- }
+ if (priv->cx_data == NULL) return VPX_CODEC_MEM_ERROR;
vp9_initialize_enc();
res = validate_config(priv, &priv->cfg, &priv->vp8_cfg);
- if (!res) {
+ if (res == VPX_CODEC_OK) {
set_vp9e_config(&ctx->priv->alg_priv->oxcf,
ctx->priv->alg_priv->cfg,
ctx->priv->alg_priv->vp8_cfg);
optr = vp9_create_compressor(&ctx->priv->alg_priv->oxcf);
- if (!optr)
+ if (optr == NULL)
res = VPX_CODEC_MEM_ERROR;
else
ctx->priv->alg_priv->cpi = optr;
@@ -725,7 +720,7 @@ static vpx_codec_err_t vp9e_encode(vpx_codec_alg_priv_t *ctx,
}
/* Initialize the encoder instance on the first frame. */
- if (!res && ctx->cpi) {
+ if (res == VPX_CODEC_OK && ctx->cpi != NULL) {
unsigned int lib_flags;
YV12_BUFFER_CONFIG sd;
int64_t dst_time_stamp, dst_end_time_stamp;
@@ -785,8 +780,8 @@ static vpx_codec_err_t vp9e_encode(vpx_codec_alg_priv_t *ctx,
VP9_COMP *cpi = (VP9_COMP *)ctx->cpi;
/* Pack invisible frames with the next visible frame */
- if (!cpi->common.show_frame) {
- if (!ctx->pending_cx_data)
+ if (cpi->common.show_frame == 0) {
+ if (ctx->pending_cx_data == 0)
ctx->pending_cx_data = cx_data;
ctx->pending_cx_data_sz += size;
ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
@@ -811,7 +806,7 @@ static vpx_codec_err_t vp9e_encode(vpx_codec_alg_priv_t *ctx,
if (lib_flags & FRAMEFLAGS_KEY)
pkt.data.frame.flags |= VPX_FRAME_IS_KEY;
- if (!cpi->common.show_frame) {
+ if (cpi->common.show_frame == 0) {
pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE;
// This timestamp should be as close as possible to the
@@ -1021,12 +1016,7 @@ static vpx_codec_err_t vp9e_set_scalemode(vpx_codec_alg_priv_t *ctx,
res = vp9_set_internal_size(ctx->cpi,
(VPX_SCALING)scalemode->h_scaling_mode,
(VPX_SCALING)scalemode->v_scaling_mode);
-
- if (!res) {
- return VPX_CODEC_OK;
- } else {
- return VPX_CODEC_INVALID_PARAM;
- }
+ return (res == 0) ? VPX_CODEC_OK : VPX_CODEC_INVALID_PARAM;
} else {
return VPX_CODEC_INVALID_PARAM;
}