diff --git a/Changelog b/Changelog index 07cf1cf7..2faa83fa 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,11 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version 2.3.1: +- public AVDCT API/ABI for DCT functions +- g2meet: allow size changes within original sizes +- dv: improved error resilience, fixing Ticket2340 and Ticket2341 + version 2.3: - AC3 fixed-point decoding - shuffleplanes filter diff --git a/MAINTAINERS b/MAINTAINERS index 38437725..41f40e77 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -528,8 +528,8 @@ x86 Michael Niedermayer Releases ======== +2.3 Michael Niedermayer 2.2 Michael Niedermayer -2.1 Michael Niedermayer 1.2 Michael Niedermayer If you want to maintain an older release, please contact us diff --git a/RELEASE b/RELEASE index bb576dbd..2bf1c1cc 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -2.3 +2.3.1 diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 07805951..6323cf54 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -105,7 +105,7 @@ Other interesting new features including hqx video filter, a pixel art scaling filter; a fixed-point AC-3 decoder contributed by Imagination Technologies; an On2 TrueMotion VP7 video decoder; an HTML5 WebVTT - subtitle decoder that allows creation of WebVTT from any text-based + subtitle encoder that allows creation of WebVTT from any text-based subtitles; and an 1-bit Direct Stream Digital audio decoder. ┌────────────────────────────┐ diff --git a/VERSION b/VERSION index bb576dbd..2bf1c1cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3 +2.3.1 diff --git a/doc/APIchanges b/doc/APIchanges index c0486f24..1a9d103e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -35,6 +35,10 @@ API changes, most recent first: is now setting AVStream.time_base, instead of AVStream.codec.time_base as was done previously. The old method is now deprecated. +2014-06-11 - 67d29da - lavc 55.66.101 - avcodec.h + Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing + it + 2014-06-10 - xxxxxxx - lavf 55.43.100 - avformat.h New field int64_t max_analyze_duration2 instead of deprecated int max_analyze_duration. diff --git a/doc/Doxyfile b/doc/Doxyfile index 7b2a785a..e7075283 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.3 +PROJECT_NUMBER = 2.3.1 # With the PROJECT_LOGO tag one can specify a logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/doc/indevs.texi b/doc/indevs.texi index 42058087..5cac07f1 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -483,6 +483,21 @@ ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]" @end itemize +@section libcdio + +Audio-CD input device based on cdio. + +To enable this input device during configuration you need libcdio +installed on your system. + +This device allows playing and grabbing from an Audio-CD. + +For example to copy with @command{ffmpeg} the entire Audio-CD in /dev/sr0, +you may run the command: +@example +ffmpeg -f libcdio -i /dev/sr0 cd.wav +@end example + @section libdc1394 IIDC1394 input device, based on libdc1394 and libraw1394. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0bbfa27e..e5233f94 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -15,6 +15,7 @@ HEADERS = avcodec.h \ OBJS = allcodecs.o \ audioconvert.o \ + avdct.o \ avpacket.o \ avpicture.o \ bitstream.o \ diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c new file mode 100644 index 00000000..58f4974b --- /dev/null +++ b/libavcodec/avdct.c @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2014 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "idctdsp.h" +#include "fdctdsp.h" +#include "avdct.h" + +#define OFFSET(x) offsetof(AVDCT,x) +#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C +//these names are too long to be readable +#define V AV_OPT_FLAG_VIDEO_PARAM +#define A AV_OPT_FLAG_AUDIO_PARAM +#define E AV_OPT_FLAG_ENCODING_PARAM +#define D AV_OPT_FLAG_DECODING_PARAM + +static const AVOption avdct_options[] = { +{"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"}, +{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"}, +{"fastint", "fast integer (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, +{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"}, +{"mmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"}, +{"altivec", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"}, +{"faan", "floating point AAN DCT (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"}, + +{"idct", "select IDCT implementation", OFFSET(idct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E|D, "idct"}, +{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"int", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simple", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplemmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"arm", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"altivec", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#if FF_API_ARCH_SH4 +{"sh4", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#endif +{"simplearm", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearmv5te", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearmv6", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simpleneon", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#if FF_API_ARCH_ALPHA +{"simplealpha", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"}, +#endif +{"ipp", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"xvidmmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"faani", "floating point AAN IDCT (experimental / for debugging)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, +{"simpleauto", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEAUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{NULL}, +}; + +static const AVClass avdct_class = { + .class_name = "AVDCT", + .option = avdct_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +const AVClass *avcodec_dct_get_class(void) +{ + return &avdct_class; +} + +AVDCT *avcodec_dct_alloc(void) +{ + AVDCT *dsp = av_mallocz(sizeof(AVDCT)); + + if (!dsp) + return NULL; + + dsp->av_class = &avdct_class; + av_opt_set_defaults(dsp); + + return dsp; +} + +int avcodec_dct_init(AVDCT *dsp) +{ + AVCodecContext *avctx = avcodec_alloc_context3(NULL); + + if (!avctx) + return AVERROR(ENOMEM); + + avctx->idct_algo = dsp->idct_algo; + avctx->dct_algo = dsp->dct_algo; + +#define COPY(src, name) memcpy(&dsp->name, &src.name, sizeof(dsp->name)) + +#if CONFIG_IDCTDSP + { + IDCTDSPContext idsp; + ff_idctdsp_init(&idsp, avctx); + COPY(idsp, idct); + COPY(idsp, idct_permutation); + } +#endif + +#if CONFIG_FDCTDSP + { + FDCTDSPContext fdsp; + ff_fdctdsp_init(&fdsp, avctx); + COPY(fdsp, fdct); + } +#endif + + avcodec_close(avctx); + av_free(avctx); + + return 0; +} diff --git a/libavcodec/avdct.h b/libavcodec/avdct.h new file mode 100644 index 00000000..4c9d00f9 --- /dev/null +++ b/libavcodec/avdct.h @@ -0,0 +1,78 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVDCT_H +#define AVCODEC_AVDCT_H + +#include "libavutil/opt.h" + +/** + * AVDCT context. + * @note function pointers can be NULL if the specific features have been + * disabled at build time. + */ +typedef struct AVDCT { + const AVClass *av_class; + + void (*idct)(int16_t *block /* align 16 */); + + /** + * IDCT input permutation. + * Several optimized IDCTs need a permutated input (relative to the + * normal order of the reference IDCT). + * This permutation must be performed before the idct_put/add. + * Note, normally this can be merged with the zigzag/alternate scan
+ * An example to avoid confusion: + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) + * - (x -> reference DCT -> reference IDCT -> x) + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation + * -> simple_idct_mmx -> x) + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant + * -> simple_idct_mmx -> ...) + */ + uint8_t idct_permutation[64]; + + void (*fdct)(int16_t *block /* align 16 */); + + + /** + * DCT algorithm. + * must use AVOptions to set this field. + */ + int dct_algo; + + /** + * IDCT algorithm. + * must use AVOptions to set this field. + */ + int idct_algo; +} AVDCT; + +/** + * Allocates a AVDCT context. + * This needs to be initialized with avcodec_dct_init() after optionally + * configuring it with AVOptions. + * + * To free it use av_free() + */ +AVDCT *avcodec_dct_alloc(void); +int avcodec_dct_init(AVDCT *); + +const AVClass *avcodec_dct_get_class(void); + +#endif /* AVCODEC_AVDCT_H */ diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 60c48c38..1004e192 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -90,6 +90,7 @@ typedef struct G2MContext { int compression; int width, height, bpp; + int orig_width, orig_height; int tile_width, tile_height; int tiles_x, tiles_y, tile_x, tile_y; @@ -712,8 +713,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, } c->width = bytestream2_get_be32(&bc); c->height = bytestream2_get_be32(&bc); - if (c->width < 16 || c->width > avctx->width || - c->height < 16 || c->height > avctx->height) { + if (c->width < 16 || c->width > c->orig_width || + c->height < 16 || c->height > c->orig_height) { av_log(avctx, AV_LOG_ERROR, "Invalid frame dimensions %dx%d\n", c->width, c->height); @@ -882,6 +883,10 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_RGB24; + // store original sizes and check against those if resize happens + c->orig_width = avctx->width; + c->orig_height = avctx->height; + return 0; } diff --git a/libavcodec/x86/hevc_mc.asm b/libavcodec/x86/hevc_mc.asm index 5cf37d01..d7796ec6 100644 --- a/libavcodec/x86/hevc_mc.asm +++ b/libavcodec/x86/hevc_mc.asm @@ -342,7 +342,7 @@ QPEL_TABLE 10, 4, w, sse4 %macro LOOP_END 4 lea %1q, [%1q+2*%2q] ; dst += dststride - lea %3q, [%3q+ %4q] ; src += srcstride + add %3q, %4q ; src += srcstride dec heightd ; cmp height jnz .loop ; height loop %endmacro diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index b07d4c0c..bc4d1f05 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -681,7 +681,7 @@ static int pulse_write_frame(AVFormatContext *h, int stream_index, AVERROR(EINVAL) : 0; pkt.data = (*frame)->data[0]; - pkt.size = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * (*frame)->channels; + pkt.size = (*frame)->nb_samples * av_get_bytes_per_sample((*frame)->format) * av_frame_get_channels(*frame); pkt.dts = (*frame)->pkt_dts; pkt.duration = av_frame_get_pkt_duration(*frame); return pulse_write_packet(h, &pkt); diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index 4e4a5795..aff1ddf3 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -233,9 +233,9 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, const int y1 = y + offset[i + count - 1][1]; const int index = x1 + y1*linesize; p->pdsp.get_pixels(block, p->src + index, linesize); - p->fdsp.fdct(block); - p->requantize(block2, block, qp, p->idsp.idct_permutation); - p->idsp.idct(block2); + p->dct->fdct(block); + p->requantize(block2, block, qp, p->dct->idct_permutation); + p->dct->idct(block2); add_block(p->temp + index, linesize, block2); } } @@ -378,11 +378,11 @@ static av_cold int init(AVFilterContext *ctx) SPPContext *spp = ctx->priv; spp->avctx = avcodec_alloc_context3(NULL); - if (!spp->avctx) + spp->dct = avcodec_dct_alloc(); + if (!spp->avctx || !spp->dct) return AVERROR(ENOMEM); - ff_idctdsp_init(&spp->idsp, spp->avctx); - ff_fdctdsp_init(&spp->fdsp, spp->avctx); ff_pixblockdsp_init(&spp->pdsp, spp->avctx); + avcodec_dct_init(spp->dct); spp->store_slice = store_slice_c; switch (spp->mode) { case MODE_HARD: spp->requantize = hardthresh_c; break; @@ -403,6 +403,7 @@ static av_cold void uninit(AVFilterContext *ctx) avcodec_close(spp->avctx); av_freep(&spp->avctx); } + av_freep(&spp->dct); av_freep(&spp->non_b_qp_table); } diff --git a/libavfilter/vf_spp.h b/libavfilter/vf_spp.h index c8eac3ca..2dcf813e 100644 --- a/libavfilter/vf_spp.h +++ b/libavfilter/vf_spp.h @@ -24,8 +24,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/pixblockdsp.h" -#include "libavcodec/idctdsp.h" -#include "libavcodec/fdctdsp.h" +#include "libavcodec/avdct.h" #include "avfilter.h" #define MAX_LEVEL 6 /* quality levels */ @@ -41,9 +40,8 @@ typedef struct { uint8_t *src; int16_t *temp; AVCodecContext *avctx; - IDCTDSPContext idsp; - FDCTDSPContext fdsp; PixblockDSPContext pdsp; + AVDCT *dct; int8_t *non_b_qp_table; int non_b_qp_alloc_size; int use_bframe_qp; diff --git a/libavformat/dv.c b/libavformat/dv.c index 4f7b062f..1e15c082 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -72,30 +72,33 @@ static inline uint16_t dv_audio_12to16(uint16_t sample) return result; } -/* - * This is the dumbest implementation of all -- it simply looks at - * a fixed offset and if pack isn't there -- fails. We might want - * to have a fallback mechanism for complete search of missing packs. - */ static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t) { int offs; + int c; - switch (t) { - case dv_audio_source: - offs = (80 * 6 + 80 * 16 * 3 + 3); - break; - case dv_audio_control: - offs = (80 * 6 + 80 * 16 * 4 + 3); - break; - case dv_video_control: - offs = (80 * 5 + 48 + 5); - break; - case dv_timecode: - offs = (80*1 + 3 + 3); - break; - default: - return NULL; + for (c = 0; c < 10; c++) { + switch (t) { + case dv_audio_source: + if (c&1) offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000); + else offs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000); + break; + case dv_audio_control: + if (c&1) offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000); + else offs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000); + break; + case dv_video_control: + if (c&1) offs = (80 * 3 + 8 + c*12000); + else offs = (80 * 5 + 48 + 5 + c*12000); + break; + case dv_timecode: + offs = (80*1 + 3 + 3); + break; + default: + return NULL; + } + if (frame[offs] == t) + break; } return frame[offs] == t ? &frame[offs] : NULL; diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index cda49965..f9780079 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -666,6 +666,7 @@ static const AVClass imgname ## _class = {\ };\ AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\ .name = AV_STRINGIFY(imgname) "_pipe",\ + .long_name = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\ .priv_data_size = sizeof(VideoDemuxData),\ .read_probe = imgname ## _probe,\ .read_header = ff_img_read_header,\ diff --git a/tests/fate.sh b/tests/fate.sh index 38458c74..5a78018b 100755 --- a/tests/fate.sh +++ b/tests/fate.sh @@ -19,6 +19,8 @@ test -n "$slot" || die "slot not specified" test -n "$repo" || die "repo not specified" test -d "$samples" || die "samples location not specified" +: ${branch:=master} + lock(){ lock=$1/fate.lock (set -C; exec >$lock) 2>/dev/null || return @@ -28,14 +30,14 @@ lock(){ checkout(){ case "$repo" in file:*|/*) src="${repo#file:}" ;; - git:*) git clone --quiet "$repo" "$src" ;; + git:*) git clone --quiet --branch "$branch" "$repo" "$src" ;; esac } update()( cd ${src} || return case "$repo" in - git:*) git fetch --force && git reset --hard FETCH_HEAD ;; + git:*) git fetch --force && git reset --hard "origin/$branch" ;; esac ) @@ -82,7 +84,9 @@ clean(){ report(){ date=$(date -u +%Y%m%d%H%M%S) echo "fate:0:${date}:${slot}:${version}:$1:$2:${comment}" >report - cat ${build}/config.fate ${build}/tests/data/fate/*.rep >>report +# echo "fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment}" >report + cat ${build}/config.fate >>report + cat ${build}/tests/data/fate/*.rep >>report || for i in ${build}/tests/data/fate/*.rep ; do cat "$i" >>report ; done test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv } diff --git a/version.sh b/version.sh index 92edcb94..f9754eb3 100755 --- a/version.sh +++ b/version.sh @@ -4,7 +4,11 @@ # check for git short hash if ! test "$revision"; then - revision=$(cd "$1" && git describe --tags --match N 2> /dev/null) + if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then + revision=$(cd "$1" && git describe --tags --match N 2> /dev/null) + else + revision=$(cd "$1" && git describe --tags --always 2> /dev/null) + fi fi # Shallow Git clones (--depth) do not have the N tag: