mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
rename picture_init to picture alloc and picture_destroy to picture_free
This commit is contained in:
parent
b76f7377b6
commit
92e14cc80d
|
@ -359,7 +359,7 @@ static int encoder_state_init_one(encoder_state * const state, const encoder_sta
|
|||
state->frame = 0;
|
||||
state->poc = 0;
|
||||
|
||||
state->cur_pic = picture_init(width, height, width_in_lcu, height_in_lcu);
|
||||
state->cur_pic = picture_alloc(width, height, width_in_lcu, height_in_lcu);
|
||||
|
||||
if (!state->cur_pic) {
|
||||
printf("Error allocating picture!\r\n");
|
||||
|
@ -415,8 +415,8 @@ int encoder_state_init(encoder_state * const encoder_state, const encoder_contro
|
|||
}
|
||||
|
||||
static int encoder_state_finalize_one(encoder_state * const encoder_state) {
|
||||
picture_destroy(encoder_state->cur_pic);
|
||||
FREE_POINTER(encoder_state->cur_pic);
|
||||
picture_free(encoder_state->cur_pic);
|
||||
encoder_state->cur_pic = NULL;
|
||||
|
||||
bitstream_finalize(&encoder_state->stream);
|
||||
return 1;
|
||||
|
@ -1389,7 +1389,7 @@ void encoder_next_frame(encoder_state *encoder_state) {
|
|||
picture_list_add(encoder_state->ref, encoder_state->cur_pic);
|
||||
// Allocate new memory to current picture
|
||||
// TODO: reuse memory from old reference
|
||||
encoder_state->cur_pic = picture_init(encoder_state->cur_pic->width, encoder_state->cur_pic->height, encoder_state->cur_pic->width_in_lcu, encoder_state->cur_pic->height_in_lcu);
|
||||
encoder_state->cur_pic = picture_alloc(encoder_state->cur_pic->width, encoder_state->cur_pic->height, encoder_state->cur_pic->width_in_lcu, encoder_state->cur_pic->height_in_lcu);
|
||||
|
||||
// Copy pointer from the last cur_pic because we don't want to reallocate it
|
||||
MOVE_POINTER(encoder_state->cur_pic->coeff_y,encoder_state->ref->pics[0]->coeff_y);
|
||||
|
|
|
@ -172,8 +172,8 @@ int picture_list_destroy(picture_list *list)
|
|||
unsigned int i;
|
||||
if (list->used_size > 0) {
|
||||
for (i = 0; i < list->used_size; ++i) {
|
||||
picture_destroy(list->pics[i]);
|
||||
FREE_POINTER(list->pics[i]);
|
||||
picture_free(list->pics[i]);
|
||||
list->pics[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ int picture_list_rem(picture_list *list, unsigned n, int8_t destroy)
|
|||
}
|
||||
|
||||
if (destroy) {
|
||||
picture_destroy(list->pics[n]);
|
||||
FREE_POINTER(list->pics[n]);
|
||||
picture_free(list->pics[n]);
|
||||
list->pics[n] = NULL;
|
||||
}
|
||||
|
||||
// The last item is easy to remove
|
||||
|
@ -246,8 +246,8 @@ int picture_list_rem(picture_list *list, unsigned n, int8_t destroy)
|
|||
* \param pic picture pointer
|
||||
* \return picture pointer
|
||||
*/
|
||||
picture *picture_init(int32_t width, int32_t height,
|
||||
int32_t width_in_lcu, int32_t height_in_lcu)
|
||||
picture *picture_alloc(const int32_t width, const int32_t height,
|
||||
const int32_t width_in_lcu, const int32_t height_in_lcu)
|
||||
{
|
||||
picture *pic = (picture *)malloc(sizeof(picture));
|
||||
unsigned int luma_size = width * height;
|
||||
|
@ -306,7 +306,7 @@ picture *picture_init(int32_t width, int32_t height,
|
|||
* \param pic picture pointer
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int picture_destroy(picture *pic)
|
||||
int picture_free(picture * const pic)
|
||||
{
|
||||
free(pic->u_data);
|
||||
free(pic->v_data);
|
||||
|
@ -332,6 +332,8 @@ int picture_destroy(picture *pic)
|
|||
|
||||
FREE_POINTER(pic->sao_luma);
|
||||
FREE_POINTER(pic->sao_chroma);
|
||||
|
||||
free(pic);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -213,9 +213,9 @@ typedef struct {
|
|||
yuv_t * alloc_yuv_t(int luma_size);
|
||||
void dealloc_yuv_t(yuv_t * yuv);
|
||||
|
||||
picture * picture_init(int32_t width, int32_t height,
|
||||
picture * picture_alloc(int32_t width, int32_t height,
|
||||
int32_t width_in_lcu, int32_t height_in_lcu);
|
||||
int picture_destroy(picture *pic);
|
||||
int picture_free(picture *pic);
|
||||
|
||||
void picture_blit_pixels(const pixel* orig, pixel *dst,
|
||||
unsigned width, unsigned height,
|
||||
|
|
Loading…
Reference in a new issue