Lines Matching defs:avctx
78 int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
84 if (avctx->hwaccel)
88 av_log(avctx, AV_LOG_ERROR, "Image too small, temporary buffers cannot function\n");
92 if (av_image_check_size2(alloc_size, EMU_EDGE_HEIGHT, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)
118 static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic,
123 int edges_needed = av_codec_is_encoder(avctx->codec);
129 pic->f->width = avctx->width + 2 * EDGE_WIDTH;
130 pic->f->height = avctx->height + 2 * EDGE_WIDTH;
132 r = ff_encode_alloc_frame(avctx, pic->f);
133 } else if (avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
134 avctx->codec_id != AV_CODEC_ID_VC1IMAGE &&
135 avctx->codec_id != AV_CODEC_ID_MSS2) {
136 r = ff_thread_get_ext_buffer(avctx, &pic->tf,
139 pic->f->width = avctx->width;
140 pic->f->height = avctx->height;
141 pic->f->format = avctx->pix_fmt;
142 r = avcodec_default_get_buffer2(avctx, pic->f, 0);
146 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed (%d %p)\n",
159 pic->f->width = avctx->width;
160 pic->f->height = avctx->height;
163 if (avctx->hwaccel) {
165 if (avctx->hwaccel->frame_priv_data_size) {
166 pic->hwaccel_priv_buf = av_buffer_allocz(avctx->hwaccel->frame_priv_data_size);
168 av_log(avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
177 av_log(avctx, AV_LOG_ERROR,
181 ff_mpeg_unref_picture(avctx, pic);
187 av_log(avctx, AV_LOG_ERROR,
189 ff_mpeg_unref_picture(avctx, pic);
194 (ret = ff_mpeg_framesize_alloc(avctx, me, sc,
196 av_log(avctx, AV_LOG_ERROR,
198 ff_mpeg_unref_picture(avctx, pic);
205 static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encoding, int out_format,
230 (avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) {
253 int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me,
271 if (alloc_frame_buffer(avctx, pic, me, sc,
281 ret = alloc_picture_tables(avctx, pic, encoding, out_format,
307 av_log(avctx, AV_LOG_ERROR, "Error allocating a picture.\n");
308 ff_mpeg_unref_picture(avctx, pic);
317 void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic)
324 if (avctx->codec_id != AV_CODEC_ID_WMV3IMAGE &&
325 avctx->codec_id != AV_CODEC_ID_VC1IMAGE &&
326 avctx->codec_id != AV_CODEC_ID_MSS2)
327 ff_thread_release_ext_buffer(avctx, &pic->tf);
377 int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
416 ff_mpeg_unref_picture(avctx, dst);
429 static int find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
445 av_log(avctx, AV_LOG_FATAL,
462 int ff_find_unused_picture(AVCodecContext *avctx, Picture *picture, int shared)
464 int ret = find_unused_picture(avctx, picture, shared);
468 ff_mpeg_unref_picture(avctx, &picture[ret]);
474 void av_cold ff_mpv_picture_free(AVCodecContext *avctx, Picture *pic)
477 ff_mpeg_unref_picture(avctx, pic);