changeset 669:b4bddbde44f3 libavcodec

aspect (ext. par too) support for h263 and mpeg4 (inc. build becouse of new vars)
author al3x
date Fri, 13 Sep 2002 19:31:32 +0000
parents acd1a808343b
children 340e3ba84119
files avcodec.h h263.c h263dec.c
diffstat 3 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Fri Sep 13 15:44:53 2002 +0000
+++ b/avcodec.h	Fri Sep 13 19:31:32 2002 +0000
@@ -5,8 +5,8 @@
 
 #define LIBAVCODEC_VERSION_INT 0x000406
 #define LIBAVCODEC_VERSION     "0.4.6"
-#define LIBAVCODEC_BUILD       4622
-#define LIBAVCODEC_BUILD_STR   "4622"
+#define LIBAVCODEC_BUILD       4623
+#define LIBAVCODEC_BUILD_STR   "4623"
 
 enum CodecID {
     CODEC_ID_NONE, 
--- a/h263.c	Fri Sep 13 15:44:53 2002 +0000
+++ b/h263.c	Fri Sep 13 19:31:32 2002 +0000
@@ -187,12 +187,17 @@
             /* Custom Picture Format (CPFMT) */
 		
 	    if (s->aspect_ratio_info)
-            put_bits(&s->pb,4,s->aspect_ratio_info);
+        	put_bits(&s->pb,4,s->aspect_ratio_info);
 	    else
-            put_bits(&s->pb,4,2); /* Aspect ratio: CIF 12:11 (4:3) picture */
+        	put_bits(&s->pb,4,2); /* Aspect ratio: CIF 12:11 (4:3) picture */
             put_bits(&s->pb,9,(s->width >> 2) - 1);
             put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */
             put_bits(&s->pb,9,(s->height >> 2));
+	    if (s->aspect_ratio_info == FF_ASPECT_EXTENDED)
+	    {
+		put_bits(&s->pb, 8, s->aspected_width);
+		put_bits(&s->pb, 8, s->aspected_height);
+	    }
         }
         
         /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
@@ -1361,6 +1366,11 @@
         put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */
     else
         put_bits(&s->pb, 4, 1);		/* aspect ratio info= sqare pixel */
+    if (s->aspect_ratio_info == FF_ASPECT_EXTENDED)
+    {
+	put_bits(&s->pb, 8, s->aspected_width);
+	put_bits(&s->pb, 8, s->aspected_height);
+    }
 
     if(s->low_delay){
         put_bits(&s->pb, 1, 1);		/* vol control parameters= yes */
@@ -3158,7 +3168,7 @@
             if (s->h263_rv10 && level == -128) {
                 /* XXX: should patch encoder too */
                 level = get_bits(&s->gb, 12);
-                level= (level + ((-1)<<11)) ^ ((-1)<<11); //sign extension
+		level= (level + ((-1)<<11)) ^ ((-1)<<11); //sign extension
             }
         } else {
             run = rl->table_run[code];
@@ -3547,10 +3557,10 @@
                 skip_bits1(&s->gb);
                 height = get_bits(&s->gb, 9) * 4;
                 dprintf("\nH.263+ Custom picture: %dx%d\n",width,height);
-                if (s->aspect_ratio_info == EXTENDED_PAR) {
+                if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
                     /* aspected dimensions */
-                    skip_bits(&s->gb, 8); /* width */
-                    skip_bits(&s->gb, 8); /* height */
+		    s->aspected_width = get_bits(&s->gb, 8);
+		    s->aspected_height = get_bits(&s->gb, 8);
                 }
             } else {
                 width = h263_format[format][0];
@@ -3817,9 +3827,9 @@
         }
 //printf("vo type:%d\n",s->vo_type);
         s->aspect_ratio_info= get_bits(&s->gb, 4);
-	if(s->aspect_ratio_info == EXTENDED_PAR){
-            skip_bits(&s->gb, 8); //par_width
-            skip_bits(&s->gb, 8); // par_height
+	if(s->aspect_ratio_info == FF_ASPECT_EXTENDED){	    
+	    s->aspected_width = get_bits(&s->gb, 8); // par_width
+	    s->aspected_height = get_bits(&s->gb, 8); // par_height
         }
 
         if ((s->vol_control_parameters=get_bits1(&s->gb))) { /* vol control parameter */
--- a/h263dec.c	Fri Sep 13 15:44:53 2002 +0000
+++ b/h263dec.c	Fri Sep 13 19:31:32 2002 +0000
@@ -193,6 +193,11 @@
         avctx->width = s->width;
         avctx->height = s->height;
         avctx->aspect_ratio_info= s->aspect_ratio_info;
+	if (s->aspect_ratio_info == FF_ASPECT_EXTENDED)
+	{
+	    avctx->aspected_width = s->aspected_width;
+	    avctx->aspected_height = s->aspected_height;
+	}
         if (MPV_common_init(s) < 0)
             return -1;
     }