diff utils.c @ 2270:21f450be6cb5 libavcodec

lowres width/height cleanup 3rd try
author michael
date Mon, 27 Sep 2004 11:50:56 +0000
parents 8f605c66d1d4
children 7b345b735ac7
line wrap: on
line diff
--- a/utils.c	Mon Sep 27 10:06:10 2004 +0000
+++ b/utils.c	Mon Sep 27 11:50:56 2004 +0000
@@ -123,6 +123,13 @@
     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 @@
     } 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);