[xiph-commits] r16446 - trunk/ffmpeg2theora/src

j at svn.xiph.org j at svn.xiph.org
Thu Aug 6 14:34:57 PDT 2009


Author: j
Date: 2009-08-06 14:34:57 -0700 (Thu, 06 Aug 2009)
New Revision: 16446

Modified:
   trunk/ffmpeg2theora/src/ffmpeg2theora.c
Log:
pad image by offset_x/offset_y, still output square pixeled image if not upscaling

Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-08-06 20:04:04 UTC (rev 16445)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-08-06 21:34:57 UTC (rev 16446)
@@ -594,7 +594,9 @@
                 this->aspect_numerator = 10000*this->frame_aspect*display_height;
                 this->aspect_denominator = 10000*display_width;
             }
-            av_reduce(&this->aspect_numerator,&this->aspect_denominator,this->aspect_numerator,this->aspect_denominator,10000);
+            av_reduce(&this->aspect_numerator,&this->aspect_denominator,
+                       this->aspect_numerator,this->aspect_denominator,
+                       1024*1024);
             frame_aspect=this->frame_aspect;
         }
 
@@ -723,10 +725,14 @@
         }
 
         if (this->no_upscaling) {
-            if (this->picture_width && this->picture_width > display_width) {
-                this->picture_width = display_width;
+            if (this->picture_height && this->picture_height > display_height) {
+                this->picture_width = display_height * display_aspect_ratio.num / display_aspect_ratio.den;
                 this->picture_height = display_height;
             }
+            else if (this->picture_width && this->picture_width > display_width) {
+                this->picture_width = display_width;
+                this->picture_height = display_width * display_aspect_ratio.den / display_aspect_ratio.num;
+            }
             if (this->fps < (double)this->framerate_new.num / this->framerate_new.den) {
                 this->framerate_new.num = vstream_fps.num;
                 this->framerate_new.den = vstream_fps.den;
@@ -1363,8 +1369,8 @@
                                 if (av_picture_pad((AVPicture *)output_padded,
                                                  (AVPicture *)output_resized,
                                                  this->frame_height, this->frame_width, this->pix_fmt,
-                                                 0, this->frame_height - this->picture_height,
-                                                 0, this->frame_width - this->picture_width,
+                                                 this->frame_y_offset, this->frame_y_offset,
+                                                 this->frame_x_offset, this->frame_x_offset,
                                                  padcolor ) < 0 ) {
                                     av_log(NULL, AV_LOG_ERROR, "error padding frame\n");
                                 }



More information about the commits mailing list