/** * \brief Add picture to the front of the picturelist * \param pic picture pointer to add * \param picture_list list to use * \return 1 on success */ int kvz_image_list_add(image_list_t *list, kvz_picture *im, cu_array_t *cua, int32_t poc) { int i = 0; if (KVZ_ATOMIC_INC(&(im->refcount)) == 1) { fprintf(stderr, "Tried to add an unreferenced picture. This is a bug!\n"); assert(0); //Stop for debugging return 0; } if (KVZ_ATOMIC_INC(&(cua->refcount)) == 1) { fprintf(stderr, "Tried to add an unreferenced cu_array. This is a bug!\n"); assert(0); //Stop for debugging return 0; } if (list->size == list->used_size) { if (!kvz_image_list_resize(list, list->size*2)) return 0; } for (i = list->used_size; i > 0; i--) { list->images[i] = list->images[i - 1]; list->cu_arrays[i] = list->cu_arrays[i - 1]; list->pocs[i] = list->pocs[i - 1]; } list->images[0] = im; list->cu_arrays[0] = cua; list->pocs[0] = poc; list->used_size++; return 1; }
/** * \brief Get a new pointer to a job. * * Increment reference count and return the job. */ threadqueue_job_t *kvz_threadqueue_copy_ref(threadqueue_job_t *job) { // The caller should have had another reference. assert(job->refcount > 0); KVZ_ATOMIC_INC(&job->refcount); return job; }