mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits) avconv: Reformat s16 volume adjustment. ARM: NEON optimised vector_fmac_scalar() dca: use vector_fmac_scalar from dsputil dsputil: add vector_fmac_scalar() latmenc: Fix private options vf_unsharp: store hsub/vsub in the filter context vf_unsharp: adopt a more natural order of params in apply_unsharp() vf_unsharp: rename method "unsharpen" to "apply_unsharp" vf_scale: apply the same transform to the aspect during init that is applied per frame vf_pad: fix "vsub" variable value computation vf_scale: add a "sar" variable lavfi: fix realloc size computation in avfilter_add_format() vsrc_color: use internal timebase lavfi: fix signature for avfilter_graph_parse() and avfilter_graph_config() graphparser: prefer void * over AVClass * for log contexts avfiltergraph: use meaningful error codes avconv: Initialize return value for codec copy path. fate: use 'run' helper for seek-test fate: remove seek-mpeg2reuse test Fix memory (re)allocation in matroskadec.c, related to MSVR-11-0080. ... Conflicts: doc/filters.texi libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/avfiltergraph.h libavfilter/graphparser.c libavfilter/vf_scale.c libavfilter/vsrc_color.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
f9a2d0c3fe
64
avconv.c
64
avconv.c
@ -153,7 +153,7 @@ static uint8_t *audio_buf;
|
||||
static uint8_t *audio_out;
|
||||
static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
|
||||
|
||||
static short *samples;
|
||||
static void *samples;
|
||||
|
||||
#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
|
||||
|
||||
@ -1586,7 +1586,7 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
{
|
||||
AVFormatContext *os;
|
||||
OutputStream *ost;
|
||||
int ret, i;
|
||||
int ret = 0, i;
|
||||
int got_output;
|
||||
void *buffer_to_free = NULL;
|
||||
static unsigned int samples_size= 0;
|
||||
@ -1641,8 +1641,8 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
if (ist->decoding_needed) {
|
||||
switch(ist->st->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:{
|
||||
if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
|
||||
samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
if(pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
|
||||
samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
av_free(samples);
|
||||
samples= av_malloc(samples_size);
|
||||
}
|
||||
@ -1731,11 +1731,57 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
// preprocess audio (volume)
|
||||
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
if (audio_volume != 256) {
|
||||
short *volp;
|
||||
volp = samples;
|
||||
for(i=0;i<(decoded_data_size / sizeof(short));i++) {
|
||||
int v = ((*volp) * audio_volume + 128) >> 8;
|
||||
*volp++ = av_clip_int16(v);
|
||||
switch (ist->st->codec->sample_fmt) {
|
||||
case AV_SAMPLE_FMT_U8:
|
||||
{
|
||||
uint8_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128;
|
||||
*volp++ = av_clip_uint8(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_S16:
|
||||
{
|
||||
int16_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int v = ((*volp) * audio_volume + 128) >> 8;
|
||||
*volp++ = av_clip_int16(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_S32:
|
||||
{
|
||||
int32_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8);
|
||||
*volp++ = av_clipl_int32(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_FLT:
|
||||
{
|
||||
float *volp = samples;
|
||||
float scale = audio_volume / 256.f;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
*volp++ *= scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_DBL:
|
||||
{
|
||||
double *volp = samples;
|
||||
double scale = audio_volume / 256.;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
*volp++ *= scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Audio volume adjustment on sample format %s is not supported.\n",
|
||||
av_get_sample_fmt_name(ist->st->codec->sample_fmt));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1687,6 +1687,9 @@ input sample aspect ratio
|
||||
@item dar
|
||||
input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
|
||||
|
||||
@item sar
|
||||
input sample aspect ratio
|
||||
|
||||
@item hsub, vsub
|
||||
horizontal and vertical chroma subsample values. For example for the
|
||||
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
|
||||
|
64
ffmpeg.c
64
ffmpeg.c
@ -160,7 +160,7 @@ static uint8_t *audio_buf;
|
||||
static uint8_t *audio_out;
|
||||
static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
|
||||
|
||||
static short *samples;
|
||||
static void *samples;
|
||||
static uint8_t *input_tmp= NULL;
|
||||
|
||||
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
|
||||
@ -1596,7 +1596,7 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
{
|
||||
AVFormatContext *os;
|
||||
OutputStream *ost;
|
||||
int ret, i;
|
||||
int ret = 0, i;
|
||||
int got_output;
|
||||
void *buffer_to_free = NULL;
|
||||
static unsigned int samples_size= 0;
|
||||
@ -1651,8 +1651,8 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
if (ist->decoding_needed) {
|
||||
switch(ist->st->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:{
|
||||
if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
|
||||
samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
if(pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
|
||||
samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
av_free(samples);
|
||||
samples= av_malloc(samples_size);
|
||||
}
|
||||
@ -1758,11 +1758,57 @@ static int output_packet(InputStream *ist, int ist_index,
|
||||
// preprocess audio (volume)
|
||||
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
if (audio_volume != 256) {
|
||||
short *volp;
|
||||
volp = samples;
|
||||
for(i=0;i<(decoded_data_size / sizeof(short));i++) {
|
||||
int v = ((*volp) * audio_volume + 128) >> 8;
|
||||
*volp++ = av_clip_int16(v);
|
||||
switch (ist->st->codec->sample_fmt) {
|
||||
case AV_SAMPLE_FMT_U8:
|
||||
{
|
||||
uint8_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128;
|
||||
*volp++ = av_clip_uint8(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_S16:
|
||||
{
|
||||
int16_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int v = ((*volp) * audio_volume + 128) >> 8;
|
||||
*volp++ = av_clip_int16(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_S32:
|
||||
{
|
||||
int32_t *volp = samples;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8);
|
||||
*volp++ = av_clipl_int32(v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_FLT:
|
||||
{
|
||||
float *volp = samples;
|
||||
float scale = audio_volume / 256.f;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
*volp++ *= scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AV_SAMPLE_FMT_DBL:
|
||||
{
|
||||
double *volp = samples;
|
||||
double scale = audio_volume / 256.;
|
||||
for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
|
||||
*volp++ *= scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Audio volume adjustment on sample format %s is not supported.\n",
|
||||
av_get_sample_fmt_name(ist->st->codec->sample_fmt));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,8 @@ void ff_vector_fmul_window_neon(float *dst, const float *src0,
|
||||
const float *src1, const float *win, int len);
|
||||
void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
|
||||
int len);
|
||||
void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul,
|
||||
int len);
|
||||
void ff_butterflies_float_neon(float *v1, float *v2, int len);
|
||||
float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
|
||||
void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
|
||||
@ -305,6 +307,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
|
||||
c->vector_fmul = ff_vector_fmul_neon;
|
||||
c->vector_fmul_window = ff_vector_fmul_window_neon;
|
||||
c->vector_fmul_scalar = ff_vector_fmul_scalar_neon;
|
||||
c->vector_fmac_scalar = ff_vector_fmac_scalar_neon;
|
||||
c->butterflies_float = ff_butterflies_float_neon;
|
||||
c->scalarproduct_float = ff_scalarproduct_float_neon;
|
||||
c->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
|
||||
|
@ -587,6 +587,54 @@ NOVFP vdup.32 q8, r2
|
||||
.unreq len
|
||||
endfunc
|
||||
|
||||
function ff_vector_fmac_scalar_neon, export=1
|
||||
VFP len .req r2
|
||||
VFP acc .req r3
|
||||
NOVFP len .req r3
|
||||
NOVFP acc .req r2
|
||||
VFP vdup.32 q15, d0[0]
|
||||
NOVFP vdup.32 q15, r2
|
||||
bics r12, len, #15
|
||||
mov acc, r0
|
||||
beq 3f
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vld1.32 {q8}, [acc,:128]!
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vld1.32 {q9}, [acc,:128]!
|
||||
1: vmla.f32 q8, q0, q15
|
||||
vld1.32 {q2}, [r1,:128]!
|
||||
vld1.32 {q10}, [acc,:128]!
|
||||
vmla.f32 q9, q1, q15
|
||||
vld1.32 {q3}, [r1,:128]!
|
||||
vld1.32 {q11}, [acc,:128]!
|
||||
vmla.f32 q10, q2, q15
|
||||
vst1.32 {q8}, [r0,:128]!
|
||||
vmla.f32 q11, q3, q15
|
||||
vst1.32 {q9}, [r0,:128]!
|
||||
subs r12, r12, #16
|
||||
beq 2f
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vld1.32 {q8}, [acc,:128]!
|
||||
vst1.32 {q10}, [r0,:128]!
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vld1.32 {q9}, [acc,:128]!
|
||||
vst1.32 {q11}, [r0,:128]!
|
||||
b 1b
|
||||
2: vst1.32 {q10}, [r0,:128]!
|
||||
vst1.32 {q11}, [r0,:128]!
|
||||
ands len, len, #15
|
||||
it eq
|
||||
bxeq lr
|
||||
3: vld1.32 {q0}, [r1,:128]!
|
||||
vld1.32 {q8}, [acc,:128]!
|
||||
vmla.f32 q8, q0, q15
|
||||
vst1.32 {q8}, [r0,:128]!
|
||||
subs len, len, #4
|
||||
bgt 3b
|
||||
bx lr
|
||||
.unreq len
|
||||
endfunc
|
||||
|
||||
function ff_butterflies_float_neon, export=1
|
||||
1: vld1.32 {q0},[r0,:128]
|
||||
vld1.32 {q1},[r1,:128]
|
||||
|
@ -1833,11 +1833,8 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
float* back_chan = s->samples + s->channel_order_tab[s->xch_base_channel] * 256;
|
||||
float* lt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 2] * 256;
|
||||
float* rt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256;
|
||||
int j;
|
||||
for(j = 0; j < 256; ++j) {
|
||||
lt_chan[j] -= back_chan[j] * M_SQRT1_2;
|
||||
rt_chan[j] -= back_chan[j] * M_SQRT1_2;
|
||||
}
|
||||
s->dsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256);
|
||||
s->dsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256);
|
||||
}
|
||||
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
|
@ -2443,6 +2443,14 @@ static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
|
||||
dst[i] = src[i] * mul;
|
||||
}
|
||||
|
||||
static void vector_fmac_scalar_c(float *dst, const float *src, float mul,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
dst[i] += src[i] * mul;
|
||||
}
|
||||
|
||||
static void butterflies_float_c(float *restrict v1, float *restrict v2,
|
||||
int len)
|
||||
{
|
||||
@ -2978,6 +2986,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
|
||||
c->scalarproduct_float = scalarproduct_float_c;
|
||||
c->butterflies_float = butterflies_float_c;
|
||||
c->vector_fmul_scalar = vector_fmul_scalar_c;
|
||||
c->vector_fmac_scalar = vector_fmac_scalar_c;
|
||||
|
||||
c->shrink[0]= av_image_copy_plane;
|
||||
c->shrink[1]= ff_shrink22;
|
||||
|
@ -423,6 +423,17 @@ typedef struct DSPContext {
|
||||
*/
|
||||
void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
|
||||
int len);
|
||||
/**
|
||||
* Multiply a vector of floats by a scalar float and add to
|
||||
* destination vector. Source and destination vectors must
|
||||
* overlap exactly or not at all.
|
||||
* @param dst result vector, 16-byte aligned
|
||||
* @param src input vector, 16-byte aligned
|
||||
* @param mul scalar value
|
||||
* @param len length of vector, multiple of 4
|
||||
*/
|
||||
void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
|
||||
int len);
|
||||
/**
|
||||
* Calculate the scalar product of two vectors of floats.
|
||||
* @param v1 first vector, 16-byte aligned
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||
#define LIBAVFILTER_VERSION_MINOR 43
|
||||
#define LIBAVFILTER_VERSION_MICRO 5
|
||||
#define LIBAVFILTER_VERSION_MICRO 6
|
||||
|
||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||
LIBAVFILTER_VERSION_MINOR, \
|
||||
|
@ -171,4 +171,5 @@ int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const
|
||||
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
|
||||
|
||||
|
||||
|
||||
#endif /* AVFILTER_AVFILTERGRAPH_H */
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "rawenc.h"
|
||||
|
||||
typedef struct {
|
||||
AVClass *av_class;
|
||||
int off;
|
||||
int channel_conf;
|
||||
int object_type;
|
||||
|
@ -967,6 +967,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
|
||||
uint8_t* data = *buf;
|
||||
int isize = *buf_size;
|
||||
uint8_t* pkt_data = NULL;
|
||||
uint8_t* newpktdata;
|
||||
int pkt_size = isize;
|
||||
int result = 0;
|
||||
int olen;
|
||||
@ -996,7 +997,12 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
|
||||
zstream.avail_in = isize;
|
||||
do {
|
||||
pkt_size *= 3;
|
||||
pkt_data = av_realloc(pkt_data, pkt_size);
|
||||
newpktdata = av_realloc(pkt_data, pkt_size);
|
||||
if (!newpktdata) {
|
||||
inflateEnd(&zstream);
|
||||
goto failed;
|
||||
}
|
||||
pkt_data = newpktdata;
|
||||
zstream.avail_out = pkt_size - zstream.total_out;
|
||||
zstream.next_out = pkt_data + zstream.total_out;
|
||||
if (pkt_data) {
|
||||
@ -1020,7 +1026,12 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
|
||||
bzstream.avail_in = isize;
|
||||
do {
|
||||
pkt_size *= 3;
|
||||
pkt_data = av_realloc(pkt_data, pkt_size);
|
||||
newpktdata = av_realloc(pkt_data, pkt_size);
|
||||
if (!newpktdata) {
|
||||
BZ2_bzDecompressEnd(&bzstream);
|
||||
goto failed;
|
||||
}
|
||||
pkt_data = newpktdata;
|
||||
bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
|
||||
bzstream.next_out = pkt_data + bzstream.total_out_lo32;
|
||||
if (pkt_data) {
|
||||
|
@ -105,7 +105,7 @@ seektest(){
|
||||
file=$(echo tests/data/$d/$file)
|
||||
;;
|
||||
esac
|
||||
$target_exec $target_path/libavformat/seek-test $target_path/$file
|
||||
run libavformat/seek-test $target_path/$file
|
||||
}
|
||||
|
||||
mkdir -p "$outdir"
|
||||
|
Loading…
Reference in New Issue
Block a user