static vpx_codec_err_t vp9_init(vpx_codec_ctx_t *ctx, vpx_codec_priv_enc_mr_cfg_t *data) { vpx_codec_err_t res = VPX_CODEC_OK; // This function only allocates space for the vpx_codec_alg_priv_t // structure. More memory may be required at the time the stream // information becomes known. if (!ctx->priv) { vpx_codec_mmap_t mmap; mmap.id = vp9_mem_req_segs[0].id; mmap.sz = sizeof(vpx_codec_alg_priv_t); mmap.align = vp9_mem_req_segs[0].align; mmap.flags = vp9_mem_req_segs[0].flags; res = vpx_mmap_alloc(&mmap); if (!res) { vp9_init_ctx(ctx, &mmap); ctx->priv->alg_priv->defer_alloc = 1; } } return res; }
static vpx_codec_err_t vp9_xma_set_mmap(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap) { vpx_codec_err_t res = VPX_CODEC_MEM_ERROR; int i, done; if (!ctx->priv) { if (mmap->id == VP9_SEG_ALG_PRIV) { if (!ctx->priv) { vp9_init_ctx(ctx, mmap); res = VPX_CODEC_OK; } } } done = 1; if (!res && ctx->priv->alg_priv) { for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++) { if (ctx->priv->alg_priv->mmaps[i].id == mmap->id) if (!ctx->priv->alg_priv->mmaps[i].base) { ctx->priv->alg_priv->mmaps[i] = *mmap; res = VPX_CODEC_OK; } done &= (ctx->priv->alg_priv->mmaps[i].base != NULL); } } if (done && !res) { vp9_finalize_mmaps(ctx->priv->alg_priv); res = ctx->iface->init(ctx, NULL); } return res; }
static vpx_codec_err_t vp9_init(vpx_codec_ctx_t *ctx, vpx_codec_priv_enc_mr_cfg_t *data) { vpx_codec_err_t res = VPX_CODEC_OK; // This function only allocates space for the vpx_codec_alg_priv_t // structure. More memory may be required at the time the stream // information becomes known. if (!ctx->priv) { vpx_codec_mmap_t mmap; mmap.id = vp9_mem_req_segs[0].id; mmap.sz = sizeof(vpx_codec_alg_priv_t); mmap.align = vp9_mem_req_segs[0].align; mmap.flags = vp9_mem_req_segs[0].flags; res = vpx_mmap_alloc(&mmap); if (!res) { vp9_init_ctx(ctx, &mmap); ctx->priv->alg_priv->defer_alloc = 1; } } #if USE_INTER_PREDICT_OCL // Initialize opencl for vp9 vp9_init_ocl(); #if COPY_MIP_GPU create_cpy_mip_kernel(&ocl_cpy_mip_obj); #endif #endif // USE_INTER_PREDICT_OCL return res; }