From af3c06b4dbe3bdc801d3fdc3392e7f47b414c17c Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 27 Sep 2011 10:20:23 -0700 Subject: [PATCH 01/23] avconv: Use the size of the decode sample format when allocating the audio samples buffer. --- avconv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avconv.c b/avconv.c index ed5d7092fe..ad5547f874 100644 --- a/avconv.c +++ b/avconv.c @@ -1573,8 +1573,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); } From fe332cf5b9b91f24f3f2bf049b2ed43ccd78149f Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 27 Sep 2011 10:21:39 -0700 Subject: [PATCH 02/23] avconv: Make samples void*. Different sample formats are different sizes. --- avconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv.c b/avconv.c index ad5547f874..a9cd9bf481 100644 --- a/avconv.c +++ b/avconv.c @@ -136,7 +136,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" From a9a033773a49a090c8247a628d86b172d357ca41 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 27 Sep 2011 10:15:07 -0700 Subject: [PATCH 03/23] avconv: Fix volume adjustment for non-s16 sample formats --- avconv.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/avconv.c b/avconv.c index a9cd9bf481..fa39e6b052 100644 --- a/avconv.c +++ b/avconv.c @@ -1664,12 +1664,59 @@ 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) { + 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: + { 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); } + 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); + } } } From 77d2ef13a8fa630e5081f14bde3fd20f84c90aec Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 28 Jul 2011 14:59:54 +0200 Subject: [PATCH 04/23] Fix memory (re)allocation in matroskadec.c, related to MSVR-11-0080. Whitespace of the patch cleaned up by Aurel Some of the issues have been reported by Steve Manzuik / Microsoft Vulnerability Research (MSVR) Signed-off-by: Michael Niedermayer (cherry picked from commit 956c901c68eff78288f40e3c8f41ee2fa081d4a8) Further suggestions from Kostya have been implemented by Reinhard Tartler Signed-off-by: Reinhard Tartler --- libavformat/matroskadec.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index af5532bde3..89df095cd8 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -801,11 +801,15 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, uint32_t id = syntax->id; uint64_t length; int res; + void *newelem; data = (char *)data + syntax->data_offset; if (syntax->list_elem_size) { EbmlList *list = data; - list->elem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size); + newelem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size); + if (!newelem) + return AVERROR(ENOMEM); + list->elem = newelem; data = (char*)list->elem + list->nb_elem*syntax->list_elem_size; memset(data, 0, syntax->list_elem_size); list->nb_elem++; @@ -935,6 +939,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; @@ -964,7 +969,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; result = inflate(&zstream, Z_NO_FLUSH); @@ -985,7 +995,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; result = BZ2_bzDecompress(&bzstream); @@ -1040,13 +1055,17 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, } } -static void matroska_merge_packets(AVPacket *out, AVPacket *in) +static int matroska_merge_packets(AVPacket *out, AVPacket *in) { - out->data = av_realloc(out->data, out->size+in->size); + void *newdata = av_realloc(out->data, out->size+in->size); + if (!newdata) + return AVERROR(ENOMEM); + out->data = newdata; memcpy(out->data+out->size, in->data, in->size); out->size += in->size; av_destruct_packet(in); av_free(in); + return 0; } static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, @@ -1604,11 +1623,13 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska, memcpy(pkt, matroska->packets[0], sizeof(AVPacket)); av_free(matroska->packets[0]); if (matroska->num_packets > 1) { + void *newpackets; memmove(&matroska->packets[0], &matroska->packets[1], (matroska->num_packets - 1) * sizeof(AVPacket *)); - matroska->packets = - av_realloc(matroska->packets, (matroska->num_packets - 1) * - sizeof(AVPacket *)); + newpackets = av_realloc(matroska->packets, + (matroska->num_packets - 1) * sizeof(AVPacket *)); + if (newpackets) + matroska->packets = newpackets; } else { av_freep(&matroska->packets); } From bc3a741fa0869670ff16db1542442fb7cbbe8c0a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 28 Sep 2011 02:11:14 +0100 Subject: [PATCH 05/23] fate: remove seek-mpeg2reuse test The input file for this test is no longer generated. Signed-off-by: Mans Rullgard --- tests/ref/seek/mpeg2reuse_mpg | 46 ----------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 tests/ref/seek/mpeg2reuse_mpg diff --git a/tests/ref/seek/mpeg2reuse_mpg b/tests/ref/seek/mpeg2reuse_mpg deleted file mode 100644 index c4ae3ea291..0000000000 --- a/tests/ref/seek/mpeg2reuse_mpg +++ /dev/null @@ -1,46 +0,0 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 337078 size: 26840 -ret: 0 st: 0 flags:0 ts: 0.788334 -ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 141401 size: 23537 -ret:-1 st: 0 flags:1 ts:-0.317499 -ret:-1 st:-1 flags:0 ts: 2.576668 -ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 232037 size: 26192 -ret: 0 st: 0 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 63793 size: 21295 -ret:-1 st: 0 flags:1 ts:-0.740831 -ret:-1 st:-1 flags:0 ts: 2.153336 -ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 141401 size: 23537 -ret: 0 st: 0 flags:0 ts:-0.058330 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st: 0 flags:1 ts: 2.835837 -ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 337078 size: 26840 -ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 337078 size: 26840 -ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 63793 size: 21295 -ret: 0 st: 0 flags:0 ts:-0.481662 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st: 0 flags:1 ts: 2.412505 -ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 337078 size: 26840 -ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 232037 size: 26192 -ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st: 0 flags:0 ts:-0.904994 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 20829 -ret: 0 st: 0 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 337078 size: 26840 -ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 232037 size: 26192 -ret:-1 st:-1 flags:1 ts:-0.222493 -ret:-1 st: 0 flags:0 ts: 2.671674 -ret: 0 st: 0 flags:1 ts: 1.565841 -ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 232037 size: 26192 -ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 141401 size: 23537 -ret:-1 st:-1 flags:1 ts:-0.645825 From dec4b4705fe0bcfc3f07959a79960cb97e895f8a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 28 Sep 2011 02:13:31 +0100 Subject: [PATCH 06/23] fate: use 'run' helper for seek-test This is simpler, and the actual seek-test command is printed with V=1. Signed-off-by: Mans Rullgard --- tests/fate-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 56514c8120..1babcc867e 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -104,7 +104,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" From 4bb0b31f762c422ad15bee68da7bcf76940cc9fa Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 27 Sep 2011 15:27:18 -0700 Subject: [PATCH 07/23] avconv: Initialize return value for codec copy path. --- avconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv.c b/avconv.c index fa39e6b052..d6003dd2c1 100644 --- a/avconv.c +++ b/avconv.c @@ -1518,7 +1518,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; From 59cef18c24ab21de4e652e130ac25905c1141f62 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 11 Jun 2011 11:15:40 +0200 Subject: [PATCH 08/23] avfiltergraph: use meaningful error codes Signed-off-by: Anton Khirnov --- libavfilter/avfiltergraph.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index b503c366f8..af96807531 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -90,7 +90,7 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n", filt->input_pads[j].name, filt->name, filt->filter->name); - return -1; + return AVERROR(EINVAL); } } @@ -99,7 +99,7 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n", filt->output_pads[j].name, filt->name, filt->filter->name); - return -1; + return AVERROR(EINVAL); } } } @@ -178,7 +178,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) av_log(log_ctx, AV_LOG_ERROR, "Impossible to convert between the formats supported by the filter " "'%s' and the filter '%s'\n", link->src->name, link->dst->name); - return -1; + return AVERROR(EINVAL); } } } @@ -216,9 +216,11 @@ static void pick_formats(AVFilterGraph *graph) int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) { + int ret; + /* find supported formats from sub-filters, and merge along links */ - if (query_formats(graph, log_ctx)) - return -1; + if ((ret = query_formats(graph, log_ctx)) < 0) + return ret; /* Once everything is merged, it's possible that we'll still have * multiple valid media format choices. We pick the first one. */ From 64abd375ec0219dca1bd918eca7793f71fcd9a3a Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 11 Jun 2011 14:33:09 +0200 Subject: [PATCH 09/23] graphparser: prefer void * over AVClass * for log contexts Signed-off-by: Anton Khirnov --- libavfilter/graphparser.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index f5e68edfa4..abee4dffba 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -36,7 +36,7 @@ */ static int link_filter(AVFilterContext *src, int srcpad, AVFilterContext *dst, int dstpad, - AVClass *log_ctx) + void *log_ctx) { int ret; if ((ret = avfilter_link(src, srcpad, dst, dstpad))) { @@ -55,7 +55,7 @@ static int link_filter(AVFilterContext *src, int srcpad, * @return a pointer (that need to be freed after use) to the name * between parenthesis */ -static char *parse_link_name(const char **buf, AVClass *log_ctx) +static char *parse_link_name(const char **buf, void *log_ctx) { const char *start = *buf; char *name; @@ -92,7 +92,7 @@ static char *parse_link_name(const char **buf, AVClass *log_ctx) * @return 0 in case of success, a negative AVERROR code otherwise */ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int index, - const char *filt_name, const char *args, AVClass *log_ctx) + const char *filt_name, const char *args, void *log_ctx) { AVFilter *filt; char inst_name[30]; @@ -153,7 +153,7 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind * @return 0 in case of success, a negative AVERROR code otherwise */ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGraph *graph, - int index, AVClass *log_ctx) + int index, void *log_ctx) { char *opts = NULL; char *name = av_get_token(buf, "=,;[\n"); @@ -203,7 +203,7 @@ static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element) static int link_filter_inouts(AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, - AVFilterInOut **open_inputs, AVClass *log_ctx) + AVFilterInOut **open_inputs, void *log_ctx) { int pad = filt_ctx->input_count, ret; @@ -251,7 +251,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx, } static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, - AVFilterInOut **open_outputs, AVClass *log_ctx) + AVFilterInOut **open_outputs, void *log_ctx) { int pad = 0; @@ -286,7 +286,7 @@ static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, - AVFilterInOut **open_outputs, AVClass *log_ctx) + AVFilterInOut **open_outputs, void *log_ctx) { int ret, pad = 0; From 57fa314090ab006808911fd790053b534749aa53 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 11 Jun 2011 11:41:49 +0200 Subject: [PATCH 10/23] lavfi: fix signature for avfilter_graph_parse() and avfilter_graph_config() Require "void *" rather than "AVClass *" for the log context type. Signed-off-by: Anton Khirnov --- libavfilter/avfilter.h | 2 +- libavfilter/avfiltergraph.c | 2 +- libavfilter/avfiltergraph.h | 4 ++-- libavfilter/graphparser.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index b9af1c4773..ee42585d6d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -30,7 +30,7 @@ #define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MINOR 7 -#define LIBAVFILTER_VERSION_MICRO 0 +#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index af96807531..8c43251c4c 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -229,7 +229,7 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) return 0; } -int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx) +int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx) { int ret; diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h index a0f6b2e01f..f9cf5cd3f9 100644 --- a/libavfilter/avfiltergraph.h +++ b/libavfilter/avfiltergraph.h @@ -76,7 +76,7 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, * @param log_ctx context used for logging * @return 0 in case of success, a negative AVERROR code otherwise */ -int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx); +int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); /** * Free a graph, destroy its links, and set *graph to NULL. @@ -118,6 +118,6 @@ typedef struct AVFilterInOut { */ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, - AVClass *log_ctx); + void *log_ctx); #endif /* AVFILTER_AVFILTERGRAPH_H */ diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index abee4dffba..90f2936590 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -331,7 +331,7 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *open_inputs, - AVFilterInOut *open_outputs, AVClass *log_ctx) + AVFilterInOut *open_outputs, void *log_ctx) { int index = 0, ret; char chr = 0; From e63e4c99c9de88b6765911da85e49e7e3be91bf0 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 18 Jun 2011 01:52:40 +0200 Subject: [PATCH 11/23] vsrc_color: use internal timebase Avoid timescale conversion, simplify. Signed-off-by: Anton Khirnov --- libavfilter/vsrc_color.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c index 1248ffd959..94b5a29719 100644 --- a/libavfilter/vsrc_color.c +++ b/libavfilter/vsrc_color.c @@ -130,6 +130,7 @@ static int color_config_props(AVFilterLink *inlink) is_packed_rgba ? "rgba" : "yuva"); inlink->w = color->w; inlink->h = color->h; + inlink->time_base = color->time_base; return 0; } @@ -139,7 +140,7 @@ static int color_request_frame(AVFilterLink *link) ColorContext *color = link->src->priv; AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); picref->video->pixel_aspect = (AVRational) {1, 1}; - picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); + picref->pts = color->pts++; picref->pos = -1; avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); From 0ec56d1144fa4ea36950295987bb5f49c9747046 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 19 Jun 2011 22:07:18 +0200 Subject: [PATCH 12/23] lavfi: fix realloc size computation in avfilter_add_format() Replace sizeof((*avff)->formats) with sizeof(*(*avff)->formats) as the size of the array element is given by the pointed element rather than by its pointer. In particular fix computation with the pending patch when sizeof(int64_t) != sizeof(int64_t *). Signed-off-by: Anton Khirnov --- libavfilter/formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index bb7b921552..ae916cf16c 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -94,7 +94,7 @@ int avfilter_add_format(AVFilterFormats **avff, int fmt) return AVERROR(ENOMEM); fmts = av_realloc((*avff)->formats, - sizeof((*avff)->formats) * ((*avff)->format_count+1)); + sizeof(*(*avff)->formats) * ((*avff)->format_count+1)); if (!fmts) return AVERROR(ENOMEM); From 46b29397a658805118e920167dcfe1bf60573e53 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 2 Jul 2011 17:27:31 +0200 Subject: [PATCH 13/23] vf_scale: add a "sar" variable Also create a "dar" alias for the "a" variable, for avoiding possible confusion between dar/sar. Signed-off-by: Anton Khirnov --- doc/filters.texi | 5 ++++- libavfilter/avfilter.h | 2 +- libavfilter/vf_scale.c | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 2967db14d2..228c1f087f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1013,9 +1013,12 @@ the output (cropped) width and heigth @item ow, oh same as @var{out_w} and @var{out_h} -@item a +@item dar, a input display aspect ratio, same as @var{iw} / @var{ih} +@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. diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index ee42585d6d..c46dd1f5dd 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -30,7 +30,7 @@ #define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MINOR 7 -#define LIBAVFILTER_VERSION_MICRO 1 +#define LIBAVFILTER_VERSION_MICRO 2 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 5217bd07f7..5e7285cda8 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -38,7 +38,8 @@ static const char *var_names[] = { "in_h", "ih", "out_w", "ow", "out_h", "oh", - "a", + "a", "dar", + "sar", "hsub", "vsub", NULL @@ -52,7 +53,8 @@ enum var_name { VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH, - VAR_A, + VAR_A, VAR_DAR, + VAR_SAR, VAR_HSUB, VAR_VSUB, VARS_NB @@ -149,7 +151,9 @@ static int config_props(AVFilterLink *outlink) var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; - var_values[VAR_A] = (float) inlink->w / inlink->h; + var_values[VAR_DAR] = var_values[VAR_A] = (float) inlink->w / inlink->h; + var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? + (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; var_values[VAR_HSUB] = 1<format].log2_chroma_w; var_values[VAR_VSUB] = 1<format].log2_chroma_h; From 80de930a781c177dc54f3836f57aa8959597bcda Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 4 Jul 2011 11:15:14 +0200 Subject: [PATCH 14/23] vf_pad: fix "vsub" variable value computation It was shifting 2 rather than 1, +10l. Signed-off-by: Anton Khirnov --- libavfilter/vf_pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 27440d842f..9ba91ed21c 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -158,7 +158,7 @@ static int config_input(AVFilterLink *inlink) var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; var_values[VAR_A] = (float) inlink->w / inlink->h; var_values[VAR_HSUB] = 1<hsub; - var_values[VAR_VSUB] = 2<vsub; + var_values[VAR_VSUB] = 1<vsub; /* evaluate width and height */ av_expr_parse_and_eval(&res, (expr = pad->w_expr), From d33e0c6bc819048b05c168d304fba7bdd75a80e1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 27 Aug 2011 01:49:55 +0200 Subject: [PATCH 15/23] vf_scale: apply the same transform to the aspect during init that is applied per frame Signed-off-by: Anton Khirnov --- libavfilter/vf_scale.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 5e7285cda8..dd2f7e18a5 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -218,6 +218,14 @@ static int config_props(AVFilterLink *outlink) if (!scale->sws) return AVERROR(EINVAL); + + if (inlink->sample_aspect_ratio.num) + outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h*inlink->w, + outlink->w*inlink->h}, + inlink->sample_aspect_ratio); + else + outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + return 0; fail: From de7b58da3e4b1e204550efa56a10acaf3f768bc8 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 12 Aug 2011 08:47:09 +0200 Subject: [PATCH 16/23] vf_unsharp: rename method "unsharpen" to "apply_unsharp" More consistent with the original libmpcodecs code, and the name "unsharpen" was confusing. Signed-off-by: Anton Khirnov --- libavfilter/vf_unsharp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 274b13c296..9be6715641 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -63,7 +63,9 @@ typedef struct { FilterParam chroma; ///< chroma parameters (width, height, amount) } UnsharpContext; -static void unsharpen(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, FilterParam *fp) +static void apply_unsharp(uint8_t *dst, const uint8_t *src, + int dst_stride, int src_stride, + int width, int height, FilterParam *fp) { uint32_t **sc = fp->sc; uint32_t sr[(MAX_SIZE * MAX_SIZE) - 1], tmp1, tmp2; @@ -206,9 +208,9 @@ static void end_frame(AVFilterLink *link) AVFilterBufferRef *in = link->cur_buf; AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; - unsharpen(out->data[0], in->data[0], out->linesize[0], in->linesize[0], link->w, link->h, &unsharp->luma); - unsharpen(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); - unsharpen(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); + apply_unsharp(out->data[0], in->data[0], out->linesize[0], in->linesize[0], link->w, link->h, &unsharp->luma); + apply_unsharp(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); + apply_unsharp(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); avfilter_unref_buffer(in); avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); From e6d17ba4268800964b60d71c227c25f028b03889 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 12 Aug 2011 09:22:31 +0200 Subject: [PATCH 17/23] vf_unsharp: adopt a more natural order of params in apply_unsharp() Signed-off-by: Anton Khirnov --- libavfilter/vf_unsharp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 9be6715641..6386888a39 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -63,8 +63,8 @@ typedef struct { FilterParam chroma; ///< chroma parameters (width, height, amount) } UnsharpContext; -static void apply_unsharp(uint8_t *dst, const uint8_t *src, - int dst_stride, int src_stride, +static void apply_unsharp( uint8_t *dst, int dst_stride, + const uint8_t *src, int src_stride, int width, int height, FilterParam *fp) { uint32_t **sc = fp->sc; @@ -208,9 +208,9 @@ static void end_frame(AVFilterLink *link) AVFilterBufferRef *in = link->cur_buf; AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; - apply_unsharp(out->data[0], in->data[0], out->linesize[0], in->linesize[0], link->w, link->h, &unsharp->luma); - apply_unsharp(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); - apply_unsharp(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); + apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma); + apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); + apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); avfilter_unref_buffer(in); avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); From 1c257dc32d76011409a67154767a02b8e3991fc9 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 12 Aug 2011 09:30:17 +0200 Subject: [PATCH 18/23] vf_unsharp: store hsub/vsub in the filter context Also drop obfuscating CHROMA_WIDTH/HEIGHT macros. Signed-off-by: Anton Khirnov --- libavfilter/vf_unsharp.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 6386888a39..8a4f9c7a0c 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -44,8 +44,8 @@ #define MIN_SIZE 3 #define MAX_SIZE 13 -#define CHROMA_WIDTH(link) -((-link->w) >> av_pix_fmt_descriptors[link->format].log2_chroma_w) -#define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_descriptors[link->format].log2_chroma_h) +/* right-shift and round-up */ +#define SHIFTUP(x,shift) (-((-(x))>>(shift))) typedef struct FilterParam { int msize_x; ///< matrix width @@ -61,6 +61,7 @@ typedef struct FilterParam { typedef struct { FilterParam luma; ///< luma parameters (width, height, amount) FilterParam chroma; ///< chroma parameters (width, height, amount) + int hsub, vsub; } UnsharpContext; static void apply_unsharp( uint8_t *dst, int dst_stride, @@ -180,8 +181,11 @@ static int config_props(AVFilterLink *link) { UnsharpContext *unsharp = link->dst->priv; + unsharp->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; + unsharp->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; + init_filter_param(link->dst, &unsharp->luma, "luma", link->w); - init_filter_param(link->dst, &unsharp->chroma, "chroma", CHROMA_WIDTH(link)); + init_filter_param(link->dst, &unsharp->chroma, "chroma", SHIFTUP(link->w, unsharp->hsub)); return 0; } @@ -207,10 +211,12 @@ static void end_frame(AVFilterLink *link) UnsharpContext *unsharp = link->dst->priv; AVFilterBufferRef *in = link->cur_buf; AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; + int cw = SHIFTUP(link->w, unsharp->hsub); + int ch = SHIFTUP(link->h, unsharp->vsub); - apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma); - apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); - apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); + apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma); + apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, &unsharp->chroma); + apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, &unsharp->chroma); avfilter_unref_buffer(in); avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); From 32dfd8ca65e67b18bd22f83cf967f8216818e1fe Mon Sep 17 00:00:00 2001 From: Kieran Kunhya Date: Wed, 28 Sep 2011 07:46:10 -0500 Subject: [PATCH 19/23] latmenc: Fix private options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/latmenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 8d67b5a615..707c6031c2 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -27,6 +27,7 @@ #include "avformat.h" typedef struct { + AVClass *av_class; int off; int channel_conf; int object_type; From fcca826a63c79168f82a48c2620312630a83080a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 28 Sep 2011 14:33:21 +0100 Subject: [PATCH 20/23] dsputil: add vector_fmac_scalar() Signed-off-by: Mans Rullgard --- libavcodec/dsputil.c | 9 +++++++++ libavcodec/dsputil.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 039cf0b213..967406eedf 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -2455,6 +2455,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) { @@ -2994,6 +3002,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; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 4d783cf266..73830f8190 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -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 From a92a1b93b4888821b2c0f01ab628d8ebaf3f6d61 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 28 Sep 2011 14:34:04 +0100 Subject: [PATCH 21/23] dca: use vector_fmac_scalar from dsputil Signed-off-by: Mans Rullgard --- libavcodec/dca.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 58f3420586..db794a72fd 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1829,11 +1829,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) { From baf6b738f23bbe7db3a8438372d01a958492e477 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 28 Sep 2011 14:34:54 +0100 Subject: [PATCH 22/23] ARM: NEON optimised vector_fmac_scalar() Signed-off-by: Mans Rullgard --- libavcodec/arm/dsputil_init_neon.c | 3 ++ libavcodec/arm/dsputil_neon.S | 48 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index 101bd055a1..acb2132132 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -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; diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S index aef8a129ee..13f0699eb2 100644 --- a/libavcodec/arm/dsputil_neon.S +++ b/libavcodec/arm/dsputil_neon.S @@ -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] From daf98908118074e96199ca7195663af4543d3808 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 27 Sep 2011 10:24:28 -0700 Subject: [PATCH 23/23] avconv: Reformat s16 volume adjustment. --- avconv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/avconv.c b/avconv.c index d6003dd2c1..c418b7cfc1 100644 --- a/avconv.c +++ b/avconv.c @@ -1676,13 +1676,12 @@ static int output_packet(InputStream *ist, int ist_index, } case AV_SAMPLE_FMT_S16: { - 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); - } - break; + 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: {