jpeglsenc: Check memory allocations
[ffmpeg.git] / libswscale / ppc / yuv2yuv_altivec.c
index 659840b..08545b3 100644 (file)
 #include <inttypes.h>
 
 #include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
 #include "libswscale/swscale.h"
 #include "libswscale/swscale_internal.h"
-#include "libavutil/cpu.h"
 
 #if HAVE_ALTIVEC
 
@@ -183,18 +184,21 @@ static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[],
 
 #endif /* HAVE_ALTIVEC */
 
-void ff_get_unscaled_swscale_ppc(SwsContext *c)
+av_cold void ff_get_unscaled_swscale_ppc(SwsContext *c)
 {
 #if HAVE_ALTIVEC
-    if ((av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) && !(c->srcW & 15) &&
-        !(c->flags & SWS_BITEXACT) && c->srcFormat == AV_PIX_FMT_YUV420P) {
+    if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
+        return;
+
+    if (!(c->srcW & 15) && !(c->flags & SWS_BITEXACT) &&
+        c->srcFormat == AV_PIX_FMT_YUV420P) {
         enum AVPixelFormat dstFormat = c->dstFormat;
 
         // unscaled YV12 -> packed YUV, we want speed
         if (dstFormat == AV_PIX_FMT_YUYV422)
-            c->swScale = yv12toyuy2_unscaled_altivec;
+            c->swscale = yv12toyuy2_unscaled_altivec;
         else if (dstFormat == AV_PIX_FMT_UYVY422)
-            c->swScale = yv12touyvy_unscaled_altivec;
+            c->swscale = yv12touyvy_unscaled_altivec;
     }
 #endif /* HAVE_ALTIVEC */
 }