From 46d33d39451014a90d454299a517ec8f66a9f06e Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Fri, 4 Apr 2014 11:08:34 +0300 Subject: [PATCH] Resolve unsigned/signed mismatch warnings. - Working towards issue #11. --- src/encmain.c | 2 +- src/encoder.c | 2 +- src/picture.h | 4 ++-- src/search.c | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/encmain.c b/src/encmain.c index 9e163f77..dec696ef 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -353,7 +353,7 @@ int main(int argc, char *argv[]) // TODO: add more than one reference // Remove the ref pic (if present) - if (encoder->ref->used_size == encoder->cfg->ref_frames) { + if (encoder->ref->used_size == (uint32_t)encoder->cfg->ref_frames) { picture_list_rem(encoder->ref, encoder->ref->used_size-1, 1); } // Add current picture as reference diff --git a/src/encoder.c b/src/encoder.c index 8b46da50..1c39b965 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -837,7 +837,7 @@ static void encode_scaling_list(encoder_control* encoder) { uint32_t size_id; for (size_id = 0; size_id < SCALING_LIST_SIZE_NUM; size_id++) { - uint32_t list_id; + int32_t list_id; for (list_id = 0; list_id < g_scaling_list_num[size_id]; list_id++) { uint8_t scaling_list_pred_mode_flag = 1; int32_t pred_list_idx; diff --git a/src/picture.h b/src/picture.h index ea090b34..1d72f5cd 100644 --- a/src/picture.h +++ b/src/picture.h @@ -140,8 +140,8 @@ typedef struct picture_struct typedef struct { picture** pics; //!< \brief Pointer to array of picture pointers. - int32_t size; //!< \brief Array size. - int32_t used_size; + uint32_t size; //!< \brief Array size. + uint32_t used_size; } picture_list; diff --git a/src/search.c b/src/search.c index 69d26a70..3c0afc46 100644 --- a/src/search.c +++ b/src/search.c @@ -132,7 +132,7 @@ static int calc_mvd_cost(int x, int y, const vector2d *pred, y <<= 2; // Check every candidate to find a match - for(merge_idx = 0; merge_idx < num_cand; merge_idx++) { + for(merge_idx = 0; merge_idx < (uint32_t)num_cand; merge_idx++) { if (merge_cand[merge_idx][0] == x && merge_cand[merge_idx][1] == y && merge_cand[merge_idx][2] == ref_idx) { @@ -373,7 +373,7 @@ static unsigned search_mv_full(unsigned depth, static int search_cu_inter(encoder_control *encoder, int x, int y, int depth, lcu_t *lcu) { picture *cur_pic = encoder->in.cur_pic; - int32_t ref_idx = 0; + uint32_t ref_idx = 0; int x_local = (x&0x3f), y_local = (y&0x3f); int x_cu = x>>3; int y_cu = y>>3; @@ -427,7 +427,7 @@ static int search_cu_inter(encoder_control *encoder, int x, int y, int depth, lc for(merge_idx = 0; merge_idx < num_cand; merge_idx++) { if (merge_cand[merge_idx][0] == mv.x && merge_cand[merge_idx][1] == mv.y && - merge_cand[merge_idx][2] == ref_idx) { + (uint32_t)merge_cand[merge_idx][2] == ref_idx) { merged = 1; break; } @@ -699,9 +699,9 @@ static int search_cu_intra(encoder_control *encoder, // Find best intra mode for 2Nx2N. { - uint32_t cost = -1; + uint32_t cost = UINT32_MAX; int16_t mode = -1; - uint32_t bitcost = -1; + uint32_t bitcost = UINT32_MAX; pixel *ref_pixels = &lcu->ref.y[lcu_px.x + lcu_px.y * LCU_WIDTH]; unsigned pu_index = PU_INDEX(x_px >> 2, y_px >> 2); mode = intra_prediction(ref_pixels, LCU_WIDTH,