Use orc_memcpy() instead of memcpy() as it should be faster for larger memory areas

This commit is contained in:
Sebastian Dröge 2012-09-25 10:32:26 +02:00
parent 7a53743bfd
commit 9f7ed3f180
2 changed files with 19 additions and 7 deletions

View file

@ -31,6 +31,12 @@
#include <gst/audio/multichannel.h>
#include <string.h>
#ifdef HAVE_ORC
#include <orc/orc.h>
#else
#define orc_memcpy memcpy
#endif
#include "gstamcaudiodec.h"
#include "gstamc-constants.h"
@ -592,7 +598,7 @@ retry:
goto failed_allocate;
buf = &self->output_buffers[idx];
memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info.offset,
orc_memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info.offset,
buffer_info.size);
GST_BUFFER_TIMESTAMP (outbuf) =
@ -1053,7 +1059,7 @@ gst_amc_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
buffer_info.offset = 0;
buffer_info.size = MIN (GST_BUFFER_SIZE (inbuf) - offset, buf->size);
memcpy (buf->data, GST_BUFFER_DATA (inbuf) + offset, buffer_info.size);
orc_memcpy (buf->data, GST_BUFFER_DATA (inbuf) + offset, buffer_info.size);
/* Interpolate timestamps if we're passing the buffer
* in multiple chunks */

View file

@ -30,6 +30,12 @@
#include <gst/gst.h>
#include <string.h>
#ifdef HAVE_ORC
#include <orc/orc.h>
#else
#define orc_memcpy memcpy
#endif
#include "gstamcvideodec.h"
#include "gstamc-constants.h"
@ -720,7 +726,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
/* Same video format */
if (buffer_info->size == GST_BUFFER_SIZE (outbuf)) {
GST_DEBUG_OBJECT (self, "Buffer sizes equal, doing fast copy");
memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info->offset,
orc_memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info->offset,
buffer_info->size);
ret = TRUE;
goto done;
@ -766,7 +772,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
height = GST_VIDEO_INFO_COMP_HEIGHT (info, i);
for (j = 0; j < height; j++) {
memcpy (dest, src, row_length);
orc_memcpy (dest, src, row_length);
src += src_stride;
dest += dest_stride;
}
@ -804,7 +810,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
height = GST_VIDEO_INFO_COMP_HEIGHT (info, i);
for (j = 0; j < height; j++) {
memcpy (dest, src, row_length);
orc_memcpy (dest, src, row_length);
src += src_stride;
dest += dest_stride;
}
@ -846,7 +852,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx,
height = GST_VIDEO_INFO_COMP_HEIGHT (info, i);
for (j = 0; j < height; j++) {
memcpy (dest, src, row_length);
orc_memcpy (dest, src, row_length);
src += src_stride;
dest += dest_stride;
}
@ -1404,7 +1410,7 @@ gst_amc_video_dec_handle_frame (GstVideoDecoder * decoder,
buffer_info.size =
MIN (GST_BUFFER_SIZE (frame->input_buffer) - offset, buf->size);
memcpy (buf->data, GST_BUFFER_DATA (frame->input_buffer) + offset,
orc_memcpy (buf->data, GST_BUFFER_DATA (frame->input_buffer) + offset,
buffer_info.size);
/* Interpolate timestamps if we're passing the buffer