diff --git a/src/encoder_state-ctors_dtors.c b/src/encoder_state-ctors_dtors.c index 96912f3c..e194cd8e 100644 --- a/src/encoder_state-ctors_dtors.c +++ b/src/encoder_state-ctors_dtors.c @@ -113,15 +113,14 @@ static void encoder_state_config_tile_finalize(encoder_state_t * const state) { static int encoder_state_config_slice_init(encoder_state_t * const state, const int start_address_in_ts, const int end_address_in_ts) { - int i = 0, slice_found=0; - for (i = 0; i < state->encoder_control->slice_count; ++i) { + state->slice->id = -1; + for (int i = 0; i < state->encoder_control->slice_count; ++i) { if (state->encoder_control->slice_addresses_in_ts[i] == start_address_in_ts) { state->slice->id = i; - slice_found = 1; break; } } - assert(slice_found); + assert(state->slice->id != -1); state->slice->start_in_ts = start_address_in_ts; state->slice->end_in_ts = end_address_in_ts; diff --git a/src/image.c b/src/image.c index 7c40e994..ef387265 100644 --- a/src/image.c +++ b/src/image.c @@ -114,10 +114,9 @@ void kvz_image_free(kvz_picture *const im) */ kvz_picture *kvz_image_copy_ref(kvz_picture *im) { - int32_t new_refcount = ATOMIC_INC(&(im->refcount)); - // The caller should have had another reference. - assert(new_refcount > 1); + assert(im->refcount > 0); + ATOMIC_INC(&(im->refcount)); return im; }