]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/defaults.c
dsputil: use movups instead of movdqu in ff_emu_edge_core_sse()
[ffmpeg] / libavfilter / defaults.c
index 4a48a3aff1f1fed2ba5ebafaf8280536822bf5ac..b891ab1f22c542d30b63c441354a9230ed166bed 100644 (file)
@@ -2,26 +2,26 @@
  * Filter layer - default implementations
  * Copyright (c) 2007 Bobby Bingham
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcore/audioconvert.h"
-#include "libavcore/imgutils.h"
-#include "libavcore/samplefmt.h"
+#include "libavutil/audioconvert.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/samplefmt.h"
 #include "avfilter.h"
 #include "internal.h"
 
@@ -37,26 +37,18 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
  * alloc & free cycle currently implemented. */
 AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
 {
-    char *buf = NULL;
-    int linesize[4], i, tempsize;
+    int linesize[4];
     uint8_t *data[4];
     AVFilterBufferRef *picref = NULL;
 
-    av_image_fill_linesizes(linesize, link->format, w);
-    for (i = 0; i < 4; i++)
-        linesize[i] = FFALIGN(linesize[i], 16);
-    tempsize = av_image_fill_pointers(data, link->format, h, NULL, linesize);
-    buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
-                                    // SIMD-friendly
-    if (!buf)
+    // +2 is needed for swscaler, +16 to be SIMD-friendly
+    if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
         return NULL;
 
-    av_image_fill_pointers(data, link->format, h, buf, linesize);
-
     picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
                                                        perms, w, h, link->format);
     if (!picref) {
-        av_free(buf);
+        av_free(data[0]);
         return NULL;
     }
 
@@ -92,11 +84,11 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
     samples->refcount   = 1;
     samples->free       = ff_avfilter_default_free_buffer;
 
-    sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3;
+    sample_size = av_get_bytes_per_sample(sample_fmt);
     chans_nb = av_get_channel_layout_nb_channels(channel_layout);
 
     per_channel_size = size/chans_nb;
-    ref->audio->samples_nb = per_channel_size/sample_size;
+    ref->audio->nb_samples = per_channel_size/sample_size;
 
     /* Set the number of bytes to traverse to reach next sample of a particular channel:
      * For planar, this is simply the sample size.
@@ -134,8 +126,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per
     return ref;
 
 fail:
-    av_free(buf);
-    if (ref && ref->audio)
+    if (ref)
         av_free(ref->audio);
     av_free(ref);
     av_free(samples);