+ if (avctx->trellis) {
+ int frontier = 1 << avctx->trellis;
+ int max_paths = frontier * FREEZE_INTERVAL;
+
+ for (int i = 0; i < 2; i++) {
+ c->paths[i] = av_calloc(max_paths, sizeof(**c->paths));
+ c->node_buf[i] = av_calloc(frontier, 2 * sizeof(**c->node_buf));
+ c->nodep_buf[i] = av_calloc(frontier, 2 * sizeof(**c->nodep_buf));
+ if (!c->paths[i] || !c->node_buf[i] || !c->nodep_buf[i])
+ return AVERROR(ENOMEM);
+ }
+ }