ref: 896a9ab934aaf51ddff7b752701e1a08516561fb
parent: 356a7e96420c297d87fad5c00640ddc2ea0556c3
author: Adrian Grange <[email protected]>
date: Wed Feb 5 04:45:13 EST 2014
Minor cleanup. Change-Id: I6ef0ce5371ed9e2a415dd8c08c93ad603f0ad7b2
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1481,7 +1481,7 @@
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);
@@ -1496,14 +1496,13 @@
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
@@ -3963,11 +3962,11 @@
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);
}
}
@@ -3975,11 +3974,11 @@
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);
}
}
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -222,7 +222,7 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
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;
}