Exemple #1
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 #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;
    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;
}