| 105 | } |
| 106 | |
| 107 | static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f) |
| 108 | { |
| 109 | VP9Context *s = avctx->priv_data; |
| 110 | int ret, sz; |
| 111 | |
| 112 | ret = ff_progress_frame_get_buffer(avctx, &f->tf, AV_GET_BUFFER_FLAG_REF); |
| 113 | if (ret < 0) |
| 114 | return ret; |
| 115 | |
| 116 | sz = 64 * s->sb_cols * s->sb_rows; |
| 117 | if (sz != s->frame_extradata_pool_size) { |
| 118 | av_refstruct_pool_uninit(&s->frame_extradata_pool); |
| 119 | s->frame_extradata_pool = av_refstruct_pool_alloc(sz * (1 + sizeof(VP9mvrefPair)), |
| 120 | AV_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME); |
| 121 | if (!s->frame_extradata_pool) { |
| 122 | s->frame_extradata_pool_size = 0; |
| 123 | ret = AVERROR(ENOMEM); |
| 124 | goto fail; |
| 125 | } |
| 126 | s->frame_extradata_pool_size = sz; |
| 127 | } |
| 128 | f->extradata = av_refstruct_pool_get(s->frame_extradata_pool); |
| 129 | if (!f->extradata) { |
| 130 | ret = AVERROR(ENOMEM); |
| 131 | goto fail; |
| 132 | } |
| 133 | |
| 134 | f->segmentation_map = f->extradata; |
| 135 | f->mv = (VP9mvrefPair *) ((char*)f->extradata + sz); |
| 136 | |
| 137 | ret = ff_hwaccel_frame_priv_alloc(avctx, &f->hwaccel_picture_private); |
| 138 | if (ret < 0) |
| 139 | goto fail; |
| 140 | |
| 141 | return 0; |
| 142 | |
| 143 | fail: |
| 144 | vp9_frame_unref(f); |
| 145 | return ret; |
| 146 | } |
| 147 | |
| 148 | static void vp9_frame_replace(VP9Frame *dst, const VP9Frame *src) |
| 149 | { |
no test coverage detected