MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_frame

Function decode_frame

libavcodec/ffv1dec.c:795–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793}
794
795static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
796 int *got_frame, AVPacket *avpkt)
797{
798 FFV1Context *f = avctx->priv_data;
799 int ret;
800 AVFrame *p;
801 const FFHWAccel *hwaccel = NULL;
802
803 /* This is copied onto the first slice's range coder context */
804 RangeCoder c;
805
806 ff_progress_frame_unref(&f->last_picture);
807 av_refstruct_unref(&f->hwaccel_last_picture_private);
808
809 FFSWAP(ProgressFrame, f->picture, f->last_picture);
810 FFSWAP(void *, f->hwaccel_picture_private, f->hwaccel_last_picture_private);
811
812 f->avctx = avctx;
813 f->frame_damaged = 0;
814
815 ret = decode_header(avctx, &c, avpkt->data, avpkt->size);
816 if (ret < 0)
817 return ret;
818
819 if (avctx->debug & FF_DEBUG_PICT_INFO)
820 av_log(avctx, AV_LOG_DEBUG, "ver:%d keyframe:%d coder:%d ec:%d slices:%d bps:%d\n",
821 f->version, !!f->key_frame, f->ac, f->ec, f->slice_count, f->avctx->bits_per_raw_sample);
822
823 if (avctx->skip_frame >= AVDISCARD_ALL)
824 return avpkt->size;
825
826 if (avctx->hwaccel)
827 hwaccel = ffhwaccel(avctx->hwaccel);
828
829 ret = ff_progress_frame_get_buffer(avctx, &f->picture,
830 AV_GET_BUFFER_FLAG_REF);
831 if (ret < 0)
832 return ret;
833
834 ret = ff_hwaccel_frame_priv_alloc(avctx, &f->hwaccel_picture_private);
835 if (ret < 0)
836 return ret;
837
838 p = f->picture.f;
839
840 p->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P
841 p->flags = (p->flags & ~AV_FRAME_FLAG_KEY) | f->key_frame;
842
843 if (f->version < 3 && avctx->field_order > AV_FIELD_PROGRESSIVE) {
844 /* we have interlaced material flagged in container */
845 p->flags |= AV_FRAME_FLAG_INTERLACED;
846 if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)
847 p->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
848 }
849
850 /* Start */
851 if (hwaccel) {
852 ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size);

Callers

nothing calls this directly

Calls 13

ff_progress_frame_unrefFunction · 0.85
av_refstruct_unrefFunction · 0.85
av_logFunction · 0.85
ffhwaccelFunction · 0.85
ff_progress_frame_awaitFunction · 0.85
find_next_sliceFunction · 0.85
ff_progress_frame_reportFunction · 0.85
av_frame_refFunction · 0.85
decode_headerFunction · 0.70
ff_thread_finish_setupFunction · 0.70

Tested by

no test coverage detected