Lines Matching defs:frame
34 #include "libavutil/frame.h"
65 QSVFrame *frame;
119 static int qsv_get_continuous_buffer(AVCodecContext *avctx, AVFrame *frame,
124 ff_decode_frame_props(avctx, frame);
126 frame->width = avctx->width;
127 frame->height = avctx->height;
131 frame->linesize[0] = FFALIGN(avctx->width, 128);
135 frame->linesize[0] = 2 * FFALIGN(avctx->width, 128);
138 frame->linesize[0] = 4 * FFALIGN(avctx->width, 128);
145 frame->buf[0] = av_buffer_pool_get(pool);
146 if (!frame->buf[0])
149 frame->data[0] = frame->buf[0]->data;
152 frame->linesize[1] = frame->linesize[0];
153 frame->data[1] = frame->data[0] +
154 frame->linesize[0] * FFALIGN(avctx->height, 64);
157 ret = ff_attach_decode_data(frame);
292 av_log(NULL, AV_LOG_ERROR, "Error initializing a QSV frame pool\n");
420 static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
425 ret = qsv_get_continuous_buffer(avctx, frame->frame, q->pool);
427 ret = ff_get_buffer(avctx, frame->frame, AV_GET_BUFFER_FLAG_REF);
432 if (frame->frame->format == AV_PIX_FMT_QSV) {
433 frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
435 ret = ff_qsv_map_frame_to_surface(frame->frame, &frame->surface);
437 av_log(avctx, AV_LOG_ERROR, "map frame to surface failed.\n");
442 frame->surface.Info = q->frame_info;
445 ret = ff_qsv_find_surface_idx(&q->frames_ctx, frame);
449 frame->surface.Data.MemId = &q->frames_ctx.mids[ret];
452 frame->surface.Data.ExtParam = frame->ext_param;
453 frame->surface.Data.NumExtParam = 0;
454 frame->num_ext_params = 0;
455 frame->dec_info.Header.BufferId = MFX_EXTBUFF_DECODED_FRAME_INFO;
456 frame->dec_info.Header.BufferSz = sizeof(frame->dec_info);
457 ff_qsv_frame_add_ext_param(avctx, frame, (mfxExtBuffer *)&frame->dec_info);
460 frame->av1_film_grain_param.Header.BufferId = MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM;
461 frame->av1_film_grain_param.Header.BufferSz = sizeof(frame->av1_film_grain_param);
462 frame->av1_film_grain_param.FilmGrainFlags = 0;
463 ff_qsv_frame_add_ext_param(avctx, frame, (mfxExtBuffer *)&frame->av1_film_grain_param);
467 frame->used = 1;
478 av_frame_unref(cur->frame);
486 QSVFrame *frame, **last;
491 frame = q->work_frames;
493 while (frame) {
494 if (!frame->used) {
495 ret = alloc_frame(avctx, q, frame);
498 *surf = &frame->surface;
502 last = &frame->next;
503 frame = frame->next;
506 frame = av_mallocz(sizeof(*frame));
507 if (!frame)
509 frame->frame = av_frame_alloc();
510 if (!frame->frame) {
511 av_freep(&frame);
514 *last = frame;
516 ret = alloc_frame(avctx, q, frame);
520 *surf = &frame->surface;
537 static int qsv_export_film_grain(AVCodecContext *avctx, mfxExtAV1FilmGrainParam *ext_param, AVFrame *frame)
546 fgp = av_film_grain_params_create_side_data(frame);
604 AVFrame *frame, int *got_frame,
675 "The returned surface does not correspond to any frame\n");
694 aframe.frame->queued -= 1;
704 src_frame = aframe.frame->frame;
706 ret = av_frame_ref(frame, src_frame);
710 outsurf = &aframe.frame->surface;
712 frame->pts = MFX_PTS_TO_PTS(outsurf->Data.TimeStamp, avctx->pkt_timebase);
717 ret = qsv_export_film_grain(avctx, &aframe.frame->av1_film_grain_param, frame);
724 frame->repeat_pict =
728 frame->top_field_first =
730 frame->interlaced_frame =
732 frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
733 //Key frame is IDR frame is only suitable for H264. For HEVC, IRAPs are key frames.
735 frame->key_frame = !!(aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR);
739 ((mfxFrameSurface1*)frame->data[3])->Info = outsurf->Info;
763 av_frame_free(&cur->frame);
776 AVFrame *frame, int *got_frame, const AVPacket *pkt)
783 return qsv_decode(avctx, q, frame, got_frame, pkt);
800 ret = qsv_decode(avctx, q, frame, got_frame, &zero_pkt);
844 return qsv_decode(avctx, q, frame, got_frame, pkt);
940 static int qsv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
962 return avpkt->size ? avpkt->size : qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt);
970 ret = qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->buffer_pkt);