Use signed int type for av1_lookahead_init params Callers of av1_lookahead_init pass signed int variables as those parameters, and av1_lookahead_init passes those parameters to a function that receives signed int parameters. Also change av1_lookahead_depth to return signed int. Change-Id: Ia58970004473534c8090e0bf5ba74d47dc4584c9
diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c index 1011799..162a245 100644 --- a/av1/encoder/lookahead.c +++ b/av1/encoder/lookahead.c
@@ -42,11 +42,13 @@ } } -struct lookahead_ctx *av1_lookahead_init( - unsigned int width, unsigned int height, unsigned int subsampling_x, - unsigned int subsampling_y, int use_highbitdepth, unsigned int depth, - const int border_in_pixels, int byte_alignment, int num_lap_buffers, - bool is_all_intra, bool alloc_pyramid) { +struct lookahead_ctx *av1_lookahead_init(int width, int height, + int subsampling_x, int subsampling_y, + int use_highbitdepth, int depth, + const int border_in_pixels, + int byte_alignment, + int num_lap_buffers, bool is_all_intra, + bool alloc_pyramid) { int lag_in_frames = AOMMAX(1, depth); // For all-intra frame encoding, previous source frames are not required. @@ -66,7 +68,6 @@ // Allocate the lookahead structures struct lookahead_ctx *ctx = calloc(1, sizeof(*ctx)); if (ctx) { - unsigned int i; ctx->max_sz = depth; ctx->push_frame_count = 0; ctx->max_pre_frames = max_pre_frames; @@ -78,7 +79,7 @@ } ctx->buf = calloc(depth, sizeof(*ctx->buf)); if (!ctx->buf) goto fail; - for (i = 0; i < depth; i++) { + for (int i = 0; i < depth; i++) { if (aom_realloc_frame_buffer( &ctx->buf[i].img, width, height, subsampling_x, subsampling_y, use_highbitdepth, border_in_pixels, byte_alignment, NULL, NULL, @@ -207,8 +208,7 @@ return buf; } -unsigned int av1_lookahead_depth(struct lookahead_ctx *ctx, - COMPRESSOR_STAGE stage) { +int av1_lookahead_depth(struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage) { assert(ctx != NULL); struct read_ctx *read_ctx = &ctx->read_ctxs[stage];
diff --git a/av1/encoder/lookahead.h b/av1/encoder/lookahead.h index 0a33120..2d2456a 100644 --- a/av1/encoder/lookahead.h +++ b/av1/encoder/lookahead.h
@@ -66,11 +66,13 @@ * The lookahead stage is a queue of frame buffers on which some analysis * may be done when buffers are enqueued. */ -struct lookahead_ctx *av1_lookahead_init( - unsigned int width, unsigned int height, unsigned int subsampling_x, - unsigned int subsampling_y, int use_highbitdepth, unsigned int depth, - const int border_in_pixels, int byte_alignment, int num_lap_buffers, - bool is_all_intra, bool alloc_pyramid); +struct lookahead_ctx *av1_lookahead_init(int width, int height, + int subsampling_x, int subsampling_y, + int use_highbitdepth, int depth, + const int border_in_pixels, + int byte_alignment, + int num_lap_buffers, bool is_all_intra, + bool alloc_pyramid); /**\brief Destroys the lookahead stage */ @@ -124,8 +126,7 @@ /**\brief Get the number of frames currently in the lookahead queue */ -unsigned int av1_lookahead_depth(struct lookahead_ctx *ctx, - COMPRESSOR_STAGE stage); +int av1_lookahead_depth(struct lookahead_ctx *ctx, COMPRESSOR_STAGE stage); /**\brief Get pop_sz value */
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c index b43532a..244b906 100644 --- a/av1/encoder/pass2_strategy.c +++ b/av1/encoder/pass2_strategy.c
@@ -2147,7 +2147,7 @@ static void correct_frames_to_key(AV1_COMP *cpi) { int lookahead_size = - (int)av1_lookahead_depth(cpi->ppi->lookahead, cpi->compressor_stage); + av1_lookahead_depth(cpi->ppi->lookahead, cpi->compressor_stage); if (lookahead_size < av1_lookahead_pop_sz(cpi->ppi->lookahead, cpi->compressor_stage)) { assert(