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

j at svn.xiph.org j at svn.xiph.org
Mon Oct 5 14:06:00 PDT 2009


Author: j
Date: 2009-10-05 14:06:00 -0700 (Mon, 05 Oct 2009)
New Revision: 16618

Modified:
   trunk/ffmpeg2theora/src/ffmpeg2theora.c
Log:
use billinear downscaling and bicubic upscaling

Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-10-05 20:23:44 UTC (rev 16617)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c	2009-10-05 21:06:00 UTC (rev 16618)
@@ -110,8 +110,6 @@
 #define NTSC_FULL_HEIGHT 480
 
 
-static int sws_flags = SWS_BICUBIC;
-
 oggmux_info info;
 
 static int using_stdin = 0;
@@ -475,6 +473,7 @@
     AVCodec *vcodec = NULL;
     pp_mode_t *ppMode = NULL;
     pp_context_t *ppContext = NULL;
+    int sws_flags;
     float frame_aspect = 0;
     double fps = 0.0;
     AVRational vstream_fps;
@@ -808,6 +807,14 @@
         this->frame_x_offset = this->frame_width-this->picture_width>>1&~1;
         this->frame_y_offset = this->frame_height-this->picture_height>>1&~1;
 
+        //Bicubic  (best for upscaling),
+        if(display_width - (this->frame_leftBand + this->frame_rightBand) < this->picture_width |
+           display_height - (this->frame_topBand + this->frame_bottomBand) < this->picture_height) {
+           sws_flags = SWS_BICUBIC;
+        } else {        //Bilinear (best for downscaling),
+           sws_flags = SWS_BILINEAR;
+        }
+
         if (this->frame_width > 0 || this->frame_height > 0) {
             this->sws_colorspace_ctx = sws_getContext(
                             display_width, display_height, venc_pix_fmt,



More information about the commits mailing list