Esempio n. 1
0
static vpx_codec_err_t decoder_destroy(vpx_codec_alg_priv_t *ctx) {
  if (ctx->frame_workers != NULL) {
    int i;
    for (i = 0; i < ctx->num_frame_workers; ++i) {
      VPxWorker *const worker = &ctx->frame_workers[i];
      FrameWorkerData *const frame_worker_data =
          (FrameWorkerData *)worker->data1;
      vpx_get_worker_interface()->end(worker);
      vp10_remove_common(&frame_worker_data->pbi->common);
#if CONFIG_VP9_POSTPROC
      vp10_free_postproc_buffers(&frame_worker_data->pbi->common);
#endif
      vp10_decoder_remove(frame_worker_data->pbi);
      vpx_free(frame_worker_data->scratch_buffer);
#if CONFIG_MULTITHREAD
      pthread_mutex_destroy(&frame_worker_data->stats_mutex);
      pthread_cond_destroy(&frame_worker_data->stats_cond);
#endif
      vpx_free(frame_worker_data);
    }
#if CONFIG_MULTITHREAD
    pthread_mutex_destroy(&ctx->buffer_pool->pool_mutex);
#endif
  }

  if (ctx->buffer_pool) {
    vp10_free_ref_frame_buffers(ctx->buffer_pool);
    vp10_free_internal_frame_buffers(&ctx->buffer_pool->int_frame_buffers);
  }

  vpx_free(ctx->frame_workers);
  vpx_free(ctx->buffer_pool);
  vpx_free(ctx);
  return VPX_CODEC_OK;
}
Esempio n. 2
0
int vp10_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
  assert(list != NULL);
  vp10_free_internal_frame_buffers(list);

  list->num_internal_frame_buffers =
      VPX_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
  list->int_fb = (InternalFrameBuffer *)vpx_calloc(
      list->num_internal_frame_buffers, sizeof(*list->int_fb));
  return (list->int_fb == NULL);
}