From f6a152db1130976aa0b5da446e5df45e2c7585b8 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 10 Jan 2012 17:21:52 +0100 Subject: [PATCH 01/12] threads: add CODEC_CAP_AUTO_THREADS for libvpx and xavs --- libavcodec/libvpxdec.c | 3 ++- libavcodec/libvpxenc.c | 2 +- libavcodec/libxavs.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 5acd0f9eb0..917a50219c 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -119,5 +119,6 @@ AVCodec ff_libvpx_decoder = { .init = vp8_init, .close = vp8_free, .decode = vp8_decode, - .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), + .capabilities = CODEC_CAP_AUTO_THREADS, + .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), }; diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index fce3de0ea8..64ff2c1eaa 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -572,7 +572,7 @@ AVCodec ff_libvpx_encoder = { .init = vp8_init, .encode = vp8_encode, .close = vp8_free, - .capabilities = CODEC_CAP_DELAY, + .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), .priv_class = &class, diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 823f5fbd73..1a16bd9ae7 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -414,7 +414,7 @@ AVCodec ff_libxavs_encoder = { .init = XAVS_init, .encode = XAVS_frame, .close = XAVS_close, - .capabilities = CODEC_CAP_DELAY, + .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libxavs - the Chinese Audio Video Standard Encoder"), .priv_class = &class, From 68e252f548f54a069c26e7502a5ed8e426f26324 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 11 Jan 2012 01:34:30 +0100 Subject: [PATCH 02/12] wtv: fix memleaks during normal operation --- libavformat/wtv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index e4b9ae573a..c6198680c7 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -302,6 +302,8 @@ static void wtvfile_close(AVIOContext *pb) { WtvFile *wf = pb->opaque; av_free(wf->sectors); + av_free(wf); + av_free(pb->buffer); av_free(pb); } @@ -1093,6 +1095,7 @@ static int read_seek(AVFormatContext *s, int stream_index, static int read_close(AVFormatContext *s) { WtvContext *wtv = s->priv_data; + av_free(wtv->index_entries); wtvfile_close(wtv->pb); return 0; } From 014f8d8106c47e2d557c4c7645e82b4e67ac75b0 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Tue, 10 Jan 2012 17:52:50 +0100 Subject: [PATCH 03/12] No longer build libpostproc by default update documentation to inform developers that it may be removed in a later release. Signed-off-by: Reinhard Tartler --- Changelog | 2 ++ cmdutils.c | 4 ++++ configure | 3 +-- doc/APIchanges | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index b098203fa5..4714ca791f 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,8 @@ releases are sorted from youngest to oldest. version : - Automatic thread count based on detection number of (available) CPU cores +- Deprecate libpostproc. If desired, the switch --enable-postproc will + enable it but it may be removed in a later Libav release. version 0.8_beta1: diff --git a/cmdutils.c b/cmdutils.c index 1b8f1dd816..f2e3490286 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -33,7 +33,9 @@ #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" +#if CONFIG_POSTPROC #include "libpostproc/postprocess.h" +#endif #include "libavutil/avstring.h" #include "libavutil/mathematics.h" #include "libavutil/parseutils.h" @@ -496,7 +498,9 @@ static void print_all_libs_info(int flags, int level) PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level); PRINT_LIB_INFO(avfilter, AVFILTER, flags, level); PRINT_LIB_INFO(swscale, SWSCALE, flags, level); +#if CONFIG_POSTPROC PRINT_LIB_INFO(postproc, POSTPROC, flags, level); +#endif } void show_banner(void) diff --git a/configure b/configure index 9bf65d23cc..526aa77f9f 100755 --- a/configure +++ b/configure @@ -89,7 +89,7 @@ Configuration options: --disable-avcodec disable libavcodec build --disable-avformat disable libavformat build --disable-swscale disable libswscale build - --disable-postproc disable libpostproc build + --enable-postproc enable libpostproc build (deprecated) [no] --disable-avfilter disable video filter support [no] --disable-pthreads disable pthreads [auto] --disable-w32threads disable Win32 threads [auto] @@ -1680,7 +1680,6 @@ enable avdevice enable avfilter enable avformat enable avutil -enable postproc enable swscale enable asm diff --git a/doc/APIchanges b/doc/APIchanges index 622e502da6..e94c656e9e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -6,7 +6,7 @@ libavcodec: 2011-04-18 libavdevice: 2011-04-18 libavfilter: 2011-04-18 libavformat: 2011-04-18 -libpostproc: 2011-04-18 +libpostproc: 2011-04-18 (deprecated, to be removed later) libswscale: 2011-06-20 libavutil: 2011-04-18 From cf53a2127b4e5a34d1f839cea22bb0b3f0c55704 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Wed, 11 Jan 2012 09:32:56 +0100 Subject: [PATCH 04/12] Add some missing changelog entries and release 0.8_beta2 Signed-off-by: Reinhard Tartler --- Changelog | 4 +++- RELEASE | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 4714ca791f..e69bde57cd 100644 --- a/Changelog +++ b/Changelog @@ -2,11 +2,13 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. -version : +version 0.8_beta2: - Automatic thread count based on detection number of (available) CPU cores - Deprecate libpostproc. If desired, the switch --enable-postproc will enable it but it may be removed in a later Libav release. +- rv34: frame-level multi-threading +- optimized iMDCT transform on x86 using SSE for for mpegaudiodec version 0.8_beta1: diff --git a/RELEASE b/RELEASE index 8e0f8bcd44..ce377b1f07 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.8_beta1 +0.8_beta2 From 5ea20630b4cc96a6538a6a11b08698debe3a303a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 12 Dec 2011 21:21:24 +0100 Subject: [PATCH 05/12] Fix a bunch of platform name and other typos. --- Doxyfile | 2 +- avplay.c | 2 +- configure | 2 +- doc/platform.texi | 6 +++--- libavcodec/error_resilience.c | 2 +- libavcodec/msrle.c | 4 ++-- tools/patcheck | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Doxyfile b/Doxyfile index f28fb707e6..457cf5140a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -864,7 +864,7 @@ HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). +# integrated development environment, introduced with OS X 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in diff --git a/avplay.c b/avplay.c index 3bbb7ef1a2..4d212344d9 100644 --- a/avplay.c +++ b/avplay.c @@ -2692,7 +2692,7 @@ static void toggle_full_screen(void) { is_full_screen = !is_full_screen; #if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14) - /* OSX needs to empty the picture_queue */ + /* OS X needs to empty the picture_queue */ for (int i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { cur_stream->pictq[i].reallocate = 1; } diff --git a/configure b/configure index 526aa77f9f..3146641724 100755 --- a/configure +++ b/configure @@ -239,7 +239,7 @@ Advanced options (experts only): --disable-armvfp disable ARM VFP optimizations --disable-iwmmxt disable iwmmxt optimizations --disable-mmi disable MMI optimizations - --disable-neon disable neon optimizations + --disable-neon disable NEON optimizations --disable-vis disable VIS optimizations --disable-yasm disable use of yasm assembler --enable-pic build position-independent code diff --git a/doc/platform.texi b/doc/platform.texi index 6a44640e8f..7ec7cb3dd0 100644 --- a/doc/platform.texi +++ b/doc/platform.texi @@ -45,17 +45,17 @@ bash ./configure @end example @anchor{Darwin} -@section Darwin (OSX, iPhone) +@section Darwin (OS X, iPhone) The toolchain provided with Xcode is sufficient to build the basic unacelerated code. -OSX on PowerPC or ARM (iPhone) requires a preprocessor from +OS X on PowerPC or ARM (iPhone) requires a preprocessor from @url{http://github.com/yuvi/gas-preprocessor} to build the optimized assembler functions. Just download the Perl script and put it somewhere in your PATH, Libav's configure will pick it up automatically. -OSX on amd64 and x86 requires @command{yasm} to build most of the +OS X on AMD64 and x86 requires @command{yasm} to build most of the optimized assembler functions @url{http://mxcl.github.com/homebrew/, Homebrew}, @url{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix} or @url{http://www.macports.org, MacPorts} can easily provide it. diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 855ae770ad..6ffc4e9ede 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -50,7 +50,7 @@ static void decode_mb(MpegEncContext *s, int ref){ h->mb_xy= s->mb_x + s->mb_y*s->mb_stride; memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache)); assert(ref>=0); - /* FIXME: It is posible albeit uncommon that slice references + /* FIXME: It is possible albeit uncommon that slice references * differ between slices. We take the easy approach and ignore * it for now. If this turns out to have any relevance in * practice then correct remapping should be added. */ diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 11ac7be2ff..41f1fd8ebd 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -1,5 +1,5 @@ /* - * Micrsoft RLE Video Decoder + * Microsoft RLE video decoder * Copyright (C) 2003 the ffmpeg project * * This file is part of Libav. @@ -21,7 +21,7 @@ /** * @file - * MS RLE Video Decoder by Mike Melanson (melanson@pcisys.net) + * MS RLE video decoder by Mike Melanson (melanson@pcisys.net) * For more information about the MS RLE format, visit: * http://www.pcisys.net/~melanson/codecs/ * diff --git a/tools/patcheck b/tools/patcheck index 30617166f1..94e1232e30 100755 --- a/tools/patcheck +++ b/tools/patcheck @@ -67,7 +67,7 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^ cat $TMP hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $* -hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket)\b' 'common typos' $* +hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible)\b' 'common typos' $* hiegrep 'av_log\( *NULL' 'Missing context in av_log' $* hiegrep '[^sn]printf' 'Please use av_log' $* From 1466a5181b516a4d33cfd0da0c8222589742df27 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 11 Jan 2012 10:49:49 +0100 Subject: [PATCH 06/12] doc: Fix names of av_log color environment variables. --- doc/avtools-common-opts.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi index 18e7ba5cbe..badd35818c 100644 --- a/doc/avtools-common-opts.texi +++ b/doc/avtools-common-opts.texi @@ -119,8 +119,8 @@ Set the logging level used by the library. By default the program logs to stderr, if coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable -@env{FFMPEG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting -the environment variable @env{FFMPEG_FORCE_COLOR}. +@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting +the environment variable @env{AV_LOG_FORCE_COLOR}. The use of the environment variable @env{NO_COLOR} is deprecated and will be dropped in a following Libav version. From f1355dfcd6cf0a4d413d7b04c2c166b825d559ce Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 11 Jan 2012 10:50:35 +0100 Subject: [PATCH 07/12] doc: Replace ffmpeg references in avserver config file by avconv. --- doc/avserver.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/avserver.conf b/doc/avserver.conf index 2105ac5e8c..1f21f4d002 100644 --- a/doc/avserver.conf +++ b/doc/avserver.conf @@ -31,16 +31,16 @@ NoDaemon ################################################################## # Definition of the live feeds. Each live feed contains one video -# and/or audio sequence coming from an ffmpeg encoder or another +# and/or audio sequence coming from an avconv encoder or another # avserver. This sequence may be encoded simultaneously with several # codecs at several resolutions. -# You must use 'ffmpeg' to send a live feed to avserver. In this +# You must use 'avconv' to send a live feed to avserver. In this # example, you can type: # -# ffmpeg http://localhost:8090/feed1.ffm +# avconv http://localhost:8090/feed1.ffm # avserver can also do time shifting. It means that it can stream any # previously recorded live stream. The request should contain: @@ -55,10 +55,10 @@ FileMaxSize 200K # ReadOnlyFile /saved/specialvideo.ffm # This marks the file as readonly and it will not be deleted or updated. -# Specify launch in order to start ffmpeg automatically. -# First ffmpeg must be defined with an appropriate path if needed, +# Specify launch in order to start avconv automatically. +# First avconv must be defined with an appropriate path if needed, # after that options can follow, but avoid adding the http:// field -#Launch ffmpeg +#Launch avconv # Only allow connections from localhost to the feed. ACL allow 127.0.0.1 From 82390f57d1714fdc952c15ba91511d93f2e59bfc Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 8 Jan 2012 19:50:31 -0500 Subject: [PATCH 08/12] avcodec: add GSM parser The WAVE demuxer returns packets with many blocks per frame, which needs to be parsed into single blocks. This has a side-effect of fixing the timestamps. --- Changelog | 5 +++ libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/gsm.h | 31 ++++++++++++++ libavcodec/gsm_parser.c | 79 ++++++++++++++++++++++++++++++++++++ libavcodec/gsmdec_data.h | 5 --- libavcodec/gsmdec_template.c | 1 + libavcodec/libgsm.c | 7 +--- libavcodec/msgsmdec.c | 1 + libavcodec/version.h | 4 +- 10 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 libavcodec/gsm.h create mode 100644 libavcodec/gsm_parser.c diff --git a/Changelog b/Changelog index e69bde57cd..cbe61f5614 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,11 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version : + +- GSM audio parser + + version 0.8_beta2: - Automatic thread count based on detection number of (available) CPU cores diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 741df91527..1e8d09b956 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -608,6 +608,7 @@ OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o OBJS-$(CONFIG_DVDSUB_PARSER) += dvdsub_parser.o OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o +OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o OBJS-$(CONFIG_H261_PARSER) += h261_parser.o OBJS-$(CONFIG_H263_PARSER) += h263_parser.o OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 3980982d26..528969214e 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -399,6 +399,7 @@ void avcodec_register_all(void) REGISTER_PARSER (DVBSUB, dvbsub); REGISTER_PARSER (DVDSUB, dvdsub); REGISTER_PARSER (FLAC, flac); + REGISTER_PARSER (GSM, gsm); REGISTER_PARSER (H261, h261); REGISTER_PARSER (H263, h263); REGISTER_PARSER (H264, h264); diff --git a/libavcodec/gsm.h b/libavcodec/gsm.h new file mode 100644 index 0000000000..c7c3e22bde --- /dev/null +++ b/libavcodec/gsm.h @@ -0,0 +1,31 @@ +/* + * GSM common header + * + * 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 AVCODEC_GSM_H +#define AVCODEC_GSM_H + +/* bytes per block */ +#define GSM_BLOCK_SIZE 33 +#define GSM_MS_BLOCK_SIZE 65 + +/* samples per block */ +#define GSM_FRAME_SIZE 160 + +#endif /* AVCODEC_GSM_H */ diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c new file mode 100644 index 0000000000..a2965d3fb5 --- /dev/null +++ b/libavcodec/gsm_parser.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2012 Justin Ruggles + * + * 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 + * GSM audio parser + * + * Splits packets into individual blocks. + */ + +#include "parser.h" +#include "gsm.h" + +typedef struct GSMParseContext { + ParseContext pc; + int block_size; + int remaining; +} GSMParseContext; + +static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + GSMParseContext *s = s1->priv_data; + ParseContext *pc = &s->pc; + int next; + + if (!s->block_size) { + switch (avctx->codec_id) { + case CODEC_ID_GSM: s->block_size = GSM_BLOCK_SIZE; break; + case CODEC_ID_GSM_MS: s->block_size = GSM_MS_BLOCK_SIZE; break; + default: + return AVERROR(EINVAL); + } + } + + if (!s->remaining) + s->remaining = s->block_size; + if (s->remaining <= buf_size) { + next = s->remaining; + s->remaining = 0; + } else { + next = END_NOT_FOUND; + s->remaining -= buf_size; + } + + if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } + *poutbuf = buf; + *poutbuf_size = buf_size; + return next; +} + +AVCodecParser ff_gsm_parser = { + .codec_ids = { CODEC_ID_GSM, CODEC_ID_GSM_MS }, + .priv_data_size = sizeof(GSMParseContext), + .parser_parse = gsm_parse, + .parser_close = ff_parse_close, +}; diff --git a/libavcodec/gsmdec_data.h b/libavcodec/gsmdec_data.h index 21789f725b..2ff2322ab1 100644 --- a/libavcodec/gsmdec_data.h +++ b/libavcodec/gsmdec_data.h @@ -25,11 +25,6 @@ #include #include "avcodec.h" -// input and output sizes in byte -#define GSM_BLOCK_SIZE 33 -#define GSM_MS_BLOCK_SIZE 65 -#define GSM_FRAME_SIZE 160 - typedef struct { AVFrame frame; // Contains first 120 elements from the previous frame diff --git a/libavcodec/gsmdec_template.c b/libavcodec/gsmdec_template.c index 7e57c7183f..b5222af4da 100644 --- a/libavcodec/gsmdec_template.c +++ b/libavcodec/gsmdec_template.c @@ -25,6 +25,7 @@ */ #include "get_bits.h" +#include "gsm.h" #include "gsmdec_data.h" static void apcm_dequant_add(GetBitContext *gb, int16_t *dst) diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index 16d9972f2c..1fa04cf9d9 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -27,13 +27,10 @@ // The idiosyncrasies of GSM-in-WAV are explained at http://kbs.cs.tu-berlin.de/~jutta/toast.html -#include "avcodec.h" #include -// gsm.h misses some essential constants -#define GSM_BLOCK_SIZE 33 -#define GSM_MS_BLOCK_SIZE 65 -#define GSM_FRAME_SIZE 160 +#include "avcodec.h" +#include "gsm.h" static av_cold int libgsm_encode_init(AVCodecContext *avctx) { if (avctx->channels > 1) { diff --git a/libavcodec/msgsmdec.c b/libavcodec/msgsmdec.c index 1a288ee291..52b0f5db0a 100644 --- a/libavcodec/msgsmdec.c +++ b/libavcodec/msgsmdec.c @@ -22,6 +22,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" #include "msgsmdec.h" +#include "gsm.h" #include "gsmdec_template.c" int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, diff --git a/libavcodec/version.h b/libavcodec/version.h index 1317ef0ddc..87838c08d4 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,8 +21,8 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 32 -#define LIBAVCODEC_VERSION_MICRO 2 +#define LIBAVCODEC_VERSION_MINOR 33 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From 467879eb54526d187847bbbd32723500ab0ab330 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 9 Jan 2012 13:48:46 -0500 Subject: [PATCH 09/12] gsm demuxer: return packets with only 1 gsm block at a time. fixes stream copy of raw gsm to mov. tested with QuickTime. --- libavformat/gsmdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c index 23608873c1..a23ce3b7a0 100644 --- a/libavformat/gsmdec.c +++ b/libavformat/gsmdec.c @@ -37,7 +37,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size; - size = GSM_BLOCK_SIZE * 32; + size = GSM_BLOCK_SIZE; pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; @@ -48,7 +48,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt) return ret < 0 ? ret : AVERROR(EIO); } pkt->size = ret; - pkt->duration = ret / GSM_BLOCK_SIZE; + pkt->duration = 1; pkt->pts = pkt->pos / GSM_BLOCK_SIZE; return 0; @@ -65,7 +65,6 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_id = s->iformat->value; st->codec->channels = 1; st->codec->sample_rate = c->sample_rate; - st->codec->block_align = GSM_BLOCK_SIZE; st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE); From f01f6a847474755ee00a86c599cda3cbadef34fe Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 9 Jan 2012 13:49:52 -0500 Subject: [PATCH 10/12] gsm demuxer: use generic seeking instead of a gsm-specific function. Since packets all contain only a single block, the generic seek function can be used while still maintaining block-accuracy. --- libavformat/gsmdec.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c index a23ce3b7a0..443f820ad8 100644 --- a/libavformat/gsmdec.c +++ b/libavformat/gsmdec.c @@ -72,39 +72,6 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap) return 0; } -static int gsm_read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts, - int64_t ts, int64_t max_ts, int flags) -{ - GSMDemuxerContext *c = s->priv_data; - - /* convert timestamps to file positions */ - if (!(flags & AVSEEK_FLAG_BYTE)) { - if (stream_index < 0) { - AVRational bitrate_q = { GSM_BLOCK_SAMPLES, c->sample_rate * GSM_BLOCK_SIZE }; - ts = av_rescale_q(ts, AV_TIME_BASE_Q, bitrate_q); - min_ts = av_rescale_q(min_ts, AV_TIME_BASE_Q, bitrate_q); - max_ts = av_rescale_q(max_ts, AV_TIME_BASE_Q, bitrate_q); - } else { - ts *= GSM_BLOCK_SIZE; - min_ts *= GSM_BLOCK_SIZE; - max_ts *= GSM_BLOCK_SIZE; - } - } - /* round to nearest block boundary */ - ts = (ts + GSM_BLOCK_SIZE / 2) / GSM_BLOCK_SIZE * GSM_BLOCK_SIZE; - ts = FFMAX(0, ts); - - /* handle min/max */ - while (ts < min_ts) - ts += GSM_BLOCK_SIZE; - while (ts > max_ts) - ts -= GSM_BLOCK_SIZE; - if (ts < min_ts || ts > max_ts) - return -1; - - return avio_seek(s->pb, ts, SEEK_SET); -} - static const AVOption options[] = { { "sample_rate", "", offsetof(GSMDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.dbl = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE, @@ -125,7 +92,7 @@ AVInputFormat ff_gsm_demuxer = { .priv_data_size = sizeof(GSMDemuxerContext), .read_header = gsm_read_header, .read_packet = gsm_read_packet, - .read_seek2 = gsm_read_seek2, + .flags = AVFMT_GENERIC_INDEX, .extensions = "gsm", .value = CODEC_ID_GSM, .priv_class = &class, From 56f22b7e16006a4201ed4cf9d21e5ec26faea638 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 10 Jan 2012 15:17:39 -0500 Subject: [PATCH 11/12] pcmenc: set frame_size to 0. This indicates that the actual frame size is based on the buf_size passed to avcodec_encode_audio(). --- libavcodec/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 76d5c100bc..32231125d2 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -33,7 +33,7 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx) { - avctx->frame_size = 1; + avctx->frame_size = 0; switch(avctx->codec->id) { case CODEC_ID_PCM_ALAW: pcm_alaw_tableinit(); From e7d02b04dcfb65d1873b81bd3281442ac5ddec1d Mon Sep 17 00:00:00 2001 From: Henrik Gramner Date: Wed, 11 Jan 2012 17:40:34 +0000 Subject: [PATCH 12/12] fft: init functions with INIT_XMM/YMM. This is required to handle clobbering of XMM registers on Win64 correctly. Fixes FFT and all tests depending on FFT on Win64. Signed-off-by: Ronald S. Bultje Signed-off-by: Janne Grunau --- libavcodec/x86/fft_mmx.asm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm index 27276a1a31..d6d07b825f 100644 --- a/libavcodec/x86/fft_mmx.asm +++ b/libavcodec/x86/fft_mmx.asm @@ -639,11 +639,14 @@ cglobal fft_dispatch%3%2, 2,5,8, z, nbits %endmacro ; DECL_FFT %ifdef HAVE_AVX +INIT_YMM DECL_FFT 6, _avx DECL_FFT 6, _avx, _interleave %endif +INIT_XMM DECL_FFT 5, _sse DECL_FFT 5, _sse, _interleave +INIT_MMX DECL_FFT 4, _3dn DECL_FFT 4, _3dn, _interleave DECL_FFT 4, _3dn2