Home | History | Annotate | Download | only in vp9

Lines Matching full:ctx

75 static void vp9_init_ctx(vpx_codec_ctx_t *ctx, const vpx_codec_mmap_t *mmap) {
78 ctx->priv = mmap->base;
79 ctx->priv->sz = sizeof(*ctx->priv);
80 ctx->priv->iface = ctx->iface;
81 ctx->priv->alg_priv = mmap->base;
83 for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++)
84 ctx->priv->alg_priv->mmaps[i].id = vp9_mem_req_segs[i].id;
86 ctx->priv->alg_priv->mmaps[0] = *mmap;
87 ctx->priv->alg_priv->si.sz = sizeof(ctx->priv->alg_priv->si);
88 ctx->priv->init_flags = ctx->init_flags;
90 if (ctx->config.dec) {
92 ctx->priv->alg_priv->cfg = *ctx->config.dec;
93 ctx->config.dec = &ctx->priv->alg_priv->cfg;
97 static void vp9_finalize_mmaps(vpx_codec_alg_priv_t *ctx) {
101 static vpx_codec_err_t vp9_init(vpx_codec_ctx_t *ctx,
109 if (!ctx->priv) {
120 vp9_init_ctx(ctx, &mmap);
122 ctx->priv->alg_priv->defer_alloc = 1;
130 static vpx_codec_err_t vp9_destroy(vpx_codec_alg_priv_t *ctx) {
133 vp9_remove_decompressor(ctx->pbi);
135 for (i = NELEMENTS(ctx->mmaps) - 1; i >= 0; i--) {
136 if (ctx->mmaps[i].dtor)
137 ctx->mmaps[i].dtor(&ctx->mmaps[i]);
206 static vpx_codec_err_t vp9_get_si(vpx_codec_alg_priv_t *ctx,
215 memcpy(si, &ctx->si, sz);
223 update_error_state(vpx_codec_alg_priv_t *ctx,
228 ctx->base.err_detail = error->has_detail
235 static vpx_codec_err_t decode_one(vpx_codec_alg_priv_t *ctx,
242 ctx->img_avail = 0;
248 if (!ctx->si.h)
249 res = ctx->base.iface->dec.peek_si(*data, data_sz, &ctx->si);
253 if (!res && ctx->defer_alloc) {
256 for (i = 1; !res && i < NELEMENTS(ctx->mmaps); i++) {
259 cfg.w = ctx->si.w;
260 cfg.h = ctx->si.h;
261 ctx->mmaps[i].id = vp9_mem_req_segs[i].id;
262 ctx->mmaps[i].sz = vp9_mem_req_segs[i].sz;
263 ctx->mmaps[i].align = vp9_mem_req_segs[i].align;
264 ctx->mmaps[i].flags = vp9_mem_req_segs[i].flags;
266 if (!ctx->mmaps[i].sz)
267 ctx->mmaps[i].sz = vp9_mem_req_segs[i].calc_sz(&cfg,
268 ctx->base.init_flags);
270 res = vpx_mmap_alloc(&ctx->mmaps[i]);
274 vp9_finalize_mmaps(ctx);
276 ctx->defer_alloc = 0;
280 if (!res && !ctx->decoder_init) {
281 res = vpx_validate_mmaps(&ctx->si, ctx->mmaps,
283 ctx->base.init_flags);
291 oxcf.width = ctx->si.w;
292 oxcf.height = ctx->si.h;
295 oxcf.max_threads = ctx->cfg.threads;
296 oxcf.inv_tile_order = ctx->invert_tile_order;
302 if (!ctx->postproc_cfg_set
303 && (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC)) {
304 ctx->postproc_cfg.post_proc_flag =
306 ctx->postproc_cfg.deblocking_level = 4;
307 ctx->postproc_cfg.noise_level = 0;
313 ctx->pbi = optr;
316 ctx->decoder_init = 1;
319 if (!res && ctx->pbi) {
324 if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC) {
327 ((ctx->dbg_color_ref_frame_flag != 0) ?
329 | ((ctx->dbg_color_mb_modes_flag != 0) ?
331 | ((ctx->dbg_color_b_modes_flag != 0) ?
333 | ((ctx->dbg_display_mv_flag != 0) ?
337 ctx->postproc_cfg.post_proc_flag;
339 flags.deblocking_level = ctx->postproc_cfg.deblocking_level;
340 flags.noise_level = ctx->postproc_cfg.noise_level;
342 flags.display_ref_frame_flag = ctx->dbg_color_ref_frame_flag;
343 flags.display_mb_modes_flag = ctx->dbg_color_mb_modes_flag;
344 flags.display_b_modes_flag = ctx->dbg_color_b_modes_flag;
345 flags.display_mv_flag = ctx->dbg_display_mv_flag;
349 if (vp9_receive_compressed_data(ctx->pbi, data_sz, data, deadline)) {
350 VP9D_COMP *pbi = (VP9D_COMP *)ctx->pbi;
351 res = update_error_state(ctx, &pbi->common.error);
354 if (!res && 0 == vp9_get_raw_frame(ctx->pbi, &sd, &time_stamp,
356 yuvconfig2image(&ctx->img, &sd, user_priv);
357 ctx->img_avail = 1;
397 static vpx_codec_err_t vp9_decode(vpx_codec_alg_priv_t *ctx,
435 ctx->base.err_detail = "Invalid frame size in index";
443 res = decode_one(ctx, &data_start, data_sz, user_priv, deadline);
460 static vpx_image_t *vp9_get_frame(vpx_codec_alg_priv_t *ctx,
464 if (ctx->img_avail) {
469 img = &ctx->img;
473 ctx->img_avail = 0;
478 static vpx_codec_err_t vp9_xma_get_mmap(const vpx_codec_ctx_t *ctx,
500 mmap->sz = seg_iter->calc_sz(ctx->config.dec, ctx->init_flags);
511 static vpx_codec_err_t vp9_xma_set_mmap(vpx_codec_ctx_t *ctx,
516 if (!ctx->priv) {
518 if (!ctx->priv) {
519 vp9_init_ctx(ctx, mmap);
527 if (!res && ctx->priv->alg_priv) {
528 for (i = 0; i < NELEMENTS(ctx->priv->alg_priv->mmaps); i++) {
529 if (ctx->priv->alg_priv->mmaps[i].id == mmap->id)
530 if (!ctx->priv->alg_priv->mmaps[i].base) {
531 ctx->priv->alg_priv->mmaps[i] = *mmap;
535 done &= (ctx->priv->alg_priv->mmaps[i].base != NULL);
540 vp9_finalize_mmaps(ctx->priv->alg_priv);
541 res = ctx->iface->init(ctx, NULL);
547 static vpx_codec_err_t set_reference(vpx_codec_alg_priv_t *ctx,
558 return vp9_set_reference_dec(ctx->pbi,
565 static vpx_codec_err_t copy_reference(vpx_codec_alg_priv_t *ctx,
576 return vp9_copy_reference_dec(ctx->pbi,
583 static vpx_codec_err_t get_reference(vpx_codec_alg_priv_t *ctx,
591 vp9_get_reference_dec(ctx->pbi, data->idx, &fb);
599 static vpx_codec_err_t set_postproc(vpx_codec_alg_priv_t *ctx,
606 ctx->postproc_cfg_set = 1;
607 ctx->postproc_cfg = *((vp8_postproc_cfg_t *)data);
617 static vpx_codec_err_t set_dbg_options(vpx_codec_alg_priv_t *ctx,
626 MAP(VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag);
627 MAP(VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag);
628 MAP(VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag);
629 MAP(VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag);
638 static vpx_codec_err_t get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
642 VP9D_COMP *pbi = (VP9D_COMP *)ctx->pbi;
654 static vpx_codec_err_t get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
660 VP9D_COMP *pbi = (VP9D_COMP *)ctx->pbi;
671 static vpx_codec_err_t set_invert_tile_order(vpx_codec_alg_priv_t *ctx,
674 ctx->invert_tile_order = va_arg(args, int);