提交 c437d4aa 编写于 作者: M Matt Oliver

Merge remote-tracking branch 'upstream/master'

...@@ -20,8 +20,9 @@ version <next>: ...@@ -20,8 +20,9 @@ version <next>:
- selectivecolor filter - selectivecolor filter
- extensive native AAC encoder improvements - extensive native AAC encoder improvements
- ADPCM PSX decoder - ADPCM PSX decoder
- genh, vag, ads & svag demuxer - genh, vag, ads, msf & svag demuxer
- zscale filter - zscale filter
- wve demuxer
version 2.8: version 2.8:
......
...@@ -8939,7 +8939,8 @@ The description of the accepted parameters follows. ...@@ -8939,7 +8939,8 @@ The description of the accepted parameters follows.
@table @option @table @option
@item stats_file, f @item stats_file, f
If specified the filter will use the named file to save the PSNR of 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 @end table
The file printed if @var{stats_file} is selected, contains a sequence of The file printed if @var{stats_file} is selected, contains a sequence of
......
...@@ -151,15 +151,6 @@ int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **phdr) ...@@ -151,15 +151,6 @@ int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **phdr)
return 0; 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, static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int *need_next_header, int *new_frame_start) int *need_next_header, int *new_frame_start)
{ {
......
...@@ -39,6 +39,4 @@ ...@@ -39,6 +39,4 @@
*/ */
int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **hdr); int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **hdr);
int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
#endif /* AVCODEC_AC3_PARSER_H */ #endif /* AVCODEC_AC3_PARSER_H */
...@@ -166,7 +166,6 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, ...@@ -166,7 +166,6 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
/* read the duration and sample rate from the frame header */ /* read the duration and sample rate from the frame header */
if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) { if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) {
s->duration = duration; s->duration = duration;
avctx->sample_rate = sample_rate;
} else } else
s->duration = 0; s->duration = 0;
......
...@@ -87,22 +87,14 @@ void dnxhd_10bit_get_pixels_8x4_sym(int16_t *av_restrict block, ...@@ -87,22 +87,14 @@ void dnxhd_10bit_get_pixels_8x4_sym(int16_t *av_restrict block,
const uint8_t *pixels, const uint8_t *pixels,
ptrdiff_t line_size) ptrdiff_t line_size)
{ {
int i; memcpy(block + 0 * 8, pixels + 0 * line_size, 8 * sizeof(*block));
const uint16_t* pixels16 = (const uint16_t*)pixels; memcpy(block + 7 * 8, pixels + 0 * line_size, 8 * sizeof(*block));
line_size >>= 1; memcpy(block + 1 * 8, pixels + 1 * line_size, 8 * sizeof(*block));
memcpy(block + 6 * 8, pixels + 1 * line_size, 8 * sizeof(*block));
for (i = 0; i < 4; i++) { memcpy(block + 2 * 8, pixels + 2 * line_size, 8 * sizeof(*block));
block[0] = pixels16[0]; block[1] = pixels16[1]; memcpy(block + 5 * 8, pixels + 2 * line_size, 8 * sizeof(*block));
block[2] = pixels16[2]; block[3] = pixels16[3]; memcpy(block + 3 * 8, pixels + 3 * line_size, 8 * sizeof(*block));
block[4] = pixels16[4]; block[5] = pixels16[5]; memcpy(block + 4 * 8, pixels + 3 * line_size, 8 * sizeof(*block));
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);
} }
static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block, static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
......
...@@ -115,6 +115,7 @@ YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \ ...@@ -115,6 +115,7 @@ YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \
YASM-OBJS-$(CONFIG_HPELDSP) += x86/fpel.o \ YASM-OBJS-$(CONFIG_HPELDSP) += x86/fpel.o \
x86/hpeldsp.o x86/hpeldsp.o
YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.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_IDCTDSP) += x86/idctdsp.o
YASM-OBJS-$(CONFIG_LLAUDDSP) += x86/lossless_audiodsp.o YASM-OBJS-$(CONFIG_LLAUDDSP) += x86/lossless_audiodsp.o
YASM-OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp.o YASM-OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp.o
......
;************************************************************************
;* SIMD-optimized HuffYUV encoding functions
;* Copyright (c) 2000, 2001 Fabrice Bellard
;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
;*
;* MMX optimization by Nick Kurshev <nickols_k@mail.ru>
;* Conversion to NASM format by Tiancheng "Timothy" Gu <timothygu99@gmail.com>
;*
;* 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
...@@ -29,33 +29,10 @@ ...@@ -29,33 +29,10 @@
#include "libavcodec/huffyuvencdsp.h" #include "libavcodec/huffyuvencdsp.h"
#include "libavcodec/mathops.h" #include "libavcodec/mathops.h"
#if HAVE_INLINE_ASM void ff_diff_bytes_mmx(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
intptr_t w);
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));
for (; i < w; i++) #if HAVE_INLINE_ASM
dst[i + 0] = src1[i + 0] - src2[i + 0];
}
static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *src1, static void sub_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *src1,
const uint8_t *src2, intptr_t w, 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, ...@@ -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) av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c)
{ {
#if HAVE_INLINE_ASM av_unused int cpu_flags = av_get_cpu_flags();
int cpu_flags = av_get_cpu_flags();
if (INLINE_MMX(cpu_flags)) { if (EXTERNAL_MMX(cpu_flags)) {
c->diff_bytes = diff_bytes_mmx; c->diff_bytes = ff_diff_bytes_mmx;
} }
#if HAVE_INLINE_ASM
if (INLINE_MMXEXT(cpu_flags)) { if (INLINE_MMXEXT(cpu_flags)) {
c->sub_hfyu_median_pred = sub_hfyu_median_pred_mmxext; c->sub_hfyu_median_pred = sub_hfyu_median_pred_mmxext;
} }
......
...@@ -193,7 +193,9 @@ static av_cold int init(AVFilterContext *ctx) ...@@ -193,7 +193,9 @@ static av_cold int init(AVFilterContext *ctx)
s->min_mse = +INFINITY; s->min_mse = +INFINITY;
s->max_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"); s->stats_file = fopen(s->stats_file_str, "w");
if (!s->stats_file) { if (!s->stats_file) {
int err = AVERROR(errno); int err = AVERROR(errno);
...@@ -334,7 +336,7 @@ static av_cold void uninit(AVFilterContext *ctx) ...@@ -334,7 +336,7 @@ static av_cold void uninit(AVFilterContext *ctx)
ff_dualinput_uninit(&s->dinput); ff_dualinput_uninit(&s->dinput);
if (s->stats_file) if (s->stats_file && s->stats_file != stdout)
fclose(s->stats_file); fclose(s->stats_file);
} }
......
...@@ -280,6 +280,7 @@ OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o ...@@ -280,6 +280,7 @@ OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o
OBJS-$(CONFIG_MPJPEG_DEMUXER) += mpjpegdec.o OBJS-$(CONFIG_MPJPEG_DEMUXER) += mpjpegdec.o
OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o
OBJS-$(CONFIG_MPL2_DEMUXER) += mpl2dec.o subtitles.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_MPSUB_DEMUXER) += mpsubdec.o subtitles.o
OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o
OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o
...@@ -480,6 +481,7 @@ OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv_common.o asf.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 \ OBJS-$(CONFIG_WTV_MUXER) += wtvenc.o wtv_common.o \
mpegtsenc.o asf.o mpegtsenc.o asf.o
OBJS-$(CONFIG_WV_DEMUXER) += wvdec.o wv.o apetag.o img2.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_WV_MUXER) += wvenc.o wv.o apetag.o img2.o
OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o
OBJS-$(CONFIG_XBIN_DEMUXER) += bintext.o sauce.o OBJS-$(CONFIG_XBIN_DEMUXER) += bintext.o sauce.o
......
...@@ -206,6 +206,7 @@ void av_register_all(void) ...@@ -206,6 +206,7 @@ void av_register_all(void)
REGISTER_MUXDEMUX(MPJPEG, mpjpeg); REGISTER_MUXDEMUX(MPJPEG, mpjpeg);
REGISTER_DEMUXER (MPL2, mpl2); REGISTER_DEMUXER (MPL2, mpl2);
REGISTER_DEMUXER (MPSUB, mpsub); REGISTER_DEMUXER (MPSUB, mpsub);
REGISTER_DEMUXER (MSF, msf);
REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp);
REGISTER_DEMUXER (MTV, mtv); REGISTER_DEMUXER (MTV, mtv);
REGISTER_DEMUXER (MV, mv); REGISTER_DEMUXER (MV, mv);
...@@ -330,6 +331,7 @@ void av_register_all(void) ...@@ -330,6 +331,7 @@ void av_register_all(void)
REGISTER_DEMUXER (WSAUD, wsaud); REGISTER_DEMUXER (WSAUD, wsaud);
REGISTER_DEMUXER (WSVQA, wsvqa); REGISTER_DEMUXER (WSVQA, wsvqa);
REGISTER_MUXDEMUX(WTV, wtv); REGISTER_MUXDEMUX(WTV, wtv);
REGISTER_DEMUXER (WVE, wve);
REGISTER_MUXDEMUX(WV, wv); REGISTER_MUXDEMUX(WV, wv);
REGISTER_DEMUXER (XA, xa); REGISTER_DEMUXER (XA, xa);
REGISTER_DEMUXER (XBIN, xbin); REGISTER_DEMUXER (XBIN, xbin);
......
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
#define XING_TOC_COUNT 100 #define XING_TOC_COUNT 100
#define SAME_HEADER_MASK \
(0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
typedef struct { typedef struct {
AVClass *class; AVClass *class;
int64_t filesize; int64_t filesize;
...@@ -54,7 +57,7 @@ typedef struct { ...@@ -54,7 +57,7 @@ typedef struct {
int is_cbr; int is_cbr;
} MP3DecContext; } MP3DecContext;
static int check(AVIOContext *pb, int64_t pos); static int check(AVIOContext *pb, int64_t pos, uint32_t *header);
/* mp3 read */ /* mp3 read */
...@@ -374,12 +377,21 @@ static int mp3_read_header(AVFormatContext *s) ...@@ -374,12 +377,21 @@ static int mp3_read_header(AVFormatContext *s)
off = avio_tell(s->pb); off = avio_tell(s->pb);
for (i = 0; i < 64 * 1024; i++) { for (i = 0; i < 64 * 1024; i++) {
uint32_t header, header2;
int frame_size;
if (!(i&1023)) if (!(i&1023))
ffio_ensure_seekback(s->pb, i + 1024 + 4); ffio_ensure_seekback(s->pb, i + 1024 + 4);
if (check(s->pb, off + i) >= 0) { frame_size = check(s->pb, off + i, &header);
av_log(s, AV_LOG_INFO, "Skipping %d bytes of junk at %"PRId64".\n", i, off); if (frame_size > 0) {
avio_seek(s->pb, off + i, SEEK_SET); avio_seek(s->pb, off, SEEK_SET);
break; 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); avio_seek(s->pb, off, SEEK_SET);
} }
...@@ -420,7 +432,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -420,7 +432,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
#define SEEK_WINDOW 4096 #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); int64_t ret = avio_seek(pb, pos, SEEK_SET);
unsigned header; unsigned header;
...@@ -434,6 +446,8 @@ static int check(AVIOContext *pb, int64_t pos) ...@@ -434,6 +446,8 @@ static int check(AVIOContext *pb, int64_t pos)
if (avpriv_mpegaudio_decode_header(&sd, header) == 1) if (avpriv_mpegaudio_decode_header(&sd, header) == 1)
return -1; return -1;
if (ret_header)
*ret_header = header;
return sd.frame_size; return sd.frame_size;
} }
...@@ -461,7 +475,7 @@ static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) ...@@ -461,7 +475,7 @@ static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags)
continue; continue;
for(j=0; j<MIN_VALID; j++) { for(j=0; j<MIN_VALID; j++) {
ret = check(s->pb, pos); ret = check(s->pb, pos, NULL);
if(ret < 0) if(ret < 0)
break; break;
if ((target_pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) { if ((target_pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) {
......
/*
* 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",
};
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 57 #define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 8 #define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MICRO 102 #define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \
......
/*
* 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,
};
...@@ -20,6 +20,7 @@ HEADERS = adler32.h \ ...@@ -20,6 +20,7 @@ HEADERS = adler32.h \
common.h \ common.h \
cpu.h \ cpu.h \
crc.h \ crc.h \
des.h \
display.h \ display.h \
downmix_info.h \ downmix_info.h \
error.h \ error.h \
...@@ -47,6 +48,7 @@ HEADERS = adler32.h \ ...@@ -47,6 +48,7 @@ HEADERS = adler32.h \
pixelutils.h \ pixelutils.h \
pixfmt.h \ pixfmt.h \
random_seed.h \ random_seed.h \
rc4.h \
replaygain.h \ replaygain.h \
rational.h \ rational.h \
ripemd.h \ ripemd.h \
...@@ -58,6 +60,7 @@ HEADERS = adler32.h \ ...@@ -58,6 +60,7 @@ HEADERS = adler32.h \
time.h \ time.h \
timecode.h \ timecode.h \
timestamp.h \ timestamp.h \
tree.h \
twofish.h \ twofish.h \
version.h \ version.h \
xtea.h \ xtea.h \
......
...@@ -116,8 +116,12 @@ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len) ...@@ -116,8 +116,12 @@ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
return p; 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_fmul = vector_fmul_c;
fdsp->vector_fmac_scalar = vector_fmac_scalar_c; fdsp->vector_fmac_scalar = vector_fmac_scalar_c;
fdsp->vector_fmul_scalar = vector_fmul_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) ...@@ -138,14 +142,7 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
ff_float_dsp_init_x86(fdsp); ff_float_dsp_init_x86(fdsp);
if (ARCH_MIPS) if (ARCH_MIPS)
ff_float_dsp_init_mips(fdsp); ff_float_dsp_init_mips(fdsp);
} return 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;
} }
...@@ -386,7 +383,7 @@ int main(int argc, char **argv) ...@@ -386,7 +383,7 @@ int main(int argc, char **argv)
{ {
int ret = 0, seeded = 0; int ret = 0, seeded = 0;
uint32_t seed; uint32_t seed;
AVFloatDSPContext fdsp, cdsp; AVFloatDSPContext *fdsp, *cdsp;
AVLFG lfg; AVLFG lfg;
LOCAL_ALIGNED(32, float, src0, [LEN]); LOCAL_ALIGNED(32, float, src0, [LEN]);
...@@ -421,6 +418,15 @@ int main(int argc, char **argv) ...@@ -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); 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); av_lfg_init(&lfg, seed);
fill_float_array(&lfg, src0, LEN); fill_float_array(&lfg, src0, LEN);
...@@ -430,29 +436,28 @@ int main(int argc, char **argv) ...@@ -430,29 +436,28 @@ int main(int argc, char **argv)
fill_double_array(&lfg, dbl_src0, LEN); fill_double_array(&lfg, dbl_src0, LEN);
fill_double_array(&lfg, dbl_src1, LEN); fill_double_array(&lfg, dbl_src1, LEN);
avpriv_float_dsp_init(&fdsp, 1); if (test_vector_fmul(fdsp, cdsp, src0, src1))
av_force_cpu_flags(0);
avpriv_float_dsp_init(&cdsp, 1);
if (test_vector_fmul(&fdsp, &cdsp, src0, src1))
ret -= 1 << 0; 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; 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; 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; 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; ret -= 1 << 4;
if (test_vector_fmul_reverse(&fdsp, &cdsp, src0, src1)) if (test_vector_fmul_reverse(fdsp, cdsp, src0, src1))
ret -= 1 << 5; ret -= 1 << 5;
if (test_butterflies_float(&fdsp, &cdsp, src0, src1)) if (test_butterflies_float(fdsp, cdsp, src0, src1))
ret -= 1 << 6; ret -= 1 << 6;
if (test_scalarproduct_float(&fdsp, &cdsp, src0, src1)) if (test_scalarproduct_float(fdsp, cdsp, src0, src1))
ret -= 1 << 7; 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; ret -= 1 << 8;
end:
av_freep(&fdsp);
av_freep(&cdsp);
return ret; return ret;
} }
......
...@@ -170,15 +170,6 @@ typedef struct AVFloatDSPContext { ...@@ -170,15 +170,6 @@ typedef struct AVFloatDSPContext {
*/ */
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len); 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_aarch64(AVFloatDSPContext *fdsp);
void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp); void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp);
void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict); void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册