diff --git a/Changelog b/Changelog index b5be951979b8f507815190fcf145dd82ac2420a6..81542c7bcee54cae9ec0bc873e8796d145fcfa77 100644 --- a/Changelog +++ b/Changelog @@ -20,8 +20,9 @@ version : - selectivecolor filter - extensive native AAC encoder improvements - ADPCM PSX decoder -- genh, vag, ads & svag demuxer +- genh, vag, ads, msf & svag demuxer - zscale filter +- wve demuxer version 2.8: diff --git a/doc/filters.texi b/doc/filters.texi index 1af0a72f24feed52b8f84cf8641467a2fe197be5..486398d31cf9682674982513c65897c48f511a55 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -8939,7 +8939,8 @@ The description of the accepted parameters follows. @table @option @item stats_file, f If specified the filter will use the named file to save the PSNR of -each individual frame. +each individual frame. When filename equals "-" the data is sent to +standard output. @end table The file printed if @var{stats_file} is selected, contains a sequence of diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 5ab5627a46f43eb60a5d668201fa5a8c86e257e6..0dd98b9b8c3ed965f4ea9286e7a61195399c14c0 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -151,15 +151,6 @@ int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **phdr) return 0; } -int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) -{ - AC3HeaderInfo tmp, *ptmp = &tmp; - int ret = avpriv_ac3_parse_header2(gbc, &ptmp); - - memcpy(hdr, ptmp, ((intptr_t)&tmp.channel_layout) - ((intptr_t)&tmp) + sizeof(uint64_t)); - return ret; -} - static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { diff --git a/libavcodec/ac3_parser.h b/libavcodec/ac3_parser.h index f37387d76c2cbd266ce8b874c0595f3789f0d5db..80bc5ef1923a1cc6f15f6d37ed33ec621cb68f32 100644 --- a/libavcodec/ac3_parser.h +++ b/libavcodec/ac3_parser.h @@ -39,6 +39,4 @@ */ int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **hdr); -int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr); - #endif /* AVCODEC_AC3_PARSER_H */ diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 337a99d2cb3b98753e9abd6d2f6bc5fa8b448b13..70e64a89b8d6826ef7355c1744368b4f97133fc7 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -166,7 +166,6 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, /* read the duration and sample rate from the frame header */ if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) { s->duration = duration; - avctx->sample_rate = sample_rate; } else s->duration = 0; diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 36154acb2779a4e3a5205b5f6bce978ec264dc40..cad4fcff8d3e80cc8a30dcb002bf680e27995bef 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -87,22 +87,14 @@ void dnxhd_10bit_get_pixels_8x4_sym(int16_t *av_restrict block, const uint8_t *pixels, ptrdiff_t line_size) { - int i; - const uint16_t* pixels16 = (const uint16_t*)pixels; - line_size >>= 1; - - for (i = 0; i < 4; i++) { - block[0] = pixels16[0]; block[1] = pixels16[1]; - block[2] = pixels16[2]; block[3] = pixels16[3]; - block[4] = pixels16[4]; block[5] = pixels16[5]; - block[6] = pixels16[6]; block[7] = pixels16[7]; - pixels16 += line_size; - block += 8; - } - memcpy(block, block - 8, sizeof(*block) * 8); - memcpy(block + 8, block - 16, sizeof(*block) * 8); - memcpy(block + 16, block - 24, sizeof(*block) * 8); - memcpy(block + 24, block - 32, sizeof(*block) * 8); + memcpy(block + 0 * 8, pixels + 0 * line_size, 8 * sizeof(*block)); + memcpy(block + 7 * 8, pixels + 0 * line_size, 8 * sizeof(*block)); + memcpy(block + 1 * 8, pixels + 1 * line_size, 8 * sizeof(*block)); + memcpy(block + 6 * 8, pixels + 1 * line_size, 8 * sizeof(*block)); + memcpy(block + 2 * 8, pixels + 2 * line_size, 8 * sizeof(*block)); + memcpy(block + 5 * 8, pixels + 2 * line_size, 8 * sizeof(*block)); + memcpy(block + 3 * 8, pixels + 3 * line_size, 8 * sizeof(*block)); + memcpy(block + 4 * 8, pixels + 3 * line_size, 8 * sizeof(*block)); } static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block, diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 4591e4bc80aed4fd46adc682cc24defa6ce5a558..e1b1f0c61fd521fa0f79d526dd772dedf14cfb01 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -115,6 +115,7 @@ YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \ YASM-OBJS-$(CONFIG_HPELDSP) += x86/fpel.o \ x86/hpeldsp.o YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.o +YASM-OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp.o YASM-OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp.o YASM-OBJS-$(CONFIG_LLAUDDSP) += x86/lossless_audiodsp.o YASM-OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp.o diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm new file mode 100644 index 0000000000000000000000000000000000000000..e00190674220ad5fffee755240f7ea43d3c40b0b --- /dev/null +++ b/libavcodec/x86/huffyuvencdsp.asm @@ -0,0 +1,73 @@ +;************************************************************************ +;* SIMD-optimized HuffYUV encoding functions +;* Copyright (c) 2000, 2001 Fabrice Bellard +;* Copyright (c) 2002-2004 Michael Niedermayer +;* +;* MMX optimization by Nick Kurshev +;* Conversion to NASM format by Tiancheng "Timothy" Gu +;* +;* 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 +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "libavutil/x86/x86util.asm" + +section .text + +INIT_MMX mmx +; void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, +; intptr_t w); +%if ARCH_X86_32 +cglobal diff_bytes, 3,5,2, dst, src1, src2 +%define wq r4q + DECLARE_REG_TMP 3 + mov wq, r3mp +%else +cglobal diff_bytes, 4,5,2, dst, src1, src2, w + DECLARE_REG_TMP 4 +%endif ; ARCH_X86_32 +%define i t0q + mov i, wq + and i, -2 * mmsize + jz .setup_loop2 + add dstq, i + add src1q, i + add src2q, i + neg i +.loop: + mova m0, [src1q + i] + mova m1, [src1q + i + mmsize] + psubb m0, [src2q + i] + psubb m1, [src2q + i + mmsize] + mova [dstq + i], m0 + mova [mmsize + dstq + i], m1 + add i, 2 * mmsize + jl .loop +.setup_loop2: + and wq, 2 * mmsize - 1 + jz .end + add dstq, wq + add src1q, wq + add src2q, wq + neg wq +.loop2: + mov t0b, [src1q + wq] + sub t0b, [src2q + wq] + mov [dstq + wq], t0b + inc wq + jl .loop2 +.end: + REP_RET diff --git a/libavcodec/x86/huffyuvencdsp_mmx.c b/libavcodec/x86/huffyuvencdsp_mmx.c index ee60f4c5739d06a27d574f7fd9a2950bbc667eec..f28df05dba4df2869520b581a7c30a838a24835e 100644 --- a/libavcodec/x86/huffyuvencdsp_mmx.c +++ b/libavcodec/x86/huffyuvencdsp_mmx.c @@ -29,33 +29,10 @@ #include "libavcodec/huffyuvencdsp.h" #include "libavcodec/mathops.h" -#if HAVE_INLINE_ASM - -static void diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, - intptr_t w) -{ - x86_reg i = 0; - - if (w >= 16) - __asm__ volatile ( - "1: \n\t" - "movq (%2, %0), %%mm0 \n\t" - "movq (%1, %0), %%mm1 \n\t" - "psubb %%mm0, %%mm1 \n\t" - "movq %%mm1, (%3, %0) \n\t" - "movq 8(%2, %0), %%mm0 \n\t" - "movq 8(%1, %0), %%mm1 \n\t" - "psubb %%mm0, %%mm1 \n\t" - "movq %%mm1, 8(%3, %0) \n\t" - "add $16, %0 \n\t" - "cmp %4, %0 \n\t" - " jb 1b \n\t" - : "+r" (i) - : "r" (src1), "r" (src2), "r" (dst), "r" ((x86_reg) w - 15)); +void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, + intptr_t w); - for (; i < w; i++) - dst[i + 0] = src1[i + 0] - src2[i + 0]; -} +#if HAVE_INLINE_ASM static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, intptr_t w, @@ -101,13 +78,13 @@ static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *src1, av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c) { -#if HAVE_INLINE_ASM - int cpu_flags = av_get_cpu_flags(); + av_unused int cpu_flags = av_get_cpu_flags(); - if (INLINE_MMX(cpu_flags)) { - c->diff_bytes = diff_bytes_mmx; + if (EXTERNAL_MMX(cpu_flags)) { + c->diff_bytes = ff_diff_bytes_mmx; } +#if HAVE_INLINE_ASM if (INLINE_MMXEXT(cpu_flags)) { c->sub_hfyu_median_pred = sub_hfyu_median_pred_mmxext; } diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index a01b2c12ce5a05f855d198a0a28abe69e553a486..bfb0711950fed2cf215b7e904e6deeaa42036a0e 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -193,7 +193,9 @@ static av_cold int init(AVFilterContext *ctx) s->min_mse = +INFINITY; s->max_mse = -INFINITY; - if (s->stats_file_str) { + if (!strcmp(s->stats_file_str, "-")) { + s->stats_file = stdout; + } else if (s->stats_file_str) { s->stats_file = fopen(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); @@ -334,7 +336,7 @@ static av_cold void uninit(AVFilterContext *ctx) ff_dualinput_uninit(&s->dinput); - if (s->stats_file) + if (s->stats_file && s->stats_file != stdout) fclose(s->stats_file); } diff --git a/libavformat/Makefile b/libavformat/Makefile index ded2d542b14e47503c18dd5f36ab67424343b4c0..de776340f277f7b6865846ffd24de94badc93001 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -280,6 +280,7 @@ OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o OBJS-$(CONFIG_MPJPEG_DEMUXER) += mpjpegdec.o OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o OBJS-$(CONFIG_MPL2_DEMUXER) += mpl2dec.o subtitles.o +OBJS-$(CONFIG_MSF_DEMUXER) += msf.o OBJS-$(CONFIG_MPSUB_DEMUXER) += mpsubdec.o subtitles.o OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o @@ -480,6 +481,7 @@ OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv_common.o asf.o \ OBJS-$(CONFIG_WTV_MUXER) += wtvenc.o wtv_common.o \ mpegtsenc.o asf.o OBJS-$(CONFIG_WV_DEMUXER) += wvdec.o wv.o apetag.o img2.o +OBJS-$(CONFIG_WVE_DEMUXER) += wvedec.o pcm.o OBJS-$(CONFIG_WV_MUXER) += wvenc.o wv.o apetag.o img2.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_XBIN_DEMUXER) += bintext.o sauce.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 40fea8e70e8be4a6cb09b357cb38c06b4ccf49ff..5f691efe367a3cfdb68d617800dc7fa957e48f27 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -206,6 +206,7 @@ void av_register_all(void) REGISTER_MUXDEMUX(MPJPEG, mpjpeg); REGISTER_DEMUXER (MPL2, mpl2); REGISTER_DEMUXER (MPSUB, mpsub); + REGISTER_DEMUXER (MSF, msf); REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); REGISTER_DEMUXER (MTV, mtv); REGISTER_DEMUXER (MV, mv); @@ -330,6 +331,7 @@ void av_register_all(void) REGISTER_DEMUXER (WSAUD, wsaud); REGISTER_DEMUXER (WSVQA, wsvqa); REGISTER_MUXDEMUX(WTV, wtv); + REGISTER_DEMUXER (WVE, wve); REGISTER_MUXDEMUX(WV, wv); REGISTER_DEMUXER (XA, xa); REGISTER_DEMUXER (XBIN, xbin); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index d3080d715c6f5682dc3d61bc7aac6506bad638bb..32ca00c6a59e32c2d6ac0762e5d0fb8ad3fb790d 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -42,6 +42,9 @@ #define XING_TOC_COUNT 100 +#define SAME_HEADER_MASK \ + (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19)) + typedef struct { AVClass *class; int64_t filesize; @@ -54,7 +57,7 @@ typedef struct { int is_cbr; } MP3DecContext; -static int check(AVIOContext *pb, int64_t pos); +static int check(AVIOContext *pb, int64_t pos, uint32_t *header); /* mp3 read */ @@ -374,12 +377,21 @@ static int mp3_read_header(AVFormatContext *s) off = avio_tell(s->pb); for (i = 0; i < 64 * 1024; i++) { + uint32_t header, header2; + int frame_size; if (!(i&1023)) ffio_ensure_seekback(s->pb, i + 1024 + 4); - if (check(s->pb, off + i) >= 0) { - av_log(s, AV_LOG_INFO, "Skipping %d bytes of junk at %"PRId64".\n", i, off); - avio_seek(s->pb, off + i, SEEK_SET); - break; + frame_size = check(s->pb, off + i, &header); + if (frame_size > 0) { + avio_seek(s->pb, off, SEEK_SET); + ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4); + if (check(s->pb, off + i + frame_size, &header2) >= 0 && + (header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK)) + { + av_log(s, AV_LOG_INFO, "Skipping %d bytes of junk at %"PRId64".\n", i, off); + avio_seek(s->pb, off + i, SEEK_SET); + break; + } } avio_seek(s->pb, off, SEEK_SET); } @@ -420,7 +432,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) #define SEEK_WINDOW 4096 -static int check(AVIOContext *pb, int64_t pos) +static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header) { int64_t ret = avio_seek(pb, pos, SEEK_SET); unsigned header; @@ -434,6 +446,8 @@ static int check(AVIOContext *pb, int64_t pos) if (avpriv_mpegaudio_decode_header(&sd, header) == 1) return -1; + if (ret_header) + *ret_header = header; return sd.frame_size; } @@ -461,7 +475,7 @@ static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) continue; for(j=0; jpb, pos); + ret = check(s->pb, pos, NULL); if(ret < 0) break; if ((target_pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) { diff --git a/libavformat/msf.c b/libavformat/msf.c new file mode 100644 index 0000000000000000000000000000000000000000..754ad44408f8b02cefef8d37c6aa52a995260d6e --- /dev/null +++ b/libavformat/msf.c @@ -0,0 +1,95 @@ +/* + * MSF demuxer + * Copyright (c) 2015 Paul B Mahol + * + * 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 "libavutil/intreadwrite.h" +#include "avformat.h" +#include "internal.h" + +static int msf_probe(AVProbeData *p) +{ + if (memcmp(p->buf, "MSF", 3)) + return 0; + + if (AV_RB32(p->buf+8) <= 0) + return 0; + + if (AV_RB32(p->buf+16) <= 0) + return 0; + + return AVPROBE_SCORE_MAX / 3 * 2; +} + +static int msf_read_header(AVFormatContext *s) +{ + unsigned codec, align, size; + AVStream *st; + + avio_skip(s->pb, 4); + + st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + codec = avio_rb32(s->pb); + st->codec->channels = avio_rb32(s->pb); + if (st->codec->channels <= 0) + return AVERROR_INVALIDDATA; + size = avio_rb32(s->pb); + st->codec->sample_rate = avio_rb32(s->pb); + if (st->codec->sample_rate <= 0) + return AVERROR_INVALIDDATA; + align = avio_rb32(s->pb) ; + if (align > INT_MAX / st->codec->channels) + return AVERROR_INVALIDDATA; + st->codec->block_align = align; + switch (codec) { + case 0: st->codec->codec_id = AV_CODEC_ID_PCM_S16BE; break; + case 3: st->codec->block_align = 16 * st->codec->channels; + st->codec->codec_id = AV_CODEC_ID_ADPCM_PSX; break; + case 7: st->need_parsing = AVSTREAM_PARSE_FULL_RAW; + st->codec->codec_id = AV_CODEC_ID_MP3; break; + default: + avpriv_request_sample(s, "Codec %d", codec); + return AVERROR_PATCHWELCOME; + } + st->duration = av_get_audio_frame_duration(st->codec, size); + avio_skip(s->pb, 0x40 - avio_tell(s->pb)); + avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + + return 0; +} + +static int msf_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + AVCodecContext *codec = s->streams[0]->codec; + + return av_get_packet(s->pb, pkt, codec->block_align ? codec->block_align : 1024 * codec->channels); +} + +AVInputFormat ff_msf_demuxer = { + .name = "msf", + .long_name = NULL_IF_CONFIG_SMALL("MSF"), + .read_probe = msf_probe, + .read_header = msf_read_header, + .read_packet = msf_read_packet, + .extensions = "msf", +}; diff --git a/libavformat/version.h b/libavformat/version.h index 4426955390e83388a0ec0409bced3c77aac8b2b4..3b11e6b09c6f5096cbac8c083c782775d6032a11 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,8 +30,8 @@ #include "libavutil/version.h" #define LIBAVFORMAT_VERSION_MAJOR 57 -#define LIBAVFORMAT_VERSION_MINOR 8 -#define LIBAVFORMAT_VERSION_MICRO 102 +#define LIBAVFORMAT_VERSION_MINOR 10 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff --git a/libavformat/wvedec.c b/libavformat/wvedec.c new file mode 100644 index 0000000000000000000000000000000000000000..8e74abe5eaed18db866ce439bed9a65f5d94b09d --- /dev/null +++ b/libavformat/wvedec.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2015 Paul B Mahol + * + * 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 "avformat.h" +#include "internal.h" +#include "pcm.h" + +static int wve_probe(AVProbeData *p) +{ + if (memcmp(p->buf, "ALawSoundFile**\0\017\020", 18) || + memcmp(p->buf + 22, "\0\0\0\1\0\0\0\0\0\0", 10)) + return 0; + return AVPROBE_SCORE_MAX; +} + +static int wve_read_header(AVFormatContext *s) +{ + AVStream *st; + + st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + + avio_skip(s->pb, 18); + st->duration = avio_rb32(s->pb); + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->codec_id = AV_CODEC_ID_PCM_ALAW; + st->codec->sample_rate = 8000; + st->codec->channels = 1; + st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id); + st->codec->block_align = st->codec->bits_per_coded_sample * st->codec->channels / 8; + avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + avio_skip(s->pb, 10); + + return 0; +} + +AVInputFormat ff_wve_demuxer = { + .name = "wve", + .long_name = NULL_IF_CONFIG_SMALL("Psion 3 audio"), + .read_probe = wve_probe, + .read_header = wve_read_header, + .read_packet = ff_pcm_read_packet, + .read_seek = ff_pcm_read_seek, +}; diff --git a/libavutil/Makefile b/libavutil/Makefile index 74397501a28f15a544ee2fe57452e59734a8fdd8..1bac2b978e76bc2affad2406f79337387f90f612 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -20,6 +20,7 @@ HEADERS = adler32.h \ common.h \ cpu.h \ crc.h \ + des.h \ display.h \ downmix_info.h \ error.h \ @@ -47,6 +48,7 @@ HEADERS = adler32.h \ pixelutils.h \ pixfmt.h \ random_seed.h \ + rc4.h \ replaygain.h \ rational.h \ ripemd.h \ @@ -58,6 +60,7 @@ HEADERS = adler32.h \ time.h \ timecode.h \ timestamp.h \ + tree.h \ twofish.h \ version.h \ xtea.h \ diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c index 337708e847276a5face35524d611d6a3c8156b57..49e0ae7f0307f4d1b09b61d0524294683a285c4d 100644 --- a/libavutil/float_dsp.c +++ b/libavutil/float_dsp.c @@ -116,8 +116,12 @@ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len) return p; } -av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact) +av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact) { + AVFloatDSPContext *fdsp = av_mallocz(sizeof(AVFloatDSPContext)); + if (!fdsp) + return NULL; + fdsp->vector_fmul = vector_fmul_c; fdsp->vector_fmac_scalar = vector_fmac_scalar_c; fdsp->vector_fmul_scalar = vector_fmul_scalar_c; @@ -138,14 +142,7 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact) ff_float_dsp_init_x86(fdsp); if (ARCH_MIPS) ff_float_dsp_init_mips(fdsp); -} - -av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact) -{ - AVFloatDSPContext *ret = av_mallocz(sizeof(AVFloatDSPContext)); - if (ret) - avpriv_float_dsp_init(ret, bit_exact); - return ret; + return fdsp; } @@ -386,7 +383,7 @@ int main(int argc, char **argv) { int ret = 0, seeded = 0; uint32_t seed; - AVFloatDSPContext fdsp, cdsp; + AVFloatDSPContext *fdsp, *cdsp; AVLFG lfg; LOCAL_ALIGNED(32, float, src0, [LEN]); @@ -421,6 +418,15 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_INFO, "float_dsp-test: %s %u\n", seeded ? "seed" : "random seed", seed); + fdsp = avpriv_float_dsp_alloc(1); + av_force_cpu_flags(0); + cdsp = avpriv_float_dsp_alloc(1); + + if (!fdsp || !cdsp) { + ret = 1; + goto end; + } + av_lfg_init(&lfg, seed); fill_float_array(&lfg, src0, LEN); @@ -430,29 +436,28 @@ int main(int argc, char **argv) fill_double_array(&lfg, dbl_src0, LEN); fill_double_array(&lfg, dbl_src1, LEN); - avpriv_float_dsp_init(&fdsp, 1); - av_force_cpu_flags(0); - avpriv_float_dsp_init(&cdsp, 1); - - if (test_vector_fmul(&fdsp, &cdsp, src0, src1)) + if (test_vector_fmul(fdsp, cdsp, src0, src1)) ret -= 1 << 0; - if (test_vector_fmac_scalar(&fdsp, &cdsp, src2, src0, src1[0])) + if (test_vector_fmac_scalar(fdsp, cdsp, src2, src0, src1[0])) ret -= 1 << 1; - if (test_vector_fmul_scalar(&fdsp, &cdsp, src0, src1[0])) + if (test_vector_fmul_scalar(fdsp, cdsp, src0, src1[0])) ret -= 1 << 2; - if (test_vector_fmul_window(&fdsp, &cdsp, src0, src1, src2)) + if (test_vector_fmul_window(fdsp, cdsp, src0, src1, src2)) ret -= 1 << 3; - if (test_vector_fmul_add(&fdsp, &cdsp, src0, src1, src2)) + if (test_vector_fmul_add(fdsp, cdsp, src0, src1, src2)) ret -= 1 << 4; - if (test_vector_fmul_reverse(&fdsp, &cdsp, src0, src1)) + if (test_vector_fmul_reverse(fdsp, cdsp, src0, src1)) ret -= 1 << 5; - if (test_butterflies_float(&fdsp, &cdsp, src0, src1)) + if (test_butterflies_float(fdsp, cdsp, src0, src1)) ret -= 1 << 6; - if (test_scalarproduct_float(&fdsp, &cdsp, src0, src1)) + if (test_scalarproduct_float(fdsp, cdsp, src0, src1)) ret -= 1 << 7; - if (test_vector_dmul_scalar(&fdsp, &cdsp, dbl_src0, dbl_src1[0])) + if (test_vector_dmul_scalar(fdsp, cdsp, dbl_src0, dbl_src1[0])) ret -= 1 << 8; +end: + av_freep(&fdsp); + av_freep(&cdsp); return ret; } diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h index ad8e3eb1fb239d7daf692d0a1977ead3cd0ebeb9..d1be38f947d42cf9e5c0ecfcb394b86619587983 100644 --- a/libavutil/float_dsp.h +++ b/libavutil/float_dsp.h @@ -170,15 +170,6 @@ typedef struct AVFloatDSPContext { */ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len); -/** - * Initialize a float DSP context. - * - * @param fdsp float DSP context - * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant - */ -void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict); - - void ff_float_dsp_init_aarch64(AVFloatDSPContext *fdsp); void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp); void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);