]> git.sesse.net Git - mlt/commitdiff
Enable swscale CPU flags.
authorDan Dennedy <dan@dennedy.org>
Sun, 22 Aug 2010 05:50:48 +0000 (22:50 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 22 Aug 2010 05:50:48 +0000 (22:50 -0700)
For FFmpeg builds that use runtime CPU detection. This should make
things faster and it seems to be same quality as C routines.

src/modules/avformat/consumer_avformat.c
src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_swscale.c
src/modules/avformat/producer_avformat.c

index 22c52a9ba251e85ceaa814cb4687054ece80eb42..079baf1bf1ccf672a25758b016adc3e3b6c21d0c 100644 (file)
@@ -1282,8 +1282,15 @@ static void *consumer_thread( void *arg )
 
                                                // Do the colour space conversion
 #ifdef SWSCALE
+                                               int flags = SWS_BILINEAR;
+#ifdef USE_MMX
+                                               flags |= SWS_CPU_CAPS_MMX;
+#endif
+#ifdef USE_SSE
+                                               flags |= SWS_CPU_CAPS_MMX2;
+#endif
                                                struct SwsContext *context = sws_getContext( width, height, PIX_FMT_YUYV422,
-                                                       width, height, video_st->codec->pix_fmt, SWS_BILINEAR, NULL, NULL, NULL);
+                                                       width, height, video_st->codec->pix_fmt, flags, NULL, NULL, NULL);
                                                sws_scale( context, input->data, input->linesize, 0, height,
                                                        output->data, output->linesize);
                                                sws_freeContext( context );
index d64841ecde5afe8e6122cfc9122235e6d64a6488..6b403d5723935d80d0e8f0c16f8f35e5e72881f6 100644 (file)
@@ -82,6 +82,12 @@ static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt
                flags |= SWS_FULL_CHR_H_INP;
        else
                flags |= SWS_FULL_CHR_H_INT;
+#ifdef USE_MMX
+               flags |= SWS_CPU_CAPS_MMX;
+#endif
+#ifdef USE_SSE
+               flags |= SWS_CPU_CAPS_MMX2;
+#endif
 
        avpicture_fill( &input, in, in_fmt, width, height );
        avpicture_fill( &output, out, out_fmt, width, height );
index c841928ac9ece01515f1d413add51990c1e456a4..d9c429c5b35e6fd6e7082d44962199882784176a 100644 (file)
@@ -115,6 +115,12 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format *form
                        // XXX: we only know how to rescale packed formats
                        return 1;
        }
+#ifdef USE_MMX
+       interp |= SWS_CPU_CAPS_MMX;
+#endif
+#ifdef USE_SSE
+       interp |= SWS_CPU_CAPS_MMX2;
+#endif
 
        // Convert the pixel formats
        int avformat = convert_mlt_to_av_cs( *format );
index 1217c29ffb07e875046d123bfcd935ebfc187c87..e8bcf3343771ba3ceb2d4b61aab0dcef5f8a1255 100644 (file)
@@ -680,6 +680,14 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt,
 {
 #ifdef SWSCALE
        int flags = SWS_BILINEAR | SWS_ACCURATE_RND;
+
+#ifdef USE_MMX
+       flags |= SWS_CPU_CAPS_MMX;
+#endif
+#ifdef USE_SSE
+       flags |= SWS_CPU_CAPS_MMX2;
+#endif
+
        if ( pix_fmt == PIX_FMT_RGB32 )
        {
                *format = mlt_image_rgb24a;