void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) { int i; for (i = 0; i < NUM_YV12_BUFFERS; i++) vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]); vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame); #if CONFIG_POSTPROC vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer); if (oci->post_proc_buffer_int_used) vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer_int); vpx_free(oci->pp_limits_buffer); oci->pp_limits_buffer = NULL; #endif vpx_free(oci->above_context); vpx_free(oci->mip); #if CONFIG_ERROR_CONCEALMENT vpx_free(oci->prev_mip); oci->prev_mip = NULL; #endif oci->above_context = NULL; oci->mip = NULL; }
void vp8_denoiser_free(VP8_DENOISER *denoiser) { int i; assert(denoiser); for (i = 0; i < MAX_REF_FRAMES ; i++) { vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]); } vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_mc_running_avg); }
int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border) { if (ybf) { vp8_yv12_de_alloc_frame_buffer(ybf); return vp8_yv12_realloc_frame_buffer(ybf, width, height, border); } return -2; }
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci) { int i; for (i = 0; i < NUM_YV12_BUFFERS; i++) vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]); vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame); vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer); vpx_free(oci->above_context); vpx_free(oci->mip); oci->above_context = 0; oci->mip = 0; }
int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border) { /*NOTE:*/ int yplane_size = (height + 2 * border) * (width + 2 * border); int uvplane_size = ((1 + height) / 2 + border) * ((1 + width) / 2 + border); if (ybf) { vp8_yv12_de_alloc_frame_buffer(ybf); ybf->y_width = width; ybf->y_height = height; ybf->y_stride = width + 2 * border; ybf->uv_width = (1 + width) / 2; ybf->uv_height = (1 + height) / 2; ybf->uv_stride = ybf->uv_width + border; ybf->border = border; ybf->frame_size = yplane_size + 2 * uvplane_size; /* Added 2 extra lines to framebuffer so that copy12x12 doesn't fail * when we have a large motion vector in V on the last v block. * Note : We never use these pixels anyway so this doesn't hurt. */ ybf->buffer_alloc = (unsigned char *) duck_memalign(32, ybf->frame_size + (ybf->y_stride * 2) + 32, 0); if (ybf->buffer_alloc == NULL) return -1; ybf->y_buffer = ybf->buffer_alloc + (border * ybf->y_stride) + border; if (yplane_size & 0xf) yplane_size += 16 - (yplane_size & 0xf); ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * ybf->uv_stride) + border / 2; ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * ybf->uv_stride) + border / 2; ybf->corrupted = 0; /* assume not currupted by errors */ } else { return -2; } return 0; }
void vp8_lookahead_destroy(struct lookahead_ctx *ctx) { if(ctx) { if(ctx->buf) { unsigned int i; for(i = 0; i < ctx->max_sz; i++) vp8_yv12_de_alloc_frame_buffer(&ctx->buf[i].img); free(ctx->buf); } free(ctx); } }