diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-20 22:18:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-20 22:18:26 +0200 |
commit | 3194ab78a6c4ea0a4c60c91c4d0ea34028ca408f (patch) | |
tree | 13f41910a7e4feec8d64182bf3b6772d88236098 | |
parent | 9b1f776d751472e8a376b412d02a96a35044e2a0 (diff) | |
parent | b0e9edc44f1722787adacbff9aa60343206a58c0 (diff) | |
download | ffmpeg-3194ab78a6c4ea0a4c60c91c4d0ea34028ca408f.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
avcodec: add a cook parser to get subpacket duration
FATE: allow lavf tests to alter input parameters
FATE: replace the acodec-pcm_s24daud test with an enc_dec_pcm checksum test
FATE: replace the acodec-g726 test with 4 new encode/decode tests
FATE: replace current g722 encoding tests with an encode/decode test
FATE: add a pattern rule for generating asynth wav files
FATE: optionally write a WAVE header in audiogen
avutil: add audio fifo buffer
Conflicts:
doc/APIchanges
libavcodec/version.h
libavutil/avutil.h
tests/Makefile
tests/codec-regression.sh
tests/fate/voice.mak
tests/lavf-regression.sh
tests/ref/acodec/g722
tests/ref/acodec/g726
tests/ref/acodec/pcm_s24daud
tests/ref/lavf/dv_fmt
tests/ref/lavf/gxf
tests/ref/lavf/mxf
tests/ref/lavf/mxf_d10
tests/ref/seek/lavf_dv
Merged-by: Michael Niedermayer <michaelni@gmx.at>
32 files changed, 536 insertions, 146 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index ab78401488..a0b786d79e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -22,6 +22,18 @@ 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 - lavu 51.28.0 - audio_fifo.h + Add audio FIFO functions: + av_audio_fifo_free() + av_audio_fifo_alloc() + av_audio_fifo_realloc() + av_audio_fifo_write() + av_audio_fifo_read() + av_audio_fifo_drain() + av_audio_fifo_reset() + av_audio_fifo_size() + av_audio_fifo_space() + 2012-xx-xx - xxxxxxx - lavfi 2.16.0 - avfiltergraph.h Add avfilter_graph_parse2() diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d7179c2233..e336917231 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -679,6 +679,7 @@ OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \ aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o +OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4a24d3199d..c8a6621818 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -437,6 +437,7 @@ void avcodec_register_all(void) REGISTER_PARSER (AC3, ac3); REGISTER_PARSER (ADX, adx); REGISTER_PARSER (CAVSVIDEO, cavsvideo); + REGISTER_PARSER (COOK, cook); REGISTER_PARSER (DCA, dca); REGISTER_PARSER (DIRAC, dirac); REGISTER_PARSER (DNXHD, dnxhd); diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c new file mode 100644 index 0000000000..c16f7c8a5f --- /dev/null +++ b/libavcodec/cook_parser.c @@ -0,0 +1,59 @@ +/* + * 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 + */ + +/** + * @file + * Cook audio parser + * + * Determines subpacket duration from extradata. + */ + +#include <stdint.h> + +#include "libavutil/intreadwrite.h" +#include "parser.h" + +typedef struct CookParseContext { + int duration; +} CookParseContext; + +static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + CookParseContext *s = s1->priv_data; + + if (s->duration) + s1->duration = s->duration; + else if (avctx->extradata && avctx->extradata_size >= 8 && avctx->channels) + s->duration = AV_RB16(avctx->extradata + 4) / avctx->channels; + + /* always return the full packet. this parser isn't doing any splitting or + combining, only setting packet duration */ + *poutbuf = buf; + *poutbuf_size = buf_size; + return buf_size; +} + +AVCodecParser ff_cook_parser = { + .codec_ids = { CODEC_ID_COOK }, + .priv_data_size = sizeof(CookParseContext), + .parser_parse = cook_parse, +}; diff --git a/libavcodec/version.h b/libavcodec/version.h index 2429eb5e64..1a549ba63c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -27,8 +27,8 @@ */ #define LIBAVCODEC_VERSION_MAJOR 54 -#define LIBAVCODEC_VERSION_MINOR 14 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MINOR 15 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/daud.c b/libavformat/daud.c index 2f74c3236d..916489fc0e 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -75,7 +75,7 @@ AVInputFormat ff_daud_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio format"), .read_header = daud_header, .read_packet = daud_packet, - .extensions = "302", + .extensions = "302,daud", }; #endif diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index bd83956c12..d919a9a41a 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -205,6 +205,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, st->codec->block_align = coded_framesize; break; case CODEC_ID_COOK: + st->need_parsing = AVSTREAM_PARSE_HEADERS; case CODEC_ID_ATRAC3: case CODEC_ID_SIPR: avio_rb16(pb); avio_r8(pb); diff --git a/libavutil/Makefile b/libavutil/Makefile index ed7de258ac..83e6c07605 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -5,6 +5,7 @@ NAME = avutil HEADERS = adler32.h \ aes.h \ attributes.h \ + audio_fifo.h \ audioconvert.h \ avassert.h \ avstring.h \ @@ -45,6 +46,7 @@ BUILT_HEADERS = avconfig.h OBJS = adler32.o \ aes.o \ + audio_fifo.o \ audioconvert.o \ avstring.o \ base64.o \ diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c new file mode 100644 index 0000000000..97c51a72c1 --- /dev/null +++ b/libavutil/audio_fifo.c @@ -0,0 +1,193 @@ +/* + * Audio FIFO + * 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 + */ + +/** + * @file + * Audio FIFO + */ + +#include "avutil.h" +#include "audio_fifo.h" +#include "fifo.h" +#include "mem.h" +#include "samplefmt.h" + +struct AVAudioFifo { + AVFifoBuffer **buf; /**< single buffer for interleaved, per-channel buffers for planar */ + int nb_buffers; /**< number of buffers */ + int nb_samples; /**< number of samples currently in the FIFO */ + int allocated_samples; /**< current allocated size, in samples */ + + int channels; /**< number of channels */ + enum AVSampleFormat sample_fmt; /**< sample format */ + int sample_size; /**< size, in bytes, of one sample in a buffer */ +}; + +void av_audio_fifo_free(AVAudioFifo *af) +{ + if (af) { + if (af->buf) { + int i; + for (i = 0; i < af->nb_buffers; i++) { + if (af->buf[i]) + av_fifo_free(af->buf[i]); + } + av_free(af->buf); + } + av_free(af); + } +} + +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples) +{ + AVAudioFifo *af; + int buf_size, i; + + /* get channel buffer size (also validates parameters) */ + if (av_samples_get_buffer_size(&buf_size, channels, nb_samples, sample_fmt, 1) < 0) + return NULL; + + af = av_mallocz(sizeof(*af)); + if (!af) + return NULL; + + af->channels = channels; + af->sample_fmt = sample_fmt; + af->sample_size = buf_size / nb_samples; + af->nb_buffers = av_sample_fmt_is_planar(sample_fmt) ? channels : 1; + + af->buf = av_mallocz(af->nb_buffers * sizeof(*af->buf)); + if (!af->buf) + goto error; + + for (i = 0; i < af->nb_buffers; i++) { + af->buf[i] = av_fifo_alloc(buf_size); + if (!af->buf[i]) + goto error; + } + af->allocated_samples = nb_samples; + + return af; + +error: + av_audio_fifo_free(af); + return NULL; +} + +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples) +{ + int i, ret, buf_size; + + if ((ret = av_samples_get_buffer_size(&buf_size, af->channels, nb_samples, + af->sample_fmt, 1)) < 0) + return ret; + + for (i = 0; i < af->nb_buffers; i++) { + if ((ret = av_fifo_realloc2(af->buf[i], buf_size)) < 0) + return ret; + } + af->allocated_samples = nb_samples; + return 0; +} + +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples) +{ + int i, ret, size; + + /* automatically reallocate buffers if needed */ + if (av_audio_fifo_space(af) < nb_samples) { + int current_size = av_audio_fifo_size(af); + /* check for integer overflow in new size calculation */ + if (INT_MAX / 2 - current_size < nb_samples) + return AVERROR(EINVAL); + /* reallocate buffers */ + if ((ret = av_audio_fifo_realloc(af, 2 * (current_size + nb_samples))) < 0) + return ret; + } + + size = nb_samples * af->sample_size; + for (i = 0; i < af->nb_buffers; i++) { + ret = av_fifo_generic_write(af->buf[i], data[i], size, NULL); + if (ret != size) + return AVERROR_BUG; + } + af->nb_samples += nb_samples; + + return nb_samples; +} + +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples) +{ + int i, ret, size; + + if (nb_samples < 0) + return AVERROR(EINVAL); + nb_samples = FFMIN(nb_samples, af->nb_samples); + if (!nb_samples) + return 0; + + size = nb_samples * af->sample_size; + for (i = 0; i < af->nb_buffers; i++) { + if ((ret = av_fifo_generic_read(af->buf[i], data[i], size, NULL)) < 0) + return AVERROR_BUG; + } + af->nb_samples -= nb_samples; + + return nb_samples; +} + +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples) +{ + int i, size; + + if (nb_samples < 0) + return AVERROR(EINVAL); + nb_samples = FFMIN(nb_samples, af->nb_samples); + + if (nb_samples) { + size = nb_samples * af->sample_size; + for (i = 0; i < af->nb_buffers; i++) + av_fifo_drain(af->buf[i], size); + af->nb_samples -= nb_samples; + } + return 0; +} + +void av_audio_fifo_reset(AVAudioFifo *af) +{ + int i; + + for (i = 0; i < af->nb_buffers; i++) + av_fifo_reset(af->buf[i]); + + af->nb_samples = 0; +} + +int av_audio_fifo_size(AVAudioFifo *af) +{ + return af->nb_samples; +} + +int av_audio_fifo_space(AVAudioFifo *af) +{ + return af->allocated_samples - af->nb_samples; +} diff --git a/libavutil/audio_fifo.h b/libavutil/audio_fifo.h new file mode 100644 index 0000000000..8c76388255 --- /dev/null +++ b/libavutil/audio_fifo.h @@ -0,0 +1,146 @@ +/* + * Audio FIFO + * 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 + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 6464167473..0787bcbe09 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -153,7 +153,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 46 +#define LIBAVUTIL_VERSION_MINOR 47 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/Makefile b/tests/Makefile index 1a94663c50..9b88c06f82 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -29,6 +29,9 @@ tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) | tests/data tests/data/asynth-16000-1.sw: tests/audiogen$(HOSTEXESUF) | tests/data $(M)./$< $@ 16000 1 +tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data + $(M)./$< $@ $(subst -, ,$*) + tests/data/mapchan-6ch.sw: tests/audiogen$(HOSTEXESUF) @mkdir -p tests/data $(M)./$< $@ 22050 6 @@ -37,7 +40,7 @@ tests/data/mapchan-mono.sw: tests/audiogen$(HOSTEXESUF) @mkdir -p tests/data $(M)./$< $@ 22050 1 -tests/data/%.sw tests/vsynth%/00.pgm: TAG = GEN +tests/data/%.sw tests/data/asynth% tests/vsynth%/00.pgm: TAG = GEN include $(SRC_PATH)/tests/fate/aac.mak include $(SRC_PATH)/tests/fate/ac3.mak diff --git a/tests/audiogen.c b/tests/audiogen.c index 776fdf9316..5818797a65 100644 --- a/tests/audiogen.c +++ b/tests/audiogen.c @@ -22,7 +22,9 @@ */ #include <stdlib.h> +#include <stdint.h> #include <stdio.h> +#include <string.h> #define MAX_CHANNELS 8 @@ -93,12 +95,45 @@ static int int_cos(int a) FILE *outfile; -static void put_sample(int v) +static void put16(int16_t v) { - fputc(v & 0xff, outfile); + fputc( v & 0xff, outfile); fputc((v >> 8) & 0xff, outfile); } +static void put32(uint32_t v) +{ + fputc( v & 0xff, outfile); + fputc((v >> 8) & 0xff, outfile); + fputc((v >> 16) & 0xff, outfile); + fputc((v >> 24) & 0xff, outfile); +} + +#define HEADER_SIZE 46 +#define FMT_SIZE 18 +#define SAMPLE_SIZE 2 +#define WFORMAT_PCM 0x0001 + +static void put_wav_header(int sample_rate, int channels, int nb_samples) +{ + int block_align = SAMPLE_SIZE * channels; + int data_size = block_align * nb_samples; + + fputs("RIFF", outfile); + put32(HEADER_SIZE + data_size); + fputs("WAVEfmt ", outfile); + put32(FMT_SIZE); + put16(WFORMAT_PCM); + put16(channels); + put32(sample_rate); + put32(block_align * sample_rate); + put16(block_align); + put16(SAMPLE_SIZE * 8); + put16(0); + fputs("data", outfile); + put32(data_size); +} + int main(int argc, char **argv) { int i, a, v, j, f, amp, ampa; @@ -107,10 +142,12 @@ int main(int argc, char **argv) int taba[MAX_CHANNELS]; int sample_rate = 44100; int nb_channels = 2; + char *ext; if (argc < 2 || argc > 4) { printf("usage: %s file [<sample rate> [<channels>]]\n" "generate a test raw 16 bit audio stream\n" + "If the file extension is .wav a WAVE header will be added.\n" "default: 44100 Hz stereo\n", argv[0]); exit(1); } @@ -137,12 +174,15 @@ int main(int argc, char **argv) return 1; } + if ((ext = strrchr(argv[1], '.')) != NULL && !strcmp(ext, ".wav")) + put_wav_header(sample_rate, nb_channels, 6 * sample_rate); + /* 1 second of single freq sinus at 1000 Hz */ a = 0; for (i = 0; i < 1 * sample_rate; i++) { v = (int_cos(a) * 10000) >> FRAC_BITS; for (j = 0; j < nb_channels; j++) - put_sample(v); + put16(v); a += (1000 * FRAC_ONE) / sample_rate; } @@ -151,7 +191,7 @@ int main(int argc, char **argv) for (i = 0; i < 1 * sample_rate; i++) { v = (int_cos(a) * 10000) >> FRAC_BITS; for (j = 0; j < nb_channels; j++) - put_sample(v); + put16(v); f = 100 + (((10000 - 100) * i) / sample_rate); a += (f * FRAC_ONE) / sample_rate; } @@ -160,14 +200,14 @@ int main(int argc, char **argv) for (i = 0; i < sample_rate / 2; i++) { v = myrnd(&seed, 20000) - 10000; for (j = 0; j < nb_channels; j++) - put_sample(v); + put16(v); } /* 0.5 second of high amplitude white noise */ for (i = 0; i < sample_rate / 2; i++) { v = myrnd(&seed, 65535) - 32768; for (j = 0; j < nb_channels; j++) - put_sample(v); + put16(v); } /* 1 second of unrelated ramps for each channel */ @@ -179,7 +219,7 @@ int main(int argc, char **argv) for (i = 0; i < 1 * sample_rate; i++) { for (j = 0; j < nb_channels; j++) { v = (int_cos(taba[j]) * 10000) >> FRAC_BITS; - put_sample(v); + put16(v); f = tabf1[j] + (((tabf2[j] - tabf1[j]) * i) / sample_rate); taba[j] += (f * FRAC_ONE) / sample_rate; } @@ -194,7 +234,7 @@ int main(int argc, char **argv) if (j & 1) amp = 10000 - amp; v = (int_cos(a) * amp) >> FRAC_BITS; - put_sample(v); + put16(v); a += (500 * FRAC_ONE) / sample_rate; ampa += (2 * FRAC_ONE) / sample_rate; } diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh index 1e5f8166bd..51d1b4c67b 100755 --- a/tests/codec-regression.sh +++ b/tests/codec-regression.sh @@ -395,16 +395,6 @@ do_audio_encoding g723_1.tco "-b:a 6.3k -ac 1 -ar 8000 -acodec g723_1" do_audio_decoding fi -if [ -n "$do_g722" ] ; then -do_audio_encoding g722.wav "-b 64k -ac 1 -ar 16000 -acodec g722" -do_audio_decoding -fi - -if [ -n "$do_g726" ] ; then -do_audio_encoding g726.wav "-b:a 32k -ac 1 -ar 8000 -acodec g726" -do_audio_decoding -fi - if [ -n "$do_adpcm_adx" ] ; then do_audio_encoding adpcm_adx.adx "-acodec adpcm_adx" do_audio_decoding @@ -534,6 +524,3 @@ fi if [ -n "$do_pcm_f64le" ] ; then do_audio_enc_dec wav dbl pcm_f64le fi -if [ -n "$do_pcm_s24daud" ] ; then -do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000" -fi diff --git a/tests/fate/pcm.mak b/tests/fate/pcm.mak index 3ce04f9cea..4b271346f6 100644 --- a/tests/fate/pcm.mak +++ b/tests/fate/pcm.mak @@ -25,5 +25,10 @@ fate-pcm_u8-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-raw.mov -f FATE_PCM += fate-w64 fate-w64: CMD = crc -i $(SAMPLES)/w64/w64-pcm16.w64 +FATE_PCM += fate-dcinema-encode +fate-dcinema-encode: tests/data/asynth-96000-6.wav +fate-dcinema-encode: SRC = tests/data/asynth-96000-6.wav +fate-dcinema-encode: CMD = enc_dec_pcm daud md5 s16le $(SRC) -c:a pcm_s24daud + FATE_TESTS += $(FATE_PCM) fate-pcm: $(FATE_PCM) diff --git a/tests/fate/voice.mak b/tests/fate/voice.mak index b9bf8e1e51..f8fa24b7b6 100644 --- a/tests/fate/voice.mak +++ b/tests/fate/voice.mak @@ -1,9 +1,36 @@ -FATE_VOICE += fate-g722dec-1 +FATE_G722 += fate-g722dec-1 fate-g722dec-1: CMD = framecrc -i $(SAMPLES)/g722/conf-adminmenu-162.g722 -FATE_VOICE += fate-g722enc -fate-g722enc: tests/data/asynth-16000-1.sw -fate-g722enc: CMD = md5 -ar 16000 -ac 1 -f s16le -i $(TARGET_PATH)/tests/data/asynth-16000-1.sw -acodec g722 -ac 1 -f g722 +FATE_G722 += fate-g722-encode +fate-g722-encode: tests/data/asynth-16000-1.wav +fate-g722-encode: SRC = tests/data/asynth-16000-1.wav +fate-g722-encode: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g722 + +FATE_VOICE += $(FATE_G722) +fate-g722: $(FATE_G722) + +FATE_G726 += fate-g726-encode-2bit +fate-g726-encode-2bit: tests/data/asynth-8000-1.wav +fate-g726-encode-2bit: SRC = tests/data/asynth-8000-1.wav +fate-g726-encode-2bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 16k + +FATE_G726 += fate-g726-encode-3bit +fate-g726-encode-3bit: tests/data/asynth-8000-1.wav +fate-g726-encode-3bit: SRC = tests/data/asynth-8000-1.wav +fate-g726-encode-3bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 24k + +FATE_G726 += fate-g726-encode-4bit +fate-g726-encode-4bit: tests/data/asynth-8000-1.wav +fate-g726-encode-4bit: SRC = tests/data/asynth-8000-1.wav +fate-g726-encode-4bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 32k + +FATE_G726 += fate-g726-encode-5bit +fate-g726-encode-5bit: tests/data/asynth-8000-1.wav +fate-g726-encode-5bit: SRC = tests/data/asynth-8000-1.wav +fate-g726-encode-5bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 40k + +FATE_VOICE += $(FATE_G726) +fate-g726: $(FATE_G726) FATE_GSM += fate-gsm-ms fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh index 24a0c64ce8..2d27519fa1 100755 --- a/tests/lavf-regression.sh +++ b/tests/lavf-regression.sh @@ -24,18 +24,18 @@ do_lavf_fate() do_lavf() { file=${outfile}lavf.$1 - do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $2 - do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3 + do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $2 -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $3 + do_avconv_crc $file $DEC_OPTS -i $target_path/$file $4 } -do_lavf_timecode_nodrop() { do_lavf $1 "$2 -timecode 02:56:14:13"; } -do_lavf_timecode_drop() { do_lavf $1 "$2 -timecode 02:56:14.13 -r 30000/1001"; } +do_lavf_timecode_nodrop() { do_lavf $1 "" "$2 -timecode 02:56:14:13"; } +do_lavf_timecode_drop() { do_lavf $1 "" "$2 -timecode 02:56:14.13 -r 30000/1001"; } do_lavf_timecode() { do_lavf_timecode_nodrop "$@" do_lavf_timecode_drop "$@" - do_lavf "$@" + do_lavf $1 "" "$2" } do_streamed_images() @@ -64,11 +64,11 @@ do_audio_only() } if [ -n "$do_avi" ] ; then -do_lavf avi "-acodec mp2 -ab 64k" +do_lavf avi "" "-acodec mp2 -ab 64k" fi if [ -n "$do_asf" ] ; then -do_lavf asf "-acodec mp2 -ab 64k" "-r 25" +do_lavf asf "" "-acodec mp2 -ab 64k" "-r 25" fi if [ -n "$do_rm" ] ; then @@ -87,15 +87,15 @@ do_lavf_timecode mxf "-ar 48000 -bf 2" fi if [ -n "$do_mxf_d10" ]; then -do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -non_linear_quant 1 -intra_vlc 1 -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10" +do_lavf mxf_d10 "-ar 48000 -ac 2" "-r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -non_linear_quant 1 -intra_vlc 1 -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10" fi if [ -n "$do_ts" ] ; then -do_lavf ts "-ab 64k -mpegts_transport_stream_id 42" +do_lavf ts "" "-ab 64k -mpegts_transport_stream_id 42" fi if [ -n "$do_swf" ] ; then -do_lavf swf -an +do_lavf swf "" "-an" fi if [ -n "$do_ffm" ] ; then @@ -103,11 +103,11 @@ do_lavf ffm "-ab 64k" fi if [ -n "$do_flv_fmt" ] ; then -do_lavf flv -an +do_lavf flv "" "-an" fi if [ -n "$do_mov" ] ; then -do_lavf mov "-movflags +rtphint -acodec pcm_alaw -vcodec mpeg4" +do_lavf mov "" "-movflags +rtphint -acodec pcm_alaw -vcodec mpeg4" do_lavf_timecode mov "-acodec pcm_alaw -vcodec mpeg4" fi @@ -118,21 +118,21 @@ 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" "-r 25 -s pal -ac 2" fi if [ -n "$do_gxf" ] ; then do_lavf_timecode_nodrop gxf "-ar 48000 -r 25 -s pal -ac 1" do_lavf_timecode_drop gxf "-ar 48000 -s ntsc -ac 1" -do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1" +do_lavf gxf "-ar 48000" "-r 25 -s pal -ac 1" fi if [ -n "$do_nut" ] ; then -do_lavf nut "-acodec mp2 -ab 64k" +do_lavf nut "" "-acodec mp2 -ab 64k" fi if [ -n "$do_mkv" ] ; then -do_lavf mkv "-acodec mp2 -ab 64k -vcodec mpeg4" +do_lavf mkv "" "-acodec mp2 -ab 64k -vcodec mpeg4" fi if [ -n "$do_mp3" ] ; then @@ -150,7 +150,7 @@ do_lavf_fate ogg "vp3/coeff_level64.mkv" fi if [ -n "$do_wtv" ] ; then -do_lavf wtv "-acodec mp2" +do_lavf wtv "" "-acodec mp2" fi diff --git a/tests/ref/acodec/g722 b/tests/ref/acodec/g722 deleted file mode 100644 index de0e5a0caa..0000000000 --- a/tests/ref/acodec/g722 +++ /dev/null @@ -1,4 +0,0 @@ -e4d5ae038f29659c03fcf68818f7be6c *./tests/data/acodec/g722.wav -48053 ./tests/data/acodec/g722.wav -8dafe5b74ccd5f08fed2fb2a69c5475f *./tests/data/g722.acodec.out.wav -stddev: 8939.47 PSNR: 17.30 MAXDIFF:40370 bytes: 191980/ 1058400 diff --git a/tests/ref/acodec/g726 b/tests/ref/acodec/g726 deleted file mode 100644 index c519ac297e..0000000000 --- a/tests/ref/acodec/g726 +++ /dev/null @@ -1,4 +0,0 @@ -331fcf91f4483b508059d0933af97987 *./tests/data/acodec/g726.wav -24054 ./tests/data/acodec/g726.wav -fac563ba7947d8fc42b4af048707c145 *./tests/data/g726.acodec.out.wav -stddev: 8553.69 PSNR: 17.69 MAXDIFF:29353 bytes: 95984/ 1058400 diff --git a/tests/ref/acodec/pcm_s24daud b/tests/ref/acodec/pcm_s24daud deleted file mode 100644 index e1f22964fc..0000000000 --- a/tests/ref/acodec/pcm_s24daud +++ /dev/null @@ -1,4 +0,0 @@ -1b75d5198ae789ab3c48f7024e08f4a9 *./tests/data/acodec/pcm_s24daud.302 -10368730 ./tests/data/acodec/pcm_s24daud.302 -70ec0ba6bc151ddc7509c09804d95d3b *./tests/data/pcm_s24daud.acodec.out.wav -stddev: 8967.92 PSNR: 17.28 MAXDIFF:42548 bytes: 6911796/ 1058400 diff --git a/tests/ref/fate/dcinema-encode b/tests/ref/fate/dcinema-encode new file mode 100644 index 0000000000..8aeb21526c --- /dev/null +++ b/tests/ref/fate/dcinema-encode @@ -0,0 +1 @@ +MD5=2d7c6897c315493647db159f4bfd6edc diff --git a/tests/ref/fate/g722-encode b/tests/ref/fate/g722-encode new file mode 100644 index 0000000000..c7198cf83c --- /dev/null +++ b/tests/ref/fate/g722-encode @@ -0,0 +1 @@ +MD5=7106189574186051c0497b287e2e5f19 diff --git a/tests/ref/fate/g722enc b/tests/ref/fate/g722enc deleted file mode 100644 index 9b8e469a8b..0000000000 --- a/tests/ref/fate/g722enc +++ /dev/null @@ -1 +0,0 @@ -94e2f200d6e05b47cec4aa3e94571cf3 diff --git a/tests/ref/fate/g726-encode-2bit b/tests/ref/fate/g726-encode-2bit new file mode 100644 index 0000000000..26a12190fc --- /dev/null +++ b/tests/ref/fate/g726-encode-2bit @@ -0,0 +1 @@ +MD5=215eaef5778a16e2bf4f3725a557f355 diff --git a/tests/ref/fate/g726-encode-3bit b/tests/ref/fate/g726-encode-3bit new file mode 100644 index 0000000000..f9c6940217 --- /dev/null +++ b/tests/ref/fate/g726-encode-3bit @@ -0,0 +1 @@ +MD5=0bebd949dfd5ac0ae3f2c3ceb2e3fac1 diff --git a/tests/ref/fate/g726-encode-4bit b/tests/ref/fate/g726-encode-4bit new file mode 100644 index 0000000000..6d03517164 --- /dev/null +++ b/tests/ref/fate/g726-encode-4bit @@ -0,0 +1 @@ +MD5=a21cfea116ab2179eabe5d84b6bfc09a diff --git a/tests/ref/fate/g726-encode-5bit b/tests/ref/fate/g726-encode-5bit new file mode 100644 index 0000000000..459ebb39f2 --- /dev/null +++ b/tests/ref/fate/g726-encode-5bit @@ -0,0 +1 @@ +MD5=9cad98cf5205bf76d6e9d1241e56141a diff --git a/tests/ref/lavf/dv_fmt b/tests/ref/lavf/dv_fmt index 884c079243..ea667b9627 100644 --- a/tests/ref/lavf/dv_fmt +++ b/tests/ref/lavf/dv_fmt @@ -4,6 +4,6 @@ cc33ae4f9e6828914dea0f09d1241b7e *./tests/data/lavf/lavf.dv 3480000 ./tests/data/lavf/lavf.dv ./tests/data/lavf/lavf.dv CRC=0x8d5e9e8f -3a6a9163a67b729b4a6b5d972ccceb97 *./tests/data/lavf/lavf.dv +b36c83cd0ba0ebe719f09f885c4bbcd3 *./tests/data/lavf/lavf.dv 3600000 ./tests/data/lavf/lavf.dv -./tests/data/lavf/lavf.dv CRC=0x5ce4e5e4 +./tests/data/lavf/lavf.dv CRC=0x2bc2ae3a diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf index 5796895a1d..63101b89ed 100644 --- a/tests/ref/lavf/gxf +++ b/tests/ref/lavf/gxf @@ -4,6 +4,6 @@ befc1a39c37a4ecd9264942a3e34b3f6 *./tests/data/lavf/lavf.gxf 267d2b2b6e357209d76c366302cf35c3 *./tests/data/lavf/lavf.gxf 794572 ./tests/data/lavf/lavf.gxf ./tests/data/lavf/lavf.gxf CRC=0xab47d02d -1c1693cf2358025f1e37ac76e1da925a *./tests/data/lavf/lavf.gxf +0a1a37fa79b62435545271b4e8e882f5 *./tests/data/lavf/lavf.gxf 796392 ./tests/data/lavf/lavf.gxf -./tests/data/lavf/lavf.gxf CRC=0x102918fd +./tests/data/lavf/lavf.gxf CRC=0x3b1a8e91 diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10 index efeac5a2c0..a10e8456ed 100644 --- a/tests/ref/lavf/mxf_d10 +++ b/tests/ref/lavf/mxf_d10 @@ -1,3 +1,3 @@ -23177c8a72f34e243e9ffc4f6c70d3c7 *./tests/data/lavf/lavf.mxf_d10 +0d72247067569901a2e351586ddc0b82 *./tests/data/lavf/lavf.mxf_d10 5330989 ./tests/data/lavf/lavf.mxf_d10 -./tests/data/lavf/lavf.mxf_d10 CRC=0x81602ff1 +./tests/data/lavf/lavf.mxf_d10 CRC=0x4474d480 diff --git a/tests/ref/seek/g726_wav b/tests/ref/seek/g726_wav deleted file mode 100644 index 0e145a2722..0000000000 --- a/tests/ref/seek/g726_wav +++ /dev/null @@ -1,53 +0,0 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894000 pts: 1.894000 pos: 7634 size: 4096 -ret: 0 st: 0 flags:0 ts: 0.788375 -ret: 0 st: 0 flags:1 dts: 0.788500 pts: 0.788500 pos: 3212 size: 4096 -ret: 0 st: 0 flags:1 ts:-0.317500 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.576750 pts: 2.576750 pos: 10365 size: 4096 -ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.470750 pts: 1.470750 pos: 5941 size: 4096 -ret: 0 st: 0 flags:0 ts: 0.365000 -ret: 0 st: 0 flags:1 dts: 0.365000 pts: 0.365000 pos: 1518 size: 4096 -ret: 0 st: 0 flags:1 ts:-0.740875 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.153500 pts: 2.153500 pos: 8672 size: 4096 -ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.047500 pts: 1.047500 pos: 4248 size: 4096 -ret: 0 st: 0 flags:0 ts:-0.058375 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st: 0 flags:1 ts: 2.835875 -ret: 0 st: 0 flags:1 dts: 2.835750 pts: 2.835750 pos: 11401 size: 4096 -ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 6978 size: 4096 -ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.624000 pts: 0.624000 pos: 2554 size: 4096 -ret: 0 st: 0 flags:0 ts:-0.481625 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st: 0 flags:1 ts: 2.412500 -ret: 0 st: 0 flags:1 dts: 2.412500 pts: 2.412500 pos: 9708 size: 4096 -ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.306750 pts: 1.306750 pos: 5285 size: 4096 -ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.200750 pts: 0.200750 pos: 861 size: 4096 -ret: 0 st: 0 flags:0 ts:-0.905000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st: 0 flags:1 ts: 1.989125 -ret: 0 st: 0 flags:1 dts: 1.989000 pts: 1.989000 pos: 8014 size: 4096 -ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.883500 pts: 0.883500 pos: 3592 size: 4096 -ret: 0 st:-1 flags:1 ts:-0.222493 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 -ret: 0 st: 0 flags:0 ts: 2.671625 -ret: 0 st: 0 flags:1 dts: 2.671750 pts: 2.671750 pos: 10745 size: 4096 -ret: 0 st: 0 flags:1 ts: 1.565875 -ret: 0 st: 0 flags:1 dts: 1.565750 pts: 1.565750 pos: 6321 size: 4096 -ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 1898 size: 4096 -ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 diff --git a/tests/ref/seek/pcm_s24daud_302 b/tests/ref/seek/pcm_s24daud_302 deleted file mode 100644 index 5c9b6d976b..0000000000 --- a/tests/ref/seek/pcm_s24daud_302 +++ /dev/null @@ -1,27 +0,0 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 4 size: 39816 -ret:-1 st:-1 flags:0 ts:-1.000000 -ret:-1 st:-1 flags:1 ts: 1.894167 -ret:-1 st: 0 flags:0 ts: 0.788333 -ret:-1 st: 0 flags:1 ts:-0.317500 -ret:-1 st:-1 flags:0 ts: 2.576668 -ret:-1 st:-1 flags:1 ts: 1.470835 -ret:-1 st: 0 flags:0 ts: 0.365000 -ret:-1 st: 0 flags:1 ts:-0.740833 -ret:-1 st:-1 flags:0 ts: 2.153336 -ret:-1 st:-1 flags:1 ts: 1.047503 -ret:-1 st: 0 flags:0 ts:-0.058333 -ret:-1 st: 0 flags:1 ts: 2.835833 -ret:-1 st:-1 flags:0 ts: 1.730004 -ret:-1 st:-1 flags:1 ts: 0.624171 -ret:-1 st: 0 flags:0 ts:-0.481667 -ret:-1 st: 0 flags:1 ts: 2.412500 -ret:-1 st:-1 flags:0 ts: 1.306672 -ret:-1 st:-1 flags:1 ts: 0.200839 -ret:-1 st: 0 flags:0 ts:-0.904989 -ret:-1 st: 0 flags:1 ts: 1.989178 -ret:-1 st:-1 flags:0 ts: 0.883340 -ret:-1 st:-1 flags:1 ts:-0.222493 -ret:-1 st: 0 flags:0 ts: 2.671678 -ret:-1 st: 0 flags:1 ts: 1.565844 -ret:-1 st:-1 flags:0 ts: 0.460008 -ret:-1 st:-1 flags:1 ts:-0.645825 |