summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2006-08-31 19:14:00 +0000
committerLuca Barbato <lu_zero@gentoo.org>2006-08-31 19:14:00 +0000
commit9814587500d819e88b92e80ed43a2cc1e1a869b7 (patch)
tree97171fdd22a0cda2242d0d2d0f41a340c7c7396b
parent12ccec0f15f1062c807a0f233561ded6f24d7879 (diff)
Align the input buffer in ffplay, introduce a public macro for aligned declarations
Update the avcodec_decode_audio and the float_to_int16 descriptions accordingly Originally committed as revision 6147 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffplay.c2
-rw-r--r--libavcodec/avcodec.h15
-rw-r--r--libavcodec/dsputil.h2
-rw-r--r--libavutil/common.h7
4 files changed, 22 insertions, 4 deletions
diff --git a/ffplay.c b/ffplay.c
index 46638bdc5c..77d4aaa983 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -133,7 +133,7 @@ typedef struct VideoState {
int audio_hw_buf_size;
/* samples output by the codec. we reserve more space for avsync
compensation */
- uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
+ DECLARE_ALIGNED(16,uint8_t,audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]);
unsigned int audio_buf_size; /* in bytes */
int audio_buf_index; /* in bytes */
AVPacket audio_pkt;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 99d34a6a28..195c258b04 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -17,8 +17,8 @@ extern "C" {
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
-#define LIBAVCODEC_VERSION_INT ((51<<16)+(11<<8)+0)
-#define LIBAVCODEC_VERSION 51.11.0
+#define LIBAVCODEC_VERSION_INT ((51<<16)+(12<<8)+0)
+#define LIBAVCODEC_VERSION 51.12.0
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
@@ -2451,6 +2451,17 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v
*/
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
+/**
+ * Decode an audio frame.
+ *
+ * @param avctx the codec context.
+ * @param samples output buffer, 16 byte aligned
+ * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed
+ * @param buf input buffer, 16 byte aligned
+ * @param buf_size the input buffer size
+ * @return 0 if successful, -1 if not.
+ */
+
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr,
uint8_t *buf, int buf_size);
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 1fc292be0f..3e47901dc0 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -323,7 +323,7 @@ typedef struct DSPContext {
void (*vector_fmul_add_add)(float *dst, const float *src0, const float *src1, const float *src2, int src3, int len, int step);
/* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767]
- * asm versions: convert floats from [-32768.0,32767.0] without rescaling */
+ * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */
void (*float_to_int16)(int16_t *dst, const float *src, int len);
/* (I)DCT */
diff --git a/libavutil/common.h b/libavutil/common.h
index 60ea46a83d..e47688be99 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -364,6 +364,13 @@ tend= read_time();\
#endif
/* memory */
+
+#ifdef __GNUC__
+ #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
+#else
+ #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
+#endif
+
void *av_malloc(unsigned int size);
void *av_realloc(void *ptr, unsigned int size);
void av_free(void *ptr);