History

ff_get_buffer(): allocate the frame for max(coded,display) dimensions

Needed e.g. for h264 cropping to work properly.

Anton Khirnov committed 13 years ago

Commit a7f46581 parent 505642f1 file · +13 −5Browse files

Unified · Split

libavcodec/utils.c+13−5
@@ -555,10 +555,8 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) · 554 unmodified lines
555 555
556 switch (avctx->codec_type) {556 switch (avctx->codec_type) {
557 case AVMEDIA_TYPE_VIDEO:557 case AVMEDIA_TYPE_VIDEO:
558 if (!frame->width)558 frame->width = FFMAX(avctx->width, avctx->coded_width);
559 frame->width = avctx->width;559 frame->height = FFMAX(avctx->height, avctx->coded_height);
560 if (!frame->height)
561 frame->height = avctx->height;
562 if (frame->format < 0)560 if (frame->format < 0)
563 frame->format = avctx->pix_fmt;561 frame->format = avctx->pix_fmt;
564 if (!frame->sample_aspect_ratio.num)562 if (!frame->sample_aspect_ratio.num)
@@ -702,6 +700,9 @@ do { \ · 137 unmodified lines
702 700
703 av_buffer_unref(&dummy_buf);701 av_buffer_unref(&dummy_buf);
704 702
703 frame->width = avctx->width;
704 frame->height = avctx->height;
705
705 return 0;706 return 0;
706 707
707fail:708fail:
@@ -712,7 +713,14 @@ fail: · 4 unmodified lines
712 }713 }
713#endif714#endif
714 715
715 return avctx->get_buffer2(avctx, frame, flags);716 ret = avctx->get_buffer2(avctx, frame, flags);
717
718 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
719 frame->width = avctx->width;
720 frame->height = avctx->height;
721 }
722
723 return ret;
716}724}
717 725
718int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)726int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t