summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-09-27 11:50:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-09-27 11:50:56 +0000
commit21adafec2a42d5575ff0a36a028849a9b886c055 (patch)
tree08fa557bfc0d7b64f2974636330ddeb9da65b416 /libavcodec/utils.c
parent0b2346d38c96cbc218cb75e8f83eec788cd1bc29 (diff)
lowres width/height cleanup 3rd try
Originally committed as revision 3522 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2790362fe6..7579e6f316 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -123,6 +123,13 @@ void register_avcodec(AVCodec *format)
format->next = NULL;
}
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
+ s->coded_width = width;
+ s->coded_height= height;
+ s->width = -((-width )>>s->lowres);
+ s->height= -((-height)>>s->lowres);
+}
+
typedef struct InternalBuffer{
int last_pic_num;
uint8_t *base[4];
@@ -456,6 +463,12 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
} else {
avctx->priv_data = NULL;
}
+
+ if(avctx->coded_width && avctx->coded_height)
+ avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
+ else if(avctx->width && avctx->height)
+ avcodec_set_dimensions(avctx, avctx->width, avctx->height);
+
ret = avctx->codec->init(avctx);
if (ret < 0) {
av_freep(&avctx->priv_data);