mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
remove package 'ffmpeg'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
407d1448a8
commit
9dddc7045e
@ -1,230 +0,0 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="ffmpeg"
|
||||
PKG_VERSION="1.2.5"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="LGPL"
|
||||
PKG_SITE="http://ffmpeg.org"
|
||||
PKG_URL="http://ffmpeg.org/releases/$PKG_NAME-$PKG_VERSION.tar.bz2"
|
||||
PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libvorbis gnutls"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="multimedia"
|
||||
PKG_SHORTDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
|
||||
PKG_LONGDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
|
||||
|
||||
PKG_IS_ADDON="no"
|
||||
PKG_AUTORECONF="no"
|
||||
|
||||
if [ "$VAAPI" = yes ]; then
|
||||
# configure GPU drivers and dependencies:
|
||||
get_graphicdrivers
|
||||
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET $LIBVA"
|
||||
FFMPEG_VAAPI="--enable-vaapi"
|
||||
else
|
||||
FFMPEG_VAAPI="--disable-vaapi"
|
||||
fi
|
||||
|
||||
if [ "$VDPAU" = yes ]; then
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libvdpau"
|
||||
FFMPEG_VDPAU="--enable-vdpau"
|
||||
else
|
||||
FFMPEG_VDPAU="--disable-vdpau"
|
||||
fi
|
||||
|
||||
if [ "$DEBUG" = yes ]; then
|
||||
FFMPEG_DEBUG="--enable-debug --disable-stripping"
|
||||
else
|
||||
FFMPEG_DEBUG="--disable-debug --enable-stripping"
|
||||
fi
|
||||
|
||||
if [ "$OPTIMIZATIONS" = size ]; then
|
||||
FFMPEG_OPTIM="--disable-small"
|
||||
else
|
||||
FFMPEG_OPTIM="--disable-small"
|
||||
fi
|
||||
|
||||
if [ "$CRYSTALHD" = yes ]; then
|
||||
# disabled, we use XBMC's internal solution
|
||||
FFMPEG_CRYSTALHD="--disable-crystalhd"
|
||||
else
|
||||
FFMPEG_CRYSTALHD="--disable-crystalhd"
|
||||
fi
|
||||
|
||||
case "$TARGET_ARCH" in
|
||||
arm)
|
||||
FFMPEG_CPU=""
|
||||
FFMPEG_TABLES="--enable-hardcoded-tables"
|
||||
FFMPEG_PIC="--enable-pic"
|
||||
;;
|
||||
i?86)
|
||||
FFMPEG_CPU=""
|
||||
FFMPEG_TABLES="--disable-hardcoded-tables"
|
||||
FFMPEG_PIC="--disable-pic"
|
||||
;;
|
||||
x86_64)
|
||||
FFMPEG_CPU=""
|
||||
FFMPEG_TABLES="--disable-hardcoded-tables"
|
||||
FFMPEG_PIC="--enable-pic"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$TARGET_FPU" in
|
||||
neon*)
|
||||
FFMPEG_FPU="--enable-neon"
|
||||
;;
|
||||
vfp*)
|
||||
FFMPEG_FPU=""
|
||||
;;
|
||||
*)
|
||||
FFMPEG_FPU=""
|
||||
;;
|
||||
esac
|
||||
|
||||
pre_configure_target() {
|
||||
cd $ROOT/$PKG_BUILD
|
||||
rm -rf .$TARGET_NAME
|
||||
|
||||
export pkg_config="$ROOT/$TOOLCHAIN/bin/pkg-config"
|
||||
|
||||
# ffmpeg fails building with LTO support
|
||||
strip_lto
|
||||
|
||||
# ffmpeg fails running with GOLD support
|
||||
strip_gold
|
||||
}
|
||||
|
||||
configure_target() {
|
||||
./configure --prefix=/usr \
|
||||
--cpu=$TARGET_CPU \
|
||||
--arch=$TARGET_ARCH \
|
||||
--enable-cross-compile \
|
||||
--cross-prefix=$TARGET_PREFIX \
|
||||
--sysroot=$SYSROOT_PREFIX \
|
||||
--sysinclude="$SYSROOT_PREFIX/usr/include" \
|
||||
--target-os="linux" \
|
||||
--nm="$NM" \
|
||||
--ar="$AR" \
|
||||
--as="$CC" \
|
||||
--cc="$CC" \
|
||||
--ld="$CC" \
|
||||
--host-cc="$HOST_CC" \
|
||||
--host-cflags="$HOST_CFLAGS" \
|
||||
--host-ldflags="$HOST_LDFLAGS" \
|
||||
--host-libs="-lm" \
|
||||
--extra-cflags="$CFLAGS" \
|
||||
--extra-ldflags="$LDFLAGS" \
|
||||
--extra-libs="" \
|
||||
--extra-version="" \
|
||||
--build-suffix="" \
|
||||
--disable-static \
|
||||
--enable-shared \
|
||||
--enable-gpl \
|
||||
--disable-version3 \
|
||||
--disable-nonfree \
|
||||
--enable-logging \
|
||||
--disable-doc \
|
||||
$FFMPEG_DEBUG \
|
||||
$FFMPEG_PIC \
|
||||
--enable-optimizations \
|
||||
--disable-extra-warnings \
|
||||
--disable-ffprobe \
|
||||
--disable-ffplay \
|
||||
--disable-ffserver \
|
||||
--enable-ffmpeg \
|
||||
--enable-avdevice \
|
||||
--enable-avcodec \
|
||||
--enable-avformat \
|
||||
--enable-swscale \
|
||||
--enable-postproc \
|
||||
--enable-avfilter \
|
||||
--disable-devices \
|
||||
--enable-pthreads \
|
||||
--disable-w32threads \
|
||||
--disable-x11grab \
|
||||
--enable-network \
|
||||
--enable-gnutls \
|
||||
--disable-gray \
|
||||
--enable-swscale-alpha \
|
||||
$FFMPEG_OPTIM \
|
||||
--enable-dct \
|
||||
--enable-fft \
|
||||
--enable-mdct \
|
||||
--enable-rdft \
|
||||
$FFMPEG_CRYSTALHD \
|
||||
$FFMPEG_VAAPI \
|
||||
$FFMPEG_VDPAU \
|
||||
--disable-dxva2 \
|
||||
--enable-runtime-cpudetect \
|
||||
$FFMPEG_TABLES \
|
||||
--disable-memalign-hack \
|
||||
--disable-encoders \
|
||||
--enable-encoder=ac3 \
|
||||
--enable-encoder=aac \
|
||||
--disable-decoder=mpeg_xvmc \
|
||||
--enable-hwaccels \
|
||||
--disable-muxers \
|
||||
--enable-muxer=spdif \
|
||||
--enable-muxer=adts \
|
||||
--enable-demuxers \
|
||||
--enable-parsers \
|
||||
--enable-bsfs \
|
||||
--enable-protocol=http \
|
||||
--disable-indevs \
|
||||
--disable-outdevs \
|
||||
--enable-filters \
|
||||
--disable-avisynth \
|
||||
--enable-bzlib \
|
||||
--disable-frei0r \
|
||||
--disable-libopencore-amrnb \
|
||||
--disable-libopencore-amrwb \
|
||||
--disable-libopencv \
|
||||
--disable-libdc1394 \
|
||||
--disable-libfaac \
|
||||
--disable-libfreetype \
|
||||
--disable-libgsm \
|
||||
--disable-libmp3lame \
|
||||
--disable-libnut \
|
||||
--disable-libopenjpeg \
|
||||
--disable-librtmp \
|
||||
--disable-libschroedinger \
|
||||
--disable-libspeex \
|
||||
--disable-libtheora \
|
||||
--disable-libvo-aacenc \
|
||||
--disable-libvo-amrwbenc \
|
||||
--enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis \
|
||||
--disable-libvpx \
|
||||
--disable-libx264 \
|
||||
--disable-libxavs \
|
||||
--disable-libxvid \
|
||||
--enable-zlib \
|
||||
--enable-asm \
|
||||
--disable-altivec \
|
||||
$FFMPEG_CPU \
|
||||
$FFMPEG_FPU \
|
||||
--disable-vis \
|
||||
--enable-yasm \
|
||||
--disable-sram \
|
||||
--disable-symver
|
||||
}
|
||||
|
||||
post_makeinstall_target() {
|
||||
rm -rf $INSTALL/usr/share/ffmpeg/examples
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
From a77624551376c138dcda4d0bce167abe379a0a6b Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:08:55 +0000
|
||||
Subject: [PATCH] Support-raw-dvdsub-palette-as-stored-on-normal-dvd-s
|
||||
|
||||
---
|
||||
libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
|
||||
index cc9e11b..52ec0a8 100644
|
||||
--- a/libavcodec/dvdsubdec.c
|
||||
+++ b/libavcodec/dvdsubdec.c
|
||||
@@ -54,6 +54,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *
|
||||
}
|
||||
}
|
||||
|
||||
+static void ayvu_to_argb(const uint8_t *ayvu, uint32_t *argb, int num_values)
|
||||
+{
|
||||
+ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
|
||||
+ uint8_t r, g, b;
|
||||
+ int i, y, cb, cr, a;
|
||||
+ int r_add, g_add, b_add;
|
||||
+
|
||||
+ for (i = num_values; i > 0; i--) {
|
||||
+ a = *ayvu++;
|
||||
+ y = *ayvu++;
|
||||
+ cr = *ayvu++;
|
||||
+ cb = *ayvu++;
|
||||
+ YUV_TO_RGB1_CCIR(cb, cr);
|
||||
+ YUV_TO_RGB2_CCIR(r, g, b, y);
|
||||
+ *argb++ = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int decode_run_2bit(GetBitContext *gb, int *color)
|
||||
{
|
||||
unsigned int v, t;
|
||||
@@ -574,6 +592,12 @@ static int dvdsub_init(AVCodecContext *avctx)
|
||||
|
||||
if (ctx->palette_str)
|
||||
parse_palette(ctx, ctx->palette_str);
|
||||
+
|
||||
+ if (!ctx->has_palette && avctx->extradata_size == 64) {
|
||||
+ ayvu_to_argb((uint8_t*)avctx->extradata, ctx->palette, 16);
|
||||
+ ctx->has_palette = 1;
|
||||
+ }
|
||||
+
|
||||
if (ctx->has_palette) {
|
||||
int i;
|
||||
av_log(avctx, AV_LOG_DEBUG, "palette:");
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,125 +0,0 @@
|
||||
From bad37718f9fb608ffdd271c96a17f071ad508464 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:23:24 +0000
|
||||
Subject: [PATCH] Change-fallthrough-logic-for-read_seek-to-be-based-o
|
||||
|
||||
---
|
||||
libavformat/asfdec.c | 2 +-
|
||||
libavformat/gxf.c | 4 ++--
|
||||
libavformat/jvdec.c | 2 +-
|
||||
libavformat/oggdec.c | 4 +++-
|
||||
libavformat/pmpdec.c | 2 +-
|
||||
libavformat/r3d.c | 2 +-
|
||||
libavformat/utils.c | 4 +++-
|
||||
7 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
|
||||
index 2dcdf56..2581307 100644
|
||||
--- a/libavformat/asfdec.c
|
||||
+++ b/libavformat/asfdec.c
|
||||
@@ -1415,7 +1415,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
||||
AVStream *st = s->streams[stream_index];
|
||||
|
||||
if (s->packet_size <= 0)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
|
||||
/* Try using the protocol's read_seek if available */
|
||||
if(s->pb) {
|
||||
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
|
||||
index 86e6291..b46e6d6 100644
|
||||
--- a/libavformat/gxf.c
|
||||
+++ b/libavformat/gxf.c
|
||||
@@ -559,7 +559,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
|
||||
idx = av_index_search_timestamp(st, timestamp - start_time,
|
||||
AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
|
||||
if (idx < 0)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
pos = st->index_entries[idx].pos;
|
||||
if (idx < st->nb_index_entries - 2)
|
||||
maxlen = st->index_entries[idx + 2].pos - pos;
|
||||
@@ -569,7 +569,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
|
||||
return res;
|
||||
found = gxf_resync_media(s, maxlen, -1, timestamp);
|
||||
if (FFABS(found - timestamp) > 4)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
|
||||
index e941492..8039b2a 100644
|
||||
--- a/libavformat/jvdec.c
|
||||
+++ b/libavformat/jvdec.c
|
||||
@@ -209,7 +209,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
|
||||
if (i < 0 || i >= ast->nb_index_entries)
|
||||
- return 0;
|
||||
+ return -1;
|
||||
if (avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET) < 0)
|
||||
return -1;
|
||||
|
||||
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
|
||||
index e51db61..7441615 100644
|
||||
--- a/libavformat/oggdec.c
|
||||
+++ b/libavformat/oggdec.c
|
||||
@@ -808,8 +808,10 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index,
|
||||
|
||||
ret = ff_seek_frame_binary(s, stream_index, timestamp, flags);
|
||||
os = ogg->streams + stream_index;
|
||||
- if (ret < 0)
|
||||
+ if (ret < 0) {
|
||||
os->keyframe_seek = 0;
|
||||
+ ret = AVERROR(ENOSYS);
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
|
||||
index 2ea37ef..0a89650 100644
|
||||
--- a/libavformat/pmpdec.c
|
||||
+++ b/libavformat/pmpdec.c
|
||||
@@ -161,7 +161,7 @@ static int pmp_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags)
|
||||
PMPContext *pmp = s->priv_data;
|
||||
pmp->cur_stream = 0;
|
||||
// fallback to default seek now
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
static int pmp_close(AVFormatContext *s)
|
||||
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
|
||||
index 35da81e..452849d 100644
|
||||
--- a/libavformat/r3d.c
|
||||
+++ b/libavformat/r3d.c
|
||||
@@ -366,7 +366,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
|
||||
int frame_num;
|
||||
|
||||
if (!st->avg_frame_rate.num)
|
||||
- return -1;
|
||||
+ return AVERROR(ENOSYS);
|
||||
|
||||
frame_num = av_rescale_q(sample_time, st->time_base,
|
||||
av_inv_q(st->avg_frame_rate));
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 5cbf7ca..4b8bcd1 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -2059,10 +2059,12 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index,
|
||||
ff_read_frame_flush(s);
|
||||
ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
|
||||
} else
|
||||
- ret = -1;
|
||||
+ ret = AVERROR(ENOSYS);
|
||||
if (ret >= 0) {
|
||||
return 0;
|
||||
}
|
||||
+ if (ret != AVERROR(ENOSYS))
|
||||
+ return ret;
|
||||
|
||||
if (s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) {
|
||||
ff_read_frame_flush(s);
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,60 +0,0 @@
|
||||
From 6d0c6f74bce43810c2c8a7ca01de5e1f0e7da333 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:27:59 +0000
|
||||
Subject: [PATCH] matroska-Check-return-value-of-avio_seek-and-avoid-m
|
||||
|
||||
---
|
||||
libavformat/matroskadec.c | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
|
||||
index 87c4a39..d066186 100644
|
||||
--- a/libavformat/matroskadec.c
|
||||
+++ b/libavformat/matroskadec.c
|
||||
@@ -2386,7 +2386,8 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
|
||||
|
||||
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
|
||||
- avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
|
||||
+ if (avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
matroska->current_id = 0;
|
||||
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
|
||||
matroska_clear_queue(matroska);
|
||||
@@ -2395,16 +2396,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
}
|
||||
|
||||
- matroska_clear_queue(matroska);
|
||||
if (index < 0 || (matroska->cues_parsing_deferred < 0 && index == st->nb_index_entries - 1))
|
||||
goto err;
|
||||
|
||||
index_min = index;
|
||||
for (i=0; i < matroska->tracks.nb_elem; i++) {
|
||||
- tracks[i].audio.pkt_cnt = 0;
|
||||
- tracks[i].audio.sub_packet_cnt = 0;
|
||||
- tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
|
||||
- tracks[i].end_timecode = 0;
|
||||
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
|
||||
&& tracks[i].stream->discard != AVDISCARD_ALL) {
|
||||
index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
|
||||
@@ -2415,7 +2411,16 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
}
|
||||
}
|
||||
|
||||
- avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
|
||||
+ if (avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ matroska_clear_queue(matroska);
|
||||
+ for (i=0; i < matroska->tracks.nb_elem; i++) {
|
||||
+ tracks[i].audio.pkt_cnt = 0;
|
||||
+ tracks[i].audio.sub_packet_cnt = 0;
|
||||
+ tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
|
||||
+ tracks[i].end_timecode = 0;
|
||||
+ }
|
||||
matroska->current_id = 0;
|
||||
st->skip_to_keyframe =
|
||||
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 16ed0150800958b4ca544fd380bda92f21393555 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Mon, 12 Sep 2011 21:37:17 +0200
|
||||
Subject: [PATCH 04/24] asf hacks
|
||||
|
||||
---
|
||||
libavformat/asfdec.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
|
||||
index a62bab3..7db3bd8 100644
|
||||
--- a/libavformat/asfdec.c
|
||||
+++ b/libavformat/asfdec.c
|
||||
@@ -1277,9 +1277,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
||||
ASFContext *asf = s->priv_data;
|
||||
AVStream *st = s->streams[stream_index];
|
||||
|
||||
+ if (pts == 0) {
|
||||
+ // this is a hack since av_gen_search searches the entire file in this case
|
||||
+ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", s->data_offset);
|
||||
+ if (avio_seek(s->pb, s->data_offset, SEEK_SET) < 0)
|
||||
+ return -1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (s->packet_size <= 0)
|
||||
return AVERROR(ENOSYS);
|
||||
|
||||
+ if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
+ return -1;
|
||||
+
|
||||
/* Try using the protocol's read_seek if available */
|
||||
if(s->pb) {
|
||||
int ret = avio_seek_time(s->pb, stream_index, pts, flags);
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,24 +0,0 @@
|
||||
From dac532f278c50002ed2fae5c7e2c5b3edfc4f96e Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:34:09 +0000
|
||||
Subject: [PATCH] if-av_read_packet-returns-AVERROR_IO-we-are-done.-ff
|
||||
|
||||
---
|
||||
libavformat/utils.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 4b8bcd1..bdb9d17 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -1386,6 +1386,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return ret;
|
||||
+ if (ret == AVERROR(EIO))
|
||||
+ return ret;
|
||||
/* flush the parsers */
|
||||
for(i = 0; i < s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 81f4c30d6f4dd4f1da818553c869082b50ab601b Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:41:56 +0000
|
||||
Subject: [PATCH] added-Ticket-7187-TV-Teletext-support-for-DVB-EBU-Te
|
||||
|
||||
---
|
||||
libavcodec/avcodec.h | 4 ++++
|
||||
libavformat/mpegts.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
|
||||
index ab7a8a5..fff064c 100644
|
||||
--- a/libavcodec/avcodec.h
|
||||
+++ b/libavcodec/avcodec.h
|
||||
@@ -472,6 +472,10 @@ enum AVCodecID {
|
||||
AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'),
|
||||
AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'),
|
||||
|
||||
+ /* data codecs */
|
||||
+ AV_CODEC_ID_VBI_DATA= 0x17500,
|
||||
+ AV_CODEC_ID_VBI_TELETEXT,
|
||||
+
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
AV_CODEC_ID_TTF = 0x18000,
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index a6e07fa..87269d7 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -611,6 +611,8 @@ static const StreamType DESC_types[] = {
|
||||
{ 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
|
||||
{ 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
|
||||
{ 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
|
||||
+ { 0x45, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_DATA }, /* VBI Data descriptor */
|
||||
+ { 0x46, AVMEDIA_TYPE_DATA, AV_CODEC_ID_VBI_TELETEXT }, /* VBI Teletext descriptor */
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 3bf21b1049abf8991beac79235adfcca9d705eda Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sun, 18 Sep 2011 19:16:34 +0200
|
||||
Subject: [PATCH 07/24] Don't accept mpegts PMT that isn't current
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index e7e061e..817fbed 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -437,6 +437,7 @@ typedef struct SectionHeader {
|
||||
uint8_t tid;
|
||||
uint16_t id;
|
||||
uint8_t version;
|
||||
+ uint8_t current;
|
||||
uint8_t sec_num;
|
||||
uint8_t last_sec_num;
|
||||
} SectionHeader;
|
||||
@@ -508,6 +509,7 @@ static int parse_section_header(SectionHeader *h,
|
||||
val = get8(pp, p_end);
|
||||
if (val < 0)
|
||||
return -1;
|
||||
+ h->current = val & 0x1;
|
||||
h->version = (val >> 1) & 0x1f;
|
||||
val = get8(pp, p_end);
|
||||
if (val < 0)
|
||||
@@ -1556,6 +1558,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
return;
|
||||
if (h->tid != PAT_TID)
|
||||
return;
|
||||
+ if (!h->current)
|
||||
+ return;
|
||||
|
||||
ts->stream->ts_id = h->id;
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 5fecd135de1486be63e0cef53134c44f8b4becd6 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sun, 18 Sep 2011 19:17:23 +0200
|
||||
Subject: [PATCH 08/24] Don't reparse PMT unless it's version has changed
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 817fbed..8bdafc5 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -78,6 +78,7 @@ struct MpegTSFilter {
|
||||
int pid;
|
||||
int es_id;
|
||||
int last_cc; /* last cc code (-1 if first packet) */
|
||||
+ int last_version; /* last version of data on this pid */
|
||||
enum MpegTSFilterType type;
|
||||
union {
|
||||
MpegTSPESFilter pes_filter;
|
||||
@@ -334,6 +335,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int
|
||||
filter->pid = pid;
|
||||
filter->es_id = -1;
|
||||
filter->last_cc = -1;
|
||||
+ filter->last_version = -1;
|
||||
sec = &filter->u.section_filter;
|
||||
sec->section_cb = section_cb;
|
||||
sec->opaque = opaque;
|
||||
@@ -1560,6 +1562,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
return;
|
||||
if (!h->current)
|
||||
return;
|
||||
+ if (h->version == filter->last_version)
|
||||
+ return;
|
||||
+ filter->last_version = h->version;
|
||||
+ av_dlog(ts->stream, "version=%d\n", filter->last_version);
|
||||
|
||||
ts->stream->ts_id = h->id;
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,64 +0,0 @@
|
||||
From eaa6e4a2d98b3f04b4e1d9cd7db6185015d370d7 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:46:38 +0000
|
||||
Subject: [PATCH] fixed-compile-with-VDPAU-header-versions-without-MPE
|
||||
|
||||
---
|
||||
configure | 2 ++
|
||||
libavcodec/vdpau.c | 2 ++
|
||||
libavcodec/vdpau.h | 2 ++
|
||||
3 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 0707a94..6b9e668 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -3748,6 +3748,8 @@ check_header termios.h
|
||||
check_header unistd.h
|
||||
check_header vdpau/vdpau.h
|
||||
check_header vdpau/vdpau_x11.h
|
||||
+check_cpp_condition vdpau/vdpau.h "defined(VDP_DECODER_PROFILE_MPEG4_PART2_SP)" && enable vdpau_mpeg4_support
|
||||
+
|
||||
check_header VideoDecodeAcceleration/VDADecoder.h
|
||||
check_header windows.h
|
||||
check_header X11/extensions/XvMClib.h
|
||||
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
|
||||
index 6ac195e..09dcb3e 100644
|
||||
--- a/libavcodec/vdpau.c
|
||||
+++ b/libavcodec/vdpau.c
|
||||
@@ -316,6 +316,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
render->bitstream_buffers_used = 0;
|
||||
}
|
||||
|
||||
+#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_SP
|
||||
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
int buf_size)
|
||||
{
|
||||
@@ -369,6 +370,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
|
||||
ff_draw_horiz_band(s, 0, s->avctx->height);
|
||||
render->bitstream_buffers_used = 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Only dummy functions for now
|
||||
static int vdpau_mpeg2_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
|
||||
index 23394b5..67fadb6 100644
|
||||
--- a/libavcodec/vdpau.h
|
||||
+++ b/libavcodec/vdpau.h
|
||||
@@ -56,7 +56,9 @@ union FFVdpPictureInfo {
|
||||
VdpPictureInfoH264 h264;
|
||||
VdpPictureInfoMPEG1Or2 mpeg;
|
||||
VdpPictureInfoVC1 vc1;
|
||||
- VdpPictureInfoMPEG4Part2 mpeg4;
|
||||
+#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_SP
|
||||
+ VdpPictureInfoMPEG4Part2 mpeg4;
|
||||
+#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
--
|
||||
1.7.10.4
|
||||
|
||||
|
||||
|
@ -1,98 +0,0 @@
|
||||
From 3c31f5987079c3796f3f7313d97ee3c58fb0d4db Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:52:01 +0000
|
||||
Subject: [PATCH] Read-PID-timestamps-as-well-as-PCR-timestamps-to-fin
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 46 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 3befaf8..21df7b3 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -1985,6 +1985,44 @@ static int parse_pcr(int64_t *ppcr_high, int *ppcr_low,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int parse_timestamp(int64_t *ts, const uint8_t *buf)
|
||||
+{
|
||||
+ int afc, flags;
|
||||
+ const uint8_t *p;
|
||||
+
|
||||
+ if(!(buf[1] & 0x40)) /* must be a start packet */
|
||||
+ return -1;
|
||||
+
|
||||
+ afc = (buf[3] >> 4) & 3;
|
||||
+ p = buf + 4;
|
||||
+ if (afc == 0 || afc == 2) /* invalid or only adaption field */
|
||||
+ return -1;
|
||||
+ if (afc == 3)
|
||||
+ p += p[0] + 1;
|
||||
+ if (p >= buf + TS_PACKET_SIZE)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (p[0] != 0x00 || p[1] != 0x00 || p[2] != 0x01) /* packet_start_code_prefix */
|
||||
+ return -1;
|
||||
+
|
||||
+ flags = p[3] | 0x100; /* stream type */
|
||||
+ if (!((flags >= 0x1c0 && flags <= 0x1df) ||
|
||||
+ (flags >= 0x1e0 && flags <= 0x1ef) ||
|
||||
+ (flags == 0x1bd) || (flags == 0x1fd)))
|
||||
+ return -1;
|
||||
+
|
||||
+ flags = p[7];
|
||||
+ if ((flags & 0xc0) == 0x80) {
|
||||
+ *ts = ff_parse_pes_pts(p+9);
|
||||
+ return 0;
|
||||
+ } else if ((flags & 0xc0) == 0xc0) {
|
||||
+ *ts = ff_parse_pes_pts(p+9+5);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int mpegts_read_header(AVFormatContext *s)
|
||||
{
|
||||
MpegTSContext *ts = s->priv_data;
|
||||
@@ -2176,6 +2214,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
|
||||
int64_t pos, timestamp;
|
||||
uint8_t buf[TS_PACKET_SIZE];
|
||||
int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid;
|
||||
+ int pid = ((PESContext*)s->streams[stream_index]->priv_data)->pid;
|
||||
pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
|
||||
while(pos < pos_limit) {
|
||||
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||
@@ -2193,6 +2232,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
|
||||
*ppos = pos;
|
||||
return timestamp;
|
||||
}
|
||||
+ if ((pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pid) &&
|
||||
+ parse_timestamp(×tamp, buf) == 0) {
|
||||
+ *ppos = pos;
|
||||
+ return timestamp;
|
||||
+ }
|
||||
pos += ts->raw_packet_size;
|
||||
}
|
||||
|
||||
@@ -2294,7 +2338,7 @@ AVInputFormat ff_mpegts_demuxer = {
|
||||
.read_header = mpegts_read_header,
|
||||
.read_packet = mpegts_read_packet,
|
||||
.read_close = mpegts_read_close,
|
||||
- .read_timestamp = mpegts_get_dts,
|
||||
+ .read_timestamp = mpegts_get_pcr,
|
||||
.flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
|
||||
};
|
||||
|
||||
@@ -2305,7 +2349,7 @@ AVInputFormat ff_mpegtsraw_demuxer = {
|
||||
.read_header = mpegts_read_header,
|
||||
.read_packet = mpegts_raw_read_packet,
|
||||
.read_close = mpegts_read_close,
|
||||
- .read_timestamp = mpegts_get_dts,
|
||||
+ .read_timestamp = mpegts_get_pcr,
|
||||
.flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
|
||||
.priv_class = &mpegtsraw_class,
|
||||
};
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,68 +0,0 @@
|
||||
From f3bdfee28332b1ccc794186d91a1f9e082004a1e Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 11:55:37 +0000
|
||||
Subject: [PATCH] Get-stream-durations-using-read_timestamp
|
||||
|
||||
---
|
||||
libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index bdb9d17..3e7dec9 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -2283,6 +2283,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
|
||||
#define DURATION_MAX_READ_SIZE 250000LL
|
||||
#define DURATION_MAX_RETRY 4
|
||||
|
||||
+static void av_estimate_timings_from_pts2(AVFormatContext *ic, int64_t old_offset)
|
||||
+{
|
||||
+ AVStream *st;
|
||||
+ int i, step= 1024;
|
||||
+ int64_t ts, pos;
|
||||
+
|
||||
+ for(i=0;i<ic->nb_streams;i++) {
|
||||
+ st = ic->streams[i];
|
||||
+
|
||||
+ pos = 0;
|
||||
+ ts = ic->iformat->read_timestamp(ic, i, &pos, DURATION_MAX_READ_SIZE);
|
||||
+ if (ts == AV_NOPTS_VALUE)
|
||||
+ continue;
|
||||
+ if (st->start_time > ts || st->start_time == AV_NOPTS_VALUE)
|
||||
+ st->start_time = ts;
|
||||
+
|
||||
+ pos = avio_size(ic->pb) - 1;
|
||||
+ do {
|
||||
+ pos -= step;
|
||||
+ ts = ic->iformat->read_timestamp(ic, i, &pos, pos + step);
|
||||
+ step += step;
|
||||
+ } while (ts == AV_NOPTS_VALUE && pos >= step && step < DURATION_MAX_READ_SIZE);
|
||||
+
|
||||
+ if (ts == AV_NOPTS_VALUE)
|
||||
+ continue;
|
||||
+
|
||||
+ if (st->duration < ts - st->start_time || st->duration == AV_NOPTS_VALUE)
|
||||
+ st->duration = ts - st->start_time;
|
||||
+ }
|
||||
+
|
||||
+ fill_all_stream_timings(ic);
|
||||
+
|
||||
+ avio_seek(ic->pb, old_offset, SEEK_SET);
|
||||
+}
|
||||
+
|
||||
/* only usable for MPEG-PS streams */
|
||||
static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
|
||||
{
|
||||
@@ -2382,6 +2417,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
|
||||
the components */
|
||||
fill_all_stream_timings(ic);
|
||||
ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
|
||||
+ } else if (ic->iformat->read_timestamp &&
|
||||
+ file_size && ic->pb->seekable) {
|
||||
+ /* get accurate estimate from the PTSes */
|
||||
+ av_estimate_timings_from_pts2(ic, old_offset);
|
||||
} else {
|
||||
av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
|
||||
/* less precise: use bitrate info */
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 51e09f5022d1250802cbec8017a2c5e76160bdcb Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 16:53:54 +0000
|
||||
Subject: [PATCH] aacenc-add-recognized-profiles-array
|
||||
|
||||
---
|
||||
libavcodec/aacenc.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
|
||||
index 348d3a2..3cbca03 100644
|
||||
--- a/libavcodec/aacenc.c
|
||||
+++ b/libavcodec/aacenc.c
|
||||
@@ -818,6 +818,11 @@ static const int mpeg4audio_sample_rates[16] = {
|
||||
24000, 22050, 16000, 12000, 11025, 8000, 7350
|
||||
};
|
||||
|
||||
+static const AVProfile profiles[] = {
|
||||
+ { FF_PROFILE_AAC_LOW, "Low" },
|
||||
+ { FF_PROFILE_UNKNOWN },
|
||||
+};
|
||||
+
|
||||
AVCodec ff_aac_encoder = {
|
||||
.name = "aac",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
@@ -833,4 +838,5 @@ AVCodec ff_aac_encoder = {
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.priv_class = &aacenc_class,
|
||||
+ .profiles = profiles,
|
||||
};
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 5cc735503bfe1242606f19638bffeb686dd4d1b5 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Wed, 8 Dec 2010 14:03:43 +0000
|
||||
Subject: [PATCH 14/24] changed: allow 4 second skew between streams in mov
|
||||
before attempting to seek
|
||||
|
||||
---
|
||||
libavformat/mov.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mov.c b/libavformat/mov.c
|
||||
index 9da8eab..0f9836c 100644
|
||||
--- a/libavformat/mov.c
|
||||
+++ b/libavformat/mov.c
|
||||
@@ -2763,8 +2763,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
|
||||
if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) ||
|
||||
(s->pb->seekable &&
|
||||
((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
|
||||
- ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) ||
|
||||
- (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
|
||||
+ ((FFABS(best_dts - dts) <= 4*AV_TIME_BASE && current_sample->pos < sample->pos) ||
|
||||
+ (FFABS(best_dts - dts) > 4*AV_TIME_BASE && dts < best_dts)))))) {
|
||||
sample = current_sample;
|
||||
best_dts = dts;
|
||||
*st = avst;
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,38 +0,0 @@
|
||||
From b83c9a2505338cdf021dd499c26686e82bcbc066 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Fri, 26 Nov 2010 20:56:48 +0000
|
||||
Subject: [PATCH 15/24] fixed: memleak in mpegts demuxer on some malformed
|
||||
(??) mpegts files with too large pes packets
|
||||
|
||||
at-visions sample file brokenStream.mpg
|
||||
---
|
||||
libavformat/mpegts.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index ba2f163..c374cb9 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -664,6 +664,10 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
|
||||
|
||||
static void new_pes_packet(PESContext *pes, AVPacket *pkt)
|
||||
{
|
||||
+ if(pkt->data) {
|
||||
+ av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index);
|
||||
+ av_free_packet(pkt);
|
||||
+ }
|
||||
av_init_packet(pkt);
|
||||
|
||||
pkt->destruct = av_destruct_packet;
|
||||
@@ -2117,6 +2121,8 @@ static int mpegts_read_packet(AVFormatContext *s,
|
||||
int ret, i;
|
||||
|
||||
ts->pkt = pkt;
|
||||
+ ts->pkt->data = NULL;
|
||||
+
|
||||
ret = handle_packets(ts, 0);
|
||||
if (ret < 0) {
|
||||
/* flush pes data left */
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,37 +0,0 @@
|
||||
From c240357f903f20ba51001fb90aa2de415d5be825 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Mon, 28 Jun 2010 21:26:54 +0000
|
||||
Subject: [PATCH 16/24] Speed up mpegts av_find_stream_info
|
||||
|
||||
---
|
||||
libavformat/mpegts.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index c374cb9..6da6db5 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -825,7 +825,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
||||
goto skip;
|
||||
|
||||
/* stream not present in PMT */
|
||||
- if (!pes->st) {
|
||||
+ if (ts->auto_guess && !pes->st) {
|
||||
pes->st = avformat_new_stream(ts->stream, NULL);
|
||||
if (!pes->st)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -2013,7 +2013,10 @@ static int mpegts_read_header(AVFormatContext *s,
|
||||
|
||||
av_dlog(ts->stream, "tuning done\n");
|
||||
|
||||
- s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||
+ /* only flag NOHEADER if we are in file mode,
|
||||
+ in streaming mode scanning may take too long for users */
|
||||
+ if (pb->seekable)
|
||||
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
|
||||
} else {
|
||||
AVStream *st;
|
||||
int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 4f4aacd3d85c5caecbc0b0f02739aff0b9d8f657 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 16:58:33 +0000
|
||||
Subject: [PATCH] allow-customizing-shared-library-soname-name-with-ma
|
||||
|
||||
---
|
||||
configure | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 6b9e668..d4aa8f2 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -269,6 +269,7 @@ Advanced options (experts only):
|
||||
--arch=ARCH select architecture [$arch]
|
||||
--cpu=CPU select the minimum required CPU (affects
|
||||
instruction selection, may crash on older CPUs)
|
||||
+ --custom-libname-with-major=NAME custom library name with major [$SLIBNAME_WITH_MAJOR]
|
||||
--enable-pic build position-independent code
|
||||
--enable-sram allow use of on-chip SRAM
|
||||
--enable-thumb compile for Thumb instruction set
|
||||
@@ -1527,6 +1528,7 @@ CMDLINE_SET="
|
||||
cpu
|
||||
cross_prefix
|
||||
cxx
|
||||
+ custom_libname_with_major
|
||||
dep_cc
|
||||
extra_version
|
||||
host_cc
|
||||
@@ -3408,6 +3410,8 @@ EOF
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
+test -n "$custom_libname_with_major" && SLIBNAME_WITH_MAJOR="$custom_libname_with_major"
|
||||
+
|
||||
die_license_disabled() {
|
||||
enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
|
||||
}
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,75 +0,0 @@
|
||||
From 40f4c15370f7027dc5422edcb10e8a3b7e58e83d Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Wed, 5 Oct 2011 12:38:30 -0400
|
||||
Subject: [PATCH 18/24] dxva-mpeg2 Allocate slices array dynamically - fixes
|
||||
videos with > 175 slices. They used to result in
|
||||
images with a black bottom.
|
||||
|
||||
sample on team ftp samples/PR471/too_many_slices.ts
|
||||
|
||||
Inspired by the vaapi code to reallocate the slices array for each new slice.
|
||||
Could be more efficient if the array could be preserved for all frames and
|
||||
freed only at the end of the video, but there doesn't seem to be anywhere
|
||||
appropriate to free the memory at the end.
|
||||
|
||||
Alternative is to allocate the proper size straight away for a new frame,
|
||||
instead of realloc'ing for each slice.
|
||||
---
|
||||
libavcodec/dxva2_mpeg2.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
|
||||
index 951305d..8ba83b6 100644
|
||||
--- a/libavcodec/dxva2_mpeg2.c
|
||||
+++ b/libavcodec/dxva2_mpeg2.c
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
#include "dxva2_internal.h"
|
||||
|
||||
-#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
|
||||
struct dxva2_picture_context {
|
||||
DXVA_PictureParameters pp;
|
||||
DXVA_QmatrixData qm;
|
||||
unsigned slice_count;
|
||||
- DXVA_SliceInfo slice[MAX_SLICES];
|
||||
+ DXVA_SliceInfo *slice;
|
||||
+ unsigned int slice_alloc;
|
||||
|
||||
const uint8_t *bitstream;
|
||||
unsigned bitstream_size;
|
||||
@@ -220,6 +220,8 @@ static int start_frame(AVCodecContext *avctx,
|
||||
fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
|
||||
|
||||
ctx_pic->slice_count = 0;
|
||||
+ ctx_pic->slice = NULL;
|
||||
+ ctx_pic->slice_alloc = 0;
|
||||
ctx_pic->bitstream_size = 0;
|
||||
ctx_pic->bitstream = NULL;
|
||||
return 0;
|
||||
@@ -232,9 +234,14 @@ static int decode_slice(AVCodecContext *avctx,
|
||||
struct dxva2_picture_context *ctx_pic =
|
||||
s->current_picture_ptr->f.hwaccel_picture_private;
|
||||
unsigned position;
|
||||
+ DXVA_SliceInfo* slice;
|
||||
|
||||
- if (ctx_pic->slice_count >= MAX_SLICES)
|
||||
+ slice = av_fast_realloc(ctx_pic->slice,
|
||||
+ &ctx_pic->slice_alloc,
|
||||
+ (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
|
||||
+ if (!slice)
|
||||
return -1;
|
||||
+ ctx_pic->slice = slice;
|
||||
|
||||
if (!ctx_pic->bitstream)
|
||||
ctx_pic->bitstream = buffer;
|
||||
@@ -258,6 +265,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
if (!ret)
|
||||
ff_mpeg_draw_horiz_band(s, 0, avctx->height);
|
||||
return ret;
|
||||
+ av_freep(ctx_pic->slice);
|
||||
}
|
||||
|
||||
AVHWAccel ff_mpeg2_dxva2_hwaccel = {
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,75 +0,0 @@
|
||||
From 681f74b224e16a4df7f8c4e31a9be56975d57e10 Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Mon, 10 Oct 2011 19:42:50 -0400
|
||||
Subject: [PATCH 19/24] dxva-mpeg2 speed up slice allocation
|
||||
|
||||
The number of slices is not very likely to change from frame to frame, so
|
||||
at the beginning of a new frame, allocate memory for the amount of slices of
|
||||
the previous frame. Saves a lot of reallocation, for some TV capture samples
|
||||
there are over 200 slices.
|
||||
|
||||
There wasn't anywhere really appropriate to store last_slice_count (needs to
|
||||
live from first frame to last frame), so this is likely to cause discussion to
|
||||
merge upstream.
|
||||
Adding members to dxva_context breaks ABI, which we don't care too much about
|
||||
since on Windows we don't support external ffmpeg.
|
||||
dxva mpeg2 code also has access to MpegEncContext, but adding there would
|
||||
likely break ABI as well.
|
||||
---
|
||||
libavcodec/dxva2.h | 1 +
|
||||
libavcodec/dxva2_mpeg2.c | 12 ++++++++++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
|
||||
index fc99560..16a6994 100644
|
||||
--- a/libavcodec/dxva2.h
|
||||
+++ b/libavcodec/dxva2.h
|
||||
@@ -66,6 +66,7 @@ struct dxva_context {
|
||||
* Private to the FFmpeg AVHWAccel implementation
|
||||
*/
|
||||
unsigned report_id;
|
||||
+ unsigned last_slice_count;
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_DXVA_H */
|
||||
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
|
||||
index 8ba83b6..90507f9 100644
|
||||
--- a/libavcodec/dxva2_mpeg2.c
|
||||
+++ b/libavcodec/dxva2_mpeg2.c
|
||||
@@ -222,6 +222,16 @@
|
||||
ctx_pic->slice_count = 0;
|
||||
ctx_pic->bitstream_size = 0;
|
||||
ctx_pic->bitstream = NULL;
|
||||
+
|
||||
+ if (ctx->last_slice_count > 0)
|
||||
+ {
|
||||
+ ctx_pic->slice = av_fast_realloc(NULL,
|
||||
+ &ctx_pic->slice_alloc,
|
||||
+ ctx->last_slice_count * sizeof(DXVA_SliceInfo));
|
||||
+ if (!ctx_pic->slice)
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -251,6 +261,7 @@
|
||||
struct MpegEncContext *s = avctx->priv_data;
|
||||
struct dxva2_picture_context *ctx_pic =
|
||||
s->current_picture_ptr->f.hwaccel_picture_private;
|
||||
+ struct dxva_context *ctx = avctx->hwaccel_context;
|
||||
int ret;
|
||||
|
||||
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
|
||||
@@ -261,6 +272,8 @@
|
||||
commit_bitstream_and_slice_buffer);
|
||||
if (!ret)
|
||||
ff_mpeg_draw_horiz_band(s, 0, avctx->height);
|
||||
+
|
||||
+ ctx->last_slice_count = ctx_pic->slice_count;
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,46 +0,0 @@
|
||||
From 85a109a59218337bbfac6b3ff54e37499dcbb306 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 17:06:15 +0000
|
||||
Subject: [PATCH] dxva-vc1-Take-BI-into-account-for-forward-and-backwa
|
||||
|
||||
---
|
||||
libavcodec/dxva2_vc1.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
|
||||
index ed4836d..26e1ad4 100644
|
||||
--- a/libavcodec/dxva2_vc1.c
|
||||
+++ b/libavcodec/dxva2_vc1.c
|
||||
@@ -38,15 +38,17 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
{
|
||||
const MpegEncContext *s = &v->s;
|
||||
const Picture *current_picture = s->current_picture_ptr;
|
||||
+ BYTE bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1;
|
||||
+ BYTE bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && v->bi_type == 0;
|
||||
|
||||
memset(pp, 0, sizeof(*pp));
|
||||
pp->wDecodedPictureIndex =
|
||||
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture);
|
||||
- if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type)
|
||||
+ if (!bPicIntra)
|
||||
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
|
||||
else
|
||||
pp->wForwardRefPictureIndex = 0xffff;
|
||||
- if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type)
|
||||
+ if (bPicBackwardPrediction)
|
||||
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
|
||||
else
|
||||
pp->wBackwardRefPictureIndex = 0xffff;
|
||||
@@ -69,8 +71,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
if (s->picture_structure & PICT_BOTTOM_FIELD)
|
||||
pp->bPicStructure |= 0x02;
|
||||
pp->bSecondField = v->interlace && v->fcm == ILACE_FIELD && v->second_field;
|
||||
- pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type;
|
||||
- pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type;
|
||||
+ pp->bPicIntra = bPicIntra;
|
||||
+ pp->bPicBackwardPrediction = bPicBackwardPrediction;
|
||||
pp->bBidirectionalAveragingMode = (1 << 7) |
|
||||
((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) |
|
||||
((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 484c01de4d5dba595ad8dc5582d4f8d2b7b7f2d4 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 17:11:04 +0000
|
||||
Subject: [PATCH] dxva-vc1-Pass-overlapping-transforms-hint
|
||||
|
||||
---
|
||||
libavcodec/dxva2_vc1.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
|
||||
index 26e1ad4..3dc32cb 100644
|
||||
--- a/libavcodec/dxva2_vc1.c
|
||||
+++ b/libavcodec/dxva2_vc1.c
|
||||
@@ -103,7 +103,9 @@ static void fill_picture_parameters(AVCodecContext *avctx,
|
||||
(v->rangered << 3) |
|
||||
(s->max_b_frames );
|
||||
pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2;
|
||||
- pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) |
|
||||
+ pp->bPicDeblocked = ((v->overlap == 1 &&
|
||||
+ pp->bPicBackwardPrediction == 0 &&
|
||||
+ ctx->cfg->ConfigResidDiffHost == 0) << 6) |
|
||||
((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
|
||||
(s->loop_filter << 1);
|
||||
pp->bPicDeblockConfined = (v->postprocflag << 7) |
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 95b4c0af771121001967e01c1a13125c13178e25 Mon Sep 17 00:00:00 2001
|
||||
From: marc <mhocking@ubuntu-desktop.(none)>
|
||||
Date: Mon, 18 Feb 2013 17:18:18 +0000
|
||||
Subject: [PATCH] dxva-h264 Fix dxva playback of streams that don't start
|
||||
with an I-Frame.
|
||||
|
||||
---
|
||||
libavcodec/dxva2_h264.c | 8 ++++++++
|
||||
libavcodec/h264.c | 2 ++
|
||||
libavcodec/h264.h | 2 ++
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
|
||||
index f7d4e5d..2ad4afd 100644
|
||||
--- a/libavcodec/dxva2_h264.c
|
||||
+++ b/libavcodec/dxva2_h264.c
|
||||
@@ -431,6 +431,14 @@
|
||||
|
||||
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
|
||||
return -1;
|
||||
+
|
||||
+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
|
||||
+ if (!h->got_first_iframe) {
|
||||
+ if (!(ctx_pic->pp.wBitFields & (1 << 15)))
|
||||
+ return -1;
|
||||
+ h->got_first_iframe = 1;
|
||||
+ }
|
||||
+
|
||||
ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr,
|
||||
&ctx_pic->pp, sizeof(ctx_pic->pp),
|
||||
&ctx_pic->qm, sizeof(ctx_pic->qm),
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index 0aab4e7..aee9407 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -2183,6 +2183,7 @@ static void flush_dpb(AVCodecContext *avctx)
|
||||
h->delayed_pic[i]->f.reference = 0;
|
||||
h->delayed_pic[i] = NULL;
|
||||
}
|
||||
+ h->got_first_iframe = 0;
|
||||
|
||||
flush_change(h);
|
||||
ff_mpeg_flush(avctx);
|
||||
@@ -2597,6 +2598,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
|
||||
}
|
||||
s->first_field = 0;
|
||||
h->prev_interlaced_frame = 1;
|
||||
+ h->got_first_iframe = 0;
|
||||
|
||||
init_scan_tables(h);
|
||||
if (ff_h264_alloc_tables(h) < 0) {
|
||||
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
|
||||
index 4b6a19e..06c2384 100644
|
||||
--- a/libavcodec/h264.h
|
||||
+++ b/libavcodec/h264.h
|
||||
@@ -588,6 +588,8 @@ typedef struct H264Context {
|
||||
int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
|
||||
int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
|
||||
|
||||
+ int got_first_iframe;
|
||||
+
|
||||
// Timestamp stuff
|
||||
int sei_buffering_period_present; ///< Buffering period SEI flag
|
||||
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,44 +0,0 @@
|
||||
From f9cbb94f63aaaf889c21445e71fdd258f9ebcad1 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 17:31:52 +0000
|
||||
Subject: [PATCH] add-public-version-of-ff_read_frame_flush
|
||||
|
||||
---
|
||||
libavformat/avformat.h | 5 +++++
|
||||
libavformat/utils.c | 5 +++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
|
||||
index c907d4e..c0f517c 100644
|
||||
--- a/libavformat/avformat.h
|
||||
+++ b/libavformat/avformat.h
|
||||
@@ -1615,6 +1615,11 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt);
|
||||
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
+ * Clear out any buffered data in context
|
||||
+ */
|
||||
+void av_read_frame_flush(AVFormatContext *s);
|
||||
+
|
||||
+/**
|
||||
* Seek to the keyframe at timestamp.
|
||||
* 'timestamp' in 'stream_index'.
|
||||
* @param stream_index If stream_index is (-1), a default
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index 3e7dec9..72925bb 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -1636,6 +1636,11 @@ void ff_read_frame_flush(AVFormatContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
+void av_read_frame_flush(AVFormatContext *s)
|
||||
+{
|
||||
+ ff_read_frame_flush(s);
|
||||
+}
|
||||
+
|
||||
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
||||
{
|
||||
int i;
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,51 +0,0 @@
|
||||
From d659958d58dfec08f4666a8add325c8154a662de Mon Sep 17 00:00:00 2001
|
||||
From: CrystalP <CrystalP@xbmc.org>
|
||||
Date: Fri, 11 Nov 2011 19:10:54 -0500
|
||||
Subject: [PATCH 1/1] Handle return value of BeginFrame better.
|
||||
|
||||
The nVidia cards sometimes return E_PENDING and need time before they can start
|
||||
decoding a new frame.
|
||||
|
||||
Helps nVidia cards with blocky pictures/pixellation artifacts after skip or
|
||||
when CPU is busy.
|
||||
---
|
||||
libavcodec/dxva2.c | 14 ++++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
|
||||
index b6f8aea..3a10f69 100644
|
||||
--- a/libavcodec/dxva2.c
|
||||
+++ b/libavcodec/dxva2.c
|
||||
@@ -21,6 +21,9 @@
|
||||
*/
|
||||
|
||||
#include "dxva2_internal.h"
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define MAX_RETRY_ON_PENDING 50
|
||||
|
||||
void *ff_dxva2_get_surface(const Picture *picture)
|
||||
{
|
||||
@@ -88,10 +91,17 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
|
||||
DXVA2_DecodeBufferDesc buffer[4];
|
||||
DXVA2_DecodeExecuteParams exec = { 0 };
|
||||
int result;
|
||||
+ HRESULT hr;
|
||||
+ int tries = 0;
|
||||
|
||||
- if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||
+ while ((hr=IDirectXVideoDecoder_BeginFrame(ctx->decoder,
|
||||
ff_dxva2_get_surface(pic),
|
||||
- NULL))) {
|
||||
+ NULL)) == E_PENDING
|
||||
+ && tries < MAX_RETRY_ON_PENDING) {
|
||||
+ usleep(1000);
|
||||
+ tries++;
|
||||
+ }
|
||||
+ if (FAILED(hr)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
|
||||
return -1;
|
||||
}
|
||||
--
|
||||
1.7.9.4
|
||||
|
@ -1,26 +0,0 @@
|
||||
From a356770e3a73d79c9e4a451366930f557e3a2fa6 Mon Sep 17 00:00:00 2001
|
||||
From: Voyager1 <voyager@xbmc.org>
|
||||
Date: Sat, 13 Apr 2013 15:38:10 +0200
|
||||
Subject: [PATCH 4/4] ffmpeg 1.2 - fixed dvd still frames ended up in internal
|
||||
lavf
|
||||
|
||||
---
|
||||
libavformat/utils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavformat/utils.c b/libavformat/utils.c
|
||||
index c3bd3d9..72f59d2 100644
|
||||
--- a/libavformat/utils.c
|
||||
+++ b/libavformat/utils.c
|
||||
@@ -706,7 +706,7 @@ no_packet:
|
||||
|
||||
if(end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
|
||||
int score= set_codec_from_probe_data(s, st, pd);
|
||||
- if( (st->codec->codec_id != AV_CODEC_ID_NONE && score > AVPROBE_SCORE_RETRY)
|
||||
+ if( (st->codec->codec_id != AV_CODEC_ID_NONE && score > AVPROBE_SCORE_RETRY-1)
|
||||
|| end){
|
||||
pd->buf_size=0;
|
||||
av_freep(&pd->buf);
|
||||
--
|
||||
1.8.0.msysgit.0
|
||||
|
@ -1,24 +0,0 @@
|
||||
From bc85fb8d204c7090dc6856d880f7556e7291d353 Mon Sep 17 00:00:00 2001
|
||||
Date: Mon, 18 Feb 2013 21:18:39 +0000
|
||||
Subject: [PATCH] stop-forcing-gas-preprocessor-for-darwin
|
||||
|
||||
---
|
||||
configure | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index d4aa8f2..980346e 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -3166,7 +3166,7 @@ case $target_os in
|
||||
strip="strip -d"
|
||||
;;
|
||||
darwin)
|
||||
- gas="gas-preprocessor.pl $cc"
|
||||
+ #gas="gas-preprocessor.pl $cc"
|
||||
enabled ppc && add_asflags -force_cpusubtype_ALL
|
||||
SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
|
||||
enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -1,32 +0,0 @@
|
||||
From bb6ba57092c402b6f2e5edf6d1691beafafa0460 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Hochecker <fernetmenta@online.de>
|
||||
Date: Mon, 6 May 2013 20:58:28 +0200
|
||||
Subject: [PATCH] ffmpeg backport: register vdpau hwaccel for mpeg12
|
||||
|
||||
---
|
||||
libavcodec/mpeg12.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
|
||||
index 9d2743a..0f94772 100644
|
||||
--- a/libavcodec/mpeg12.c
|
||||
+++ b/libavcodec/mpeg12.c
|
||||
@@ -1202,6 +1202,7 @@ static const enum AVPixelFormat mpeg1_hwaccel_pixfmt_list_420[] = {
|
||||
#endif
|
||||
#if CONFIG_MPEG1_VDPAU_HWACCEL
|
||||
AV_PIX_FMT_VDPAU_MPEG1,
|
||||
+ AV_PIX_FMT_VDPAU,
|
||||
#endif
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE
|
||||
@@ -1214,6 +1215,7 @@ static const enum AVPixelFormat mpeg2_hwaccel_pixfmt_list_420[] = {
|
||||
#endif
|
||||
#if CONFIG_MPEG2_VDPAU_HWACCEL
|
||||
AV_PIX_FMT_VDPAU_MPEG2,
|
||||
+ AV_PIX_FMT_VDPAU,
|
||||
#endif
|
||||
#if CONFIG_MPEG2_DXVA2_HWACCEL
|
||||
AV_PIX_FMT_DXVA2_VLD,
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,25 +0,0 @@
|
||||
From b37cc5995b88ec68a68cb8e496a008e1cd467077 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Hochecker <fernetmenta@online.de>
|
||||
Date: Sun, 5 May 2013 15:12:59 +0200
|
||||
Subject: [PATCH] fix vdpau vc1 interlace modes
|
||||
|
||||
---
|
||||
libavcodec/vdpau_vc1.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
|
||||
index f5da9bb..993ef26 100644
|
||||
--- a/libavcodec/vdpau_vc1.c
|
||||
+++ b/libavcodec/vdpau_vc1.c
|
||||
@@ -59,7 +59,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
|
||||
else
|
||||
info->picture_type = s->pict_type - 1 + s->pict_type / 3;
|
||||
|
||||
- info->frame_coding_mode = v->fcm;
|
||||
+ info->frame_coding_mode = v->fcm ? v->fcm + 1 : 0;
|
||||
info->postprocflag = v->postprocflag;
|
||||
info->pulldown = v->broadcast;
|
||||
info->interlace = v->interlace;
|
||||
--
|
||||
1.7.9.5
|
||||
|
@ -1,236 +0,0 @@
|
||||
From 3a6ea59e122d5bc981a2a5c8f9bafcba0f9f8754 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Wed, 26 Jun 2013 22:07:28 +0200
|
||||
Subject: [PATCH 1/1] h264: expose h264 frame packing as stereo_mode metadata
|
||||
|
||||
---
|
||||
libavcodec/h264.c | 3 ++
|
||||
libavcodec/h264.h | 35 ++++++++++++++-
|
||||
libavcodec/h264_parser.c | 1 +
|
||||
libavcodec/h264_sei.c | 85 +++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 123 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index 937ad7a..85f2372 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -1437,6 +1437,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
|
||||
h->prev_poc_msb = 1 << 16;
|
||||
h->prev_frame_num = -1;
|
||||
h->x264_build = -1;
|
||||
+ h->sei_fpa.frame_packing_arrangement_cancel_flag = -1;
|
||||
ff_h264_reset_sei(h);
|
||||
if (avctx->codec_id == AV_CODEC_ID_H264) {
|
||||
if (avctx->ticks_per_frame == 1) {
|
||||
@@ -4783,6 +4784,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
out->f.reference &= ~DELAYED_PIC_REF;
|
||||
*got_frame = 1;
|
||||
*pict = out->f;
|
||||
+ av_dict_set(&pict->metadata, "stereo_mode", ff_h264_sei_stereo_mode(h), 0);
|
||||
}
|
||||
|
||||
return buf_index;
|
||||
@@ -4839,6 +4841,7 @@ not_extra:
|
||||
if (h->next_output_pic && (h->next_output_pic->sync || h->sync>1)) {
|
||||
*got_frame = 1;
|
||||
*pict = h->next_output_pic->f;
|
||||
+ av_dict_set(&pict->metadata, "stereo_mode", ff_h264_sei_stereo_mode(h), 0);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
|
||||
index 7ea613c..15a0b21 100644
|
||||
--- a/libavcodec/h264.h
|
||||
+++ b/libavcodec/h264.h
|
||||
@@ -126,7 +126,8 @@ typedef enum {
|
||||
SEI_TYPE_PIC_TIMING = 1, ///< picture timing
|
||||
SEI_TYPE_USER_DATA_ITU_T_T35 = 4, ///< user data registered by ITU-T Recommendation T.35
|
||||
SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
|
||||
- SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync)
|
||||
+ SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
|
||||
+ SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
|
||||
} SEI_Type;
|
||||
|
||||
/**
|
||||
@@ -145,6 +146,19 @@ typedef enum {
|
||||
} SEI_PicStructType;
|
||||
|
||||
/**
|
||||
+ * frame_packing_arrangement types
|
||||
+ */
|
||||
+typedef enum {
|
||||
+ SEI_FPA_TYPE_CHECKERBOARD = 0,
|
||||
+ SEI_FPA_TYPE_INTERLEAVE_COLUMN = 1,
|
||||
+ SEI_FPA_TYPE_INTERLEAVE_ROW = 2,
|
||||
+ SEI_FPA_TYPE_SIDE_BY_SIDE = 3,
|
||||
+ SEI_FPA_TYPE_TOP_BOTTOM = 4,
|
||||
+ SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5,
|
||||
+ SEI_FPA_TYPE_2D = 6,
|
||||
+} SEI_FpaType;
|
||||
+
|
||||
+/**
|
||||
* Sequence parameter set
|
||||
*/
|
||||
typedef struct SPS {
|
||||
@@ -230,6 +244,17 @@ typedef struct PPS {
|
||||
} PPS;
|
||||
|
||||
/**
|
||||
+ * Frame Packing Arrangement Type
|
||||
+ */
|
||||
+typedef struct FPA {
|
||||
+ int frame_packing_arrangement_id;
|
||||
+ int frame_packing_arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received
|
||||
+ SEI_FpaType frame_packing_arrangement_type;
|
||||
+ int content_interpretation_type;
|
||||
+ int quincunx_sampling_flag;
|
||||
+} FPA;
|
||||
+
|
||||
+/**
|
||||
* Memory management control operation opcode.
|
||||
*/
|
||||
typedef enum MMCOOpcode {
|
||||
@@ -626,6 +651,8 @@ typedef struct H264Context {
|
||||
*/
|
||||
int valid_recovery_point;
|
||||
|
||||
+ FPA sei_fpa;
|
||||
+
|
||||
int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
|
||||
int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
|
||||
|
||||
@@ -771,6 +798,12 @@ void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y,
|
||||
*/
|
||||
void ff_h264_reset_sei(H264Context *h);
|
||||
|
||||
+/**
|
||||
+ * Get stereo_mode string from the h264 frame_packing_arrangement
|
||||
+ * @param h H.264 context.
|
||||
+ */
|
||||
+const char* ff_h264_sei_stereo_mode(H264Context *h);
|
||||
+
|
||||
/*
|
||||
* o-o o-o
|
||||
* / / /
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index 44b92b7..aff9ba1 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -158,6 +158,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
h->sei_dpb_output_delay = 0;
|
||||
h->sei_cpb_removal_delay = -1;
|
||||
h->sei_buffering_period_present = 0;
|
||||
+ h->sei_fpa.frame_packing_arrangement_cancel_flag = -1;
|
||||
|
||||
if (!buf_size)
|
||||
return 0;
|
||||
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
|
||||
index ece54f1..fc9b96f 100644
|
||||
--- a/libavcodec/h264_sei.c
|
||||
+++ b/libavcodec/h264_sei.c
|
||||
@@ -194,6 +194,43 @@ static int decode_buffering_period(H264Context *h){
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int decode_frame_packing(H264Context *h, int size){
|
||||
+ int bits = get_bits_left(&h->gb);
|
||||
+
|
||||
+ h->sei_fpa.frame_packing_arrangement_id = get_ue_golomb(&h->gb);
|
||||
+ h->sei_fpa.frame_packing_arrangement_cancel_flag = get_bits(&h->gb, 1);
|
||||
+ if (!h->sei_fpa.frame_packing_arrangement_cancel_flag) {
|
||||
+ h->sei_fpa.frame_packing_arrangement_type = get_bits(&h->gb, 7);
|
||||
+ h->sei_fpa.quincunx_sampling_flag = get_bits(&h->gb, 1);
|
||||
+ h->sei_fpa.content_interpretation_type = get_bits(&h->gb, 6);
|
||||
+ skip_bits(&h->gb, 1); /* spatial_flipping_flag */
|
||||
+ skip_bits(&h->gb, 1); /* frame0_flipped_flag */
|
||||
+ skip_bits(&h->gb, 1); /* field_views_flag */
|
||||
+ skip_bits(&h->gb, 1); /* current_frame_is_frame0_flag */
|
||||
+ skip_bits(&h->gb, 1); /* frame0_self_contained_flag */
|
||||
+ skip_bits(&h->gb, 1); /* frame1_self_contained_flag */
|
||||
+ if (!h->sei_fpa.quincunx_sampling_flag && h->sei_fpa.frame_packing_arrangement_type != 5) {
|
||||
+ skip_bits(&h->gb, 4); /* frame0_grid_position_x */
|
||||
+ skip_bits(&h->gb, 4); /* frame0_grid_position_y */
|
||||
+ skip_bits(&h->gb, 4); /* frame1_grid_position_x */
|
||||
+ skip_bits(&h->gb, 4); /* frame1_grid_position_y */
|
||||
+ }
|
||||
+ skip_bits(&h->gb, 8); /* frame_packing_arrangement_reserved_byte */
|
||||
+ get_ue_golomb(&h->gb) /* frame_packing_arrangement_repetition_period */;
|
||||
+ }
|
||||
+ skip_bits(&h->gb, 1); /* frame_packing_arrangement_extension_flag */
|
||||
+
|
||||
+ if (h->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
+ av_log(h->avctx, AV_LOG_DEBUG, "SEI FPA %d %d %d %d %d\n",
|
||||
+ h->sei_fpa.frame_packing_arrangement_id,
|
||||
+ h->sei_fpa.frame_packing_arrangement_cancel_flag,
|
||||
+ h->sei_fpa.frame_packing_arrangement_type,
|
||||
+ h->sei_fpa.quincunx_sampling_flag,
|
||||
+ h->sei_fpa.content_interpretation_type);
|
||||
+ skip_bits(&h->gb, 8*size - (bits - get_bits_left(&h->gb)));
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int ff_h264_decode_sei(H264Context *h){
|
||||
while (get_bits_left(&h->gb) > 16) {
|
||||
int size, type;
|
||||
@@ -236,6 +273,9 @@ int ff_h264_decode_sei(H264Context *h){
|
||||
if(decode_buffering_period(h) < 0)
|
||||
return -1;
|
||||
break;
|
||||
+ case SEI_TYPE_FRAME_PACKING:
|
||||
+ if(decode_frame_packing(h, size) < 0)
|
||||
+ return -1;
|
||||
default:
|
||||
skip_bits(&h->gb, 8*size);
|
||||
}
|
||||
@@ -246,3 +286,48 @@ int ff_h264_decode_sei(H264Context *h){
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+const char* ff_h264_sei_stereo_mode(H264Context *h)
|
||||
+{
|
||||
+ if (h->sei_fpa.frame_packing_arrangement_cancel_flag == 0) {
|
||||
+ switch (h->sei_fpa.frame_packing_arrangement_type) {
|
||||
+ case SEI_FPA_TYPE_CHECKERBOARD:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "checkerboard_rl";
|
||||
+ else
|
||||
+ return "checkerboard_lr";
|
||||
+ case SEI_FPA_TYPE_INTERLEAVE_COLUMN:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "col_interleaved_rl";
|
||||
+ else
|
||||
+ return "col_interleaved_lr";
|
||||
+ case SEI_FPA_TYPE_INTERLEAVE_ROW:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "row_interleaved_rl";
|
||||
+ else
|
||||
+ return "row_interleaved_lr";
|
||||
+ case SEI_FPA_TYPE_SIDE_BY_SIDE:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "right_left";
|
||||
+ else
|
||||
+ return "left_right";
|
||||
+ case SEI_FPA_TYPE_TOP_BOTTOM:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "bottom_top";
|
||||
+ else
|
||||
+ return "top_bottom";
|
||||
+ case SEI_FPA_TYPE_INTERLEAVE_TEMPORAL:
|
||||
+ if (h->sei_fpa.content_interpretation_type == 2)
|
||||
+ return "block_rl";
|
||||
+ else
|
||||
+ return "block_lr";
|
||||
+ case SEI_FPA_TYPE_2D:
|
||||
+ default:
|
||||
+ return "mono";
|
||||
+ }
|
||||
+ } else if (h->sei_fpa.frame_packing_arrangement_cancel_flag == 1) {
|
||||
+ return "mono";
|
||||
+ } else {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.2
|
||||
|
@ -1,311 +0,0 @@
|
||||
From 40daea3c1bafa9cea37b65f856c3c0432767d760 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:09 +0100
|
||||
Subject: [PATCH 39/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of synth_filter_float
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 9295.0 114.9 4853.2 83.5 +91.5%
|
||||
Overall 23699.8 397.6 19285.5 292.0 +22.9%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/Makefile | 1 +
|
||||
libavcodec/arm/fft_init_arm.c | 8 +
|
||||
libavcodec/arm/synth_filter_vfp.S | 243 ++++++++++++++++++++++++++
|
||||
3 files changed, 252 insertions(+)
|
||||
create mode 100644 libavcodec/arm/synth_filter_vfp.S
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index 1c91d62..aee9d73 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -58,6 +58,7 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \
|
||||
arm/dsputil_armv6.o \
|
||||
arm/simple_idct_armv6.o \
|
||||
|
||||
+VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_vfp.o
|
||||
VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
|
||||
|
||||
NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \
|
||||
diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c
|
||||
index 8c98abc..fe0acc5 100644
|
||||
--- a/libavcodec/arm/fft_init_arm.c
|
||||
+++ b/libavcodec/arm/fft_init_arm.c
|
||||
@@ -32,6 +32,12 @@ void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input)
|
||||
|
||||
void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z);
|
||||
|
||||
+void ff_synth_filter_float_vfp(FFTContext *imdct,
|
||||
+ float *synth_buf_ptr, int *synth_buf_offset,
|
||||
+ float synth_buf2[32], const float window[512],
|
||||
+ float out[32], const float in[32],
|
||||
+ float scale);
|
||||
+
|
||||
void ff_synth_filter_float_neon(FFTContext *imdct,
|
||||
float *synth_buf_ptr, int *synth_buf_offset,
|
||||
float synth_buf2[32], const float window[512],
|
||||
@@ -71,6 +77,8 @@ av_cold void ff_synth_filter_init_arm(SynthFilterContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
+ if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags))
|
||||
+ s->synth_filter_float = ff_synth_filter_float_vfp;
|
||||
if (have_neon(cpu_flags))
|
||||
s->synth_filter_float = ff_synth_filter_float_neon;
|
||||
}
|
||||
diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S
|
||||
new file mode 100644
|
||||
index 0000000..c219c41
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/synth_filter_vfp.S
|
||||
@@ -0,0 +1,243 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd
|
||||
+ * Author: Ben Avison <bavison@riscosopen.org>
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+
|
||||
+#include "libavutil/arm/asm.S"
|
||||
+
|
||||
+IMDCT .req r0
|
||||
+ORIG_P_SB .req r1
|
||||
+P_SB_OFF .req r2
|
||||
+I .req r0
|
||||
+P_SB2_UP .req r1
|
||||
+OLDFPSCR .req r2
|
||||
+P_SB2_DN .req r3
|
||||
+P_WIN_DN .req r4
|
||||
+P_OUT_DN .req r5
|
||||
+P_SB .req r6
|
||||
+J_WRAP .req r7
|
||||
+P_WIN_UP .req r12
|
||||
+P_OUT_UP .req r14
|
||||
+
|
||||
+SCALE .req s0
|
||||
+SBUF_DAT_REV0 .req s4
|
||||
+SBUF_DAT_REV1 .req s5
|
||||
+SBUF_DAT_REV2 .req s6
|
||||
+SBUF_DAT_REV3 .req s7
|
||||
+VA0 .req s8
|
||||
+VA3 .req s11
|
||||
+VB0 .req s12
|
||||
+VB3 .req s15
|
||||
+VC0 .req s8
|
||||
+VC3 .req s11
|
||||
+VD0 .req s12
|
||||
+VD3 .req s15
|
||||
+SBUF_DAT0 .req s16
|
||||
+SBUF_DAT1 .req s17
|
||||
+SBUF_DAT2 .req s18
|
||||
+SBUF_DAT3 .req s19
|
||||
+SBUF_DAT_ALT0 .req s20
|
||||
+SBUF_DAT_ALT1 .req s21
|
||||
+SBUF_DAT_ALT2 .req s22
|
||||
+SBUF_DAT_ALT3 .req s23
|
||||
+WIN_DN_DAT0 .req s24
|
||||
+WIN_UP_DAT0 .req s28
|
||||
+
|
||||
+
|
||||
+.macro inner_loop half, tail, head
|
||||
+ .if (OFFSET & (64*4)) == 0 @ even numbered call
|
||||
+ SBUF_DAT_THIS0 .req SBUF_DAT0
|
||||
+ SBUF_DAT_THIS1 .req SBUF_DAT1
|
||||
+ SBUF_DAT_THIS2 .req SBUF_DAT2
|
||||
+ SBUF_DAT_THIS3 .req SBUF_DAT3
|
||||
+ .ifnc "\head",""
|
||||
+ vldr d8, [P_SB, #OFFSET] @ d8 = SBUF_DAT
|
||||
+ vldr d9, [P_SB, #OFFSET+8]
|
||||
+ .endif
|
||||
+ .else
|
||||
+ SBUF_DAT_THIS0 .req SBUF_DAT_ALT0
|
||||
+ SBUF_DAT_THIS1 .req SBUF_DAT_ALT1
|
||||
+ SBUF_DAT_THIS2 .req SBUF_DAT_ALT2
|
||||
+ SBUF_DAT_THIS3 .req SBUF_DAT_ALT3
|
||||
+ .ifnc "\head",""
|
||||
+ vldr d10, [P_SB, #OFFSET] @ d10 = SBUF_DAT_ALT
|
||||
+ vldr d11, [P_SB, #OFFSET+8]
|
||||
+ .endif
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ .ifc "\half","ab"
|
||||
+ vmls.f VA0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors
|
||||
+ .else
|
||||
+ vmla.f VD0, SBUF_DAT_REV0, WIN_DN_DAT0 @ all operands treated as vectors
|
||||
+ .endif
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vldr d14, [P_WIN_UP, #OFFSET] @ d14 = WIN_UP_DAT
|
||||
+ vldr d15, [P_WIN_UP, #OFFSET+8]
|
||||
+ vldr d12, [P_WIN_DN, #OFFSET] @ d12 = WIN_DN_DAT
|
||||
+ vldr d13, [P_WIN_DN, #OFFSET+8]
|
||||
+ vmov SBUF_DAT_REV3, SBUF_DAT_THIS0
|
||||
+ vmov SBUF_DAT_REV2, SBUF_DAT_THIS1
|
||||
+ vmov SBUF_DAT_REV1, SBUF_DAT_THIS2
|
||||
+ vmov SBUF_DAT_REV0, SBUF_DAT_THIS3
|
||||
+ .ifc "\half","ab"
|
||||
+ vmla.f VB0, SBUF_DAT_THIS0, WIN_UP_DAT0
|
||||
+ .else
|
||||
+ vmla.f VC0, SBUF_DAT_THIS0, WIN_UP_DAT0
|
||||
+ .endif
|
||||
+ teq J_WRAP, #J
|
||||
+ bne 2f @ strongly predictable, so better than cond exec in this case
|
||||
+ sub P_SB, P_SB, #512*4
|
||||
+2:
|
||||
+ .set J, J - 64
|
||||
+ .set OFFSET, OFFSET + 64*4
|
||||
+ .endif
|
||||
+ .unreq SBUF_DAT_THIS0
|
||||
+ .unreq SBUF_DAT_THIS1
|
||||
+ .unreq SBUF_DAT_THIS2
|
||||
+ .unreq SBUF_DAT_THIS3
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+/* void ff_synth_filter_float_vfp(FFTContext *imdct,
|
||||
+ * float *synth_buf_ptr, int *synth_buf_offset,
|
||||
+ * float synth_buf2[32], const float window[512],
|
||||
+ * float out[32], const float in[32], float scale)
|
||||
+ */
|
||||
+function ff_synth_filter_float_vfp, export=1
|
||||
+ push {r3-r7,lr}
|
||||
+ vpush {s16-s31}
|
||||
+ ldr lr, [P_SB_OFF]
|
||||
+ add a2, ORIG_P_SB, lr, LSL #2 @ calculate synth_buf to pass to imdct_half
|
||||
+ mov P_SB, a2 @ and keep a copy for ourselves
|
||||
+ bic J_WRAP, lr, #63 @ mangled to make testing for wrap easier in inner loop
|
||||
+ sub lr, lr, #32
|
||||
+ and lr, lr, #512-32
|
||||
+ str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call
|
||||
+ ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half
|
||||
+VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case
|
||||
+ bl ff_imdct_half_vfp
|
||||
+VFP vmov SCALE, s16
|
||||
+
|
||||
+ fmrx OLDFPSCR, FPSCR
|
||||
+ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
|
||||
+ fmxr FPSCR, lr
|
||||
+ ldr P_SB2_DN, [sp, #16*4]
|
||||
+ ldr P_WIN_DN, [sp, #(16+6+0)*4]
|
||||
+ ldr P_OUT_DN, [sp, #(16+6+1)*4]
|
||||
+NOVFP vldr SCALE, [sp, #(16+6+3)*4]
|
||||
+
|
||||
+#define IMM_OFF_SKEW 956 /* also valid immediate constant when you add 16*4 */
|
||||
+ add P_SB, P_SB, #IMM_OFF_SKEW @ so we can use -ve offsets to use full immediate offset range
|
||||
+ add P_SB2_UP, P_SB2_DN, #16*4
|
||||
+ add P_WIN_UP, P_WIN_DN, #16*4+IMM_OFF_SKEW
|
||||
+ add P_OUT_UP, P_OUT_DN, #16*4
|
||||
+ add P_SB2_DN, P_SB2_DN, #16*4
|
||||
+ add P_WIN_DN, P_WIN_DN, #12*4+IMM_OFF_SKEW
|
||||
+ add P_OUT_DN, P_OUT_DN, #16*4
|
||||
+ mov I, #4
|
||||
+1:
|
||||
+ vldmia P_SB2_UP!, {VB0-VB3}
|
||||
+ vldmdb P_SB2_DN!, {VA0-VA3}
|
||||
+ .set J, 512 - 64
|
||||
+ .set OFFSET, -IMM_OFF_SKEW
|
||||
+ inner_loop ab,, head
|
||||
+ .rept 7
|
||||
+ inner_loop ab, tail, head
|
||||
+ .endr
|
||||
+ inner_loop ab, tail
|
||||
+ add P_WIN_UP, P_WIN_UP, #4*4
|
||||
+ sub P_WIN_DN, P_WIN_DN, #4*4
|
||||
+ vmul.f VB0, VB0, SCALE @ SCALE treated as scalar
|
||||
+ add P_SB, P_SB, #(512+4)*4
|
||||
+ subs I, I, #1
|
||||
+ vmul.f VA0, VA0, SCALE
|
||||
+ vstmia P_OUT_UP!, {VB0-VB3}
|
||||
+ vstmdb P_OUT_DN!, {VA0-VA3}
|
||||
+ bne 1b
|
||||
+
|
||||
+ add P_SB2_DN, P_SB2_DN, #(16+28-12)*4
|
||||
+ sub P_SB2_UP, P_SB2_UP, #(16+16)*4
|
||||
+ add P_WIN_DN, P_WIN_DN, #(32+16+28-12)*4
|
||||
+ mov I, #4
|
||||
+1:
|
||||
+ vldr.d d4, zero @ d4 = VC0
|
||||
+ vldr.d d5, zero
|
||||
+ vldr.d d6, zero @ d6 = VD0
|
||||
+ vldr.d d7, zero
|
||||
+ .set J, 512 - 64
|
||||
+ .set OFFSET, -IMM_OFF_SKEW
|
||||
+ inner_loop cd,, head
|
||||
+ .rept 7
|
||||
+ inner_loop cd, tail, head
|
||||
+ .endr
|
||||
+ inner_loop cd, tail
|
||||
+ add P_WIN_UP, P_WIN_UP, #4*4
|
||||
+ sub P_WIN_DN, P_WIN_DN, #4*4
|
||||
+ add P_SB, P_SB, #(512+4)*4
|
||||
+ subs I, I, #1
|
||||
+ vstmia P_SB2_UP!, {VC0-VC3}
|
||||
+ vstmdb P_SB2_DN!, {VD0-VD3}
|
||||
+ bne 1b
|
||||
+
|
||||
+ fmxr FPSCR, OLDFPSCR
|
||||
+ vpop {s16-s31}
|
||||
+ pop {r3-r7,pc}
|
||||
+endfunc
|
||||
+
|
||||
+ .unreq IMDCT
|
||||
+ .unreq ORIG_P_SB
|
||||
+ .unreq P_SB_OFF
|
||||
+ .unreq I
|
||||
+ .unreq P_SB2_UP
|
||||
+ .unreq OLDFPSCR
|
||||
+ .unreq P_SB2_DN
|
||||
+ .unreq P_WIN_DN
|
||||
+ .unreq P_OUT_DN
|
||||
+ .unreq P_SB
|
||||
+ .unreq J_WRAP
|
||||
+ .unreq P_WIN_UP
|
||||
+ .unreq P_OUT_UP
|
||||
+
|
||||
+ .unreq SCALE
|
||||
+ .unreq SBUF_DAT_REV0
|
||||
+ .unreq SBUF_DAT_REV1
|
||||
+ .unreq SBUF_DAT_REV2
|
||||
+ .unreq SBUF_DAT_REV3
|
||||
+ .unreq VA0
|
||||
+ .unreq VA3
|
||||
+ .unreq VB0
|
||||
+ .unreq VB3
|
||||
+ .unreq VC0
|
||||
+ .unreq VC3
|
||||
+ .unreq VD0
|
||||
+ .unreq VD3
|
||||
+ .unreq SBUF_DAT0
|
||||
+ .unreq SBUF_DAT1
|
||||
+ .unreq SBUF_DAT2
|
||||
+ .unreq SBUF_DAT3
|
||||
+ .unreq SBUF_DAT_ALT0
|
||||
+ .unreq SBUF_DAT_ALT1
|
||||
+ .unreq SBUF_DAT_ALT2
|
||||
+ .unreq SBUF_DAT_ALT3
|
||||
+ .unreq WIN_DN_DAT0
|
||||
+ .unreq WIN_UP_DAT0
|
||||
+
|
||||
+ .align 3
|
||||
+zero: .word 0, 0
|
||||
--
|
||||
1.7.9.5
|
@ -1,102 +0,0 @@
|
||||
From 8ead63b22d31bf71976fc6964922b43d8e0d660b Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:10 +0100
|
||||
Subject: [PATCH 40/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of int32_to_float_fmul_scalar
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 1175.0 4.4 366.2 18.3 +220.8%
|
||||
Overall 19285.5 292.0 18420.5 489.1 +4.7%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/fmtconvert_init_arm.c | 10 ++++++
|
||||
libavcodec/arm/fmtconvert_vfp.S | 38 +++++++++++++++++++++++
|
||||
2 files changed, 48 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c
|
||||
index 1d99c97..de3b78b 100644
|
||||
--- a/libavcodec/arm/fmtconvert_init_arm.c
|
||||
+++ b/libavcodec/arm/fmtconvert_init_arm.c
|
||||
@@ -28,6 +28,9 @@
|
||||
void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src,
|
||||
float mul, int len);
|
||||
|
||||
+void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src,
|
||||
+ float mul, int len);
|
||||
+
|
||||
void ff_float_to_int16_neon(int16_t *dst, const float *src, long len);
|
||||
void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
|
||||
|
||||
@@ -38,6 +41,13 @@ av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_vfp(cpu_flags) && have_armv6(cpu_flags)) {
|
||||
+ if (!have_vfpv3(cpu_flags)) {
|
||||
+ // This function doesn't use anything armv6 specific in itself,
|
||||
+ // but ff_float_to_int16_vfp which is in the same assembly source
|
||||
+ // file does, thus the whole file requires armv6 to be built.
|
||||
+ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp;
|
||||
+ }
|
||||
+
|
||||
c->float_to_int16 = ff_float_to_int16_vfp;
|
||||
}
|
||||
|
||||
diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S
|
||||
index 7b012bc..3cc3e56 100644
|
||||
--- a/libavcodec/arm/fmtconvert_vfp.S
|
||||
+++ b/libavcodec/arm/fmtconvert_vfp.S
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd <bavison@riscosopen.org>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
@@ -76,3 +77,40 @@ function ff_float_to_int16_vfp, export=1
|
||||
vpop {d8-d11}
|
||||
pop {r4-r8,pc}
|
||||
endfunc
|
||||
+
|
||||
+/**
|
||||
+ * ARM VFP optimised int32 to float conversion.
|
||||
+ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
|
||||
+ * (16 bytes alignment is best for BCM2835), little-endian.
|
||||
+ */
|
||||
+@ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src, float mul, int len)
|
||||
+function ff_int32_to_float_fmul_scalar_vfp, export=1
|
||||
+VFP tmp .req a4
|
||||
+VFP len .req a3
|
||||
+NOVFP tmp .req a3
|
||||
+NOVFP len .req a4
|
||||
+NOVFP vmov s0, a3
|
||||
+ ldr tmp, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
|
||||
+ fmrx ip, FPSCR
|
||||
+ fmxr FPSCR, tmp
|
||||
+1:
|
||||
+ vldmia a2!, {s8-s15}
|
||||
+ vcvt.f32.s32 s8, s8
|
||||
+ vcvt.f32.s32 s9, s9
|
||||
+ vcvt.f32.s32 s10, s10
|
||||
+ vcvt.f32.s32 s11, s11
|
||||
+ vcvt.f32.s32 s12, s12
|
||||
+ vcvt.f32.s32 s13, s13
|
||||
+ vcvt.f32.s32 s14, s14
|
||||
+ vcvt.f32.s32 s15, s15
|
||||
+ vmul.f32 s8, s8, s0
|
||||
+ subs len, len, #8
|
||||
+ vstmia a1!, {s8-s11}
|
||||
+ vstmia a1!, {s12-s15}
|
||||
+ bne 1b
|
||||
+
|
||||
+ fmxr FPSCR, ip
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+ .unreq tmp
|
||||
+ .unreq len
|
||||
--
|
||||
1.7.9.5
|
@ -1,78 +0,0 @@
|
||||
From 7901e7216cf6406a2ea430c71af94ebee72f262b Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:11 +0100
|
||||
Subject: [PATCH 41/49] [ffmpeg] - backport - fmtconvert: Add a new method,
|
||||
int32_to_float_fmul_array8
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is similar to int32_to_float_fmul_scalar, but
|
||||
loads a new scalar multiplier every 8 input samples.
|
||||
This enables the use of much larger input arrays, which
|
||||
is important for pipelining on some CPUs (such as
|
||||
ARMv6).
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/fmtconvert.c | 10 ++++++++++
|
||||
libavcodec/fmtconvert.h | 16 ++++++++++++++++
|
||||
2 files changed, 26 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c
|
||||
index 79e9645..1c45d35 100644
|
||||
--- a/libavcodec/fmtconvert.c
|
||||
+++ b/libavcodec/fmtconvert.c
|
||||
@@ -30,6 +30,15 @@ static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul,
|
||||
dst[i] = src[i] * mul;
|
||||
}
|
||||
|
||||
+static void int32_to_float_fmul_array8_c(FmtConvertContext *c, float *dst,
|
||||
+ const int32_t *src, const float *mul,
|
||||
+ int len)
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i = 0; i < len; i += 8)
|
||||
+ c->int32_to_float_fmul_scalar(&dst[i], &src[i], *mul++, 8);
|
||||
+}
|
||||
+
|
||||
static av_always_inline int float_to_int16_one(const float *src){
|
||||
return av_clip_int16(lrintf(*src));
|
||||
}
|
||||
@@ -79,6 +88,7 @@ void ff_float_interleave_c(float *dst, const float **src, unsigned int len,
|
||||
av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
|
||||
{
|
||||
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
|
||||
+ c->int32_to_float_fmul_array8 = int32_to_float_fmul_array8_c;
|
||||
c->float_to_int16 = float_to_int16_c;
|
||||
c->float_to_int16_interleave = float_to_int16_interleave_c;
|
||||
c->float_interleave = ff_float_interleave_c;
|
||||
diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h
|
||||
index 3fb9f4e..02468dc 100644
|
||||
--- a/libavcodec/fmtconvert.h
|
||||
+++ b/libavcodec/fmtconvert.h
|
||||
@@ -38,6 +38,22 @@ typedef struct FmtConvertContext {
|
||||
void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
|
||||
|
||||
/**
|
||||
+ * Convert an array of int32_t to float and multiply by a float value from another array,
|
||||
+ * stepping along the float array once for each 8 integers.
|
||||
+ * @param c pointer to FmtConvertContext.
|
||||
+ * @param dst destination array of float.
|
||||
+ * constraints: 16-byte aligned
|
||||
+ * @param src source array of int32_t.
|
||||
+ * constraints: 16-byte aligned
|
||||
+ * @param mul source array of float multipliers.
|
||||
+ * @param len number of elements to convert.
|
||||
+ * constraints: multiple of 8
|
||||
+ */
|
||||
+ void (*int32_to_float_fmul_array8)(struct FmtConvertContext *c,
|
||||
+ float *dst, const int32_t *src,
|
||||
+ const float *mul, int len);
|
||||
+
|
||||
+ /**
|
||||
* Convert an array of float to an array of int16_t.
|
||||
*
|
||||
* Convert floats from in the range [-32768.0,32767.0] to ints
|
||||
--
|
||||
1.7.9.5
|
@ -1,90 +0,0 @@
|
||||
From fa755fe82fe4cfbb85b7c57501912da2e1f316bc Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Tue, 16 Jul 2013 15:41:18 +0300
|
||||
Subject: [PATCH 42/49] [ffmpeg] - backport - dcadec: Use
|
||||
int32_to_float_fmul_array8
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/dcadec.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
|
||||
index 1b955e4..b648613 100644
|
||||
--- a/libavcodec/dcadec.c
|
||||
+++ b/libavcodec/dcadec.c
|
||||
@@ -1302,7 +1302,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
|
||||
/* FIXME */
|
||||
float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index];
|
||||
- LOCAL_ALIGNED_16(int, block, [8]);
|
||||
+ LOCAL_ALIGNED_16(int, block, [8 * DCA_SUBBANDS]);
|
||||
|
||||
/*
|
||||
* Audio data
|
||||
@@ -1315,6 +1315,8 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
quant_step_table = lossy_quant_d;
|
||||
|
||||
for (k = base_channel; k < s->prim_channels; k++) {
|
||||
+ float rscale[DCA_SUBBANDS];
|
||||
+
|
||||
if (get_bits_left(&s->gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -1337,11 +1339,12 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
* Extract bits from the bit stream
|
||||
*/
|
||||
if (!abits) {
|
||||
- memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
|
||||
+ rscale[l] = 0;
|
||||
+ memset(block + 8 * l, 0, 8 * sizeof(block[0]));
|
||||
} else {
|
||||
/* Deal with transients */
|
||||
int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
|
||||
- float rscale = quant_step_size * s->scale_factor[k][l][sfi] *
|
||||
+ rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] *
|
||||
s->scalefactor_adj[k][sel];
|
||||
|
||||
if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
|
||||
@@ -1355,7 +1358,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
block_code1 = get_bits(&s->gb, size);
|
||||
block_code2 = get_bits(&s->gb, size);
|
||||
err = decode_blockcodes(block_code1, block_code2,
|
||||
- levels, block);
|
||||
+ levels, block + 8 * l);
|
||||
if (err) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"ERROR: block code look-up failed\n");
|
||||
@@ -1364,19 +1367,23 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
} else {
|
||||
/* no coding */
|
||||
for (m = 0; m < 8; m++)
|
||||
- block[m] = get_sbits(&s->gb, abits - 3);
|
||||
+ block[8 * l + m] = get_sbits(&s->gb, abits - 3);
|
||||
}
|
||||
} else {
|
||||
/* Huffman coded */
|
||||
for (m = 0; m < 8; m++)
|
||||
- block[m] = get_bitalloc(&s->gb,
|
||||
+ block[8 * l + m] = get_bitalloc(&s->gb,
|
||||
&dca_smpl_bitalloc[abits], sel);
|
||||
}
|
||||
|
||||
- s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l],
|
||||
- block, rscale, 8);
|
||||
}
|
||||
+ }
|
||||
|
||||
+ s->fmt_conv.int32_to_float_fmul_array8(&s->fmt_conv, subband_samples[k][0],
|
||||
+ block, rscale, 8 * s->vq_start_subband[k]);
|
||||
+
|
||||
+ for (l = 0; l < s->vq_start_subband[k]; l++) {
|
||||
+ int m;
|
||||
/*
|
||||
* Inverse ADPCM if in prediction mode
|
||||
*/
|
||||
--
|
||||
1.7.9.5
|
@ -1,222 +0,0 @@
|
||||
From c908a710261f33130569c4360175d8f19a282d67 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:12 +0100
|
||||
Subject: [PATCH 43/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of int32_to_float_fmul_array8
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 366.2 18.3 277.8 13.7 +31.9%
|
||||
Overall 18420.5 489.1 17049.5 408.2 +8.0%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/fmtconvert_init_arm.c | 6 +-
|
||||
libavcodec/arm/fmtconvert_vfp.S | 162 +++++++++++++++++++++++
|
||||
2 files changed, 167 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c
|
||||
index de3b78b..92d94a0 100644
|
||||
--- a/libavcodec/arm/fmtconvert_init_arm.c
|
||||
+++ b/libavcodec/arm/fmtconvert_init_arm.c
|
||||
@@ -30,6 +30,9 @@ void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src,
|
||||
|
||||
void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src,
|
||||
float mul, int len);
|
||||
+void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst,
|
||||
+ const int32_t *src, const float *mul,
|
||||
+ int len);
|
||||
|
||||
void ff_float_to_int16_neon(int16_t *dst, const float *src, long len);
|
||||
void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
|
||||
@@ -42,10 +45,11 @@ av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx
|
||||
|
||||
if (have_vfp(cpu_flags) && have_armv6(cpu_flags)) {
|
||||
if (!have_vfpv3(cpu_flags)) {
|
||||
- // This function doesn't use anything armv6 specific in itself,
|
||||
+ // These functions don't use anything armv6 specific in themselves,
|
||||
// but ff_float_to_int16_vfp which is in the same assembly source
|
||||
// file does, thus the whole file requires armv6 to be built.
|
||||
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp;
|
||||
+ c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp;
|
||||
}
|
||||
|
||||
c->float_to_int16 = ff_float_to_int16_vfp;
|
||||
diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S
|
||||
index 3cc3e56..a6d4ebd 100644
|
||||
--- a/libavcodec/arm/fmtconvert_vfp.S
|
||||
+++ b/libavcodec/arm/fmtconvert_vfp.S
|
||||
@@ -83,6 +83,168 @@ endfunc
|
||||
* Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
|
||||
* (16 bytes alignment is best for BCM2835), little-endian.
|
||||
*/
|
||||
+@ void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst, const int32_t *src, const float *mul, int len)
|
||||
+function ff_int32_to_float_fmul_array8_vfp, export=1
|
||||
+ push {lr}
|
||||
+ ldr a1, [sp, #4]
|
||||
+ subs lr, a1, #3*8
|
||||
+ bcc 50f @ too short to pipeline
|
||||
+ @ Now need to find (len / 8) % 3. The approximation
|
||||
+ @ x / 24 = (x * 0xAB) >> 12
|
||||
+ @ is good for x < 4096, which is true for both AC3 and DCA.
|
||||
+ mov a1, #0xAB
|
||||
+ ldr ip, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
|
||||
+ mul a1, lr, a1
|
||||
+ vpush {s16-s31}
|
||||
+ mov a1, a1, lsr #12
|
||||
+ add a1, a1, a1, lsl #1
|
||||
+ rsb a1, a1, lr, lsr #3
|
||||
+ cmp a1, #1
|
||||
+ fmrx a1, FPSCR
|
||||
+ fmxr FPSCR, ip
|
||||
+ beq 11f
|
||||
+ blo 10f
|
||||
+ @ Array is (2 + multiple of 3) x 8 floats long
|
||||
+ @ drop through...
|
||||
+ vldmia a3!, {s16-s23}
|
||||
+ vldmia a4!, {s2,s3}
|
||||
+ vldmia a3!, {s24-s31}
|
||||
+ vcvt.f32.s32 s16, s16
|
||||
+ vcvt.f32.s32 s17, s17
|
||||
+ vcvt.f32.s32 s18, s18
|
||||
+ vcvt.f32.s32 s19, s19
|
||||
+ vcvt.f32.s32 s20, s20
|
||||
+ vcvt.f32.s32 s21, s21
|
||||
+ vcvt.f32.s32 s22, s22
|
||||
+ vcvt.f32.s32 s23, s23
|
||||
+ vmul.f32 s16, s16, s2
|
||||
+ @ drop through...
|
||||
+3:
|
||||
+ vldmia a3!, {s8-s15}
|
||||
+ vldmia a4!, {s1}
|
||||
+ vcvt.f32.s32 s24, s24
|
||||
+ vcvt.f32.s32 s25, s25
|
||||
+ vcvt.f32.s32 s26, s26
|
||||
+ vcvt.f32.s32 s27, s27
|
||||
+ vcvt.f32.s32 s28, s28
|
||||
+ vcvt.f32.s32 s29, s29
|
||||
+ vcvt.f32.s32 s30, s30
|
||||
+ vcvt.f32.s32 s31, s31
|
||||
+ vmul.f32 s24, s24, s3
|
||||
+ vstmia a2!, {s16-s19}
|
||||
+ vstmia a2!, {s20-s23}
|
||||
+2:
|
||||
+ vldmia a3!, {s16-s23}
|
||||
+ vldmia a4!, {s2}
|
||||
+ vcvt.f32.s32 s8, s8
|
||||
+ vcvt.f32.s32 s9, s9
|
||||
+ vcvt.f32.s32 s10, s10
|
||||
+ vcvt.f32.s32 s11, s11
|
||||
+ vcvt.f32.s32 s12, s12
|
||||
+ vcvt.f32.s32 s13, s13
|
||||
+ vcvt.f32.s32 s14, s14
|
||||
+ vcvt.f32.s32 s15, s15
|
||||
+ vmul.f32 s8, s8, s1
|
||||
+ vstmia a2!, {s24-s27}
|
||||
+ vstmia a2!, {s28-s31}
|
||||
+1:
|
||||
+ vldmia a3!, {s24-s31}
|
||||
+ vldmia a4!, {s3}
|
||||
+ vcvt.f32.s32 s16, s16
|
||||
+ vcvt.f32.s32 s17, s17
|
||||
+ vcvt.f32.s32 s18, s18
|
||||
+ vcvt.f32.s32 s19, s19
|
||||
+ vcvt.f32.s32 s20, s20
|
||||
+ vcvt.f32.s32 s21, s21
|
||||
+ vcvt.f32.s32 s22, s22
|
||||
+ vcvt.f32.s32 s23, s23
|
||||
+ vmul.f32 s16, s16, s2
|
||||
+ vstmia a2!, {s8-s11}
|
||||
+ vstmia a2!, {s12-s15}
|
||||
+
|
||||
+ subs lr, lr, #8*3
|
||||
+ bpl 3b
|
||||
+
|
||||
+ vcvt.f32.s32 s24, s24
|
||||
+ vcvt.f32.s32 s25, s25
|
||||
+ vcvt.f32.s32 s26, s26
|
||||
+ vcvt.f32.s32 s27, s27
|
||||
+ vcvt.f32.s32 s28, s28
|
||||
+ vcvt.f32.s32 s29, s29
|
||||
+ vcvt.f32.s32 s30, s30
|
||||
+ vcvt.f32.s32 s31, s31
|
||||
+ vmul.f32 s24, s24, s3
|
||||
+ vstmia a2!, {s16-s19}
|
||||
+ vstmia a2!, {s20-s23}
|
||||
+ vstmia a2!, {s24-s27}
|
||||
+ vstmia a2!, {s28-s31}
|
||||
+
|
||||
+ fmxr FPSCR, a1
|
||||
+ vpop {s16-s31}
|
||||
+ pop {pc}
|
||||
+
|
||||
+10: @ Array is (multiple of 3) x 8 floats long
|
||||
+ vldmia a3!, {s8-s15}
|
||||
+ vldmia a4!, {s1,s2}
|
||||
+ vldmia a3!, {s16-s23}
|
||||
+ vcvt.f32.s32 s8, s8
|
||||
+ vcvt.f32.s32 s9, s9
|
||||
+ vcvt.f32.s32 s10, s10
|
||||
+ vcvt.f32.s32 s11, s11
|
||||
+ vcvt.f32.s32 s12, s12
|
||||
+ vcvt.f32.s32 s13, s13
|
||||
+ vcvt.f32.s32 s14, s14
|
||||
+ vcvt.f32.s32 s15, s15
|
||||
+ vmul.f32 s8, s8, s1
|
||||
+ b 1b
|
||||
+
|
||||
+11: @ Array is (1 + multiple of 3) x 8 floats long
|
||||
+ vldmia a3!, {s24-s31}
|
||||
+ vldmia a4!, {s3}
|
||||
+ vldmia a3!, {s8-s15}
|
||||
+ vldmia a4!, {s1}
|
||||
+ vcvt.f32.s32 s24, s24
|
||||
+ vcvt.f32.s32 s25, s25
|
||||
+ vcvt.f32.s32 s26, s26
|
||||
+ vcvt.f32.s32 s27, s27
|
||||
+ vcvt.f32.s32 s28, s28
|
||||
+ vcvt.f32.s32 s29, s29
|
||||
+ vcvt.f32.s32 s30, s30
|
||||
+ vcvt.f32.s32 s31, s31
|
||||
+ vmul.f32 s24, s24, s3
|
||||
+ b 2b
|
||||
+
|
||||
+50:
|
||||
+ ldr lr, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
|
||||
+ fmrx ip, FPSCR
|
||||
+ fmxr FPSCR, lr
|
||||
+51:
|
||||
+ vldmia a3!, {s8-s15}
|
||||
+ vldmia a4!, {s0}
|
||||
+ vcvt.f32.s32 s8, s8
|
||||
+ vcvt.f32.s32 s9, s9
|
||||
+ vcvt.f32.s32 s10, s10
|
||||
+ vcvt.f32.s32 s11, s11
|
||||
+ vcvt.f32.s32 s12, s12
|
||||
+ vcvt.f32.s32 s13, s13
|
||||
+ vcvt.f32.s32 s14, s14
|
||||
+ vcvt.f32.s32 s15, s15
|
||||
+ vmul.f32 s8, s8, s0
|
||||
+ subs a1, a1, #8
|
||||
+ vstmia a2!, {s8-s11}
|
||||
+ vstmia a2!, {s12-s15}
|
||||
+ bne 51b
|
||||
+
|
||||
+ fmxr FPSCR, ip
|
||||
+ pop {pc}
|
||||
+endfunc
|
||||
+
|
||||
+/**
|
||||
+ * ARM VFP optimised int32 to float conversion.
|
||||
+ * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
|
||||
+ * (16 bytes alignment is best for BCM2835), little-endian.
|
||||
+ * TODO: could be further optimised by unrolling and interleaving, as above
|
||||
+ */
|
||||
@ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src, float mul, int len)
|
||||
function ff_int32_to_float_fmul_scalar_vfp, export=1
|
||||
VFP tmp .req a4
|
||||
--
|
||||
1.7.9.5
|
@ -1,274 +0,0 @@
|
||||
From 15520de67fc951213ab32661b8b368a9439e8b9a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
|
||||
Date: Fri, 19 Jul 2013 10:59:17 +0300
|
||||
Subject: [PATCH 44/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of imdct_half
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 2653.0 28.5 1108.8 51.4 +139.3%
|
||||
Overall 17049.5 408.2 15973.0 223.2 +6.7%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/Makefile | 1 +
|
||||
libavcodec/arm/fft_init_arm.c | 9 ++
|
||||
libavcodec/arm/mdct_vfp.S | 205 ++++++++++++++++++++++++++++++
|
||||
3 files changed, 215 insertions(+)
|
||||
create mode 100644 libavcodec/arm/mdct_vfp.S
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index aee9d73..27e80d5 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -59,6 +59,7 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \
|
||||
arm/simple_idct_armv6.o \
|
||||
|
||||
VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_vfp.o
|
||||
+VFP-OBJS-$(CONFIG_MDCT) += arm/mdct_vfp.o
|
||||
VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
|
||||
|
||||
NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \
|
||||
diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c
|
||||
index fe0acc5..a000ea5 100644
|
||||
--- a/libavcodec/arm/fft_init_arm.c
|
||||
+++ b/libavcodec/arm/fft_init_arm.c
|
||||
@@ -26,6 +26,8 @@
|
||||
void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
|
||||
void ff_fft_calc_neon(FFTContext *s, FFTComplex *z);
|
||||
|
||||
+void ff_imdct_half_vfp(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
+
|
||||
void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
@@ -48,6 +50,13 @@ av_cold void ff_fft_init_arm(FFTContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
+ if (have_vfp(cpu_flags)) {
|
||||
+#if CONFIG_MDCT
|
||||
+ if (!have_vfpv3(cpu_flags))
|
||||
+ s->imdct_half = ff_imdct_half_vfp;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
if (have_neon(cpu_flags)) {
|
||||
#if CONFIG_FFT
|
||||
s->fft_permute = ff_fft_permute_neon;
|
||||
diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S
|
||||
new file mode 100644
|
||||
index 0000000..0623e96
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/mdct_vfp.S
|
||||
@@ -0,0 +1,205 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd
|
||||
+ * Author: Ben Avison <bavison@riscosopen.org>
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+
|
||||
+#include "libavutil/arm/asm.S"
|
||||
+
|
||||
+CONTEXT .req a1
|
||||
+ORIGOUT .req a2
|
||||
+IN .req a3
|
||||
+OUT .req v1
|
||||
+REVTAB .req v2
|
||||
+TCOS .req v3
|
||||
+TSIN .req v4
|
||||
+OLDFPSCR .req v5
|
||||
+J0 .req a2
|
||||
+J1 .req a4
|
||||
+J2 .req ip
|
||||
+J3 .req lr
|
||||
+
|
||||
+.macro prerotation_innerloop
|
||||
+ .set trig_lo, k
|
||||
+ .set trig_hi, n4 - k - 2
|
||||
+ .set in_lo, trig_lo * 2
|
||||
+ .set in_hi, trig_hi * 2
|
||||
+ vldr d8, [TCOS, #trig_lo*4] @ s16,s17
|
||||
+ vldr d9, [TCOS, #trig_hi*4] @ s18,s19
|
||||
+ vldr s0, [IN, #in_hi*4 + 12]
|
||||
+ vldr s1, [IN, #in_hi*4 + 4]
|
||||
+ vldr s2, [IN, #in_lo*4 + 12]
|
||||
+ vldr s3, [IN, #in_lo*4 + 4]
|
||||
+ vmul.f s8, s0, s16 @ vector operation
|
||||
+ vldr d10, [TSIN, #trig_lo*4] @ s20,s21
|
||||
+ vldr d11, [TSIN, #trig_hi*4] @ s22,s23
|
||||
+ vldr s4, [IN, #in_lo*4]
|
||||
+ vldr s5, [IN, #in_lo*4 + 8]
|
||||
+ vldr s6, [IN, #in_hi*4]
|
||||
+ vldr s7, [IN, #in_hi*4 + 8]
|
||||
+ ldr J0, [REVTAB, #trig_lo*2]
|
||||
+ vmul.f s12, s0, s20 @ vector operation
|
||||
+ ldr J2, [REVTAB, #trig_hi*2]
|
||||
+ mov J1, J0, lsr #16
|
||||
+ and J0, J0, #255 @ halfword value will be < n4
|
||||
+ vmls.f s8, s4, s20 @ vector operation
|
||||
+ mov J3, J2, lsr #16
|
||||
+ and J2, J2, #255 @ halfword value will be < n4
|
||||
+ add J0, OUT, J0, lsl #3
|
||||
+ vmla.f s12, s4, s16 @ vector operation
|
||||
+ add J1, OUT, J1, lsl #3
|
||||
+ add J2, OUT, J2, lsl #3
|
||||
+ add J3, OUT, J3, lsl #3
|
||||
+ vstr s8, [J0]
|
||||
+ vstr s9, [J1]
|
||||
+ vstr s10, [J2]
|
||||
+ vstr s11, [J3]
|
||||
+ vstr s12, [J0, #4]
|
||||
+ vstr s13, [J1, #4]
|
||||
+ vstr s14, [J2, #4]
|
||||
+ vstr s15, [J3, #4]
|
||||
+ .set k, k + 2
|
||||
+.endm
|
||||
+
|
||||
+.macro postrotation_innerloop tail, head
|
||||
+ .set trig_lo_head, n8 - k - 2
|
||||
+ .set trig_hi_head, n8 + k
|
||||
+ .set out_lo_head, trig_lo_head * 2
|
||||
+ .set out_hi_head, trig_hi_head * 2
|
||||
+ .set trig_lo_tail, n8 - (k - 2) - 2
|
||||
+ .set trig_hi_tail, n8 + (k - 2)
|
||||
+ .set out_lo_tail, trig_lo_tail * 2
|
||||
+ .set out_hi_tail, trig_hi_tail * 2
|
||||
+ .if (k & 2) == 0
|
||||
+ TCOS_D0_HEAD .req d10 @ s20,s21
|
||||
+ TCOS_D1_HEAD .req d11 @ s22,s23
|
||||
+ TCOS_S0_TAIL .req s24
|
||||
+ .else
|
||||
+ TCOS_D0_HEAD .req d12 @ s24,s25
|
||||
+ TCOS_D1_HEAD .req d13 @ s26,s27
|
||||
+ TCOS_S0_TAIL .req s20
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vmls.f s8, s0, TCOS_S0_TAIL @ vector operation
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vldr d8, [TSIN, #trig_lo_head*4] @ s16,s17
|
||||
+ vldr d9, [TSIN, #trig_hi_head*4] @ s18,s19
|
||||
+ vldr TCOS_D0_HEAD, [TCOS, #trig_lo_head*4]
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vmla.f s12, s4, TCOS_S0_TAIL @ vector operation
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vldr s0, [OUT, #out_lo_head*4]
|
||||
+ vldr s1, [OUT, #out_lo_head*4 + 8]
|
||||
+ vldr s2, [OUT, #out_hi_head*4]
|
||||
+ vldr s3, [OUT, #out_hi_head*4 + 8]
|
||||
+ vldr s4, [OUT, #out_lo_head*4 + 4]
|
||||
+ vldr s5, [OUT, #out_lo_head*4 + 12]
|
||||
+ vldr s6, [OUT, #out_hi_head*4 + 4]
|
||||
+ vldr s7, [OUT, #out_hi_head*4 + 12]
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vstr s8, [OUT, #out_lo_tail*4]
|
||||
+ vstr s9, [OUT, #out_lo_tail*4 + 8]
|
||||
+ vstr s10, [OUT, #out_hi_tail*4]
|
||||
+ vstr s11, [OUT, #out_hi_tail*4 + 8]
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vmul.f s8, s4, s16 @ vector operation
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vstr s12, [OUT, #out_hi_tail*4 + 12]
|
||||
+ vstr s13, [OUT, #out_hi_tail*4 + 4]
|
||||
+ vstr s14, [OUT, #out_lo_tail*4 + 12]
|
||||
+ vstr s15, [OUT, #out_lo_tail*4 + 4]
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vmul.f s12, s0, s16 @ vector operation
|
||||
+ vldr TCOS_D1_HEAD, [TCOS, #trig_hi_head*4]
|
||||
+ .endif
|
||||
+ .unreq TCOS_D0_HEAD
|
||||
+ .unreq TCOS_D1_HEAD
|
||||
+ .unreq TCOS_S0_TAIL
|
||||
+ .ifnc "\head",""
|
||||
+ .set k, k + 2
|
||||
+ .endif
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+/* void ff_imdct_half_vfp(FFTContext *s,
|
||||
+ * FFTSample *output,
|
||||
+ * const FFTSample *input)
|
||||
+ */
|
||||
+function ff_imdct_half_vfp, export=1
|
||||
+ ldr ip, [CONTEXT, #5*4] @ mdct_bits
|
||||
+ teq ip, #6
|
||||
+ it ne
|
||||
+ bne ff_imdct_half_c @ only case currently accelerated is the one used by DCA
|
||||
+
|
||||
+ .set n, 1<<6
|
||||
+ .set n2, n/2
|
||||
+ .set n4, n/4
|
||||
+ .set n8, n/8
|
||||
+
|
||||
+ push {v1-v5,lr}
|
||||
+ vpush {s16-s27}
|
||||
+ fmrx OLDFPSCR, FPSCR
|
||||
+ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
|
||||
+ fmxr FPSCR, lr
|
||||
+ mov OUT, ORIGOUT
|
||||
+ ldr REVTAB, [CONTEXT, #2*4]
|
||||
+ ldr TCOS, [CONTEXT, #6*4]
|
||||
+ ldr TSIN, [CONTEXT, #7*4]
|
||||
+
|
||||
+ .set k, 0
|
||||
+ .rept n8/2
|
||||
+ prerotation_innerloop
|
||||
+ .endr
|
||||
+
|
||||
+ fmxr FPSCR, OLDFPSCR
|
||||
+ mov a1, OUT
|
||||
+ bl ff_fft16_vfp
|
||||
+ ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
|
||||
+ fmxr FPSCR, lr
|
||||
+
|
||||
+ .set k, 0
|
||||
+ postrotation_innerloop , head
|
||||
+ .rept n8/2 - 1
|
||||
+ postrotation_innerloop tail, head
|
||||
+ .endr
|
||||
+ postrotation_innerloop tail
|
||||
+
|
||||
+ fmxr FPSCR, OLDFPSCR
|
||||
+ vpop {s16-s27}
|
||||
+ pop {v1-v5,pc}
|
||||
+endfunc
|
||||
+
|
||||
+ .unreq CONTEXT
|
||||
+ .unreq ORIGOUT
|
||||
+ .unreq IN
|
||||
+ .unreq OUT
|
||||
+ .unreq REVTAB
|
||||
+ .unreq TCOS
|
||||
+ .unreq TSIN
|
||||
+ .unreq OLDFPSCR
|
||||
+ .unreq J0
|
||||
+ .unreq J1
|
||||
+ .unreq J2
|
||||
+ .unreq J3
|
||||
--
|
||||
1.7.9.5
|
@ -1,58 +0,0 @@
|
||||
From 8e0babd84c7e03cf678aab8bcf7e2106fe2b3de6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
|
||||
Date: Fri, 19 Jul 2013 11:03:32 +0300
|
||||
Subject: [PATCH 45/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of dca_lfe_fir
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 868.2 33.5 436.0 27.0 +99.1%
|
||||
Overall 15973.0 223.2 15577.5 83.2 +2.5%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/Makefile | 3 ++-
|
||||
libavcodec/arm/dcadsp_init_arm.c | 4 ++++
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index 27e80d5..7fe5bb5 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -58,7 +58,8 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \
|
||||
arm/dsputil_armv6.o \
|
||||
arm/simple_idct_armv6.o \
|
||||
|
||||
-VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_vfp.o
|
||||
+VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_vfp.o \
|
||||
+ arm/synth_filter_vfp.o
|
||||
VFP-OBJS-$(CONFIG_MDCT) += arm/mdct_vfp.o
|
||||
VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
|
||||
|
||||
diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c
|
||||
index 56568e0..a1efbff 100644
|
||||
--- a/libavcodec/arm/dcadsp_init_arm.c
|
||||
+++ b/libavcodec/arm/dcadsp_init_arm.c
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavcodec/dcadsp.h"
|
||||
|
||||
+void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs,
|
||||
+ int decifactor, float scale);
|
||||
void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
|
||||
int decifactor, float scale);
|
||||
|
||||
@@ -31,6 +33,8 @@ av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
+ if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags))
|
||||
+ s->lfe_fir = ff_dca_lfe_fir_vfp;
|
||||
if (have_neon(cpu_flags))
|
||||
s->lfe_fir = ff_dca_lfe_fir_neon;
|
||||
}
|
||||
--
|
||||
1.7.9.5
|
@ -1,339 +0,0 @@
|
||||
From 018b74ea9d8f52788db18ed40838afca05e7b4df Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
|
||||
Date: Fri, 19 Jul 2013 11:23:57 +0300
|
||||
Subject: [PATCH 46/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of fft16
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 1389.3 4.2 967.8 35.1 +43.6%
|
||||
Overall 15577.5 83.2 15400.0 336.4 +1.2%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/Makefile | 1 +
|
||||
libavcodec/arm/fft_vfp.S | 298 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 299 insertions(+)
|
||||
create mode 100644 libavcodec/arm/fft_vfp.S
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index 7fe5bb5..7390a8b 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -60,6 +60,7 @@ ARMV6-OBJS += arm/dsputil_init_armv6.o \
|
||||
|
||||
VFP-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_vfp.o \
|
||||
arm/synth_filter_vfp.o
|
||||
+VFP-OBJS-$(CONFIG_FFT) += arm/fft_vfp.o
|
||||
VFP-OBJS-$(CONFIG_MDCT) += arm/mdct_vfp.o
|
||||
VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
|
||||
|
||||
diff --git a/libavcodec/arm/fft_vfp.S b/libavcodec/arm/fft_vfp.S
|
||||
new file mode 100644
|
||||
index 0000000..7845ebb
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/fft_vfp.S
|
||||
@@ -0,0 +1,298 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd
|
||||
+ * Author: Ben Avison <bavison@riscosopen.org>
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+
|
||||
+#include "libavutil/arm/asm.S"
|
||||
+
|
||||
+@ TODO: * FFTs wider than 16
|
||||
+@ * dispatch code
|
||||
+
|
||||
+function fft4_vfp
|
||||
+ vldr d0, [a1, #0*2*4] @ s0,s1 = z[0]
|
||||
+ vldr d4, [a1, #1*2*4] @ s8,s9 = z[1]
|
||||
+ vldr d1, [a1, #2*2*4] @ s2,s3 = z[2]
|
||||
+ vldr d5, [a1, #3*2*4] @ s10,s11 = z[3]
|
||||
+ @ stall
|
||||
+ vadd.f s12, s0, s8 @ i0
|
||||
+ vadd.f s13, s1, s9 @ i1
|
||||
+ vadd.f s14, s2, s10 @ i2
|
||||
+ vadd.f s15, s3, s11 @ i3
|
||||
+ vsub.f s8, s0, s8 @ i4
|
||||
+ vsub.f s9, s1, s9 @ i5
|
||||
+ vsub.f s10, s2, s10 @ i6
|
||||
+ vsub.f s11, s3, s11 @ i7
|
||||
+ @ stall
|
||||
+ @ stall
|
||||
+ vadd.f s0, s12, s14 @ z[0].re
|
||||
+ vsub.f s4, s12, s14 @ z[2].re
|
||||
+ vadd.f s1, s13, s15 @ z[0].im
|
||||
+ vsub.f s5, s13, s15 @ z[2].im
|
||||
+ vadd.f s7, s9, s10 @ z[3].im
|
||||
+ vsub.f s3, s9, s10 @ z[1].im
|
||||
+ vadd.f s2, s8, s11 @ z[1].re
|
||||
+ vsub.f s6, s8, s11 @ z[3].re
|
||||
+ @ stall
|
||||
+ @ stall
|
||||
+ vstr d0, [a1, #0*2*4]
|
||||
+ vstr d2, [a1, #2*2*4]
|
||||
+ @ stall
|
||||
+ @ stall
|
||||
+ vstr d1, [a1, #1*2*4]
|
||||
+ vstr d3, [a1, #3*2*4]
|
||||
+
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+
|
||||
+.macro macro_fft8_head
|
||||
+ @ FFT4
|
||||
+ vldr d4, [a1, #0 * 2*4]
|
||||
+ vldr d6, [a1, #1 * 2*4]
|
||||
+ vldr d5, [a1, #2 * 2*4]
|
||||
+ vldr d7, [a1, #3 * 2*4]
|
||||
+ @ BF
|
||||
+ vldr d12, [a1, #4 * 2*4]
|
||||
+ vadd.f s16, s8, s12 @ vector op
|
||||
+ vldr d14, [a1, #5 * 2*4]
|
||||
+ vldr d13, [a1, #6 * 2*4]
|
||||
+ vldr d15, [a1, #7 * 2*4]
|
||||
+ vsub.f s20, s8, s12 @ vector op
|
||||
+ vadd.f s0, s16, s18
|
||||
+ vsub.f s2, s16, s18
|
||||
+ vadd.f s1, s17, s19
|
||||
+ vsub.f s3, s17, s19
|
||||
+ vadd.f s7, s21, s22
|
||||
+ vsub.f s5, s21, s22
|
||||
+ vadd.f s4, s20, s23
|
||||
+ vsub.f s6, s20, s23
|
||||
+ vsub.f s20, s24, s28 @ vector op
|
||||
+ vstr d0, [a1, #0 * 2*4] @ transfer s0-s7 to s24-s31 via memory
|
||||
+ vstr d1, [a1, #1 * 2*4]
|
||||
+ vldr s0, cos1pi4
|
||||
+ vadd.f s16, s24, s28 @ vector op
|
||||
+ vstr d2, [a1, #2 * 2*4]
|
||||
+ vstr d3, [a1, #3 * 2*4]
|
||||
+ vldr d12, [a1, #0 * 2*4]
|
||||
+ @ TRANSFORM
|
||||
+ vmul.f s20, s20, s0 @ vector x scalar op
|
||||
+ vldr d13, [a1, #1 * 2*4]
|
||||
+ vldr d14, [a1, #2 * 2*4]
|
||||
+ vldr d15, [a1, #3 * 2*4]
|
||||
+ @ BUTTERFLIES
|
||||
+ vadd.f s0, s18, s16
|
||||
+ vadd.f s1, s17, s19
|
||||
+ vsub.f s2, s17, s19
|
||||
+ vsub.f s3, s18, s16
|
||||
+ vadd.f s4, s21, s20
|
||||
+ vsub.f s5, s21, s20
|
||||
+ vadd.f s6, s22, s23
|
||||
+ vsub.f s7, s22, s23
|
||||
+ vadd.f s8, s0, s24 @ vector op
|
||||
+ vstr d0, [a1, #0 * 2*4] @ transfer s0-s3 to s12-s15 via memory
|
||||
+ vstr d1, [a1, #1 * 2*4]
|
||||
+ vldr d6, [a1, #0 * 2*4]
|
||||
+ vldr d7, [a1, #1 * 2*4]
|
||||
+ vadd.f s1, s5, s6
|
||||
+ vadd.f s0, s7, s4
|
||||
+ vsub.f s2, s5, s6
|
||||
+ vsub.f s3, s7, s4
|
||||
+ vsub.f s12, s24, s12 @ vector op
|
||||
+ vsub.f s5, s29, s1
|
||||
+ vsub.f s4, s28, s0
|
||||
+ vsub.f s6, s30, s2
|
||||
+ vsub.f s7, s31, s3
|
||||
+ vadd.f s16, s0, s28 @ vector op
|
||||
+ vstr d6, [a1, #4 * 2*4]
|
||||
+ vstr d7, [a1, #6 * 2*4]
|
||||
+ vstr d4, [a1, #0 * 2*4]
|
||||
+ vstr d5, [a1, #2 * 2*4]
|
||||
+ vstr d2, [a1, #5 * 2*4]
|
||||
+ vstr d3, [a1, #7 * 2*4]
|
||||
+.endm
|
||||
+
|
||||
+.macro macro_fft8_tail
|
||||
+ vstr d8, [a1, #1 * 2*4]
|
||||
+ vstr d9, [a1, #3 * 2*4]
|
||||
+.endm
|
||||
+
|
||||
+function fft8_vfp
|
||||
+ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1
|
||||
+ fmrx a2, FPSCR
|
||||
+ fmxr FPSCR, a3
|
||||
+ vpush {s16-s31}
|
||||
+
|
||||
+ macro_fft8_head
|
||||
+ macro_fft8_tail
|
||||
+
|
||||
+ vpop {s16-s31}
|
||||
+ fmxr FPSCR, a2
|
||||
+ bx lr
|
||||
+endfunc
|
||||
+
|
||||
+.align 3
|
||||
+cos1pi4: @ cos(1*pi/4) = sqrt(2)
|
||||
+ .float 0.707106769084930419921875
|
||||
+cos1pi8: @ cos(1*pi/8) = sqrt(2+sqrt(2))/2
|
||||
+ .float 0.92387950420379638671875
|
||||
+cos3pi8: @ cos(2*pi/8) = sqrt(2-sqrt(2))/2
|
||||
+ .float 0.3826834261417388916015625
|
||||
+
|
||||
+function ff_fft16_vfp, export=1
|
||||
+ ldr a3, =0x03030000 @ RunFast mode, vector length 4, stride 1
|
||||
+ fmrx a2, FPSCR
|
||||
+ fmxr FPSCR, a3
|
||||
+ vpush {s16-s31}
|
||||
+
|
||||
+ macro_fft8_head
|
||||
+ @ FFT4(z+8)
|
||||
+ vldr d10, [a1, #8 * 2*4]
|
||||
+ vldr d12, [a1, #9 * 2*4]
|
||||
+ vldr d11, [a1, #10 * 2*4]
|
||||
+ vldr d13, [a1, #11 * 2*4]
|
||||
+ macro_fft8_tail
|
||||
+ vadd.f s16, s20, s24 @ vector op
|
||||
+ @ FFT4(z+12)
|
||||
+ vldr d4, [a1, #12 * 2*4]
|
||||
+ vldr d6, [a1, #13 * 2*4]
|
||||
+ vldr d5, [a1, #14 * 2*4]
|
||||
+ vsub.f s20, s20, s24 @ vector op
|
||||
+ vldr d7, [a1, #15 * 2*4]
|
||||
+ vadd.f s0, s16, s18
|
||||
+ vsub.f s4, s16, s18
|
||||
+ vadd.f s1, s17, s19
|
||||
+ vsub.f s5, s17, s19
|
||||
+ vadd.f s7, s21, s22
|
||||
+ vsub.f s3, s21, s22
|
||||
+ vadd.f s2, s20, s23
|
||||
+ vsub.f s6, s20, s23
|
||||
+ vadd.f s16, s8, s12 @ vector op
|
||||
+ vstr d0, [a1, #8 * 2*4]
|
||||
+ vstr d2, [a1, #10 * 2*4]
|
||||
+ vstr d1, [a1, #9 * 2*4]
|
||||
+ vsub.f s20, s8, s12
|
||||
+ vstr d3, [a1, #11 * 2*4]
|
||||
+ @ TRANSFORM(z[2],z[6],z[10],z[14],cos1pi4,cos1pi4)
|
||||
+ vldr d12, [a1, #10 * 2*4]
|
||||
+ vadd.f s0, s16, s18
|
||||
+ vadd.f s1, s17, s19
|
||||
+ vsub.f s6, s16, s18
|
||||
+ vsub.f s7, s17, s19
|
||||
+ vsub.f s3, s21, s22
|
||||
+ vadd.f s2, s20, s23
|
||||
+ vadd.f s5, s21, s22
|
||||
+ vsub.f s4, s20, s23
|
||||
+ vstr d0, [a1, #12 * 2*4]
|
||||
+ vmov s0, s6
|
||||
+ @ TRANSFORM(z[1],z[5],z[9],z[13],cos1pi8,cos3pi8)
|
||||
+ vldr d6, [a1, #9 * 2*4]
|
||||
+ vstr d1, [a1, #13 * 2*4]
|
||||
+ vldr d1, cos1pi4 @ s2 = cos1pi4, s3 = cos1pi8
|
||||
+ vstr d2, [a1, #15 * 2*4]
|
||||
+ vldr d7, [a1, #13 * 2*4]
|
||||
+ vadd.f s4, s25, s24
|
||||
+ vsub.f s5, s25, s24
|
||||
+ vsub.f s6, s0, s7
|
||||
+ vadd.f s7, s0, s7
|
||||
+ vmul.f s20, s12, s3 @ vector op
|
||||
+ @ TRANSFORM(z[3],z[7],z[11],z[15],cos3pi8,cos1pi8)
|
||||
+ vldr d4, [a1, #11 * 2*4]
|
||||
+ vldr d5, [a1, #15 * 2*4]
|
||||
+ vldr s1, cos3pi8
|
||||
+ vmul.f s24, s4, s2 @ vector * scalar op
|
||||
+ vmul.f s28, s12, s1 @ vector * scalar op
|
||||
+ vmul.f s12, s8, s1 @ vector * scalar op
|
||||
+ vadd.f s4, s20, s29
|
||||
+ vsub.f s5, s21, s28
|
||||
+ vsub.f s6, s22, s31
|
||||
+ vadd.f s7, s23, s30
|
||||
+ vmul.f s8, s8, s3 @ vector * scalar op
|
||||
+ vldr d8, [a1, #1 * 2*4]
|
||||
+ vldr d9, [a1, #5 * 2*4]
|
||||
+ vldr d10, [a1, #3 * 2*4]
|
||||
+ vldr d11, [a1, #7 * 2*4]
|
||||
+ vldr d14, [a1, #2 * 2*4]
|
||||
+ vadd.f s0, s6, s4
|
||||
+ vadd.f s1, s5, s7
|
||||
+ vsub.f s2, s5, s7
|
||||
+ vsub.f s3, s6, s4
|
||||
+ vadd.f s4, s12, s9
|
||||
+ vsub.f s5, s13, s8
|
||||
+ vsub.f s6, s14, s11
|
||||
+ vadd.f s7, s15, s10
|
||||
+ vadd.f s12, s0, s16 @ vector op
|
||||
+ vstr d0, [a1, #1 * 2*4]
|
||||
+ vstr d1, [a1, #5 * 2*4]
|
||||
+ vldr d4, [a1, #1 * 2*4]
|
||||
+ vldr d5, [a1, #5 * 2*4]
|
||||
+ vadd.f s0, s6, s4
|
||||
+ vadd.f s1, s5, s7
|
||||
+ vsub.f s2, s5, s7
|
||||
+ vsub.f s3, s6, s4
|
||||
+ vsub.f s8, s16, s8 @ vector op
|
||||
+ vstr d6, [a1, #1 * 2*4]
|
||||
+ vstr d7, [a1, #5 * 2*4]
|
||||
+ vldr d15, [a1, #6 * 2*4]
|
||||
+ vsub.f s4, s20, s0
|
||||
+ vsub.f s5, s21, s1
|
||||
+ vsub.f s6, s22, s2
|
||||
+ vsub.f s7, s23, s3
|
||||
+ vadd.f s20, s0, s20 @ vector op
|
||||
+ vstr d4, [a1, #9 * 2*4]
|
||||
+ @ TRANSFORM_ZERO(z[0],z[4],z[8],z[12])
|
||||
+ vldr d6, [a1, #8 * 2*4]
|
||||
+ vstr d5, [a1, #13 * 2*4]
|
||||
+ vldr d7, [a1, #12 * 2*4]
|
||||
+ vstr d2, [a1, #11 * 2*4]
|
||||
+ vldr d8, [a1, #0 * 2*4]
|
||||
+ vstr d3, [a1, #15 * 2*4]
|
||||
+ vldr d9, [a1, #4 * 2*4]
|
||||
+ vadd.f s0, s26, s24
|
||||
+ vadd.f s1, s25, s27
|
||||
+ vsub.f s2, s25, s27
|
||||
+ vsub.f s3, s26, s24
|
||||
+ vadd.f s4, s14, s12
|
||||
+ vadd.f s5, s13, s15
|
||||
+ vsub.f s6, s13, s15
|
||||
+ vsub.f s7, s14, s12
|
||||
+ vadd.f s8, s0, s28 @ vector op
|
||||
+ vstr d0, [a1, #3 * 2*4]
|
||||
+ vstr d1, [a1, #7 * 2*4]
|
||||
+ vldr d6, [a1, #3 * 2*4]
|
||||
+ vldr d7, [a1, #7 * 2*4]
|
||||
+ vsub.f s0, s16, s4
|
||||
+ vsub.f s1, s17, s5
|
||||
+ vsub.f s2, s18, s6
|
||||
+ vsub.f s3, s19, s7
|
||||
+ vsub.f s12, s28, s12 @ vector op
|
||||
+ vadd.f s16, s4, s16 @ vector op
|
||||
+ vstr d10, [a1, #3 * 2*4]
|
||||
+ vstr d11, [a1, #7 * 2*4]
|
||||
+ vstr d4, [a1, #2 * 2*4]
|
||||
+ vstr d5, [a1, #6 * 2*4]
|
||||
+ vstr d0, [a1, #8 * 2*4]
|
||||
+ vstr d1, [a1, #12 * 2*4]
|
||||
+ vstr d6, [a1, #10 * 2*4]
|
||||
+ vstr d7, [a1, #14 * 2*4]
|
||||
+ vstr d8, [a1, #0 * 2*4]
|
||||
+ vstr d9, [a1, #4 * 2*4]
|
||||
+
|
||||
+ vpop {s16-s31}
|
||||
+ fmxr FPSCR, a2
|
||||
+ bx lr
|
||||
+endfunc
|
||||
--
|
||||
1.7.9.5
|
@ -1,140 +0,0 @@
|
||||
From ed16009b0a05fbd344832d5ad2e982c169aec42c Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:16 +0100
|
||||
Subject: [PATCH 47/49] [ffmpeg] - backport - dcadsp: Add a new method,
|
||||
qmf_32_subbands
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This does most of the work formerly carried out by
|
||||
the static function qmf_32_subbands() in dcadec.c.
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/dcadec.c | 26 +++++---------------------
|
||||
libavcodec/dcadsp.c | 30 ++++++++++++++++++++++++++++++
|
||||
libavcodec/dcadsp.h | 9 +++++++++
|
||||
3 files changed, 44 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
|
||||
index b648613..4054d63 100644
|
||||
--- a/libavcodec/dcadec.c
|
||||
+++ b/libavcodec/dcadec.c
|
||||
@@ -1108,10 +1108,8 @@ static void qmf_32_subbands(DCAContext *s, int chans,
|
||||
float scale)
|
||||
{
|
||||
const float *prCoeff;
|
||||
- int i;
|
||||
|
||||
int sb_act = s->subband_activity[chans];
|
||||
- int subindex;
|
||||
|
||||
scale *= sqrt(1 / 8.0);
|
||||
|
||||
@@ -1121,25 +1119,11 @@ static void qmf_32_subbands(DCAContext *s, int chans,
|
||||
else /* Perfect reconstruction */
|
||||
prCoeff = fir_32bands_perfect;
|
||||
|
||||
- for (i = sb_act; i < 32; i++)
|
||||
- s->raXin[i] = 0.0;
|
||||
-
|
||||
- /* Reconstructed channel sample index */
|
||||
- for (subindex = 0; subindex < 8; subindex++) {
|
||||
- /* Load in one sample from each subband and clear inactive subbands */
|
||||
- for (i = 0; i < sb_act; i++) {
|
||||
- unsigned sign = (i - 1) & 2;
|
||||
- uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
|
||||
- AV_WN32A(&s->raXin[i], v);
|
||||
- }
|
||||
-
|
||||
- s->synth.synth_filter_float(&s->imdct,
|
||||
- s->subband_fir_hist[chans],
|
||||
- &s->hist_index[chans],
|
||||
- s->subband_fir_noidea[chans], prCoeff,
|
||||
- samples_out, s->raXin, scale);
|
||||
- samples_out += 32;
|
||||
- }
|
||||
+ s->dcadsp.qmf_32_subbands(samples_in, sb_act, &s->synth, &s->imdct,
|
||||
+ s->subband_fir_hist[chans],
|
||||
+ &s->hist_index[chans],
|
||||
+ s->subband_fir_noidea[chans], prCoeff,
|
||||
+ samples_out, s->raXin, scale);
|
||||
}
|
||||
|
||||
static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
|
||||
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
|
||||
index dd4994d..ab63f1b 100644
|
||||
--- a/libavcodec/dcadsp.c
|
||||
+++ b/libavcodec/dcadsp.c
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
+#include "libavutil/intreadwrite.h"
|
||||
#include "dcadsp.h"
|
||||
|
||||
static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
|
||||
@@ -44,8 +45,37 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
|
||||
}
|
||||
}
|
||||
|
||||
+static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act,
|
||||
+ SynthFilterContext *synth, FFTContext *imdct,
|
||||
+ float synth_buf_ptr[512],
|
||||
+ int *synth_buf_offset, float synth_buf2[32],
|
||||
+ const float window[512], float *samples_out,
|
||||
+ float raXin[32], float scale)
|
||||
+{
|
||||
+ int i;
|
||||
+ int subindex;
|
||||
+
|
||||
+ for (i = sb_act; i < 32; i++)
|
||||
+ raXin[i] = 0.0;
|
||||
+
|
||||
+ /* Reconstructed channel sample index */
|
||||
+ for (subindex = 0; subindex < 8; subindex++) {
|
||||
+ /* Load in one sample from each subband and clear inactive subbands */
|
||||
+ for (i = 0; i < sb_act; i++) {
|
||||
+ unsigned sign = (i - 1) & 2;
|
||||
+ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
|
||||
+ AV_WN32A(&raXin[i], v);
|
||||
+ }
|
||||
+
|
||||
+ synth->synth_filter_float(imdct, synth_buf_ptr, synth_buf_offset,
|
||||
+ synth_buf2, window, samples_out, raXin, scale);
|
||||
+ samples_out += 32;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void ff_dcadsp_init(DCADSPContext *s)
|
||||
{
|
||||
s->lfe_fir = dca_lfe_fir_c;
|
||||
+ s->qmf_32_subbands = dca_qmf_32_subbands;
|
||||
if (ARCH_ARM) ff_dcadsp_init_arm(s);
|
||||
}
|
||||
diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
|
||||
index bb157f7..d86c1f3 100644
|
||||
--- a/libavcodec/dcadsp.h
|
||||
+++ b/libavcodec/dcadsp.h
|
||||
@@ -19,9 +19,18 @@
|
||||
#ifndef AVCODEC_DCADSP_H
|
||||
#define AVCODEC_DCADSP_H
|
||||
|
||||
+#include "avfft.h"
|
||||
+#include "synth_filter.h"
|
||||
+
|
||||
typedef struct DCADSPContext {
|
||||
void (*lfe_fir)(float *out, const float *in, const float *coefs,
|
||||
int decifactor, float scale);
|
||||
+ void (*qmf_32_subbands)(float samples_in[32][8], int sb_act,
|
||||
+ SynthFilterContext *synth, FFTContext *imdct,
|
||||
+ float synth_buf_ptr[512],
|
||||
+ int *synth_buf_offset, float synth_buf2[32],
|
||||
+ const float window[512], float *samples_out,
|
||||
+ float raXin[32], float scale);
|
||||
} DCADSPContext;
|
||||
|
||||
void ff_dcadsp_init(DCADSPContext *s);
|
||||
--
|
||||
1.7.9.5
|
@ -1,551 +0,0 @@
|
||||
From a6c273927c5bb212e806be6ae10c81dcd81b2152 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 15 Jul 2013 18:28:17 +0100
|
||||
Subject: [PATCH 48/49] [ffmpeg] - backport - arm: Add VFP-accelerated version
|
||||
of qmf_32_subbands
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 1323.0 98.0 746.2 60.6 +77.3%
|
||||
Overall 15400.0 336.4 14147.5 288.4 +8.9%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/dcadsp_init_arm.c | 10 +-
|
||||
libavcodec/arm/dcadsp_vfp.S | 493 +++++++++++++++++++++++++++
|
||||
2 files changed, 502 insertions(+), 1 deletion(-)
|
||||
create mode 100644 libavcodec/arm/dcadsp_vfp.S
|
||||
|
||||
diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c
|
||||
index a1efbff..58267a2 100644
|
||||
--- a/libavcodec/arm/dcadsp_init_arm.c
|
||||
+++ b/libavcodec/arm/dcadsp_init_arm.c
|
||||
@@ -26,6 +26,12 @@
|
||||
|
||||
void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs,
|
||||
int decifactor, float scale);
|
||||
+void ff_dca_qmf_32_subbands_vfp(float samples_in[32][8], int sb_act,
|
||||
+ SynthFilterContext *synth, FFTContext *imdct,
|
||||
+ float synth_buf_ptr[512],
|
||||
+ int *synth_buf_offset, float synth_buf2[32],
|
||||
+ const float window[512], float *samples_out,
|
||||
+ float raXin[32], float scale);
|
||||
void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
|
||||
int decifactor, float scale);
|
||||
|
||||
@@ -33,8 +39,10 @@ av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
- if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags))
|
||||
+ if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) {
|
||||
s->lfe_fir = ff_dca_lfe_fir_vfp;
|
||||
+ s->qmf_32_subbands = ff_dca_qmf_32_subbands_vfp;
|
||||
+ }
|
||||
if (have_neon(cpu_flags))
|
||||
s->lfe_fir = ff_dca_lfe_fir_neon;
|
||||
}
|
||||
diff --git a/libavcodec/arm/dcadsp_vfp.S b/libavcodec/arm/dcadsp_vfp.S
|
||||
new file mode 100644
|
||||
index 0000000..6039e87
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/dcadsp_vfp.S
|
||||
@@ -0,0 +1,493 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd
|
||||
+ * Author: Ben Avison <bavison@riscosopen.org>
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+
|
||||
+#include "libavutil/arm/asm.S"
|
||||
+
|
||||
+POUT .req a1
|
||||
+PIN .req a2
|
||||
+PCOEF .req a3
|
||||
+DECIFACTOR .req a4
|
||||
+OLDFPSCR .req a4
|
||||
+COUNTER .req ip
|
||||
+
|
||||
+SCALE32 .req s28 @ use vector of 4 in place of 9th scalar when decifactor=32 / JMAX=8
|
||||
+SCALE64 .req s0 @ spare register in scalar bank when decifactor=64 / JMAX=4
|
||||
+IN0 .req s4
|
||||
+IN1 .req s5
|
||||
+IN2 .req s6
|
||||
+IN3 .req s7
|
||||
+IN4 .req s0
|
||||
+IN5 .req s1
|
||||
+IN6 .req s2
|
||||
+IN7 .req s3
|
||||
+COEF0 .req s8 @ coefficient elements
|
||||
+COEF1 .req s9
|
||||
+COEF2 .req s10
|
||||
+COEF3 .req s11
|
||||
+COEF4 .req s12
|
||||
+COEF5 .req s13
|
||||
+COEF6 .req s14
|
||||
+COEF7 .req s15
|
||||
+ACCUM0 .req s16 @ double-buffered multiply-accumulate results
|
||||
+ACCUM4 .req s20
|
||||
+POST0 .req s24 @ do long-latency post-multiply in this vector in parallel
|
||||
+POST1 .req s25
|
||||
+POST2 .req s26
|
||||
+POST3 .req s27
|
||||
+
|
||||
+
|
||||
+.macro inner_loop decifactor, dir, tail, head
|
||||
+ .ifc "\dir","up"
|
||||
+ .set X, 0
|
||||
+ .set Y, 4
|
||||
+ .else
|
||||
+ .set X, 4*JMAX*4 - 4
|
||||
+ .set Y, -4
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vldr COEF0, [PCOEF, #X + (0*JMAX + 0) * Y]
|
||||
+ vldr COEF1, [PCOEF, #X + (1*JMAX + 0) * Y]
|
||||
+ vldr COEF2, [PCOEF, #X + (2*JMAX + 0) * Y]
|
||||
+ vldr COEF3, [PCOEF, #X + (3*JMAX + 0) * Y]
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vadd.f POST0, ACCUM0, ACCUM4 @ vector operation
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vmul.f ACCUM0, COEF0, IN0 @ vector = vector * scalar
|
||||
+ vldr COEF4, [PCOEF, #X + (0*JMAX + 1) * Y]
|
||||
+ vldr COEF5, [PCOEF, #X + (1*JMAX + 1) * Y]
|
||||
+ vldr COEF6, [PCOEF, #X + (2*JMAX + 1) * Y]
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vmul.f POST0, POST0, SCALE\decifactor @ vector operation (SCALE may be scalar)
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vldr COEF7, [PCOEF, #X + (3*JMAX + 1) * Y]
|
||||
+ .ifc "\tail",""
|
||||
+ vmul.f ACCUM4, COEF4, IN1 @ vector operation
|
||||
+ .endif
|
||||
+ vldr COEF0, [PCOEF, #X + (0*JMAX + 2) * Y]
|
||||
+ vldr COEF1, [PCOEF, #X + (1*JMAX + 2) * Y]
|
||||
+ .ifnc "\tail",""
|
||||
+ vmul.f ACCUM4, COEF4, IN1 @ vector operation
|
||||
+ .endif
|
||||
+ vldr COEF2, [PCOEF, #X + (2*JMAX + 2) * Y]
|
||||
+ vldr COEF3, [PCOEF, #X + (3*JMAX + 2) * Y]
|
||||
+ .endif
|
||||
+ .ifnc "\tail",""
|
||||
+ vstmia POUT!, {POST0-POST3}
|
||||
+ .endif
|
||||
+ .ifnc "\head",""
|
||||
+ vmla.f ACCUM0, COEF0, IN2 @ vector = vector * scalar
|
||||
+ vldr COEF4, [PCOEF, #X + (0*JMAX + 3) * Y]
|
||||
+ vldr COEF5, [PCOEF, #X + (1*JMAX + 3) * Y]
|
||||
+ vldr COEF6, [PCOEF, #X + (2*JMAX + 3) * Y]
|
||||
+ vldr COEF7, [PCOEF, #X + (3*JMAX + 3) * Y]
|
||||
+ vmla.f ACCUM4, COEF4, IN3 @ vector = vector * scalar
|
||||
+ .if \decifactor == 32
|
||||
+ vldr COEF0, [PCOEF, #X + (0*JMAX + 4) * Y]
|
||||
+ vldr COEF1, [PCOEF, #X + (1*JMAX + 4) * Y]
|
||||
+ vldr COEF2, [PCOEF, #X + (2*JMAX + 4) * Y]
|
||||
+ vldr COEF3, [PCOEF, #X + (3*JMAX + 4) * Y]
|
||||
+ vmla.f ACCUM0, COEF0, IN4 @ vector = vector * scalar
|
||||
+ vldr COEF4, [PCOEF, #X + (0*JMAX + 5) * Y]
|
||||
+ vldr COEF5, [PCOEF, #X + (1*JMAX + 5) * Y]
|
||||
+ vldr COEF6, [PCOEF, #X + (2*JMAX + 5) * Y]
|
||||
+ vldr COEF7, [PCOEF, #X + (3*JMAX + 5) * Y]
|
||||
+ vmla.f ACCUM4, COEF4, IN5 @ vector = vector * scalar
|
||||
+ vldr COEF0, [PCOEF, #X + (0*JMAX + 6) * Y]
|
||||
+ vldr COEF1, [PCOEF, #X + (1*JMAX + 6) * Y]
|
||||
+ vldr COEF2, [PCOEF, #X + (2*JMAX + 6) * Y]
|
||||
+ vldr COEF3, [PCOEF, #X + (3*JMAX + 6) * Y]
|
||||
+ vmla.f ACCUM0, COEF0, IN6 @ vector = vector * scalar
|
||||
+ vldr COEF4, [PCOEF, #X + (0*JMAX + 7) * Y]
|
||||
+ vldr COEF5, [PCOEF, #X + (1*JMAX + 7) * Y]
|
||||
+ vldr COEF6, [PCOEF, #X + (2*JMAX + 7) * Y]
|
||||
+ vldr COEF7, [PCOEF, #X + (3*JMAX + 7) * Y]
|
||||
+ vmla.f ACCUM4, COEF4, IN7 @ vector = vector * scalar
|
||||
+ .endif
|
||||
+ .endif
|
||||
+.endm
|
||||
+
|
||||
+.macro dca_lfe_fir decifactor
|
||||
+ .if \decifactor == 32
|
||||
+ .set JMAX, 8
|
||||
+ vpush {s16-s31}
|
||||
+ vmov SCALE32, s0 @ duplicate scalar across vector
|
||||
+ vldr IN4, [PIN, #-4*4]
|
||||
+ vldr IN5, [PIN, #-5*4]
|
||||
+ vldr IN6, [PIN, #-6*4]
|
||||
+ vldr IN7, [PIN, #-7*4]
|
||||
+ .else
|
||||
+ .set JMAX, 4
|
||||
+ vpush {s16-s27}
|
||||
+ .endif
|
||||
+
|
||||
+ mov COUNTER, #\decifactor/4 - 1
|
||||
+ inner_loop \decifactor, up,, head
|
||||
+1: add PCOEF, PCOEF, #4*JMAX*4
|
||||
+ subs COUNTER, COUNTER, #1
|
||||
+ inner_loop \decifactor, up, tail, head
|
||||
+ bne 1b
|
||||
+ inner_loop \decifactor, up, tail
|
||||
+
|
||||
+ mov COUNTER, #\decifactor/4 - 1
|
||||
+ inner_loop \decifactor, down,, head
|
||||
+1: sub PCOEF, PCOEF, #4*JMAX*4
|
||||
+ subs COUNTER, COUNTER, #1
|
||||
+ inner_loop \decifactor, down, tail, head
|
||||
+ bne 1b
|
||||
+ inner_loop \decifactor, down, tail
|
||||
+
|
||||
+ .if \decifactor == 32
|
||||
+ vpop {s16-s31}
|
||||
+ .else
|
||||
+ vpop {s16-s27}
|
||||
+ .endif
|
||||
+ fmxr FPSCR, OLDFPSCR
|
||||
+ bx lr
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+/* void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs,
|
||||
+ * int decifactor, float scale)
|
||||
+ */
|
||||
+function ff_dca_lfe_fir_vfp, export=1
|
||||
+ teq DECIFACTOR, #32
|
||||
+ fmrx OLDFPSCR, FPSCR
|
||||
+ ldr ip, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
|
||||
+ fmxr FPSCR, ip
|
||||
+NOVFP vldr s0, [sp]
|
||||
+ vldr IN0, [PIN, #-0*4]
|
||||
+ vldr IN1, [PIN, #-1*4]
|
||||
+ vldr IN2, [PIN, #-2*4]
|
||||
+ vldr IN3, [PIN, #-3*4]
|
||||
+ beq 32f
|
||||
+64: dca_lfe_fir 64
|
||||
+ .ltorg
|
||||
+32: dca_lfe_fir 32
|
||||
+endfunc
|
||||
+
|
||||
+ .unreq POUT
|
||||
+ .unreq PIN
|
||||
+ .unreq PCOEF
|
||||
+ .unreq DECIFACTOR
|
||||
+ .unreq OLDFPSCR
|
||||
+ .unreq COUNTER
|
||||
+
|
||||
+ .unreq SCALE32
|
||||
+ .unreq SCALE64
|
||||
+ .unreq IN0
|
||||
+ .unreq IN1
|
||||
+ .unreq IN2
|
||||
+ .unreq IN3
|
||||
+ .unreq IN4
|
||||
+ .unreq IN5
|
||||
+ .unreq IN6
|
||||
+ .unreq IN7
|
||||
+ .unreq COEF0
|
||||
+ .unreq COEF1
|
||||
+ .unreq COEF2
|
||||
+ .unreq COEF3
|
||||
+ .unreq COEF4
|
||||
+ .unreq COEF5
|
||||
+ .unreq COEF6
|
||||
+ .unreq COEF7
|
||||
+ .unreq ACCUM0
|
||||
+ .unreq ACCUM4
|
||||
+ .unreq POST0
|
||||
+ .unreq POST1
|
||||
+ .unreq POST2
|
||||
+ .unreq POST3
|
||||
+
|
||||
+
|
||||
+IN .req a1
|
||||
+SBACT .req a2
|
||||
+OLDFPSCR .req a3
|
||||
+IMDCT .req a4
|
||||
+WINDOW .req v1
|
||||
+OUT .req v2
|
||||
+BUF .req v3
|
||||
+SCALEINT .req v4 @ only used in softfp case
|
||||
+COUNT .req v5
|
||||
+
|
||||
+SCALE .req s0
|
||||
+
|
||||
+/* Stack layout differs in softfp and hardfp cases:
|
||||
+ *
|
||||
+ * hardfp
|
||||
+ * fp -> 6 arg words saved by caller
|
||||
+ * a3,a4,v1-v3,v5,fp,lr on entry (a3 just to pad to 8 bytes)
|
||||
+ * s16-s23 on entry
|
||||
+ * align 16
|
||||
+ * buf -> 8*32*4 bytes buffer
|
||||
+ * s0 on entry
|
||||
+ * sp -> 3 arg words for callee
|
||||
+ *
|
||||
+ * softfp
|
||||
+ * fp -> 7 arg words saved by caller
|
||||
+ * a4,v1-v5,fp,lr on entry
|
||||
+ * s16-s23 on entry
|
||||
+ * align 16
|
||||
+ * buf -> 8*32*4 bytes buffer
|
||||
+ * sp -> 4 arg words for callee
|
||||
+ */
|
||||
+
|
||||
+/* void ff_dca_qmf_32_subbands_vfp(float samples_in[32][8], int sb_act,
|
||||
+ * SynthFilterContext *synth, FFTContext *imdct,
|
||||
+ * float (*synth_buf_ptr)[512],
|
||||
+ * int *synth_buf_offset, float (*synth_buf2)[32],
|
||||
+ * const float (*window)[512], float *samples_out,
|
||||
+ * float (*raXin)[32], float scale);
|
||||
+ */
|
||||
+function ff_dca_qmf_32_subbands_vfp, export=1
|
||||
+VFP push {a3-a4,v1-v3,v5,fp,lr}
|
||||
+NOVFP push {a4,v1-v5,fp,lr}
|
||||
+ add fp, sp, #8*4
|
||||
+ vpush {s16-s23}
|
||||
+ @ The buffer pointed at by raXin isn't big enough for us to do a
|
||||
+ @ complete matrix transposition as we want to, so allocate an
|
||||
+ @ alternative buffer from the stack. Align to 4 words for speed.
|
||||
+ sub BUF, sp, #8*32*4
|
||||
+ bic BUF, BUF, #15
|
||||
+ mov sp, BUF
|
||||
+ ldr lr, =0x03330000 @ RunFast mode, short vectors of length 4, stride 2
|
||||
+ fmrx OLDFPSCR, FPSCR
|
||||
+ fmxr FPSCR, lr
|
||||
+ @ COUNT is used to count down 2 things at once:
|
||||
+ @ bits 0-4 are the number of word pairs remaining in the output row
|
||||
+ @ bits 5-31 are the number of words to copy (with possible negation)
|
||||
+ @ from the source matrix before we start zeroing the remainder
|
||||
+ mov COUNT, #(-4 << 5) + 16
|
||||
+ adds COUNT, COUNT, SBACT, lsl #5
|
||||
+ bmi 2f
|
||||
+1:
|
||||
+ vldr s8, [IN, #(0*8+0)*4]
|
||||
+ vldr s10, [IN, #(0*8+1)*4]
|
||||
+ vldr s12, [IN, #(0*8+2)*4]
|
||||
+ vldr s14, [IN, #(0*8+3)*4]
|
||||
+ vldr s16, [IN, #(0*8+4)*4]
|
||||
+ vldr s18, [IN, #(0*8+5)*4]
|
||||
+ vldr s20, [IN, #(0*8+6)*4]
|
||||
+ vldr s22, [IN, #(0*8+7)*4]
|
||||
+ vneg.f s8, s8
|
||||
+ vldr s9, [IN, #(1*8+0)*4]
|
||||
+ vldr s11, [IN, #(1*8+1)*4]
|
||||
+ vldr s13, [IN, #(1*8+2)*4]
|
||||
+ vldr s15, [IN, #(1*8+3)*4]
|
||||
+ vneg.f s16, s16
|
||||
+ vldr s17, [IN, #(1*8+4)*4]
|
||||
+ vldr s19, [IN, #(1*8+5)*4]
|
||||
+ vldr s21, [IN, #(1*8+6)*4]
|
||||
+ vldr s23, [IN, #(1*8+7)*4]
|
||||
+ vstr d4, [BUF, #(0*32+0)*4]
|
||||
+ vstr d5, [BUF, #(1*32+0)*4]
|
||||
+ vstr d6, [BUF, #(2*32+0)*4]
|
||||
+ vstr d7, [BUF, #(3*32+0)*4]
|
||||
+ vstr d8, [BUF, #(4*32+0)*4]
|
||||
+ vstr d9, [BUF, #(5*32+0)*4]
|
||||
+ vstr d10, [BUF, #(6*32+0)*4]
|
||||
+ vstr d11, [BUF, #(7*32+0)*4]
|
||||
+ vldr s9, [IN, #(3*8+0)*4]
|
||||
+ vldr s11, [IN, #(3*8+1)*4]
|
||||
+ vldr s13, [IN, #(3*8+2)*4]
|
||||
+ vldr s15, [IN, #(3*8+3)*4]
|
||||
+ vldr s17, [IN, #(3*8+4)*4]
|
||||
+ vldr s19, [IN, #(3*8+5)*4]
|
||||
+ vldr s21, [IN, #(3*8+6)*4]
|
||||
+ vldr s23, [IN, #(3*8+7)*4]
|
||||
+ vneg.f s9, s9
|
||||
+ vldr s8, [IN, #(2*8+0)*4]
|
||||
+ vldr s10, [IN, #(2*8+1)*4]
|
||||
+ vldr s12, [IN, #(2*8+2)*4]
|
||||
+ vldr s14, [IN, #(2*8+3)*4]
|
||||
+ vneg.f s17, s17
|
||||
+ vldr s16, [IN, #(2*8+4)*4]
|
||||
+ vldr s18, [IN, #(2*8+5)*4]
|
||||
+ vldr s20, [IN, #(2*8+6)*4]
|
||||
+ vldr s22, [IN, #(2*8+7)*4]
|
||||
+ vstr d4, [BUF, #(0*32+2)*4]
|
||||
+ vstr d5, [BUF, #(1*32+2)*4]
|
||||
+ vstr d6, [BUF, #(2*32+2)*4]
|
||||
+ vstr d7, [BUF, #(3*32+2)*4]
|
||||
+ vstr d8, [BUF, #(4*32+2)*4]
|
||||
+ vstr d9, [BUF, #(5*32+2)*4]
|
||||
+ vstr d10, [BUF, #(6*32+2)*4]
|
||||
+ vstr d11, [BUF, #(7*32+2)*4]
|
||||
+ add IN, IN, #4*8*4
|
||||
+ add BUF, BUF, #4*4
|
||||
+ subs COUNT, COUNT, #(4 << 5) + 2
|
||||
+ bpl 1b
|
||||
+2: @ Now deal with trailing < 4 samples
|
||||
+ adds COUNT, COUNT, #3 << 5
|
||||
+ bmi 4f @ sb_act was a multiple of 4
|
||||
+ bics lr, COUNT, #0x1F
|
||||
+ bne 3f
|
||||
+ @ sb_act was n*4+1
|
||||
+ vldr s8, [IN, #(0*8+0)*4]
|
||||
+ vldr s10, [IN, #(0*8+1)*4]
|
||||
+ vldr s12, [IN, #(0*8+2)*4]
|
||||
+ vldr s14, [IN, #(0*8+3)*4]
|
||||
+ vldr s16, [IN, #(0*8+4)*4]
|
||||
+ vldr s18, [IN, #(0*8+5)*4]
|
||||
+ vldr s20, [IN, #(0*8+6)*4]
|
||||
+ vldr s22, [IN, #(0*8+7)*4]
|
||||
+ vneg.f s8, s8
|
||||
+ vldr s9, zero
|
||||
+ vldr s11, zero
|
||||
+ vldr s13, zero
|
||||
+ vldr s15, zero
|
||||
+ vneg.f s16, s16
|
||||
+ vldr s17, zero
|
||||
+ vldr s19, zero
|
||||
+ vldr s21, zero
|
||||
+ vldr s23, zero
|
||||
+ vstr d4, [BUF, #(0*32+0)*4]
|
||||
+ vstr d5, [BUF, #(1*32+0)*4]
|
||||
+ vstr d6, [BUF, #(2*32+0)*4]
|
||||
+ vstr d7, [BUF, #(3*32+0)*4]
|
||||
+ vstr d8, [BUF, #(4*32+0)*4]
|
||||
+ vstr d9, [BUF, #(5*32+0)*4]
|
||||
+ vstr d10, [BUF, #(6*32+0)*4]
|
||||
+ vstr d11, [BUF, #(7*32+0)*4]
|
||||
+ add BUF, BUF, #2*4
|
||||
+ sub COUNT, COUNT, #1
|
||||
+ b 4f
|
||||
+3: @ sb_act was n*4+2 or n*4+3, so do the first 2
|
||||
+ vldr s8, [IN, #(0*8+0)*4]
|
||||
+ vldr s10, [IN, #(0*8+1)*4]
|
||||
+ vldr s12, [IN, #(0*8+2)*4]
|
||||
+ vldr s14, [IN, #(0*8+3)*4]
|
||||
+ vldr s16, [IN, #(0*8+4)*4]
|
||||
+ vldr s18, [IN, #(0*8+5)*4]
|
||||
+ vldr s20, [IN, #(0*8+6)*4]
|
||||
+ vldr s22, [IN, #(0*8+7)*4]
|
||||
+ vneg.f s8, s8
|
||||
+ vldr s9, [IN, #(1*8+0)*4]
|
||||
+ vldr s11, [IN, #(1*8+1)*4]
|
||||
+ vldr s13, [IN, #(1*8+2)*4]
|
||||
+ vldr s15, [IN, #(1*8+3)*4]
|
||||
+ vneg.f s16, s16
|
||||
+ vldr s17, [IN, #(1*8+4)*4]
|
||||
+ vldr s19, [IN, #(1*8+5)*4]
|
||||
+ vldr s21, [IN, #(1*8+6)*4]
|
||||
+ vldr s23, [IN, #(1*8+7)*4]
|
||||
+ vstr d4, [BUF, #(0*32+0)*4]
|
||||
+ vstr d5, [BUF, #(1*32+0)*4]
|
||||
+ vstr d6, [BUF, #(2*32+0)*4]
|
||||
+ vstr d7, [BUF, #(3*32+0)*4]
|
||||
+ vstr d8, [BUF, #(4*32+0)*4]
|
||||
+ vstr d9, [BUF, #(5*32+0)*4]
|
||||
+ vstr d10, [BUF, #(6*32+0)*4]
|
||||
+ vstr d11, [BUF, #(7*32+0)*4]
|
||||
+ add BUF, BUF, #2*4
|
||||
+ sub COUNT, COUNT, #(2 << 5) + 1
|
||||
+ bics lr, COUNT, #0x1F
|
||||
+ bne 4f
|
||||
+ @ sb_act was n*4+3
|
||||
+ vldr s8, [IN, #(2*8+0)*4]
|
||||
+ vldr s10, [IN, #(2*8+1)*4]
|
||||
+ vldr s12, [IN, #(2*8+2)*4]
|
||||
+ vldr s14, [IN, #(2*8+3)*4]
|
||||
+ vldr s16, [IN, #(2*8+4)*4]
|
||||
+ vldr s18, [IN, #(2*8+5)*4]
|
||||
+ vldr s20, [IN, #(2*8+6)*4]
|
||||
+ vldr s22, [IN, #(2*8+7)*4]
|
||||
+ vldr s9, zero
|
||||
+ vldr s11, zero
|
||||
+ vldr s13, zero
|
||||
+ vldr s15, zero
|
||||
+ vldr s17, zero
|
||||
+ vldr s19, zero
|
||||
+ vldr s21, zero
|
||||
+ vldr s23, zero
|
||||
+ vstr d4, [BUF, #(0*32+0)*4]
|
||||
+ vstr d5, [BUF, #(1*32+0)*4]
|
||||
+ vstr d6, [BUF, #(2*32+0)*4]
|
||||
+ vstr d7, [BUF, #(3*32+0)*4]
|
||||
+ vstr d8, [BUF, #(4*32+0)*4]
|
||||
+ vstr d9, [BUF, #(5*32+0)*4]
|
||||
+ vstr d10, [BUF, #(6*32+0)*4]
|
||||
+ vstr d11, [BUF, #(7*32+0)*4]
|
||||
+ add BUF, BUF, #2*4
|
||||
+ sub COUNT, COUNT, #1
|
||||
+4: @ Now fill the remainder with 0
|
||||
+ vldr s8, zero
|
||||
+ vldr s9, zero
|
||||
+ ands COUNT, COUNT, #0x1F
|
||||
+ beq 6f
|
||||
+5: vstr d4, [BUF, #(0*32+0)*4]
|
||||
+ vstr d4, [BUF, #(1*32+0)*4]
|
||||
+ vstr d4, [BUF, #(2*32+0)*4]
|
||||
+ vstr d4, [BUF, #(3*32+0)*4]
|
||||
+ vstr d4, [BUF, #(4*32+0)*4]
|
||||
+ vstr d4, [BUF, #(5*32+0)*4]
|
||||
+ vstr d4, [BUF, #(6*32+0)*4]
|
||||
+ vstr d4, [BUF, #(7*32+0)*4]
|
||||
+ add BUF, BUF, #2*4
|
||||
+ subs COUNT, COUNT, #1
|
||||
+ bne 5b
|
||||
+6:
|
||||
+ fmxr FPSCR, OLDFPSCR
|
||||
+ ldr WINDOW, [fp, #3*4]
|
||||
+ ldr OUT, [fp, #4*4]
|
||||
+ sub BUF, BUF, #32*4
|
||||
+NOVFP ldr SCALEINT, [fp, #6*4]
|
||||
+ mov COUNT, #8
|
||||
+VFP vpush {SCALE}
|
||||
+VFP sub sp, sp, #3*4
|
||||
+NOVFP sub sp, sp, #4*4
|
||||
+7:
|
||||
+VFP ldr a1, [fp, #-7*4] @ imdct
|
||||
+NOVFP ldr a1, [fp, #-8*4]
|
||||
+ ldmia fp, {a2-a4}
|
||||
+VFP stmia sp, {WINDOW, OUT, BUF}
|
||||
+NOVFP stmia sp, {WINDOW, OUT, BUF, SCALEINT}
|
||||
+VFP vldr SCALE, [sp, #3*4]
|
||||
+ bl ff_synth_filter_float_vfp
|
||||
+ add OUT, OUT, #32*4
|
||||
+ add BUF, BUF, #32*4
|
||||
+ subs COUNT, COUNT, #1
|
||||
+ bne 7b
|
||||
+
|
||||
+A sub sp, fp, #(8+8)*4
|
||||
+T sub fp, fp, #(8+8)*4
|
||||
+T mov sp, fp
|
||||
+ vpop {s16-s23}
|
||||
+VFP pop {a3-a4,v1-v3,v5,fp,pc}
|
||||
+NOVFP pop {a4,v1-v5,fp,pc}
|
||||
+endfunc
|
||||
+
|
||||
+ .unreq IN
|
||||
+ .unreq SBACT
|
||||
+ .unreq OLDFPSCR
|
||||
+ .unreq IMDCT
|
||||
+ .unreq WINDOW
|
||||
+ .unreq OUT
|
||||
+ .unreq BUF
|
||||
+ .unreq SCALEINT
|
||||
+ .unreq COUNT
|
||||
+
|
||||
+ .unreq SCALE
|
||||
+
|
||||
+ .align 2
|
||||
+zero: .word 0
|
||||
--
|
||||
1.7.9.5
|
@ -1,64 +0,0 @@
|
||||
From 101f5a2c5db12605c24fe4aa41b3fabacfd3bad3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
|
||||
Date: Mon, 22 Jul 2013 12:33:22 +0300
|
||||
Subject: [PATCH 49/49] [ffmpeg] - backport - arm: Mangle external symbols
|
||||
properly in new vfp assembly files
|
||||
|
||||
Reviewed-by: Kostya Shishkov
|
||||
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
||||
---
|
||||
libavcodec/arm/dcadsp_vfp.S | 2 +-
|
||||
libavcodec/arm/mdct_vfp.S | 4 ++--
|
||||
libavcodec/arm/synth_filter_vfp.S | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/arm/dcadsp_vfp.S b/libavcodec/arm/dcadsp_vfp.S
|
||||
index 6039e87..5892a84 100644
|
||||
--- a/libavcodec/arm/dcadsp_vfp.S
|
||||
+++ b/libavcodec/arm/dcadsp_vfp.S
|
||||
@@ -463,7 +463,7 @@ NOVFP ldr a1, [fp, #-8*4]
|
||||
VFP stmia sp, {WINDOW, OUT, BUF}
|
||||
NOVFP stmia sp, {WINDOW, OUT, BUF, SCALEINT}
|
||||
VFP vldr SCALE, [sp, #3*4]
|
||||
- bl ff_synth_filter_float_vfp
|
||||
+ bl X(ff_synth_filter_float_vfp)
|
||||
add OUT, OUT, #32*4
|
||||
add BUF, BUF, #32*4
|
||||
subs COUNT, COUNT, #1
|
||||
diff --git a/libavcodec/arm/mdct_vfp.S b/libavcodec/arm/mdct_vfp.S
|
||||
index 0623e96..94db24f 100644
|
||||
--- a/libavcodec/arm/mdct_vfp.S
|
||||
+++ b/libavcodec/arm/mdct_vfp.S
|
||||
@@ -151,7 +151,7 @@ function ff_imdct_half_vfp, export=1
|
||||
ldr ip, [CONTEXT, #5*4] @ mdct_bits
|
||||
teq ip, #6
|
||||
it ne
|
||||
- bne ff_imdct_half_c @ only case currently accelerated is the one used by DCA
|
||||
+ bne X(ff_imdct_half_c) @ only case currently accelerated is the one used by DCA
|
||||
|
||||
.set n, 1<<6
|
||||
.set n2, n/2
|
||||
@@ -175,7 +175,7 @@ function ff_imdct_half_vfp, export=1
|
||||
|
||||
fmxr FPSCR, OLDFPSCR
|
||||
mov a1, OUT
|
||||
- bl ff_fft16_vfp
|
||||
+ bl X(ff_fft16_vfp)
|
||||
ldr lr, =0x03030000 @ RunFast mode, short vectors of length 4, stride 1
|
||||
fmxr FPSCR, lr
|
||||
|
||||
diff --git a/libavcodec/arm/synth_filter_vfp.S b/libavcodec/arm/synth_filter_vfp.S
|
||||
index c219c41..e6e6408 100644
|
||||
--- a/libavcodec/arm/synth_filter_vfp.S
|
||||
+++ b/libavcodec/arm/synth_filter_vfp.S
|
||||
@@ -132,7 +132,7 @@ function ff_synth_filter_float_vfp, export=1
|
||||
str lr, [P_SB_OFF] @ rotate offset, modulo buffer size, ready for next call
|
||||
ldr a3, [sp, #(16+6+2)*4] @ fetch in from stack, to pass to imdct_half
|
||||
VFP vmov s16, SCALE @ imdct_half is free to corrupt s0, but it contains one of our arguments in hardfp case
|
||||
- bl ff_imdct_half_vfp
|
||||
+ bl X(ff_imdct_half_vfp)
|
||||
VFP vmov SCALE, s16
|
||||
|
||||
fmrx OLDFPSCR, FPSCR
|
||||
--
|
||||
1.7.9.5
|
@ -1,72 +0,0 @@
|
||||
From 5ce8f2bf354b7adf904ac3e1438915586c5a0bb1 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Wed, 31 Jul 2013 23:46:08 +0100
|
||||
Subject: [PATCH 51/54] [ffmpeg] - backport - avio: Add an internal function
|
||||
for reading without copying
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
As long as there is enough contiguous data in the avio buffer,
|
||||
just return a pointer to it instead of copying it to the caller
|
||||
provided buffer.
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavformat/avio_internal.h | 17 +++++++++++++++++
|
||||
libavformat/aviobuf.c | 12 ++++++++++++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
|
||||
index cf36764..e9ece57 100644
|
||||
--- a/libavformat/avio_internal.h
|
||||
+++ b/libavformat/avio_internal.h
|
||||
@@ -38,6 +38,23 @@ int ffio_init_context(AVIOContext *s,
|
||||
|
||||
|
||||
/**
|
||||
+ * Read size bytes from AVIOContext, returning a pointer.
|
||||
+ * Note that the data pointed at by the returned pointer is only
|
||||
+ * valid until the next call that references the same IO context.
|
||||
+ * @param s IO context
|
||||
+ * @param buf pointer to buffer into which to assemble the requested
|
||||
+ * data if it is not available in contiguous addresses in the
|
||||
+ * underlying buffer
|
||||
+ * @param size number of bytes requested
|
||||
+ * @param data address at which to store pointer: this will be a
|
||||
+ * a direct pointer into the underlying buffer if the requested
|
||||
+ * number of bytes are available at contiguous addresses, otherwise
|
||||
+ * will be a copy of buf
|
||||
+ * @return number of bytes read or AVERROR
|
||||
+ */
|
||||
+int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data);
|
||||
+
|
||||
+/**
|
||||
* Read size bytes from AVIOContext into buf.
|
||||
* This reads at most 1 packet. If that is not enough fewer bytes will be
|
||||
* returned.
|
||||
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
|
||||
index 7a73a17..465c46d 100644
|
||||
--- a/libavformat/aviobuf.c
|
||||
+++ b/libavformat/aviobuf.c
|
||||
@@ -522,6 +522,18 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
|
||||
return size1 - size;
|
||||
}
|
||||
|
||||
+int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data)
|
||||
+{
|
||||
+ if (s->buf_end - s->buf_ptr >= size && !s->write_flag) {
|
||||
+ *data = s->buf_ptr;
|
||||
+ s->buf_ptr += size;
|
||||
+ return size;
|
||||
+ } else {
|
||||
+ *data = buf;
|
||||
+ return avio_read(s, buf, size);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
|
||||
{
|
||||
int len;
|
||||
--
|
||||
1.7.9.5
|
@ -1,149 +0,0 @@
|
||||
From 1496d8c12075c0f3783e348a5d73fef9e3000b0f Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Wed, 31 Jul 2013 23:46:08 +0100
|
||||
Subject: [PATCH 52/54] [ffmpeg] - backport - mpegts: Remove one memcpy per
|
||||
packet
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This was being performed to ensure that a complete packet was held in
|
||||
contiguous memory, prior to parsing the packet. However, the source buffer
|
||||
is typically large enough that the packet was already contiguous, so it is
|
||||
beneficial to return the packet by reference in most cases.
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
memcpy 720.7 32.7 649.8 25.1 +10.9%
|
||||
Overall 2372.7 46.1 2291.7 21.8 +3.5%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavformat/mpegts.c | 41 ++++++++++++++++++++++++++-------------
|
||||
1 file changed, 28 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index b5f5d63..5307521 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -1863,17 +1863,17 @@ static int mpegts_resync(AVFormatContext *s)
|
||||
}
|
||||
|
||||
/* return -1 if error or EOF. Return 0 if OK. */
|
||||
-static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
|
||||
+static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, uint8_t **data)
|
||||
{
|
||||
AVIOContext *pb = s->pb;
|
||||
- int skip, len;
|
||||
+ int len;
|
||||
|
||||
for(;;) {
|
||||
- len = avio_read(pb, buf, TS_PACKET_SIZE);
|
||||
+ len = ffio_read_indirect(pb, buf, TS_PACKET_SIZE, data);
|
||||
if (len != TS_PACKET_SIZE)
|
||||
return len < 0 ? len : AVERROR_EOF;
|
||||
/* check packet sync byte */
|
||||
- if (buf[0] != 0x47) {
|
||||
+ if ((*data)[0] != 0x47) {
|
||||
/* find a new packet start */
|
||||
avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR);
|
||||
if (mpegts_resync(s) < 0)
|
||||
@@ -1881,19 +1881,25 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
|
||||
else
|
||||
continue;
|
||||
} else {
|
||||
- skip = raw_packet_size - TS_PACKET_SIZE;
|
||||
- if (skip > 0)
|
||||
- avio_skip(pb, skip);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void finished_reading_packet(AVFormatContext *s, int raw_packet_size)
|
||||
+{
|
||||
+ AVIOContext *pb = s->pb;
|
||||
+ int skip = raw_packet_size - TS_PACKET_SIZE;
|
||||
+ if (skip > 0)
|
||||
+ avio_skip(pb, skip);
|
||||
+}
|
||||
+
|
||||
static int handle_packets(MpegTSContext *ts, int nb_packets)
|
||||
{
|
||||
AVFormatContext *s = ts->stream;
|
||||
uint8_t packet[TS_PACKET_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||
+ uint8_t *data;
|
||||
int packet_num, ret = 0;
|
||||
|
||||
if (avio_tell(s->pb) != ts->last_pos) {
|
||||
@@ -1926,10 +1932,11 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
|
||||
if (ts->stop_parse > 0)
|
||||
break;
|
||||
|
||||
- ret = read_packet(s, packet, ts->raw_packet_size);
|
||||
+ ret = read_packet(s, packet, ts->raw_packet_size, &data);
|
||||
if (ret != 0)
|
||||
break;
|
||||
- ret = handle_packet(ts, packet);
|
||||
+ ret = handle_packet(ts, data);
|
||||
+ finished_reading_packet(s, ts->raw_packet_size);
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
@@ -2087,6 +2094,7 @@ static int mpegts_read_header(AVFormatContext *s)
|
||||
int64_t pcrs[2], pcr_h;
|
||||
int packet_count[2];
|
||||
uint8_t packet[TS_PACKET_SIZE];
|
||||
+ uint8_t *data;
|
||||
|
||||
/* only read packets */
|
||||
|
||||
@@ -2102,18 +2110,21 @@ static int mpegts_read_header(AVFormatContext *s)
|
||||
nb_pcrs = 0;
|
||||
nb_packets = 0;
|
||||
for(;;) {
|
||||
- ret = read_packet(s, packet, ts->raw_packet_size);
|
||||
+ ret = read_packet(s, packet, ts->raw_packet_size, &data);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
- pid = AV_RB16(packet + 1) & 0x1fff;
|
||||
+ pid = AV_RB16(data + 1) & 0x1fff;
|
||||
if ((pcr_pid == -1 || pcr_pid == pid) &&
|
||||
- parse_pcr(&pcr_h, &pcr_l, packet) == 0) {
|
||||
+ parse_pcr(&pcr_h, &pcr_l, data) == 0) {
|
||||
+ finished_reading_packet(s, ts->raw_packet_size);
|
||||
pcr_pid = pid;
|
||||
packet_count[nb_pcrs] = nb_packets;
|
||||
pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
|
||||
nb_pcrs++;
|
||||
if (nb_pcrs >= 2)
|
||||
break;
|
||||
+ } else {
|
||||
+ finished_reading_packet(s, ts->raw_packet_size);
|
||||
}
|
||||
nb_packets++;
|
||||
}
|
||||
@@ -2145,15 +2156,19 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
|
||||
int64_t pcr_h, next_pcr_h, pos;
|
||||
int pcr_l, next_pcr_l;
|
||||
uint8_t pcr_buf[12];
|
||||
+ uint8_t *data;
|
||||
|
||||
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
pkt->pos= avio_tell(s->pb);
|
||||
- ret = read_packet(s, pkt->data, ts->raw_packet_size);
|
||||
+ ret = read_packet(s, pkt->data, ts->raw_packet_size, &data);
|
||||
if (ret < 0) {
|
||||
av_free_packet(pkt);
|
||||
return ret;
|
||||
}
|
||||
+ if (data != pkt->data)
|
||||
+ memcpy(pkt->data, data, ts->raw_packet_size);
|
||||
+ finished_reading_packet(s, ts->raw_packet_size);
|
||||
if (ts->mpeg2ts_compute_pcr) {
|
||||
/* compute exact PCR for each packet */
|
||||
if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
|
||||
--
|
||||
1.7.9.5
|
@ -1,47 +0,0 @@
|
||||
From 6aec5772fd5331b3514f308ab0895f6234b60045 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 5 Aug 2013 13:12:51 +0100
|
||||
Subject: [PATCH 53/54] [ffmpeg] - backport - mpegts: Make discard_pid()
|
||||
faster for single-program streams
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When a stream contains a single program, there's no point in doing a
|
||||
PID -> program lookup. Normally the one and only program isn't disabled,
|
||||
so no packets should be discarded.
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
discard_pid() 73.8 9.4 20.2 1.5 +264.8%
|
||||
Overall 2300.8 28.0 2253.1 20.6 +2.1%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavformat/mpegts.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 5307521..82dd209 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -268,6 +268,17 @@ static int discard_pid(MpegTSContext *ts, unsigned int pid)
|
||||
int i, j, k;
|
||||
int used = 0, discarded = 0;
|
||||
struct Program *p;
|
||||
+
|
||||
+ /* If none of the programs have .discard=AVDISCARD_ALL then there's
|
||||
+ * no way we have to discard this packet
|
||||
+ */
|
||||
+ for (k = 0; k < ts->stream->nb_programs; k++) {
|
||||
+ if (ts->stream->programs[k]->discard == AVDISCARD_ALL)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (k == ts->stream->nb_programs)
|
||||
+ return 0;
|
||||
+
|
||||
for(i=0; i<ts->nb_prg; i++) {
|
||||
p = &ts->prg[i];
|
||||
for(j=0; j<p->nb_pids; j++) {
|
||||
--
|
||||
1.7.9.5
|
@ -1,76 +0,0 @@
|
||||
From b79aa2b89ed9027a72a10c1d26ccdf2bb385d57b Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 5 Aug 2013 13:12:49 +0100
|
||||
Subject: [PATCH 54/54] [ffmpeg] - backport - mpegts: Remove one 64-bit
|
||||
integer modulus operation per packet
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The common case of the pointer having increased by one packet (which results
|
||||
in no change to the modulus) can be detected with a 64-bit subtraction,
|
||||
which is far cheaper than a division on many platforms.
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
Divisions 248.3 8.8 51.5 7.4 +381.7%
|
||||
Overall 2773.2 25.6 2372.5 43.1 +16.9%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/mathops.h | 9 +++++++++
|
||||
libavformat/mpegts.c | 5 ++++-
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
|
||||
index 592f5a5..1d57342 100644
|
||||
--- a/libavcodec/mathops.h
|
||||
+++ b/libavcodec/mathops.h
|
||||
@@ -195,6 +195,15 @@ if ((y) < (x)) {\
|
||||
# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
|
||||
#endif /* FASTDIV */
|
||||
|
||||
+#ifndef MOD_UNLIKELY
|
||||
+# define MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend) \
|
||||
+ do { \
|
||||
+ if ((prev_dividend) == 0 || (dividend) - (prev_dividend) != (divisor)) \
|
||||
+ (modulus) = (dividend) % (divisor); \
|
||||
+ (prev_dividend) = (dividend); \
|
||||
+ } while (0)
|
||||
+#endif
|
||||
+
|
||||
static inline av_const unsigned int ff_sqrt(unsigned int a)
|
||||
{
|
||||
unsigned int b;
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 82dd209..b995f60 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavcodec/bytestream.h"
|
||||
#include "libavcodec/get_bits.h"
|
||||
+#include "libavcodec/mathops.h"
|
||||
#include "avformat.h"
|
||||
#include "mpegts.h"
|
||||
#include "internal.h"
|
||||
@@ -99,6 +100,8 @@ struct MpegTSContext {
|
||||
int raw_packet_size;
|
||||
|
||||
int pos47;
|
||||
+ /** position corresponding to pos47, or 0 if pos47 invalid */
|
||||
+ int64_t pos;
|
||||
|
||||
/** if true, all pids are analyzed to find streams */
|
||||
int auto_guess;
|
||||
@@ -1814,7 +1817,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
|
||||
return 0;
|
||||
|
||||
pos = avio_tell(ts->stream->pb);
|
||||
- ts->pos47= pos % ts->raw_packet_size;
|
||||
+ MOD_UNLIKELY(ts->pos47, pos, ts->raw_packet_size, ts->pos);
|
||||
|
||||
if (tss->type == MPEGTS_SECTION) {
|
||||
if (is_start) {
|
||||
--
|
||||
1.7.9.5
|
@ -1,110 +0,0 @@
|
||||
From 8067f55edf3719182aed6e5b57b7863889f80218 Mon Sep 17 00:00:00 2001
|
||||
From: =?utf8?q?Reimar=20D=C3=B6ffinger?= <Reimar.Doeffinger@gmx.de>
|
||||
Date: Sat, 16 Mar 2013 13:36:20 +0100
|
||||
Subject: [PATCH] Fix compilation on ARM with android gcc 4.7
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=utf8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
With the current code it fails due to running out
|
||||
of registers.
|
||||
So code the store offsets manually into the assembler
|
||||
instead.
|
||||
Passes "make fate-dts".
|
||||
|
||||
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
|
||||
---
|
||||
libavcodec/arm/dca.h | 74 ++++++++++++++++++++++++--------------------------
|
||||
1 file changed, 36 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/arm/dca.h b/libavcodec/arm/dca.h
|
||||
index 2cfd18a..431b62e 100644
|
||||
--- a/libavcodec/arm/dca.h
|
||||
+++ b/libavcodec/arm/dca.h
|
||||
@@ -34,46 +34,44 @@ static inline int decode_blockcodes(int code1, int code2, int levels,
|
||||
{
|
||||
int v0, v1, v2, v3, v4, v5;
|
||||
|
||||
- __asm__ ("smmul %8, %14, %18 \n"
|
||||
- "smmul %11, %15, %18 \n"
|
||||
- "smlabb %14, %8, %17, %14 \n"
|
||||
- "smlabb %15, %11, %17, %15 \n"
|
||||
- "smmul %9, %8, %18 \n"
|
||||
- "smmul %12, %11, %18 \n"
|
||||
- "sub %14, %14, %16, lsr #1 \n"
|
||||
- "sub %15, %15, %16, lsr #1 \n"
|
||||
- "smlabb %8, %9, %17, %8 \n"
|
||||
- "smlabb %11, %12, %17, %11 \n"
|
||||
- "smmul %10, %9, %18 \n"
|
||||
- "smmul %13, %12, %18 \n"
|
||||
- "str %14, %0 \n"
|
||||
- "str %15, %4 \n"
|
||||
- "sub %8, %8, %16, lsr #1 \n"
|
||||
- "sub %11, %11, %16, lsr #1 \n"
|
||||
- "smlabb %9, %10, %17, %9 \n"
|
||||
- "smlabb %12, %13, %17, %12 \n"
|
||||
- "smmul %14, %10, %18 \n"
|
||||
- "smmul %15, %13, %18 \n"
|
||||
- "str %8, %1 \n"
|
||||
- "str %11, %5 \n"
|
||||
- "sub %9, %9, %16, lsr #1 \n"
|
||||
- "sub %12, %12, %16, lsr #1 \n"
|
||||
- "smlabb %10, %14, %17, %10 \n"
|
||||
- "smlabb %13, %15, %17, %13 \n"
|
||||
- "str %9, %2 \n"
|
||||
- "str %12, %6 \n"
|
||||
- "sub %10, %10, %16, lsr #1 \n"
|
||||
- "sub %13, %13, %16, lsr #1 \n"
|
||||
- "str %10, %3 \n"
|
||||
- "str %13, %7 \n"
|
||||
- : "=m"(values[0]), "=m"(values[1]),
|
||||
- "=m"(values[2]), "=m"(values[3]),
|
||||
- "=m"(values[4]), "=m"(values[5]),
|
||||
- "=m"(values[6]), "=m"(values[7]),
|
||||
- "=&r"(v0), "=&r"(v1), "=&r"(v2),
|
||||
+ __asm__ ("smmul %0, %6, %10 \n"
|
||||
+ "smmul %3, %7, %10 \n"
|
||||
+ "smlabb %6, %0, %9, %6 \n"
|
||||
+ "smlabb %7, %3, %9, %7 \n"
|
||||
+ "smmul %1, %0, %10 \n"
|
||||
+ "smmul %4, %3, %10 \n"
|
||||
+ "sub %6, %6, %8, lsr #1 \n"
|
||||
+ "sub %7, %7, %8, lsr #1 \n"
|
||||
+ "smlabb %0, %1, %9, %0 \n"
|
||||
+ "smlabb %3, %4, %9, %3 \n"
|
||||
+ "smmul %2, %1, %10 \n"
|
||||
+ "smmul %5, %4, %10 \n"
|
||||
+ "str %6, [%11, #0] \n"
|
||||
+ "str %7, [%11, #16] \n"
|
||||
+ "sub %0, %0, %8, lsr #1 \n"
|
||||
+ "sub %3, %3, %8, lsr #1 \n"
|
||||
+ "smlabb %1, %2, %9, %1 \n"
|
||||
+ "smlabb %4, %5, %9, %4 \n"
|
||||
+ "smmul %6, %2, %10 \n"
|
||||
+ "smmul %7, %5, %10 \n"
|
||||
+ "str %0, [%11, #4] \n"
|
||||
+ "str %3, [%11, #20] \n"
|
||||
+ "sub %1, %1, %8, lsr #1 \n"
|
||||
+ "sub %4, %4, %8, lsr #1 \n"
|
||||
+ "smlabb %2, %6, %9, %2 \n"
|
||||
+ "smlabb %5, %7, %9, %5 \n"
|
||||
+ "str %1, [%11, #8] \n"
|
||||
+ "str %4, [%11, #24] \n"
|
||||
+ "sub %2, %2, %8, lsr #1 \n"
|
||||
+ "sub %5, %5, %8, lsr #1 \n"
|
||||
+ "str %2, [%11, #12] \n"
|
||||
+ "str %5, [%11, #28] \n"
|
||||
+ : "=&r"(v0), "=&r"(v1), "=&r"(v2),
|
||||
"=&r"(v3), "=&r"(v4), "=&r"(v5),
|
||||
"+&r"(code1), "+&r"(code2)
|
||||
- : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels]));
|
||||
+ : "r"(levels - 1), "r"(-levels),
|
||||
+ "r"(ff_inverse[levels]), "r"(values)
|
||||
+ : "memory");
|
||||
|
||||
return code1 | code2;
|
||||
}
|
||||
--
|
||||
1.7.10.4
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index 85f2372..1cab49f 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -4523,8 +4523,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
||||
first_slice = hx->nal_unit_type;
|
||||
}
|
||||
|
||||
- // FIXME do not discard SEI id
|
||||
- if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
|
||||
+ if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0 && h->nal_unit_type != NAL_SEI)
|
||||
continue;
|
||||
|
||||
again:
|
@ -1,84 +0,0 @@
|
||||
From e2b718464e92fcde3d21c6653c88ddec2ab21c3f Mon Sep 17 00:00:00 2001
|
||||
From: Michael Niedermayer <michaelni@gmx.at>
|
||||
Date: Mon, 22 Jul 2013 03:23:54 +0200
|
||||
Subject: [PATCH] swresample: Make rematrix maxvalue user settable
|
||||
|
||||
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
||||
---
|
||||
libswresample/rematrix.c | 13 +++++++++++--
|
||||
libswresample/swresample.c | 1 +
|
||||
libswresample/swresample_internal.h | 1 +
|
||||
libswresample/version.h | 2 +-
|
||||
4 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
|
||||
index 48aff3b..33e2966 100644
|
||||
--- a/libswresample/rematrix.c
|
||||
+++ b/libswresample/rematrix.c
|
||||
@@ -120,6 +120,7 @@ av_cold static int auto_matrix(SwrContext *s)
|
||||
double maxcoef=0;
|
||||
char buf[128];
|
||||
const int matrix_encoding = s->matrix_encoding;
|
||||
+ float maxval;
|
||||
|
||||
in_ch_layout = clean_layout(s, s->in_ch_layout);
|
||||
if(!sane_layout(in_ch_layout)){
|
||||
@@ -304,8 +305,16 @@ av_cold static int auto_matrix(SwrContext *s)
|
||||
if(s->rematrix_volume < 0)
|
||||
maxcoef = -s->rematrix_volume;
|
||||
|
||||
- if(( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
|
||||
- || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){
|
||||
+ if (s->rematrix_maxval > 0) {
|
||||
+ maxval = s->rematrix_maxval;
|
||||
+ } else if ( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT
|
||||
+ || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) {
|
||||
+ maxval = 1.0;
|
||||
+ } else
|
||||
+ maxval = INT_MAX;
|
||||
+
|
||||
+ if(maxcoef > maxval){
|
||||
+ maxcoef /= maxval;
|
||||
for(i=0; i<SWR_CH_MAX; i++)
|
||||
for(j=0; j<SWR_CH_MAX; j++){
|
||||
s->matrix[i][j] /= maxcoef;
|
||||
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
|
||||
index ba2afdb..cdfe5bf 100644
|
||||
--- a/libswresample/swresample.c
|
||||
+++ b/libswresample/swresample.c
|
||||
@@ -68,6 +68,7 @@
|
||||
{"lfe_mix_level" , "set LFE mix level" , OFFSET(lfe_mix_level ), AV_OPT_TYPE_FLOAT, {.dbl=0 }, -32 , 32 , PARAM},
|
||||
{"rmvol" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
|
||||
{"rematrix_volume" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
|
||||
+{"rematrix_maxval" , "set rematrix maxval" , OFFSET(rematrix_maxval), AV_OPT_TYPE_FLOAT, {.dbl=0.0 }, 0 , 1000 , PARAM},
|
||||
|
||||
{"flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
|
||||
{"swr_flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"},
|
||||
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
|
||||
index 108f837..ab19f21 100644
|
||||
--- a/libswresample/swresample_internal.h
|
||||
+++ b/libswresample/swresample_internal.h
|
||||
@@ -82,6 +82,7 @@ struct SwrContext {
|
||||
float clev; ///< center mixing level
|
||||
float lfe_mix_level; ///< LFE mixing level
|
||||
float rematrix_volume; ///< rematrixing volume coefficient
|
||||
+ float rematrix_maxval; ///< maximum value for rematrixing output
|
||||
enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */
|
||||
const int *channel_map; ///< channel index (or -1 if muted channel) map
|
||||
int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
|
||||
diff --git a/libswresample/version.h b/libswresample/version.h
|
||||
index df9df48..8272b76 100644
|
||||
--- a/libswresample/version.h
|
||||
+++ b/libswresample/version.h
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#define LIBSWRESAMPLE_VERSION_MAJOR 0
|
||||
#define LIBSWRESAMPLE_VERSION_MINOR 17
|
||||
-#define LIBSWRESAMPLE_VERSION_MICRO 102
|
||||
+#define LIBSWRESAMPLE_VERSION_MICRO 103
|
||||
|
||||
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
|
||||
LIBSWRESAMPLE_VERSION_MINOR, \
|
||||
--
|
||||
1.8.4
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 9fb6300b1cc36c8111cee017fbb8a3e37b0c4e68 Mon Sep 17 00:00:00 2001
|
||||
From: siriuzwhite <siriuz@gmx.net>
|
||||
Date: Sun, 10 Nov 2013 23:26:16 +0100
|
||||
Subject: [PATCH] [backport] fixed ffmpeg not keep custom http headers when
|
||||
playing hls stream
|
||||
|
||||
---
|
||||
libavformat/hls.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/libavformat/hls.c b/libavformat/hls.c
|
||||
index 7de6059..2e3fd00 100644
|
||||
--- a/libavformat/hls.c
|
||||
+++ b/libavformat/hls.c
|
||||
@@ -105,6 +105,7 @@ struct variant {
|
||||
AVIOInterruptCB *interrupt_callback;
|
||||
char *user_agent; ///< holds HTTP user agent set as an AVOption to the HTTP protocol context
|
||||
char *cookies; ///< holds HTTP cookie values set in either the initial response or as an AVOption to the HTTP protocol context
|
||||
+ char *headers; ///< holds HTTP headers set as an AVOption to the HTTP protocol context (kow|mitm)
|
||||
} HLSContext;
|
||||
|
||||
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
|
||||
@@ -224,6 +225,7 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
// broker prior HTTP options that should be consistent across requests
|
||||
av_dict_set(&opts, "user-agent", c->user_agent, 0);
|
||||
av_dict_set(&opts, "cookies", c->cookies, 0);
|
||||
+ av_dict_set(&opts, "headers", c->headers, 0); // (kow|mitm)
|
||||
|
||||
ret = avio_open2(&in, url, AVIO_FLAG_READ,
|
||||
c->interrupt_callback, &opts);
|
||||
@@ -346,6 +348,7 @@ static int open_input(HLSContext *c, struct variant *var)
|
||||
// broker prior HTTP options that should be consistent across requests
|
||||
av_dict_set(&opts, "user-agent", c->user_agent, 0);
|
||||
av_dict_set(&opts, "cookies", c->cookies, 0);
|
||||
+ av_dict_set(&opts, "headers", c->headers, 0); // (kow|mitm)
|
||||
av_dict_set(&opts, "seekable", "0", 0);
|
||||
|
||||
if (seg->key_type == KEY_NONE) {
|
||||
@@ -494,6 +497,12 @@ static int hls_read_header(AVFormatContext *s)
|
||||
av_opt_get(u->priv_data, "cookies", 0, (uint8_t**)&(c->cookies));
|
||||
if (c->cookies && !strlen(c->cookies))
|
||||
av_freep(&c->cookies);
|
||||
+
|
||||
+ // get the previous headers & set back to null if string size is zero (kow|mitm)
|
||||
+ av_freep(&c->headers);
|
||||
+ av_opt_get(u->priv_data, "headers", 0, (uint8_t**)&(c->headers));
|
||||
+ if (c->headers && !strlen(c->headers))
|
||||
+ av_freep(&c->headers);
|
||||
}
|
||||
|
||||
if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
|
||||
--
|
||||
1.8.4
|
@ -1,29 +0,0 @@
|
||||
From f65afef1df49f53e14c8d4173ff960fff8d44ecb Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Hochecker <fernetmenta@online.de>
|
||||
Date: Tue, 3 Dec 2013 10:03:04 +0100
|
||||
Subject: [PATCH] mpegts: do not set pts for missing dts in video streams
|
||||
|
||||
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
||||
---
|
||||
libavformat/mpegts.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index 59b0058..d67c63a 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -972,7 +972,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
|
||||
pes->pts = AV_NOPTS_VALUE;
|
||||
pes->dts = AV_NOPTS_VALUE;
|
||||
if ((flags & 0xc0) == 0x80) {
|
||||
- pes->dts = pes->pts = ff_parse_pes_pts(r);
|
||||
+ pes->pts = ff_parse_pes_pts(r);
|
||||
+ /* video pts is not monotonic, can't be used for dts */
|
||||
+ if (pes->st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
+ pes->dts = pes->pts;
|
||||
r += 5;
|
||||
} else if ((flags & 0xc0) == 0xc0) {
|
||||
pes->pts = ff_parse_pes_pts(r);
|
||||
--
|
||||
1.8.5-rc3
|
||||
|
@ -1,135 +0,0 @@
|
||||
From 120e44f817d73572d14a3db4af24a3d517aaacd8 Mon Sep 17 00:00:00 2001
|
||||
From: Joakim Plate <elupus@ecce.se>
|
||||
Date: Sat, 14 Dec 2013 14:55:13 +0100
|
||||
Subject: [PATCH 1/1] mpegts: stop analyzing when pmt for all programs have
|
||||
been found
|
||||
|
||||
This disables NOHEADER after finding PMT for all programs to
|
||||
avoid find_stream_info always exhausting probe size for mpegts.
|
||||
|
||||
This is very important for live streams since read speed
|
||||
will be limited. rtsp, udp and any protocol streaming a live
|
||||
mpegts will have dramatically faster startup time.
|
||||
|
||||
Note, lack of codec parameters for streams can still cause
|
||||
the full probe size to be exhausted.
|
||||
---
|
||||
libavformat/mpegts.c | 54 +++++++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 45 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
|
||||
index d67c63a..fa92fb7 100644
|
||||
--- a/libavformat/mpegts.c
|
||||
+++ b/libavformat/mpegts.c
|
||||
@@ -90,6 +90,9 @@ struct Program {
|
||||
unsigned int id; //program id/service id
|
||||
unsigned int nb_pids;
|
||||
unsigned int pids[MAX_PIDS_PER_PROGRAM];
|
||||
+
|
||||
+ /** have we found pmt for this program */
|
||||
+ int pmt_found;
|
||||
};
|
||||
|
||||
struct MpegTSContext {
|
||||
@@ -205,6 +208,17 @@ typedef struct PESContext {
|
||||
|
||||
extern AVInputFormat ff_mpegts_demuxer;
|
||||
|
||||
+static struct Program * get_program(MpegTSContext *ts, unsigned int programid)
|
||||
+{
|
||||
+ int i;
|
||||
+ for(i=0; i<ts->nb_prg; i++) {
|
||||
+ if(ts->prg[i].id == programid) {
|
||||
+ return &ts->prg[i];
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static void clear_avprogram(MpegTSContext *ts, unsigned int programid)
|
||||
{
|
||||
AVProgram *prg = NULL;
|
||||
@@ -225,8 +239,10 @@ static void clear_program(MpegTSContext *ts, unsigned int programid)
|
||||
|
||||
clear_avprogram(ts, programid);
|
||||
for(i=0; i<ts->nb_prg; i++)
|
||||
- if(ts->prg[i].id == programid)
|
||||
+ if(ts->prg[i].id == programid) {
|
||||
ts->prg[i].nb_pids = 0;
|
||||
+ ts->prg[i].pmt_found = 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
static void clear_programs(MpegTSContext *ts)
|
||||
@@ -245,19 +261,13 @@ static void add_pat_entry(MpegTSContext *ts, unsigned int programid)
|
||||
p = &ts->prg[ts->nb_prg];
|
||||
p->id = programid;
|
||||
p->nb_pids = 0;
|
||||
+ p->pmt_found = 0;
|
||||
ts->nb_prg++;
|
||||
}
|
||||
|
||||
static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned int pid)
|
||||
{
|
||||
- int i;
|
||||
- struct Program *p = NULL;
|
||||
- for(i=0; i<ts->nb_prg; i++) {
|
||||
- if(ts->prg[i].id == programid) {
|
||||
- p = &ts->prg[i];
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ struct Program *p = get_program(ts, programid);
|
||||
if(!p)
|
||||
return;
|
||||
|
||||
@@ -266,6 +276,15 @@ static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned i
|
||||
p->pids[p->nb_pids++] = pid;
|
||||
}
|
||||
|
||||
+static void set_pmt_found(MpegTSContext *ts, unsigned int programid)
|
||||
+{
|
||||
+ struct Program *p = get_program(ts, programid);
|
||||
+ if(!p)
|
||||
+ return;
|
||||
+
|
||||
+ p->pmt_found = 1;
|
||||
+}
|
||||
+
|
||||
static void set_pcr_pid(AVFormatContext *s, unsigned int programid, unsigned int pid)
|
||||
{
|
||||
int i;
|
||||
@@ -1590,6 +1609,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
if (!ts->stream->nb_streams)
|
||||
ts->stop_parse = 2;
|
||||
|
||||
+ set_pmt_found(ts, h->id);
|
||||
+
|
||||
for(;;) {
|
||||
st = 0;
|
||||
pes = NULL;
|
||||
@@ -1912,6 +1933,21 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
|
||||
p, p_end - p, 0);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // stop find_stream_info from waiting for more streams
|
||||
+ // when all programs have received a PMT
|
||||
+ if( ts->stream->ctx_flags & AVFMTCTX_NOHEADER) {
|
||||
+ int i;
|
||||
+ for(i=0; i<ts->nb_prg; i++) {
|
||||
+ if (!ts->prg[i].pmt_found)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (i == ts->nb_prg && ts->nb_prg > 0) {
|
||||
+ av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n");
|
||||
+ ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
} else {
|
||||
int ret;
|
||||
int64_t pcr = -1;
|
||||
--
|
||||
1.8.2
|
||||
|
@ -1,29 +0,0 @@
|
||||
From aa1852f88f769ee438e85cec8552ff545914885c Mon Sep 17 00:00:00 2001
|
||||
From: Eli K. <eli@algotec.co.il>
|
||||
Date: Thu, 23 Jan 2014 10:27:21 +0200
|
||||
Subject: [PATCH] Correctly handle cookies that specify a sub-domain.
|
||||
|
||||
---
|
||||
libavformat/http.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavformat/http.c b/libavformat/http.c
|
||||
index 3b655c6..69c4d6d 100644
|
||||
--- a/libavformat/http.c
|
||||
+++ b/libavformat/http.c
|
||||
@@ -490,8 +490,11 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
|
||||
av_free(cpath);
|
||||
cpath = av_strdup(¶m[5]);
|
||||
} else if (!av_strncasecmp("domain=", param, 7)) {
|
||||
+ // if the cookie specifies a sub-domain, skip the leading dot thereby
|
||||
+ // supporting URLs that point to sub-domains and the master domain
|
||||
+ int leading_dot = (param[7] == '.');
|
||||
av_free(cdomain);
|
||||
- cdomain = av_strdup(¶m[7]);
|
||||
+ cdomain = av_strdup(¶m[7+leading_dot]);
|
||||
} else if (!av_strncasecmp("secure", param, 6) ||
|
||||
!av_strncasecmp("comment", param, 7) ||
|
||||
!av_strncasecmp("max-age", param, 7) ||
|
||||
--
|
||||
1.8.3.msysgit.0
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 59f16d529fdcb4c5db53ce3bd289aa8148a13de4 Mon Sep 17 00:00:00 2001
|
||||
From: Anssi Hannula <anssi.hannula@iki.fi>
|
||||
Date: Tue, 17 Dec 2013 23:04:31 +0200
|
||||
Subject: [PATCH] [ffmpeg] - backport - avcodec/aacdec: default to non-wide 7.1
|
||||
in non-strict mode
|
||||
|
||||
Upstream commit e10fccf62a36e09b54ad6ea3d5fa6638f298d5ae, for
|
||||
http://trac.xbmc.org/ticket/13758.
|
||||
|
||||
AAC specification has 7.1(wide) as a default layout for 8-channel
|
||||
streams (channel config 7). However, at least Nero AAC encoder encodes
|
||||
non-wide 7.1 streams using the default channel config 7, mapping the
|
||||
side channels of the original audio stream to the second
|
||||
AAC_CHANNEL_FRONT pair in the AAC stream. Similarly, e.g. FAAD decodes
|
||||
the second AAC_CHANNEL_FRONT pair as side channels, therefore decoding
|
||||
the incorrect streams as if they were correct (and as the encoder
|
||||
intended).
|
||||
|
||||
FFmpeg currently decodes such files by-the-spec, i.e. after decoding the
|
||||
original front pair will be in AV_CH_FRONT_x_OF_CENTER and the original
|
||||
side pair will be in AV_CH_FRONT_x.
|
||||
|
||||
As actual intended 7.1(wide) streams are very rare while misencoded 7.1
|
||||
files actually exist in the wild, default to assuming a 7.1 layout was
|
||||
intended unless in strict mode.
|
||||
|
||||
Fixes playback of e.g. 8_Channel_ID.m4a in samples.
|
||||
|
||||
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
|
||||
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
|
||||
---
|
||||
libavcodec/aacdec.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
|
||||
index 7a871c4..12dbfcf 100644
|
||||
--- a/libavcodec/aacdec.c
|
||||
+++ b/libavcodec/aacdec.c
|
||||
@@ -505,6 +505,25 @@ static int set_default_channel_config(AVCodecContext *avctx,
|
||||
}
|
||||
*tags = tags_per_config[channel_config];
|
||||
memcpy(layout_map, aac_channel_layout_map[channel_config-1], *tags * sizeof(*layout_map));
|
||||
+
|
||||
+ /*
|
||||
+ * AAC specification has 7.1(wide) as a default layout for 8-channel streams.
|
||||
+ * However, at least Nero AAC encoder encodes 7.1 streams using the default
|
||||
+ * channel config 7, mapping the side channels of the original audio stream
|
||||
+ * to the second AAC_CHANNEL_FRONT pair in the AAC stream. Similarly, e.g. FAAD
|
||||
+ * decodes the second AAC_CHANNEL_FRONT pair as side channels, therefore decoding
|
||||
+ * the incorrect streams as if they were correct (and as the encoder intended).
|
||||
+ *
|
||||
+ * As actual intended 7.1(wide) streams are very rare, default to assuming a
|
||||
+ * 7.1 layout was intended.
|
||||
+ */
|
||||
+ if (channel_config == 7 && avctx->strict_std_compliance < FF_COMPLIANCE_STRICT) {
|
||||
+ av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 channel layout"
|
||||
+ " instead of a spec-compliant 7.1(wide) layout, use -strict %d to decode"
|
||||
+ " according to the specification instead.\n", FF_COMPLIANCE_STRICT);
|
||||
+ layout_map[2][2] = AAC_CHANNEL_SIDE;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.5
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 6f99f0779ea56e4bfe40f7ca56e60b3dfd84eba6 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 5 Aug 2013 13:12:46 +0100
|
||||
Subject: [PATCH] h264_parser: Initialize the h264dsp context in the parser as
|
||||
well
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Each AVStream struct for an H.264 elementary stream actually has two
|
||||
copies of the H264DSPContext struct (and in fact all the other members
|
||||
of H264Context as well):
|
||||
|
||||
((H264Context *) ((AVStream *)st)->codec->priv_data)->h264dsp
|
||||
((H264Context *) ((AVStream *)st)->parser->priv_data)->h264dsp
|
||||
|
||||
but only the first of these was actually being initialised. This
|
||||
prevented the addition of platform-specific implementations of
|
||||
parser-related functions.
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/h264_parser.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index aff9ba1..a732f79 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -386,6 +386,7 @@ static int init(AVCodecParserContext *s)
|
||||
H264Context *h = s->priv_data;
|
||||
h->thread_context[0] = h;
|
||||
h->slice_context_count = 1;
|
||||
+ ff_h264dsp_init(&h->h264dsp, 8, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.5.1
|
||||
|
@ -1,128 +0,0 @@
|
||||
From 971a57f6067c96f8dba087285065618f1ac3ecd5 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 5 Aug 2013 13:12:47 +0100
|
||||
Subject: [PATCH] h264dsp: Factorize code into a new function,
|
||||
h264_find_start_code_candidate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This performs the start code search which was previously part of
|
||||
h264_find_frame_end() - the most CPU intensive part of the function.
|
||||
|
||||
By itself, this results in a performance regression:
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
Overall time 2925.6 26.2 3068.5 31.7 -4.7%
|
||||
|
||||
but this can more than be made up for by platform-optimised
|
||||
implementations of the function.
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/h264_parser.c | 20 +++-----------------
|
||||
libavcodec/h264dsp.c | 29 +++++++++++++++++++++++++++++
|
||||
libavcodec/h264dsp.h | 9 +++++++++
|
||||
3 files changed, 41 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index a732f79..972aace 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -62,23 +62,9 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si
|
||||
}
|
||||
|
||||
if(state==7){
|
||||
-#if HAVE_FAST_UNALIGNED
|
||||
- /* we check i<buf_size instead of i+3/7 because its simpler
|
||||
- * and there should be FF_INPUT_BUFFER_PADDING_SIZE bytes at the end
|
||||
- */
|
||||
-# if HAVE_FAST_64BIT
|
||||
- while(i<next_avc && !((~*(const uint64_t*)(buf+i) & (*(const uint64_t*)(buf+i) - 0x0101010101010101ULL)) & 0x8080808080808080ULL))
|
||||
- i+=8;
|
||||
-# else
|
||||
- while(i<next_avc && !((~*(const uint32_t*)(buf+i) & (*(const uint32_t*)(buf+i) - 0x01010101U)) & 0x80808080U))
|
||||
- i+=4;
|
||||
-# endif
|
||||
-#endif
|
||||
- for(; i<next_avc; i++){
|
||||
- if(!buf[i]){
|
||||
- state=2;
|
||||
- break;
|
||||
- }
|
||||
+ i += h->h264dsp.h264_find_start_code_candidate(buf + i, buf_size - i);
|
||||
+ if (i < buf_size)
|
||||
+ state = 2;
|
||||
}
|
||||
}else if(state<=2){
|
||||
if(buf[i]==1) state^= 5; //2->7, 1->4, 0->5
|
||||
diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
|
||||
index da9e417..b7d61cd 100644
|
||||
--- a/libavcodec/h264dsp.c
|
||||
+++ b/libavcodec/h264dsp.c
|
||||
@@ -60,6 +60,34 @@
|
||||
#include "h264addpx_template.c"
|
||||
#undef BIT_DEPTH
|
||||
|
||||
+static int h264_find_start_code_candidate_c(const uint8_t *buf, int size)
|
||||
+{
|
||||
+ int i = 0;
|
||||
+#if HAVE_FAST_UNALIGNED
|
||||
+ /* we check i < size instead of i + 3 / 7 because it is
|
||||
+ * simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE
|
||||
+ * bytes at the end.
|
||||
+ */
|
||||
+#if HAVE_FAST_64BIT
|
||||
+ while (i < size &&
|
||||
+ !((~*(const uint64_t *)(buf + i) &
|
||||
+ (*(const uint64_t *)(buf + i) - 0x0101010101010101ULL)) &
|
||||
+ 0x8080808080808080ULL))
|
||||
+ i += 8;
|
||||
+#else
|
||||
+ while (i < size &&
|
||||
+ !((~*(const uint32_t *)(buf + i) &
|
||||
+ (*(const uint32_t *)(buf + i) - 0x01010101U)) &
|
||||
+ 0x80808080U))
|
||||
+ i += 4;
|
||||
+#endif
|
||||
+#endif
|
||||
+ for (; i < size; i++)
|
||||
+ if (!buf[i])
|
||||
+ break;
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
|
||||
{
|
||||
#undef FUNC
|
||||
@@ -146,6 +174,7 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_fo
|
||||
H264_DSP(8);
|
||||
break;
|
||||
}
|
||||
+ c->h264_find_start_code_candidate = h264_find_start_code_candidate_c;
|
||||
|
||||
if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
|
||||
if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
|
||||
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
|
||||
index 98ea15c..1be4804 100644
|
||||
--- a/libavcodec/h264dsp.h
|
||||
+++ b/libavcodec/h264dsp.h
|
||||
@@ -105,6 +105,15 @@ typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src,
|
||||
/* bypass-transform */
|
||||
void (*h264_add_pixels8_clear)(uint8_t *dst, int16_t *block, int stride);
|
||||
void (*h264_add_pixels4_clear)(uint8_t *dst, int16_t *block, int stride);
|
||||
+
|
||||
+ /**
|
||||
+ * Search buf from the start for up to size bytes. Return the index
|
||||
+ * of a zero byte, or >= size if not found. Ideally, use lookahead
|
||||
+ * to filter out any zero bytes that are known to not be followed by
|
||||
+ * one or more further zero bytes and a one byte. Better still, filter
|
||||
+ * out any bytes that form the trailing_zero_8bits syntax element too.
|
||||
+ */
|
||||
+ int (*h264_find_start_code_candidate)(const uint8_t *buf, int size);
|
||||
} H264DSPContext;
|
||||
|
||||
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
|
||||
--
|
||||
1.8.5.1
|
||||
|
@ -1,335 +0,0 @@
|
||||
From fdc814cc6701f3e882a7ea7f29d16500c7340f0d Mon Sep 17 00:00:00 2001
|
||||
From: Ben Avison <bavison@riscosopen.org>
|
||||
Date: Mon, 5 Aug 2013 13:12:48 +0100
|
||||
Subject: [PATCH] arm: Add assembly version of h264_find_start_code_candidate
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
This function 508.8 23.4 185.4 9.0 +174.4%
|
||||
Overall 3068.5 31.7 2752.1 29.4 +11.5%
|
||||
|
||||
In combination with the preceding patch:
|
||||
Before After
|
||||
Mean StdDev Mean StdDev Change
|
||||
Overall 2925.6 26.2 2752.1 29.4 +6.3%
|
||||
|
||||
Signed-off-by: Martin Storsjö <martin@martin.st>
|
||||
---
|
||||
libavcodec/arm/Makefile | 1 +
|
||||
libavcodec/arm/h264dsp_armv6.S | 253 +++++++++++++++++++++++++++
|
||||
libavcodec/arm/h264dsp_init_arm.c | 4 +
|
||||
libavcodec/h264_parser.c | 1 -
|
||||
4 files changed, 258 insertions(+), 1 deletion(-)
|
||||
create mode 100644 libavcodec/arm/h264dsp_armv6.S
|
||||
|
||||
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
|
||||
index 7390a8b..480000b 100644
|
||||
--- a/libavcodec/arm/Makefile
|
||||
+++ b/libavcodec/arm/Makefile
|
||||
@@ -9,6 +9,7 @@ OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_init_arm.o \
|
||||
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
|
||||
|
||||
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
|
||||
+ARMV6-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_armv6.o
|
||||
|
||||
OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
|
||||
arm/flacdsp_arm.o \
|
||||
diff --git a/libavcodec/arm/h264dsp_armv6.S b/libavcodec/arm/h264dsp_armv6.S
|
||||
new file mode 100644
|
||||
index 0000000..c4f12a6
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/arm/h264dsp_armv6.S
|
||||
@@ -0,0 +1,253 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2013 RISC OS Open Ltd
|
||||
+ * Author: Ben Avison <bavison@riscosopen.org>
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+
|
||||
+#include "libavutil/arm/asm.S"
|
||||
+
|
||||
+RESULT .req a1
|
||||
+BUF .req a1
|
||||
+SIZE .req a2
|
||||
+PATTERN .req a3
|
||||
+PTR .req a4
|
||||
+DAT0 .req v1
|
||||
+DAT1 .req v2
|
||||
+DAT2 .req v3
|
||||
+DAT3 .req v4
|
||||
+TMP0 .req v5
|
||||
+TMP1 .req v6
|
||||
+TMP2 .req ip
|
||||
+TMP3 .req lr
|
||||
+
|
||||
+#define PRELOAD_DISTANCE 4
|
||||
+
|
||||
+.macro innerloop4
|
||||
+ ldr DAT0, [PTR], #4
|
||||
+ subs SIZE, SIZE, #4 @ C flag survives rest of macro
|
||||
+ sub TMP0, DAT0, PATTERN, lsr #14
|
||||
+ bic TMP0, TMP0, DAT0
|
||||
+ ands TMP0, TMP0, PATTERN
|
||||
+.endm
|
||||
+
|
||||
+.macro innerloop16 decrement, do_preload
|
||||
+ ldmia PTR!, {DAT0,DAT1,DAT2,DAT3}
|
||||
+ .ifnc "\do_preload",""
|
||||
+ pld [PTR, #PRELOAD_DISTANCE*32]
|
||||
+ .endif
|
||||
+ .ifnc "\decrement",""
|
||||
+ subs SIZE, SIZE, #\decrement @ C flag survives rest of macro
|
||||
+ .endif
|
||||
+ sub TMP0, DAT0, PATTERN, lsr #14
|
||||
+ sub TMP1, DAT1, PATTERN, lsr #14
|
||||
+ bic TMP0, TMP0, DAT0
|
||||
+ bic TMP1, TMP1, DAT1
|
||||
+ sub TMP2, DAT2, PATTERN, lsr #14
|
||||
+ sub TMP3, DAT3, PATTERN, lsr #14
|
||||
+ ands TMP0, TMP0, PATTERN
|
||||
+ bic TMP2, TMP2, DAT2
|
||||
+ it eq
|
||||
+ andseq TMP1, TMP1, PATTERN
|
||||
+ bic TMP3, TMP3, DAT3
|
||||
+ itt eq
|
||||
+ andseq TMP2, TMP2, PATTERN
|
||||
+ andseq TMP3, TMP3, PATTERN
|
||||
+.endm
|
||||
+
|
||||
+/* int ff_h264_find_start_code_candidate_armv6(const uint8_t *buf, int size) */
|
||||
+function ff_h264_find_start_code_candidate_armv6, export=1
|
||||
+ push {v1-v6,lr}
|
||||
+ mov PTR, BUF
|
||||
+ @ Ensure there are at least (PRELOAD_DISTANCE+2) complete cachelines to go
|
||||
+ @ before using code that does preloads
|
||||
+ cmp SIZE, #(PRELOAD_DISTANCE+3)*32 - 1
|
||||
+ blo 60f
|
||||
+
|
||||
+ @ Get to word-alignment, 1 byte at a time
|
||||
+ tst PTR, #3
|
||||
+ beq 2f
|
||||
+1: ldrb DAT0, [PTR], #1
|
||||
+ sub SIZE, SIZE, #1
|
||||
+ teq DAT0, #0
|
||||
+ beq 90f
|
||||
+ tst PTR, #3
|
||||
+ bne 1b
|
||||
+2: @ Get to 4-word alignment, 1 word at a time
|
||||
+ ldr PATTERN, =0x80008000
|
||||
+ setend be
|
||||
+ tst PTR, #12
|
||||
+ beq 4f
|
||||
+3: innerloop4
|
||||
+ bne 91f
|
||||
+ tst PTR, #12
|
||||
+ bne 3b
|
||||
+4: @ Get to cacheline (8-word) alignment
|
||||
+ tst PTR, #16
|
||||
+ beq 5f
|
||||
+ innerloop16 16
|
||||
+ bne 93f
|
||||
+5: @ Check complete cachelines, with preloading
|
||||
+ @ We need to stop when there are still (PRELOAD_DISTANCE+1)
|
||||
+ @ complete cachelines to go
|
||||
+ sub SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32
|
||||
+6: innerloop16 , do_preload
|
||||
+ bne 93f
|
||||
+ innerloop16 32
|
||||
+ bne 93f
|
||||
+ bcs 6b
|
||||
+ @ Preload trailing part-cacheline, if any
|
||||
+ tst SIZE, #31
|
||||
+ beq 7f
|
||||
+ pld [PTR, #(PRELOAD_DISTANCE+1)*32]
|
||||
+ @ Check remaining data without doing any more preloads. First
|
||||
+ @ do in chunks of 4 words:
|
||||
+7: adds SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32 - 16
|
||||
+ bmi 9f
|
||||
+8: innerloop16 16
|
||||
+ bne 93f
|
||||
+ bcs 8b
|
||||
+ @ Then in words:
|
||||
+9: adds SIZE, SIZE, #16 - 4
|
||||
+ bmi 11f
|
||||
+10: innerloop4
|
||||
+ bne 91f
|
||||
+ bcs 10b
|
||||
+11: setend le
|
||||
+ @ Check second byte of final halfword
|
||||
+ ldrb DAT0, [PTR, #-1]
|
||||
+ teq DAT0, #0
|
||||
+ beq 90f
|
||||
+ @ Check any remaining bytes
|
||||
+ tst SIZE, #3
|
||||
+ beq 13f
|
||||
+12: ldrb DAT0, [PTR], #1
|
||||
+ sub SIZE, SIZE, #1
|
||||
+ teq DAT0, #0
|
||||
+ beq 90f
|
||||
+ tst SIZE, #3
|
||||
+ bne 12b
|
||||
+ @ No candidate found
|
||||
+13: sub RESULT, PTR, BUF
|
||||
+ b 99f
|
||||
+
|
||||
+60: @ Small buffer - simply check by looping over bytes
|
||||
+ subs SIZE, SIZE, #1
|
||||
+ bcc 99f
|
||||
+61: ldrb DAT0, [PTR], #1
|
||||
+ subs SIZE, SIZE, #1
|
||||
+ teq DAT0, #0
|
||||
+ beq 90f
|
||||
+ bcs 61b
|
||||
+ @ No candidate found
|
||||
+ sub RESULT, PTR, BUF
|
||||
+ b 99f
|
||||
+
|
||||
+90: @ Found a candidate at the preceding byte
|
||||
+ sub RESULT, PTR, BUF
|
||||
+ sub RESULT, RESULT, #1
|
||||
+ b 99f
|
||||
+
|
||||
+91: @ Found a candidate somewhere in the preceding 4 bytes
|
||||
+ sub RESULT, PTR, BUF
|
||||
+ sub RESULT, RESULT, #4
|
||||
+ sub TMP0, DAT0, #0x20000
|
||||
+ bics TMP0, TMP0, DAT0
|
||||
+ itt pl
|
||||
+ ldrbpl DAT0, [PTR, #-3]
|
||||
+ addpl RESULT, RESULT, #2
|
||||
+ bpl 92f
|
||||
+ teq RESULT, #0
|
||||
+ beq 98f @ don't look back a byte if found at first byte in buffer
|
||||
+ ldrb DAT0, [PTR, #-5]
|
||||
+92: teq DAT0, #0
|
||||
+ it eq
|
||||
+ subeq RESULT, RESULT, #1
|
||||
+ b 98f
|
||||
+
|
||||
+93: @ Found a candidate somewhere in the preceding 16 bytes
|
||||
+ sub RESULT, PTR, BUF
|
||||
+ sub RESULT, RESULT, #16
|
||||
+ teq TMP0, #0
|
||||
+ beq 95f @ not in first 4 bytes
|
||||
+ sub TMP0, DAT0, #0x20000
|
||||
+ bics TMP0, TMP0, DAT0
|
||||
+ itt pl
|
||||
+ ldrbpl DAT0, [PTR, #-15]
|
||||
+ addpl RESULT, RESULT, #2
|
||||
+ bpl 94f
|
||||
+ teq RESULT, #0
|
||||
+ beq 98f @ don't look back a byte if found at first byte in buffer
|
||||
+ ldrb DAT0, [PTR, #-17]
|
||||
+94: teq DAT0, #0
|
||||
+ it eq
|
||||
+ subeq RESULT, RESULT, #1
|
||||
+ b 98f
|
||||
+95: add RESULT, RESULT, #4
|
||||
+ teq TMP1, #0
|
||||
+ beq 96f @ not in next 4 bytes
|
||||
+ sub TMP1, DAT1, #0x20000
|
||||
+ bics TMP1, TMP1, DAT1
|
||||
+ itee mi
|
||||
+ ldrbmi DAT0, [PTR, #-13]
|
||||
+ ldrbpl DAT0, [PTR, #-11]
|
||||
+ addpl RESULT, RESULT, #2
|
||||
+ teq DAT0, #0
|
||||
+ it eq
|
||||
+ subeq RESULT, RESULT, #1
|
||||
+ b 98f
|
||||
+96: add RESULT, RESULT, #4
|
||||
+ teq TMP2, #0
|
||||
+ beq 97f @ not in next 4 bytes
|
||||
+ sub TMP2, DAT2, #0x20000
|
||||
+ bics TMP2, TMP2, DAT2
|
||||
+ itee mi
|
||||
+ ldrbmi DAT0, [PTR, #-9]
|
||||
+ ldrbpl DAT0, [PTR, #-7]
|
||||
+ addpl RESULT, RESULT, #2
|
||||
+ teq DAT0, #0
|
||||
+ it eq
|
||||
+ subeq RESULT, RESULT, #1
|
||||
+ b 98f
|
||||
+97: add RESULT, RESULT, #4
|
||||
+ sub TMP3, DAT3, #0x20000
|
||||
+ bics TMP3, TMP3, DAT3
|
||||
+ itee mi
|
||||
+ ldrbmi DAT0, [PTR, #-5]
|
||||
+ ldrbpl DAT0, [PTR, #-3]
|
||||
+ addpl RESULT, RESULT, #2
|
||||
+ teq DAT0, #0
|
||||
+ it eq
|
||||
+ subeq RESULT, RESULT, #1
|
||||
+ @ drop through to 98f
|
||||
+98: setend le
|
||||
+99: pop {v1-v6,pc}
|
||||
+.endfunc
|
||||
+
|
||||
+ .unreq RESULT
|
||||
+ .unreq BUF
|
||||
+ .unreq SIZE
|
||||
+ .unreq PATTERN
|
||||
+ .unreq PTR
|
||||
+ .unreq DAT0
|
||||
+ .unreq DAT1
|
||||
+ .unreq DAT2
|
||||
+ .unreq DAT3
|
||||
+ .unreq TMP0
|
||||
+ .unreq TMP1
|
||||
+ .unreq TMP2
|
||||
+ .unreq TMP3
|
||||
diff --git a/libavcodec/arm/h264dsp_init_arm.c b/libavcodec/arm/h264dsp_init_arm.c
|
||||
index 785b604..2804e56 100644
|
||||
--- a/libavcodec/arm/h264dsp_init_arm.c
|
||||
+++ b/libavcodec/arm/h264dsp_init_arm.c
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "libavutil/arm/cpu.h"
|
||||
#include "libavcodec/h264dsp.h"
|
||||
|
||||
+int ff_h264_find_start_code_candidate_armv6(const uint8_t *buf, int size);
|
||||
+
|
||||
void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
||||
int beta, int8_t *tc0);
|
||||
void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
||||
@@ -106,6 +108,8 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
+ if (have_armv6(cpu_flags))
|
||||
+ c->h264_find_start_code_candidate = ff_h264_find_start_code_candidate_armv6;
|
||||
if (have_neon(cpu_flags))
|
||||
ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc);
|
||||
}
|
||||
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
|
||||
index 972aace..363843c 100644
|
||||
--- a/libavcodec/h264_parser.c
|
||||
+++ b/libavcodec/h264_parser.c
|
||||
@@ -65,7 +65,6 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si
|
||||
i += h->h264dsp.h264_find_start_code_candidate(buf + i, buf_size - i);
|
||||
if (i < buf_size)
|
||||
state = 2;
|
||||
- }
|
||||
}else if(state<=2){
|
||||
if(buf[i]==1) state^= 5; //2->7, 1->4, 0->5
|
||||
else if(buf[i]) state = 7;
|
||||
--
|
||||
1.8.5.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user