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
555555
556556 switch (avctx->codec_type) {
557557 case AVMEDIA_TYPE_VIDEO:
558− if (!frame->width)
559− frame->width = avctx->width;
560− if (!frame->height)
561− frame->height = avctx->height;
558+ frame->width = FFMAX(avctx->width, avctx->coded_width);
559+ frame->height = FFMAX(avctx->height, avctx->coded_height);
562560 if (frame->format < 0)
563561 frame->format = avctx->pix_fmt;
564562 if (!frame->sample_aspect_ratio.num)
@@ -702,6 +700,9 @@ do { \ · 137 unmodified lines
702700
703701 av_buffer_unref(&dummy_buf);
704702
703+ frame->width = avctx->width;
704+ frame->height = avctx->height;
705+
705706 return 0;
706707
707708 fail:
@@ -712,7 +713,14 @@ fail: · 4 unmodified lines
712713 }
713714 #endif
714715
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;
716724 }
717725
718726 int 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