Commit 3ead79ea authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  FATE: use updated reference for aac-latm_stereo_to_51
  avconv: use libavresample
  Add libavresample
  FATE: avoid channel mixing in lavf-dv_fmt

Conflicts:
	Changelog
	Makefile
	cmdutils.c
	configure
	doc/APIchanges
	ffmpeg.c
	tests/lavf-regression.sh
	tests/ref/lavf/dv_fmt
	tests/ref/seek/lavf_dv
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents cab15f9d 394dbde5
......@@ -26,6 +26,7 @@ version next:
- drawtext video filter: fontconfig support
- ffmpeg -benchmark_all option
- super2xsai filter ported from libmpcodecs
- add libavresample audio conversion library for compatibility
version 0.10:
......
......@@ -31,6 +31,7 @@ ALLMANPAGES = $(BASENAMES:%=%.1)
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
FFLIBS-$(CONFIG_AVFILTER) += avfilter
FFLIBS-$(CONFIG_AVFORMAT) += avformat
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
FFLIBS-$(CONFIG_AVCODEC) += avcodec
FFLIBS-$(CONFIG_POSTPROC) += postproc
FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
......
......@@ -32,6 +32,7 @@
#include "libavformat/avformat.h"
#include "libavfilter/avfilter.h"
#include "libavdevice/avdevice.h"
#include "libavresample/avresample.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
#if CONFIG_POSTPROC
......@@ -633,7 +634,8 @@ static int warned_cfg = 0;
const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \
av_log(NULL, level, "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n",\
av_log(NULL, level, \
"%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
indent, #libname, \
LIB##LIBNAME##_VERSION_MAJOR, \
LIB##LIBNAME##_VERSION_MINOR, \
......@@ -662,6 +664,7 @@ static void print_all_libs_info(int flags, int level)
PRINT_LIB_INFO(avformat, AVFORMAT, flags, level);
PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level);
PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
// PRINT_LIB_INFO(avresample, AVRESAMPLE, flags, level);
PRINT_LIB_INFO(swscale, SWSCALE, flags, level);
PRINT_LIB_INFO(swresample,SWRESAMPLE, flags, level);
#if CONFIG_POSTPROC
......
......@@ -20,7 +20,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
endif
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample
# NASM requires -I path terminated with /
IFLAGS := -I. -I$(SRC_PATH)/
......
......@@ -112,6 +112,7 @@ Component options:
--disable-swscale disable libswscale build
--disable-postproc disable libpostproc build
--disable-avfilter disable video filter support [no]
--disable-avresample disable libavresample build [no]
--disable-pthreads disable pthreads [auto]
--disable-w32threads disable Win32 threads [auto]
--disable-os2threads disable OS/2 threads [auto]
......@@ -1013,6 +1014,7 @@ CONFIG_LIST="
avdevice
avfilter
avformat
avresample
avisynth
bzlib
crystalhd
......@@ -1870,6 +1872,7 @@ enable avcodec
enable avdevice
enable avfilter
enable avformat
enable avresample
enable avutil
enable postproc
enable stripping
......@@ -3724,6 +3727,7 @@ get_version LIBAVCODEC libavcodec/version.h
get_version LIBAVDEVICE libavdevice/avdevice.h
get_version LIBAVFILTER libavfilter/version.h
get_version LIBAVFORMAT libavformat/version.h
get_version LIBAVRESAMPLE libavresample/version.h
get_version LIBAVUTIL libavutil/avutil.h
get_version LIBPOSTPROC libpostproc/postprocess.h
get_version LIBSWRESAMPLE libswresample/swresample.h
......@@ -3869,5 +3873,6 @@ pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_V
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps"
pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
......@@ -6,6 +6,7 @@ libavcodec: 2012-01-27
libavdevice: 2011-04-18
libavfilter: 2011-04-18
libavformat: 2012-01-27
libavresample: 2012-xx-xx
libpostproc: 2011-04-18
libswscale: 2011-06-20
libavutil: 2011-04-18
......@@ -22,6 +23,9 @@ API changes, most recent first:
2012-03-26 - a67d9cf - lavfi 2.66.100
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
2012-xx-xx - xxxxxxx - lavr 0.0.0
Add libavresample audio conversion library
2012-xx-xx - xxxxxxx - lavu 51.28.0 - audio_fifo.h
Add audio FIFO functions:
av_audio_fifo_free()
......
......@@ -36,7 +36,6 @@
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libavutil/opt.h"
#include "libavcodec/audioconvert.h"
#include "libavutil/audioconvert.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
......@@ -300,6 +299,7 @@ typedef struct OutputStream {
int audio_channels_mapped; ///< number of channels in audio_channels_map
int resample_sample_fmt;
int resample_channels;
uint64_t resample_channel_layout;
int resample_sample_rate;
float rematrix_volume;
AVFifoBuffer *fifo; /* for compression: one audio fifo per codec */
......@@ -1525,7 +1525,7 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
}
static int alloc_audio_output_buf(AVCodecContext *dec, AVCodecContext *enc,
int nb_samples)
int nb_samples, int *buf_linesize)
{
int64_t audio_buf_samples;
int audio_buf_size;
......@@ -1538,7 +1538,7 @@ static int alloc_audio_output_buf(AVCodecContext *dec, AVCodecContext *enc,
if (audio_buf_samples > INT_MAX)
return AVERROR(EINVAL);
audio_buf_size = av_samples_get_buffer_size(NULL, enc->channels,
audio_buf_size = av_samples_get_buffer_size(buf_linesize, enc->channels,
audio_buf_samples,
enc->sample_fmt, 0);
if (audio_buf_size < 0)
......@@ -1557,7 +1557,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
uint8_t *buftmp;
int64_t size_out;
int frame_bytes, resample_changed;
int frame_bytes, resample_changed, ret;
AVCodecContext *enc = ost->st->codec;
AVCodecContext *dec = ist->st->codec;
int osize = av_get_bytes_per_sample(enc->sample_fmt);
......@@ -1566,37 +1566,46 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
int size = decoded_frame->nb_samples * dec->channels * isize;
int planes = av_sample_fmt_is_planar(dec->sample_fmt) ? dec->channels : 1;
int i;
int out_linesize = 0;
int buf_linesize = decoded_frame->linesize[0];
av_assert0(planes <= AV_NUM_DATA_POINTERS);
for(i=0; i<planes; i++)
buf[i]= decoded_frame->data[i];
get_default_channel_layouts(ost, ist);
if (alloc_audio_output_buf(dec, enc, decoded_frame->nb_samples) < 0) {
if (alloc_audio_output_buf(dec, enc, decoded_frame->nb_samples, &out_linesize) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error allocating audio buffer\n");
exit_program(1);
}
if (enc->channels != dec->channels
|| enc->sample_fmt != dec->sample_fmt
|| enc->sample_rate!= dec->sample_rate
)
if (audio_sync_method > 1 ||
enc->channels != dec->channels ||
enc->channel_layout != dec->channel_layout ||
enc->sample_rate != dec->sample_rate ||
dec->sample_fmt != enc->sample_fmt)
ost->audio_resample = 1;
resample_changed = ost->resample_sample_fmt != dec->sample_fmt ||
ost->resample_channels != dec->channels ||
ost->resample_channel_layout != dec->channel_layout ||
ost->resample_sample_rate != dec->sample_rate;
if ((ost->audio_resample && !ost->swr) || resample_changed || ost->audio_channels_mapped) {
if (resample_changed) {
av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n",
av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:0x%"PRIx64" to rate:%d fmt:%s ch:%d chl:0x%"PRIx64"\n",
ist->file_index, ist->st->index,
ost->resample_sample_rate, av_get_sample_fmt_name(ost->resample_sample_fmt), ost->resample_channels,
dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt), dec->channels);
ost->resample_sample_rate, av_get_sample_fmt_name(ost->resample_sample_fmt),
ost->resample_channels, ost->resample_channel_layout,
dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt),
dec->channels, dec->channel_layout);
ost->resample_sample_fmt = dec->sample_fmt;
ost->resample_channels = dec->channels;
ost->resample_channel_layout = dec->channel_layout;
ost->resample_sample_rate = dec->sample_rate;
swr_free(&ost->swr);
}
......@@ -1604,6 +1613,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
if (audio_sync_method <= 1 && !ost->audio_channels_mapped &&
ost->resample_sample_fmt == enc->sample_fmt &&
ost->resample_channels == enc->channels &&
ost->resample_channel_layout == enc->channel_layout &&
ost->resample_sample_rate == enc->sample_rate) {
//ost->swr = NULL;
ost->audio_resample = 0;
......@@ -1673,7 +1683,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
exit_program(1);
}
if (alloc_audio_output_buf(dec, enc, decoded_frame->nb_samples + idelta) < 0) {
if (alloc_audio_output_buf(dec, enc, decoded_frame->nb_samples + idelta, &out_linesize) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error allocating audio buffer\n");
exit_program(1);
}
......@@ -1686,11 +1696,11 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
buf[i] = t;
}
size += byte_delta;
buf_linesize = allocated_async_buf_size;
av_log(NULL, AV_LOG_VERBOSE, "adding %d audio samples of silence\n", idelta);
}
} else if (audio_sync_method > 1) {
int comp = av_clip(delta, -audio_sync_method, audio_sync_method);
av_assert0(ost->audio_resample);
av_log(NULL, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n",
delta, comp, enc->sample_rate);
// fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2));
......@@ -1703,8 +1713,10 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
if (ost->audio_resample || ost->audio_channels_mapped) {
buftmp = audio_buf;
size_out = swr_convert(ost->swr, ( uint8_t*[]){buftmp}, allocated_audio_buf_size / (enc->channels * osize),
buf, size / (dec->channels * isize));
size_out = swr_convert(ost->swr, ( uint8_t*[]){buftmp},
allocated_audio_buf_size / (enc->channels * osize),
buf,
size / (dec->channels * isize));
if (size_out < 0) {
av_log(NULL, AV_LOG_FATAL, "swr_convert failed\n");
exit_program(1);
......@@ -3078,6 +3090,7 @@ static int transcode_init(void)
if (!ost->fifo) {
return AVERROR(ENOMEM);
}
if (!codec->sample_rate)
codec->sample_rate = icodec->sample_rate;
choose_sample_rate(ost->st, ost->enc);
......@@ -3110,13 +3123,15 @@ static int transcode_init(void)
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
codec->channel_layout = 0;
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt
|| codec->channel_layout != icodec->channel_layout;
icodec->request_channels = codec->channels;
// ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
// ost->audio_resample |= codec->sample_fmt != icodec->sample_fmt
// || codec->channel_layout != icodec->channel_layout;
icodec->request_channels = codec-> channels;
ost->resample_sample_fmt = icodec->sample_fmt;
ost->resample_sample_rate = icodec->sample_rate;
ost->resample_channels = icodec->channels;
ost->resample_channel_layout = icodec->channel_layout;
break;
case AVMEDIA_TYPE_VIDEO:
if (!ost->filter) {
......
NAME = avresample
FFLIBS = avutil
HEADERS = avresample.h \
version.h
OBJS = audio_convert.o \
audio_data.o \
audio_mix.o \
audio_mix_matrix.o \
options.o \
resample.o \
utils.o
TESTPROGS = avresample
This diff is collapsed.
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_AUDIO_CONVERT_H
#define AVRESAMPLE_AUDIO_CONVERT_H
#include "libavutil/samplefmt.h"
#include "avresample.h"
#include "audio_data.h"
typedef struct AudioConvert AudioConvert;
/**
* Set conversion function if the parameters match.
*
* This compares the parameters of the conversion function to the parameters
* in the AudioConvert context. If the parameters do not match, no changes are
* made to the active functions. If the parameters do match and the alignment
* is not constrained, the function is set as the generic conversion function.
* If the parameters match and the alignment is constrained, the function is
* set as the optimized conversion function.
*
* @param ac AudioConvert context
* @param out_fmt output sample format
* @param in_fmt input sample format
* @param channels number of channels, or 0 for any number of channels
* @param ptr_align buffer pointer alignment, in bytes
* @param sample_align buffer size alignment, in samples
* @param descr function type description (e.g. "C" or "SSE")
* @param conv conversion function pointer
*/
void ff_audio_convert_set_func(AudioConvert *ac, enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt, int channels,
int ptr_align, int samples_align,
const char *descr, void *conv);
/**
* Allocate and initialize AudioConvert context for sample format conversion.
*
* @param avr AVAudioResampleContext
* @param out_fmt output sample format
* @param in_fmt input sample format
* @param channels number of channels
* @return newly-allocated AudioConvert context
*/
AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels);
/**
* Convert audio data from one sample format to another.
*
* For each call, the alignment of the input and output AudioData buffers are
* examined to determine whether to use the generic or optimized conversion
* function (when available).
*
* @param ac AudioConvert context
* @param out output audio data
* @param in input audio data
* @param len number of samples to convert
* @return 0 on success, negative AVERROR code on failure
*/
int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in, int len);
/* arch-specific initialization functions */
void ff_audio_convert_init_x86(AudioConvert *ac);
#endif /* AVRESAMPLE_AUDIO_CONVERT_H */
This diff is collapsed.
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_AUDIO_DATA_H
#define AVRESAMPLE_AUDIO_DATA_H
#include <stdint.h>
#include "libavutil/audio_fifo.h"
#include "libavutil/log.h"
#include "libavutil/samplefmt.h"
#include "avresample.h"
/**
* Audio buffer used for intermediate storage between conversion phases.
*/
typedef struct AudioData {
const AVClass *class; /**< AVClass for logging */
uint8_t *data[AVRESAMPLE_MAX_CHANNELS]; /**< data plane pointers */
uint8_t *buffer; /**< data buffer */
unsigned int buffer_size; /**< allocated buffer size */
int allocated_samples; /**< number of samples the buffer can hold */
int nb_samples; /**< current number of samples */
enum AVSampleFormat sample_fmt; /**< sample format */
int channels; /**< channel count */
int allocated_channels; /**< allocated channel count */
int is_planar; /**< sample format is planar */
int planes; /**< number of data planes */
int sample_size; /**< bytes per sample */
int stride; /**< sample byte offset within a plane */
int read_only; /**< data is read-only */
int allow_realloc; /**< realloc is allowed */
int ptr_align; /**< minimum data pointer alignment */
int samples_align; /**< allocated samples alignment */
const char *name; /**< name for debug logging */
} AudioData;
int ff_audio_data_set_channels(AudioData *a, int channels);
/**
* Initialize AudioData using a given source.
*
* This does not allocate an internal buffer. It only sets the data pointers
* and audio parameters.
*
* @param a AudioData struct
* @param src source data pointers
* @param plane_size plane size, in bytes.
* This can be 0 if unknown, but that will lead to
* optimized functions not being used in many cases,
* which could slow down some conversions.
* @param channels channel count
* @param nb_samples number of samples in the source data
* @param sample_fmt sample format
* @param read_only indicates if buffer is read only or read/write
* @param name name for debug logging (can be NULL)
* @return 0 on success, negative AVERROR value on error
*/
int ff_audio_data_init(AudioData *a, void **src, int plane_size, int channels,
int nb_samples, enum AVSampleFormat sample_fmt,
int read_only, const char *name);
/**
* Allocate AudioData.
*
* This allocates an internal buffer and sets audio parameters.
*
* @param channels channel count
* @param nb_samples number of samples to allocate space for
* @param sample_fmt sample format
* @param name name for debug logging (can be NULL)
* @return newly allocated AudioData struct, or NULL on error
*/
AudioData *ff_audio_data_alloc(int channels, int nb_samples,
enum AVSampleFormat sample_fmt,
const char *name);
/**
* Reallocate AudioData.
*
* The AudioData must have been previously allocated with ff_audio_data_alloc().
*
* @param a AudioData struct
* @param nb_samples number of samples to allocate space for
* @return 0 on success, negative AVERROR value on error
*/
int ff_audio_data_realloc(AudioData *a, int nb_samples);
/**
* Free AudioData.
*
* The AudioData must have been previously allocated with ff_audio_data_alloc().
*
* @param a AudioData struct
*/
void ff_audio_data_free(AudioData **a);
/**
* Copy data from one AudioData to another.
*
* @param out output AudioData
* @param in input AudioData
* @return 0 on success, negative AVERROR value on error
*/
int ff_audio_data_copy(AudioData *out, AudioData *in);
/**
* Append data from one AudioData to the end of another.
*
* @param dst destination AudioData
* @param dst_offset offset, in samples, to start writing, relative to the
* start of dst
* @param src source AudioData
* @param src_offset offset, in samples, to start copying, relative to the
* start of the src
* @param nb_samples number of samples to copy
* @return 0 on success, negative AVERROR value on error
*/
int ff_audio_data_combine(AudioData *dst, int dst_offset, AudioData *src,
int src_offset, int nb_samples);
/**
* Drain samples from the start of the AudioData.
*
* Remaining samples are shifted to the start of the AudioData.
*
* @param a AudioData struct
* @param nb_samples number of samples to drain
*/
void ff_audio_data_drain(AudioData *a, int nb_samples);
/**
* Add samples in AudioData to an AVAudioFifo.
*
* @param af Audio FIFO Buffer
* @param a AudioData struct
* @param offset number of samples to skip from the start of the data
* @param nb_samples number of samples to add to the FIFO
* @return number of samples actually added to the FIFO, or
* negative AVERROR code on error
*/
int ff_audio_data_add_to_fifo(AVAudioFifo *af, AudioData *a, int offset,
int nb_samples);
/**
* Read samples from an AVAudioFifo to AudioData.
*
* @param af Audio FIFO Buffer
* @param a AudioData struct
* @param nb_samples number of samples to read from the FIFO
* @return number of samples actually read from the FIFO, or
* negative AVERROR code on error
*/
int ff_audio_data_read_from_fifo(AVAudioFifo *af, AudioData *a, int nb_samples);
#endif /* AVRESAMPLE_AUDIO_DATA_H */
This diff is collapsed.
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_AUDIO_MIX_H
#define AVRESAMPLE_AUDIO_MIX_H
#include <stdint.h>
#include "libavutil/samplefmt.h"
#include "avresample.h"
#include "audio_data.h"
typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
int in_ch);
typedef struct AudioMix {
AVAudioResampleContext *avr;
enum AVSampleFormat fmt;
enum AVMixCoeffType coeff_type;
uint64_t in_layout;
uint64_t out_layout;
int in_channels;
int out_channels;
int ptr_align;
int samples_align;
int has_optimized_func;
const char *func_descr;
const char *func_descr_generic;
mix_func *mix;
mix_func *mix_generic;
int16_t *matrix_q6[AVRESAMPLE_MAX_CHANNELS];
int32_t *matrix_q15[AVRESAMPLE_MAX_CHANNELS];
float *matrix_flt[AVRESAMPLE_MAX_CHANNELS];
void **matrix;
} AudioMix;
/**
* Set mixing function if the parameters match.
*
* This compares the parameters of the mixing function to the parameters in the
* AudioMix context. If the parameters do not match, no changes are made to the
* active functions. If the parameters do match and the alignment is not
* constrained, the function is set as the generic mixing function. If the
* parameters match and the alignment is constrained, the function is set as
* the optimized mixing function.
*
* @param am AudioMix context
* @param fmt input/output sample format
* @param coeff_type mixing coefficient type
* @param in_channels number of input channels, or 0 for any number of channels
* @param out_channels number of output channels, or 0 for any number of channels
* @param ptr_align buffer pointer alignment, in bytes
* @param sample_align buffer size alignment, in samples
* @param descr function type description (e.g. "C" or "SSE")
* @param mix_func mixing function pointer
*/
void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt,
enum AVMixCoeffType coeff_type, int in_channels,
int out_channels, int ptr_align, int samples_align,
const char *descr, void *mix_func);
/**
* Initialize the AudioMix context in the AVAudioResampleContext.
*
* The parameters in the AVAudioResampleContext are used to initialize the
* AudioMix context and set the mixing matrix.
*
* @param avr AVAudioResampleContext
* @return 0 on success, negative AVERROR code on failure
*/
int ff_audio_mix_init(AVAudioResampleContext *avr);
/**
* Close an AudioMix context.
*
* This clears and frees the mixing matrix arrays.
*/
void ff_audio_mix_close(AudioMix *am);
/**
* Apply channel mixing to audio data using the current mixing matrix.
*/
int ff_audio_mix(AudioMix *am, AudioData *src);
/* arch-specific initialization functions */
void ff_audio_mix_init_x86(AudioMix *am);
#endif /* AVRESAMPLE_AUDIO_MIX_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_INTERNAL_H
#define AVRESAMPLE_INTERNAL_H
#include "libavutil/audio_fifo.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avresample.h"
#include "audio_convert.h"
#include "audio_data.h"
#include "audio_mix.h"
#include "resample.h"
struct AVAudioResampleContext {
const AVClass *av_class; /**< AVClass for logging and AVOptions */
uint64_t in_channel_layout; /**< input channel layout */
enum AVSampleFormat in_sample_fmt; /**< input sample format */
int in_sample_rate; /**< input sample rate */
uint64_t out_channel_layout; /**< output channel layout */
enum AVSampleFormat out_sample_fmt; /**< output sample format */
int out_sample_rate; /**< output sample rate */
enum AVSampleFormat internal_sample_fmt; /**< internal sample format */
enum AVMixCoeffType mix_coeff_type; /**< mixing coefficient type */
double center_mix_level; /**< center mix level */
double surround_mix_level; /**< surround mix level */
double lfe_mix_level; /**< lfe mix level */
int force_resampling; /**< force resampling */
int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
int phase_shift; /**< log2 of the number of entries in the resampling polyphase filterbank */
int linear_interp; /**< if 1 then the resampling FIR filter will be linearly interpolated */
double cutoff; /**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */
int in_channels; /**< number of input channels */
int out_channels; /**< number of output channels */
int resample_channels; /**< number of channels used for resampling */
int downmix_needed; /**< downmixing is needed */
int upmix_needed; /**< upmixing is needed */
int mixing_needed; /**< either upmixing or downmixing is needed */
int resample_needed; /**< resampling is needed */
int in_convert_needed; /**< input sample format conversion is needed */
int out_convert_needed; /**< output sample format conversion is needed */
AudioData *in_buffer; /**< buffer for converted input */
AudioData *resample_out_buffer; /**< buffer for output from resampler */
AudioData *out_buffer; /**< buffer for converted output */
AVAudioFifo *out_fifo; /**< FIFO for output samples */
AudioConvert *ac_in; /**< input sample format conversion context */
AudioConvert *ac_out; /**< output sample format conversion context */
ResampleContext *resample; /**< resampling context */
AudioMix *am; /**< channel mixing context */
};
#endif /* AVRESAMPLE_INTERNAL_H */
LIBAVRESAMPLE_$MAJOR {
global: av*;
local: *;
};
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avresample.h"
#include "internal.h"
#include "audio_mix.h"
/**
* @file
* Options definition for AVAudioResampleContext.
*/
#define OFFSET(x) offsetof(AVAudioResampleContext, x)
#define PARAM AV_OPT_FLAG_AUDIO_PARAM
static const AVOption options[] = {
{ "in_channel_layout", "Input Channel Layout", OFFSET(in_channel_layout), AV_OPT_TYPE_INT64, { 0 }, INT64_MIN, INT64_MAX, PARAM },
{ "in_sample_fmt", "Input Sample Format", OFFSET(in_sample_fmt), AV_OPT_TYPE_INT, { AV_SAMPLE_FMT_S16 }, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NB-1, PARAM },
{ "in_sample_rate", "Input Sample Rate", OFFSET(in_sample_rate), AV_OPT_TYPE_INT, { 48000 }, 1, INT_MAX, PARAM },
{ "out_channel_layout", "Output Channel Layout", OFFSET(out_channel_layout), AV_OPT_TYPE_INT64, { 0 }, INT64_MIN, INT64_MAX, PARAM },
{ "out_sample_fmt", "Output Sample Format", OFFSET(out_sample_fmt), AV_OPT_TYPE_INT, { AV_SAMPLE_FMT_S16 }, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NB-1, PARAM },
{ "out_sample_rate", "Output Sample Rate", OFFSET(out_sample_rate), AV_OPT_TYPE_INT, { 48000 }, 1, INT_MAX, PARAM },
{ "internal_sample_fmt", "Internal Sample Format", OFFSET(internal_sample_fmt), AV_OPT_TYPE_INT, { AV_SAMPLE_FMT_FLTP }, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, PARAM },
{ "mix_coeff_type", "Mixing Coefficient Type", OFFSET(mix_coeff_type), AV_OPT_TYPE_INT, { AV_MIX_COEFF_TYPE_FLT }, AV_MIX_COEFF_TYPE_Q6, AV_MIX_COEFF_TYPE_NB-1, PARAM, "mix_coeff_type" },
{ "q6", "16-bit 10.6 Fixed-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_Q6 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
{ "q15", "32-bit 17.15 Fixed-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_Q15 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
{ "flt", "Floating-Point", 0, AV_OPT_TYPE_CONST, { AV_MIX_COEFF_TYPE_FLT }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
{ "center_mix_level", "Center Mix Level", OFFSET(center_mix_level), AV_OPT_TYPE_DOUBLE, { M_SQRT1_2 }, -32.0, 32.0, PARAM },
{ "surround_mix_level", "Surround Mix Level", OFFSET(surround_mix_level), AV_OPT_TYPE_DOUBLE, { M_SQRT1_2 }, -32.0, 32.0, PARAM },
{ "lfe_mix_level", "LFE Mix Level", OFFSET(lfe_mix_level), AV_OPT_TYPE_DOUBLE, { 0.0 }, -32.0, 32.0, PARAM },
{ "force_resampling", "Force Resampling", OFFSET(force_resampling), AV_OPT_TYPE_INT, { 0 }, 0, 1, PARAM },
{ "filter_size", "Resampling Filter Size", OFFSET(filter_size), AV_OPT_TYPE_INT, { 16 }, 0, 32, /* ??? */ PARAM },
{ "phase_shift", "Resampling Phase Shift", OFFSET(phase_shift), AV_OPT_TYPE_INT, { 10 }, 0, 30, /* ??? */ PARAM },
{ "linear_interp", "Use Linear Interpolation", OFFSET(linear_interp), AV_OPT_TYPE_INT, { 0 }, 0, 1, PARAM },
{ "cutoff", "Cutoff Frequency Ratio", OFFSET(cutoff), AV_OPT_TYPE_DOUBLE, { 0.8 }, 0.0, 1.0, PARAM },
{ NULL },
};
static const AVClass av_resample_context_class = {
.class_name = "AVAudioResampleContext",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
AVAudioResampleContext *avresample_alloc_context(void)
{
AVAudioResampleContext *avr;
avr = av_mallocz(sizeof(*avr));
if (!avr)
return NULL;
avr->av_class = &av_resample_context_class;
av_opt_set_defaults(avr);
avr->am = av_mallocz(sizeof(*avr->am));
if (!avr->am) {
av_free(avr);
return NULL;
}
avr->am->avr = avr;
return avr;
}
const AVClass *avresample_get_class(void)
{
return &av_resample_context_class;
}
This diff is collapsed.
/*
* Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_RESAMPLE_H
#define AVRESAMPLE_RESAMPLE_H
#include "avresample.h"
#include "audio_data.h"
typedef struct ResampleContext ResampleContext;
/**
* Allocate and initialize a ResampleContext.
*
* The parameters in the AVAudioResampleContext are used to initialize the
* ResampleContext.
*
* @param avr AVAudioResampleContext
* @return newly-allocated ResampleContext
*/
ResampleContext *ff_audio_resample_init(AVAudioResampleContext *avr);
/**
* Free a ResampleContext.
*
* @param c ResampleContext
*/
void ff_audio_resample_free(ResampleContext **c);
/**
* Resample audio data.
*
* Changes the sample rate.
*
* @par
* All samples in the source data may not be consumed depending on the
* resampling parameters and the size of the output buffer. The unconsumed
* samples are automatically added to the start of the source in the next call.
* If the destination data can be reallocated, that may be done in this function
* in order to fit all available output. If it cannot be reallocated, fewer
* input samples will be consumed in order to have the output fit in the
* destination data buffers.
*
* @param c ResampleContext
* @param dst destination audio data
* @param src source audio data
* @param consumed number of samples consumed from the source
* @return number of samples written to the destination
*/
int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src,
int *consumed);
#endif /* AVRESAMPLE_RESAMPLE_H */
This diff is collapsed.
/*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVRESAMPLE_VERSION_H
#define AVRESAMPLE_VERSION_H
#define LIBAVRESAMPLE_VERSION_MAJOR 0
#define LIBAVRESAMPLE_VERSION_MINOR 0
#define LIBAVRESAMPLE_VERSION_MICRO 0
#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
LIBAVRESAMPLE_VERSION_MINOR, \
LIBAVRESAMPLE_VERSION_MICRO)
#define LIBAVRESAMPLE_VERSION AV_VERSION(LIBAVRESAMPLE_VERSION_MAJOR, \
LIBAVRESAMPLE_VERSION_MINOR, \
LIBAVRESAMPLE_VERSION_MICRO)
#define LIBAVRESAMPLE_BUILD LIBAVRESAMPLE_VERSION_INT
#define LIBAVRESAMPLE_IDENT "Lavr" AV_STRINGIFY(LIBAVRESAMPLE_VERSION)
/**
* These FF_API_* defines are not part of public API.
* They may change, break or disappear at any time.
*/
#endif /* AVRESAMPLE_VERSION_H */
OBJS += x86/audio_convert_init.o \
x86/audio_mix_init.o
YASM-OBJS += x86/audio_convert.o \
x86/audio_mix.o
;******************************************************************************
;* x86 optimized Format Conversion Utils
;* Copyright (c) 2008 Loren Merritt
;*
;* This file is part of Libav.
;*
;* 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.
;*
;* 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 Libav; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "x86inc.asm"
%include "x86util.asm"
SECTION_TEXT
;-----------------------------------------------------------------------------
; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len,
; int channels);
;-----------------------------------------------------------------------------
%macro CONV_FLTP_TO_FLT_6CH 0
cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, src1, src2, src3, src4, src5, len
%if ARCH_X86_64
mov lend, r2d
%else
%define lend dword r2m
%endif
mov src1q, [srcq+1*gprsize]
mov src2q, [srcq+2*gprsize]
mov src3q, [srcq+3*gprsize]
mov src4q, [srcq+4*gprsize]
mov src5q, [srcq+5*gprsize]
mov srcq, [srcq]
sub src1q, srcq
sub src2q, srcq
sub src3q, srcq
sub src4q, srcq
sub src5q, srcq
.loop:
mova m0, [srcq ]
mova m1, [srcq+src1q]
mova m2, [srcq+src2q]
mova m3, [srcq+src3q]
mova m4, [srcq+src4q]
mova m5, [srcq+src5q]
%if cpuflag(sse)
SBUTTERFLYPS 0, 1, 6
SBUTTERFLYPS 2, 3, 6
SBUTTERFLYPS 4, 5, 6
movaps m6, m4
shufps m4, m0, q3210
movlhps m0, m2
movhlps m6, m2
movaps [dstq ], m0
movaps [dstq+16], m4
movaps [dstq+32], m6
movaps m6, m5
shufps m5, m1, q3210
movlhps m1, m3
movhlps m6, m3
movaps [dstq+48], m1
movaps [dstq+64], m5
movaps [dstq+80], m6
%else ; mmx
SBUTTERFLY dq, 0, 1, 6
SBUTTERFLY dq, 2, 3, 6
SBUTTERFLY dq, 4, 5, 6
movq [dstq ], m0
movq [dstq+ 8], m2
movq [dstq+16], m4
movq [dstq+24], m1
movq [dstq+32], m3
movq [dstq+40], m5
%endif
add srcq, mmsize
add dstq, mmsize*6
sub lend, mmsize/4
jg .loop
%if mmsize == 8
emms
RET
%else
REP_RET
%endif
%endmacro
INIT_MMX mmx
CONV_FLTP_TO_FLT_6CH
INIT_XMM sse
CONV_FLTP_TO_FLT_6CH
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/cpu.h"
#include "libavresample/audio_convert.h"
extern void ff_conv_fltp_to_flt_6ch_mmx(float *dst, float *const *src, int len);
extern void ff_conv_fltp_to_flt_6ch_sse(float *dst, float *const *src, int len);
av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
{
#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx);
}
if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
6, 16, 4, "SSE", ff_conv_fltp_to_flt_6ch_sse);
}
#endif
}
;******************************************************************************
;* x86 optimized channel mixing
;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
;*
;* This file is part of Libav.
;*
;* 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.
;*
;* 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 Libav; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "x86inc.asm"
%include "x86util.asm"
SECTION_TEXT
;-----------------------------------------------------------------------------
; void ff_mix_2_to_1_fltp_flt(float **src, float **matrix, int len,
; int out_ch, int in_ch);
;-----------------------------------------------------------------------------
%macro MIX_2_TO_1_FLTP_FLT 0
cglobal mix_2_to_1_fltp_flt, 3,4,6, src, matrix, len, src1
mov src1q, [srcq+gprsize]
mov srcq, [srcq ]
sub src1q, srcq
mov matrixq, [matrixq ]
VBROADCASTSS m4, [matrixq ]
VBROADCASTSS m5, [matrixq+4]
ALIGN 16
.loop:
mulps m0, m4, [srcq ]
mulps m1, m5, [srcq+src1q ]
mulps m2, m4, [srcq+ mmsize]
mulps m3, m5, [srcq+src1q+mmsize]
addps m0, m0, m1
addps m2, m2, m3
mova [srcq ], m0
mova [srcq+mmsize], m2
add srcq, mmsize*2
sub lend, mmsize*2/4
jg .loop
%if mmsize == 32
vzeroupper
RET
%else
REP_RET
%endif
%endmacro
INIT_XMM sse
MIX_2_TO_1_FLTP_FLT
INIT_YMM avx
MIX_2_TO_1_FLTP_FLT
/*
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
* This file is part of Libav.
*
* 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.
*
* 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/cpu.h"
#include "libavresample/audio_mix.h"
extern void ff_mix_2_to_1_fltp_flt_sse(float **src, float **matrix, int len,
int out_ch, int in_ch);
extern void ff_mix_2_to_1_fltp_flt_avx(float **src, float **matrix, int len,
int out_ch, int in_ch);
av_cold void ff_audio_mix_init_x86(AudioMix *am)
{
#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
2, 1, 16, 8, "SSE", ff_mix_2_to_1_fltp_flt_sse);
}
if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
2, 1, 32, 16, "AVX", ff_mix_2_to_1_fltp_flt_avx);
}
#endif
}
......@@ -585,3 +585,12 @@
pminsd %1, %3
pmaxsd %1, %2
%endmacro
%macro VBROADCASTSS 2 ; dst xmm/ymm, src m32
%if cpuflag(avx)
vbroadcastss %1, %2
%else ; sse
movss %1, %2
shufps %1, %1, 0
%endif
%endmacro
......@@ -55,8 +55,8 @@ fate-aac-ap05_48: CMD = pcm -i $(SAMPLES)/aac/ap05_48.mp4
fate-aac-ap05_48: REF = $(SAMPLES)/aac/ap05_48.s16
FATE_AAC += fate-aac-latm_stereo_to_51
fate-aac-latm_stereo_to_51: CMD = pcm -i $(SAMPLES)/aac/latm_stereo_to_51.ts -ac 6
fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51.s16
fate-aac-latm_stereo_to_51: CMD = pcm -i $(SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
fate-aac-ct%: CMD = pcm -i $(SAMPLES)/aac/CT_DecoderCheck/$(@:fate-aac-ct-%=%)
fate-aac-ct%: REF = $(SAMPLES)/aac/CT_DecoderCheck/aacPlusv2.wav
......
......@@ -118,7 +118,7 @@ fi
if [ -n "$do_dv_fmt" ] ; then
do_lavf_timecode_nodrop dv "-ar 48000 -r 25 -s pal -ac 2"
do_lavf_timecode_drop dv "-ar 48000 -pix_fmt yuv411p -s ntsc -ac 2"
do_lavf dv "-ar 48000" "-r 25 -s pal -ac 2"
do_lavf dv "-ar 48000 -channel_layout stereo" "-r 25 -s pal"
fi
if [ -n "$do_gxf" ] ; then
......
......@@ -4,6 +4,6 @@
cc33ae4f9e6828914dea0f09d1241b7e *./tests/data/lavf/lavf.dv
3480000 ./tests/data/lavf/lavf.dv
./tests/data/lavf/lavf.dv CRC=0x8d5e9e8f
b36c83cd0ba0ebe719f09f885c4bbcd3 *./tests/data/lavf/lavf.dv
87d3b20f656235671383a7eaa2f66330 *./tests/data/lavf/lavf.dv
3600000 ./tests/data/lavf/lavf.dv
./tests/data/lavf/lavf.dv CRC=0x2bc2ae3a
./tests/data/lavf/lavf.dv CRC=0x0e868a82
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment