Exemple #1
0
static vpx_codec_err_t vp8_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 == VP8_SEG_ALG_PRIV) {
      if (!ctx->priv) {
        vp8_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) {
    vp8_finalize_mmaps(ctx->priv->alg_priv);
    res = ctx->iface->init(ctx, NULL);
  }

  return res;
}
Exemple #2
0
static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx,
                                vpx_codec_priv_enc_mr_cfg_t *data)
{
    vpx_codec_err_t        res = VPX_CODEC_OK;
    (void) data;

    vp8_rtcd();

    /* 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 = vp8_mem_req_segs[0].id;
        mmap.sz = sizeof(vpx_codec_alg_priv_t);
        mmap.align = vp8_mem_req_segs[0].align;
        mmap.flags = vp8_mem_req_segs[0].flags;

        res = vp8_mmap_alloc(&mmap);

        if (!res)
        {
            vp8_init_ctx(ctx, &mmap);

            ctx->priv->alg_priv->defer_alloc = 1;
            /*post processing level initialized to do nothing */
        }
    }

    return res;
}
Exemple #3
0
static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx,
                                vpx_codec_priv_enc_mr_cfg_t *data)
{
    vpx_codec_err_t res = VPX_CODEC_OK;
    vpx_codec_alg_priv_t *priv = NULL;
    (void) data;

    vp8_rtcd();

    /* 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)
    {
        vp8_init_ctx(ctx);
        priv = (vpx_codec_alg_priv_t *)ctx->priv;

        /* initialize number of fragments to zero */
        priv->fragments.count = 0;
        /* is input fragments enabled? */
        priv->fragments.enabled =
            (priv->base.init_flags & VPX_CODEC_USE_INPUT_FRAGMENTS);

        /*post processing level initialized to do nothing */
    }
    else
    {
        priv = (vpx_codec_alg_priv_t *)ctx->priv;
    }

    priv->yv12_frame_buffers.use_frame_threads =
        (ctx->priv->init_flags & VPX_CODEC_USE_FRAME_THREADING);

    /* for now, disable frame threading */
    priv->yv12_frame_buffers.use_frame_threads = 0;

    if (priv->yv12_frame_buffers.use_frame_threads &&
        ((ctx->priv->init_flags & VPX_CODEC_USE_ERROR_CONCEALMENT) ||
         (ctx->priv->init_flags & VPX_CODEC_USE_INPUT_FRAGMENTS)))
    {
        /* row-based threading, error concealment, and input fragments will
         * not be supported when using frame-based threading */
        res = VPX_CODEC_INVALID_PARAM;
    }

    return res;
}