lowres width/height cleanup 3rd try

Originally committed as revision 3522 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2004-09-27 11:50:56 +00:00
parent 0b2346d38c
commit 21adafec2a
8 changed files with 54 additions and 43 deletions

View File

@@ -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);