Lines Matching defs:avctx

57 static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
60 if (avctx->bits_per_raw_sample > 8) {
61 av_assert1(((MpegEncContext *)avctx->priv_data)->studio_profile);
62 return avctx->pix_fmt;
65 if (avctx->codec->id == AV_CODEC_ID_MSS2)
68 if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY)) {
69 if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED)
70 avctx->color_range = AVCOL_RANGE_MPEG;
74 return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
77 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
79 MpegEncContext *s = avctx->priv_data;
85 ff_mpv_decode_init(s, avctx);
92 switch (avctx->codec->id) {
95 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
126 avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
134 av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n",
135 avctx->codec->id);
139 if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263"))
140 if (avctx->extradata_size == 56 && avctx->extradata[0] == 1)
144 if (avctx->codec->id != AV_CODEC_ID_H263 &&
145 avctx->codec->id != AV_CODEC_ID_H263P &&
146 avctx->codec->id != AV_CODEC_ID_MPEG4) {
147 avctx->pix_fmt = h263_get_format(avctx);
160 av_cold int ff_h263_decode_end(AVCodecContext *avctx)
162 MpegEncContext *s = avctx->priv_data;
175 if (s->divx_packed || s->avctx->hwaccel) {
180 } else if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
203 const int mb_size = 16 >> s->avctx->lowres;
214 if ((ret = ff_mpeg4_decode_studio_slice_header(s->avctx->priv_data)) < 0)
218 if (s->avctx->hwaccel) {
220 ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start);
230 if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0)
299 av_log(s->avctx, AV_LOG_ERROR,
306 av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
310 if ((s->avctx->err_recognition & AV_EF_IGNORE_ERR) && get_bits_left(&s->gb) > 0)
400 (s->avctx->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE)))
406 av_log(s->avctx, AV_LOG_ERROR,
410 av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
418 av_log(s->avctx, AV_LOG_ERROR,
428 int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
433 MpegEncContext *s = avctx->priv_data;
452 if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
462 av_log(s->avctx, AV_LOG_ERROR,
479 av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
506 } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
507 if (s->avctx->extradata_size && s->picture_number == 0) {
510 if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
511 ff_mpeg4_decode_picture_header(avctx->priv_data, &gb, 1, 0);
513 ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb, 0, 0);
523 if ( s->width != avctx->coded_width
524 || s->height != avctx->coded_height) {
525 av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
526 s->width = avctx->coded_width;
527 s->height= avctx->coded_height;
535 av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
540 avctx->pix_fmt = h263_get_format(avctx);
546 int i = ff_find_unused_picture(s->avctx, s->picture, 0);
552 avctx->has_b_frames = !s->low_delay;
554 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
557 if (ff_mpeg4_workaround_bugs(avctx) == 1)
567 if (s->width != avctx->coded_width ||
568 s->height != avctx->coded_height ||
573 ret = ff_set_dimensions(avctx, s->width, s->height);
577 ff_set_sar(avctx, avctx->sample_aspect_ratio);
582 if (avctx->pix_fmt != h263_get_format(avctx)) {
583 av_log(avctx, AV_LOG_ERROR, "format change not supported\n");
584 avctx->pix_fmt = AV_PIX_FMT_NONE;
602 if ((avctx->skip_frame >= AVDISCARD_NONREF &&
604 (avctx->skip_frame >= AVDISCARD_NONKEY &&
606 avctx->skip_frame >= AVDISCARD_ALL)
617 if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
620 if (!s->divx_packed && !avctx->hwaccel)
621 ff_thread_finish_setup(avctx);
623 if (avctx->hwaccel) {
624 ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
679 if (avctx->hwaccel) {
680 ret = avctx->hwaccel->end_frame(avctx);
687 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
688 ff_mpeg4_frame_end(avctx, buf, buf_size);
690 if (!s->divx_packed && avctx->hwaccel)
691 ff_thread_finish_setup(avctx);
720 if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))