mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 22:26:42 +00:00
ffmpeg: add ffmpeg-1.2 support if build with XBMA=master
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
b20d77f42e
commit
bd389f07e7
@ -59,6 +59,12 @@ else
|
||||
FFMPEG_XVBA="--disable-xvba"
|
||||
fi
|
||||
|
||||
if [ "$XBMC" = "master" ]; then
|
||||
FFMPEG_CONFIGURE=" "
|
||||
else
|
||||
FFMPEG_CONFIGURE="--enable-fastdiv --enable-aandct --enable-golomb --enable-huffman --enable-lpc --disable-libdirac --disable-mlib --disable-iwmmxt --disable-mmi"
|
||||
fi
|
||||
|
||||
case "$TARGET_ARCH" in
|
||||
arm)
|
||||
FFMPEG_CPU=""
|
||||
@ -147,14 +153,9 @@ cd $PKG_BUILD/
|
||||
--enable-network \
|
||||
--disable-gray \
|
||||
--enable-swscale-alpha \
|
||||
--enable-fastdiv \
|
||||
$FFMPEG_OPTIM \
|
||||
--enable-aandct \
|
||||
--enable-dct \
|
||||
--enable-fft \
|
||||
--enable-golomb \
|
||||
--enable-huffman \
|
||||
--enable-lpc \
|
||||
--enable-mdct \
|
||||
--enable-rdft \
|
||||
$FFMPEG_CRYSTALHD \
|
||||
@ -187,7 +188,6 @@ cd $PKG_BUILD/
|
||||
--disable-libopencore-amrwb \
|
||||
--disable-libopencv \
|
||||
--disable-libdc1394 \
|
||||
--disable-libdirac \
|
||||
--disable-libfaac \
|
||||
--disable-libfreetype \
|
||||
--disable-libgsm \
|
||||
@ -205,14 +205,12 @@ cd $PKG_BUILD/
|
||||
--disable-libx264 \
|
||||
--disable-libxavs \
|
||||
--disable-libxvid \
|
||||
--disable-mlib \
|
||||
--enable-zlib \
|
||||
--enable-asm \
|
||||
--disable-altivec \
|
||||
$FFMPEG_CONFIGURE \
|
||||
$FFMPEG_CPU \
|
||||
$FFMPEG_FPU \
|
||||
--disable-iwmmxt \
|
||||
--disable-mmi \
|
||||
--disable-vis \
|
||||
--enable-yasm \
|
||||
--disable-sram \
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
PKG_NAME="ffmpeg"
|
||||
PKG_VERSION="0.10.6"
|
||||
if [ "$XBMC" = "master" ]; then
|
||||
PKG_VERSION="1.2"
|
||||
fi
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="LGPL"
|
||||
|
@ -0,0 +1,53 @@
|
||||
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
|
||||
|
@ -0,0 +1,125 @@
|
||||
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
|
||||
|
@ -0,0 +1,60 @@
|
||||
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
|
||||
|
37
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0004-asf-hacks.patch
vendored
Normal file
37
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0004-asf-hacks.patch
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
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
|
||||
|
@ -0,0 +1,24 @@
|
||||
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
|
||||
|
@ -0,0 +1,40 @@
|
||||
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
|
||||
|
@ -0,0 +1,41 @@
|
||||
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
|
||||
|
@ -0,0 +1,43 @@
|
||||
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
|
||||
|
@ -0,0 +1,64 @@
|
||||
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
|
||||
|
||||
|
||||
|
@ -0,0 +1,98 @@
|
||||
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
|
||||
|
@ -0,0 +1,68 @@
|
||||
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
|
||||
|
33
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch
vendored
Normal file
33
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0013-aacenc-add-recognized-profiles-array.patch
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
|
@ -0,0 +1,28 @@
|
||||
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
|
||||
|
@ -0,0 +1,38 @@
|
||||
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
|
||||
|
37
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch
vendored
Normal file
37
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0016-Speed-up-mpegts-av_find_stream_info.patch
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
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
|
||||
|
@ -0,0 +1,40 @@
|
||||
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
|
||||
|
@ -0,0 +1,75 @@
|
||||
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
|
||||
|
75
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch
vendored
Normal file
75
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-0019-dxva-mpeg2-speed-up-slice-allocation.patch
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
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
|
||||
|
@ -0,0 +1,46 @@
|
||||
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
|
||||
|
@ -0,0 +1,26 @@
|
||||
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
|
||||
|
@ -0,0 +1,67 @@
|
||||
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
|
||||
|
@ -0,0 +1,44 @@
|
||||
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
|
||||
|
@ -0,0 +1,51 @@
|
||||
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
|
||||
|
@ -0,0 +1,26 @@
|
||||
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
|
||||
|
@ -0,0 +1,24 @@
|
||||
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
|
||||
|
@ -0,0 +1,25 @@
|
||||
From b066d90211072c7532e17c0c54d8475f10fc97ad Mon Sep 17 00:00:00 2001
|
||||
From: Janne Grunau <janne-libav@jannau.net>
|
||||
Date: Thu, 14 Mar 2013 15:12:30 +0100
|
||||
Subject: [PATCH] vaapi: fix argument for ff_vaapi_common_end_frame call
|
||||
|
||||
---
|
||||
libavcodec/vaapi.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
|
||||
index 9c07c8d..0532daf 100644
|
||||
--- a/libavcodec/vaapi.c
|
||||
+++ b/libavcodec/vaapi.c
|
||||
@@ -212,7 +212,7 @@ int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
|
||||
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
|
||||
|
||||
finish:
|
||||
- ff_vaapi_common_end_frame(avctx->priv_data);
|
||||
+ ff_vaapi_common_end_frame(avctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.5
|
||||
|
851
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.01-add_xvba_support.patch
vendored
Normal file
851
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.01-add_xvba_support.patch
vendored
Normal file
@ -0,0 +1,851 @@
|
||||
From 67895a77c9e5f519166dd0ce4a2a98649194b11b Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Hochecker <fernetmenta@online.de>
|
||||
Date: Sat, 8 Oct 2011 16:45:13 +0200
|
||||
Subject: [PATCH] ffmpeg: add xvba hwaccel
|
||||
|
||||
---
|
||||
configure | 11 ++
|
||||
libavcodec/Makefile | 6 ++
|
||||
libavcodec/allcodecs.c | 4 +
|
||||
libavcodec/h264.c | 3 +
|
||||
libavcodec/xvba.c | 66 ++++++++++++
|
||||
libavcodec/xvba.h | 71 +++++++++++++
|
||||
libavcodec/xvba_h264.c | 192 ++++++++++++++++++++++++++++++++++
|
||||
libavcodec/xvba_internal.h | 24 +++++
|
||||
libavcodec/xvba_mpeg2.c | 52 +++++++++
|
||||
libavcodec/xvba_vc1.c | 190 +++++++++++++++++++++++++++++++++
|
||||
libavutil/pixdesc.c | 6 ++
|
||||
libavutil/pixfmt.h | 1 +
|
||||
12 files changed, 626 insertions(+)
|
||||
create mode 100644 libavcodec/xvba.c
|
||||
create mode 100644 libavcodec/xvba.h
|
||||
create mode 100644 libavcodec/xvba_h264.c
|
||||
create mode 100644 libavcodec/xvba_internal.h
|
||||
create mode 100644 libavcodec/xvba_mpeg2.c
|
||||
create mode 100644 libavcodec/xvba_vc1.c
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 351611d..876a6ea 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -144,6 +144,7 @@ Hardware accelerators:
|
||||
--enable-vaapi enable VAAPI code
|
||||
--enable-vda enable VDA code
|
||||
--enable-vdpau enable VDPAU code
|
||||
+ --disable-xvba disable XVBA code
|
||||
|
||||
Individual component options:
|
||||
--disable-everything disable all components listed below
|
||||
@@ -1197,6 +1198,7 @@ HWACCEL_LIST="
|
||||
vaapi
|
||||
vda
|
||||
vdpau
|
||||
+ xvba
|
||||
"
|
||||
|
||||
LIBRARY_LIST="
|
||||
@@ -1827,6 +1829,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
|
||||
dxva2_deps="dxva2api_h"
|
||||
vaapi_deps="va_va_h"
|
||||
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
|
||||
+xvba_deps="amd_amdxvba_h"
|
||||
vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
|
||||
vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
|
||||
|
||||
@@ -1847,6 +1850,8 @@ h264_vdpau_decoder_deps="vdpau"
|
||||
h264_vdpau_decoder_select="h264_decoder"
|
||||
h264_vdpau_hwaccel_deps="vdpau"
|
||||
h264_vdpau_hwaccel_select="h264_decoder"
|
||||
+h264_xvba_hwaccel_select="h264_decoder"
|
||||
+h264_xvba_hwaccel_deps="xvba"
|
||||
mpeg_vdpau_decoder_deps="vdpau"
|
||||
mpeg_vdpau_decoder_select="mpegvideo_decoder"
|
||||
mpeg1_vdpau_decoder_deps="vdpau"
|
||||
@@ -1859,6 +1864,8 @@ mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_vaapi_hwaccel_deps="vaapi"
|
||||
mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_vdpau_hwaccel_deps="vdpau"
|
||||
+mpeg2_xvba_hwaccel_select="mpeg2video_decoder"
|
||||
+mpeg2_xvba_hwaccel_deps="xvba"
|
||||
mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg4_crystalhd_decoder_select="crystalhd"
|
||||
mpeg4_vaapi_hwaccel_deps="vaapi"
|
||||
@@ -1877,11 +1884,14 @@ vc1_vdpau_decoder_deps="vdpau"
|
||||
vc1_vdpau_decoder_select="vc1_decoder"
|
||||
vc1_vdpau_hwaccel_deps="vdpau"
|
||||
vc1_vdpau_hwaccel_select="vc1_decoder"
|
||||
+vc1_xvba_hwaccel_select="vc1_decoder"
|
||||
+vc1_xvba_hwaccel_deps="xvba"
|
||||
wmv3_crystalhd_decoder_select="crystalhd"
|
||||
wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
|
||||
wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
|
||||
wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
|
||||
wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
|
||||
+wmv3_xvba_hwaccel_select="vc1_xvba_hwaccel"
|
||||
|
||||
# parsers
|
||||
h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
||||
@@ -3832,6 +3842,7 @@ check_header termios.h
|
||||
check_header unistd.h
|
||||
check_header vdpau/vdpau.h
|
||||
check_header vdpau/vdpau_x11.h
|
||||
+check_header amd/amdxvba.h
|
||||
check_cpp_condition vdpau/vdpau.h "defined(VDP_DECODER_PROFILE_MPEG4_PART2_SP)" && enable vdpau_mpeg4_support
|
||||
|
||||
check_header VideoDecodeAcceleration/VDADecoder.h
|
||||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
|
||||
index dc065a5..c386923 100644
|
||||
--- a/libavcodec/Makefile
|
||||
+++ b/libavcodec/Makefile
|
||||
@@ -12,6 +12,7 @@ HEADERS = avcodec.h \
|
||||
vdpau.h \
|
||||
version.h \
|
||||
xvmc.h \
|
||||
+ xvba.h \
|
||||
|
||||
OBJS = allcodecs.o \
|
||||
audioconvert.o \
|
||||
@@ -73,6 +74,7 @@ OBJS-$(CONFIG_SHARED) += log2_tab.o
|
||||
OBJS-$(CONFIG_SINEWIN) += sinewin.o
|
||||
OBJS-$(CONFIG_VAAPI) += vaapi.o
|
||||
OBJS-$(CONFIG_VDPAU) += vdpau.o
|
||||
+OBJS-$(CONFIG_XVBA) += xvba.o
|
||||
OBJS-$(CONFIG_VIDEODSP) += videodsp.o
|
||||
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
|
||||
|
||||
@@ -232,6 +234,7 @@ OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
|
||||
OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o
|
||||
OBJS-$(CONFIG_H264_VDA_DECODER) += vda_h264_dec.o
|
||||
OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
|
||||
+OBJS-$(CONFIG_H264_XVBA_HWACCEL) += xvba_h264.o
|
||||
OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
|
||||
OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
|
||||
OBJS-$(CONFIG_IAC_DECODER) += imc.o
|
||||
@@ -295,6 +298,7 @@ OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o \
|
||||
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o
|
||||
+OBJS-$(CONFIG_MPEG2_XVBA_HWACCEL) += xvba_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o
|
||||
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o \
|
||||
timecode.o
|
||||
@@ -459,6 +463,7 @@ OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o vc1dsp.o \
|
||||
OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o
|
||||
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o
|
||||
OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o
|
||||
+OBJS-$(CONFIG_VC1_XVBA_HWACCEL) += xvba_vc1.o
|
||||
OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o
|
||||
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o
|
||||
OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdav.o
|
||||
@@ -788,6 +793,7 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
|
||||
SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h
|
||||
SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
|
||||
+SKIPHEADERS-$(CONFIG_XVBA) += xvba_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDA) += vda.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
|
||||
SKIPHEADERS-$(HAVE_OS2THREADS) += os2threads.h
|
||||
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
|
||||
index 584446f..7a8f61c 100644
|
||||
--- a/libavcodec/allcodecs.c
|
||||
+++ b/libavcodec/allcodecs.c
|
||||
@@ -79,18 +79,22 @@ void avcodec_register_all(void)
|
||||
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
|
||||
REGISTER_HWACCEL(H264_VDA, h264_vda);
|
||||
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
|
||||
+ REGISTER_HWACCEL(H264_XVBA, h264_xvba);
|
||||
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
|
||||
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
|
||||
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
|
||||
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
|
||||
+ REGISTER_HWACCEL(MPEG2_XVBA, mpeg2_xvba);
|
||||
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
|
||||
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
|
||||
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
|
||||
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
|
||||
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
|
||||
+ REGISTER_HWACCEL(VC1_XVBA, vc1_xvba);
|
||||
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
|
||||
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
|
||||
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
|
||||
+ REGISTER_HWACCEL(WMV3_XVBA, wmv3_xvba);
|
||||
|
||||
/* video codecs */
|
||||
REGISTER_ENCODER(A64MULTI, a64multi);
|
||||
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
|
||||
index 937ad7a..299039f 100644
|
||||
--- a/libavcodec/h264.c
|
||||
+++ b/libavcodec/h264.c
|
||||
@@ -81,6 +81,9 @@
|
||||
#if CONFIG_H264_VDPAU_HWACCEL
|
||||
AV_PIX_FMT_VDPAU,
|
||||
#endif
|
||||
+#if CONFIG_H264_XVBA_HWACCEL
|
||||
+ AV_PIX_FMT_XVBA_VLD,
|
||||
+#endif
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
diff --git a/libavcodec/xvba.c b/libavcodec/xvba.c
|
||||
new file mode 100644
|
||||
index 0000000..be29e5d
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba.c
|
||||
@@ -0,0 +1,66 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * \addtogroup XVBA_Decoding
|
||||
+ *
|
||||
+ * @{
|
||||
+ */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "avcodec.h"
|
||||
+
|
||||
+int ff_xvba_translate_profile(int profile) {
|
||||
+
|
||||
+ if (profile == 66)
|
||||
+ return 1;
|
||||
+ else if (profile == 77)
|
||||
+ return 2;
|
||||
+ else if (profile == 100)
|
||||
+ return 3;
|
||||
+ else if (profile == 0)
|
||||
+ return 4;
|
||||
+ else if (profile == 1)
|
||||
+ return 5;
|
||||
+ else if (profile == 3)
|
||||
+ return 6;
|
||||
+ else
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size) {
|
||||
+
|
||||
+ render->buffers = av_fast_realloc(
|
||||
+ render->buffers,
|
||||
+ &render->buffers_alllocated,
|
||||
+ sizeof(struct xvba_bitstream_buffers)*(render->num_slices + 1)
|
||||
+ );
|
||||
+
|
||||
+ render->buffers[render->num_slices].buffer = buffer;
|
||||
+ render->buffers[render->num_slices].size = size;
|
||||
+
|
||||
+ render->num_slices++;
|
||||
+}
|
||||
+
|
||||
diff --git a/libavcodec/xvba.h b/libavcodec/xvba.h
|
||||
new file mode 100644
|
||||
index 0000000..9f9ff0c
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba.h
|
||||
@@ -0,0 +1,71 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#ifndef AVCODEC_XVBA_H
|
||||
+#define AVCODEC_XVBA_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <X11/Xlib.h>
|
||||
+#include <amd/amdxvba.h>
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * \defgroup XVBA_Decoding VA API Decoding
|
||||
+ * \ingroup Decoder
|
||||
+ * @{
|
||||
+ */
|
||||
+
|
||||
+/** \brief The videoSurface is used for rendering. */
|
||||
+#define FF_XVBA_STATE_USED_FOR_RENDER 1
|
||||
+
|
||||
+/**
|
||||
+ * \brief The videoSurface is needed for reference/prediction.
|
||||
+ * The codec manipulates this.
|
||||
+ */
|
||||
+#define FF_XVBA_STATE_USED_FOR_REFERENCE 2
|
||||
+
|
||||
+/**
|
||||
+ * \brief The videoSurface holds a decoded frame.
|
||||
+ * The codec manipulates this.
|
||||
+ */
|
||||
+#define FF_XVBA_STATE_DECODED 4
|
||||
+
|
||||
+/* @} */
|
||||
+
|
||||
+struct xvba_bitstream_buffers
|
||||
+{
|
||||
+ const void *buffer;
|
||||
+ unsigned int size;
|
||||
+};
|
||||
+
|
||||
+struct xvba_render_state {
|
||||
+
|
||||
+ int state; ///< Holds FF_XVBA_STATE_* values.
|
||||
+ void *surface;
|
||||
+ XVBAPictureDescriptor *picture_descriptor;
|
||||
+ XVBAQuantMatrixAvc *iq_matrix;
|
||||
+ unsigned int num_slices;
|
||||
+ struct xvba_bitstream_buffers *buffers;
|
||||
+ uint32_t buffers_alllocated;
|
||||
+};
|
||||
+
|
||||
+#endif /* AVCODEC_XVBA_H */
|
||||
diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
|
||||
new file mode 100644
|
||||
index 0000000..ae45f3a
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba_h264.c
|
||||
@@ -0,0 +1,192 @@
|
||||
+/*
|
||||
+ * H.264 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "h264.h"
|
||||
+#include <assert.h>
|
||||
+
|
||||
+/** @file
|
||||
+ * This file implements the glue code between FFmpeg's and XvBA API's
|
||||
+ * structures for H.264 decoding.
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/** Initialize and start decoding a frame with XVBA. */
|
||||
+static int start_frame(AVCodecContext *avctx,
|
||||
+ av_unused const uint8_t *buffer,
|
||||
+ av_unused uint32_t size)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ struct xvba_render_state *render;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+ int i;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+
|
||||
+ for (i = 0; i < 2; ++i) {
|
||||
+ int foc = h->cur_pic_ptr->field_poc[i];
|
||||
+ if (foc == INT_MAX)
|
||||
+ foc = 0;
|
||||
+ pic_descriptor->avc_curr_field_order_cnt_list[i] = foc;
|
||||
+ }
|
||||
+
|
||||
+ pic_descriptor->avc_frame_num = h->frame_num;
|
||||
+
|
||||
+ render->num_slices = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/** End a hardware decoding based frame. */
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ struct xvba_render_state *render;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+ XVBAQuantMatrixAvc *iq_matrix;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0 || render->iq_matrix == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+ iq_matrix = render->iq_matrix;
|
||||
+
|
||||
+ av_dlog(avctx, "end_frame()\n");
|
||||
+
|
||||
+ /* Fill in Picture Parameters*/
|
||||
+ pic_descriptor->profile = ff_xvba_translate_profile(avctx->profile);
|
||||
+ pic_descriptor->level = avctx->level;
|
||||
+ pic_descriptor->width_in_mb = h->mb_width;
|
||||
+ pic_descriptor->height_in_mb = h->mb_height;
|
||||
+ pic_descriptor->picture_structure = h->picture_structure;
|
||||
+ pic_descriptor->chroma_format = h->chroma_format_idc ? h->chroma_format_idc : 1;
|
||||
+ pic_descriptor->avc_intra_flag = (h->slice_type == AV_PICTURE_TYPE_I) ? 1 : 0;
|
||||
+ pic_descriptor->avc_reference = (h->cur_pic_ptr->f.reference & 3) ? 1 : 0;
|
||||
+
|
||||
+ pic_descriptor->avc_bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
|
||||
+ pic_descriptor->avc_bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
|
||||
+ pic_descriptor->avc_log2_max_frame_num_minus4 = h->sps.log2_max_frame_num -4;
|
||||
+ pic_descriptor->avc_pic_order_cnt_type = h->sps.poc_type;
|
||||
+ pic_descriptor->avc_log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
|
||||
+ pic_descriptor->avc_num_ref_frames = h->sps.ref_frame_count;
|
||||
+ pic_descriptor->avc_reserved_8bit = 0;
|
||||
+
|
||||
+ /* Set a level that can decode stuff in every case without a lookup table
|
||||
+ xvba seems to have problems only when the number of Reframes goes beyond
|
||||
+ the max support number of Level4.1@High. So in praxis decoding a Level 3.0
|
||||
+ file that in deed has level4.1@High specs does not matter. We use this fact
|
||||
+ and check if the ref_frames stay in the range Level4.1@high can decode if
|
||||
+ not, we set Level5.1 */
|
||||
+ if (pic_descriptor->avc_num_ref_frames > 4) {
|
||||
+ const unsigned int mbw = pic_descriptor->width_in_mb;
|
||||
+ const unsigned int mbh = pic_descriptor->height_in_mb;
|
||||
+ // this matches Level4.1@High stats to differ between <= 4.1 and 5.1
|
||||
+ const unsigned int max_ref_frames = 12288 * 1024 / (mbw * mbh * 384);
|
||||
+ const unsigned int num_ref_frames = pic_descriptor->avc_num_ref_frames;
|
||||
+ if (max_ref_frames < num_ref_frames)
|
||||
+ pic_descriptor->level = 51;
|
||||
+ }
|
||||
+
|
||||
+ pic_descriptor->avc_num_slice_groups_minus1 = h->pps.slice_group_count - 1;
|
||||
+ pic_descriptor->avc_num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1;
|
||||
+ pic_descriptor->avc_num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1;
|
||||
+
|
||||
+ pic_descriptor->avc_pic_init_qp_minus26 = h->pps.init_qp - 26;
|
||||
+ pic_descriptor->avc_pic_init_qs_minus26 = h->pps.init_qs - 26;
|
||||
+ pic_descriptor->avc_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0];
|
||||
+ pic_descriptor->avc_second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
|
||||
+ pic_descriptor->avc_slice_group_change_rate_minus1 = 0; // not implemented in ffmpeg
|
||||
+ pic_descriptor->avc_reserved_16bit = 0; // must be 0
|
||||
+ memset(pic_descriptor->avc_field_order_cnt_list,0,sizeof(pic_descriptor->avc_field_order_cnt_list)); // must be 0
|
||||
+ memset(pic_descriptor->avc_slice_group_map,0,sizeof(pic_descriptor->avc_slice_group_map)); // must be 0
|
||||
+
|
||||
+ // sps
|
||||
+ pic_descriptor->sps_info.avc.delta_pic_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
|
||||
+ pic_descriptor->sps_info.avc.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag;
|
||||
+ pic_descriptor->sps_info.avc.frame_mbs_only_flag = h->sps.frame_mbs_only_flag;
|
||||
+ pic_descriptor->sps_info.avc.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
|
||||
+ pic_descriptor->sps_info.avc.mb_adaptive_frame_field_flag = h->sps.mb_aff;
|
||||
+ pic_descriptor->sps_info.avc.residual_colour_transform_flag = h->sps.residual_color_transform_flag;
|
||||
+ pic_descriptor->sps_info.avc.xvba_avc_sps_reserved = 0;
|
||||
+
|
||||
+ // pps
|
||||
+ pic_descriptor->pps_info.avc.entropy_coding_mode_flag = h->pps.cabac;
|
||||
+ pic_descriptor->pps_info.avc.pic_order_present_flag = h->pps.pic_order_present;
|
||||
+ pic_descriptor->pps_info.avc.weighted_pred_flag = h->pps.weighted_pred;
|
||||
+ pic_descriptor->pps_info.avc.weighted_bipred_idc = h->pps.weighted_bipred_idc;
|
||||
+ pic_descriptor->pps_info.avc.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
|
||||
+ pic_descriptor->pps_info.avc.constrained_intra_pred_flag = h->pps.constrained_intra_pred;
|
||||
+ pic_descriptor->pps_info.avc.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present;
|
||||
+ pic_descriptor->pps_info.avc.transform_8x8_mode_flag = h->pps.transform_8x8_mode;
|
||||
+ pic_descriptor->pps_info.avc.xvba_avc_pps_reserved = 0; // must be 0
|
||||
+
|
||||
+ memcpy(iq_matrix->bScalingLists4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->bScalingLists4x4));
|
||||
+ memcpy(iq_matrix->bScalingLists8x8[0], h->pps.scaling_matrix8[0], sizeof(iq_matrix->bScalingLists8x8[0]));
|
||||
+ memcpy(iq_matrix->bScalingLists8x8[1], h->pps.scaling_matrix8[3], sizeof(iq_matrix->bScalingLists8x8[0]));
|
||||
+
|
||||
+ // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs
|
||||
+ if (!h->got_first_iframe) {
|
||||
+ if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)
|
||||
+ return -1;
|
||||
+ h->got_first_iframe = 1;
|
||||
+ }
|
||||
+
|
||||
+ ff_draw_horiz_band(h->avctx, &h->dsp, h->cur_pic_ptr, NULL, 0, h->avctx->height, h->picture_structure, h->first_field, 0, 0, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/** Decode the given H.264 slice with XVBA. */
|
||||
+static int decode_slice(AVCodecContext *avctx,
|
||||
+ const uint8_t *buffer,
|
||||
+ uint32_t size)
|
||||
+{
|
||||
+ H264Context * const h = avctx->priv_data;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)h->cur_pic_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ ff_xvba_add_slice_data(render, buffer, size);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+AVHWAccel ff_h264_xvba_hwaccel = {
|
||||
+ .name = "h264_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_H264,
|
||||
+ .pix_fmt = AV_PIX_FMT_XVBA_VLD,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+};
|
||||
diff --git a/libavcodec/xvba_internal.h b/libavcodec/xvba_internal.h
|
||||
new file mode 100644
|
||||
index 0000000..9653f85
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba_internal.h
|
||||
@@ -0,0 +1,24 @@
|
||||
+/*
|
||||
+ * HW decode acceleration for MPEG-2, H.264 and VC-1
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+int ff_xvba_translate_profile(int profile);
|
||||
+void ff_xvba_add_slice_data(struct xvba_render_state *render, const uint8_t *buffer, uint32_t size);
|
||||
diff --git a/libavcodec/xvba_mpeg2.c b/libavcodec/xvba_mpeg2.c
|
||||
new file mode 100644
|
||||
index 0000000..0fc7d78
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba_mpeg2.c
|
||||
@@ -0,0 +1,52 @@
|
||||
+/*
|
||||
+ * MPEG-2 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "dsputil.h"
|
||||
+
|
||||
+static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
|
||||
+{
|
||||
+ struct MpegEncContext * const s = avctx->priv_data;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
+{
|
||||
+ struct MpegEncContext * const s = avctx->priv_data;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+AVHWAccel ff_mpeg2_xvba_hwaccel = {
|
||||
+ .name = "mpeg2_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_MPEG2VIDEO,
|
||||
+ .pix_fmt = AV_PIX_FMT_XVBA_VLD,
|
||||
+ .capabilities = 0,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+ .priv_data_size = 0,
|
||||
+};
|
||||
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
|
||||
new file mode 100644
|
||||
index 0000000..bf3d9c2
|
||||
--- /dev/null
|
||||
+++ b/libavcodec/xvba_vc1.c
|
||||
@@ -0,0 +1,190 @@
|
||||
+/*
|
||||
+ * VC-1 HW decode acceleration through XVBA
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2011 Team XBMC
|
||||
+ *
|
||||
+ * This file is part of FFmpeg.
|
||||
+ *
|
||||
+ * FFmpeg is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * FFmpeg is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with FFmpeg; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "xvba.h"
|
||||
+#include "xvba_internal.h"
|
||||
+#include "vc1.h"
|
||||
+#include "vc1data.h"
|
||||
+#include <assert.h>
|
||||
+
|
||||
+
|
||||
+/** @file
|
||||
+ * Implement structures of ffmpeg <-> XvBA
|
||||
+ */
|
||||
+
|
||||
+/* Initialize and start decoding a frame with XvBA */
|
||||
+static int start_frame(AVCodecContext *avctx,
|
||||
+ av_unused const uint8_t *buffer,
|
||||
+ av_unused uint32_t size)
|
||||
+{
|
||||
+ VC1Context * const v = avctx->priv_data;
|
||||
+ MpegEncContext * const s = &v->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ render->num_slices = 0;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* End a hardware decoding based frame */
|
||||
+static int end_frame(AVCodecContext *avctx)
|
||||
+{
|
||||
+ VC1Context* const v = avctx->priv_data;
|
||||
+ MpegEncContext* const s = &v->s;
|
||||
+ struct xvba_render_state *render, *last, *next;
|
||||
+ XVBAPictureDescriptor *pic_descriptor;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (render->picture_descriptor == 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ pic_descriptor = render->picture_descriptor;
|
||||
+
|
||||
+ av_dlog(avctx, "xvba_vc1_end_frame()\n");
|
||||
+
|
||||
+ memset(pic_descriptor, 0, sizeof(*pic_descriptor));
|
||||
+
|
||||
+ /* Fill in Parameters - for reference see AMD sdk documentation */
|
||||
+ pic_descriptor->profile = ff_xvba_translate_profile(v->profile);
|
||||
+ pic_descriptor->level = v->level;
|
||||
+ //done like in va-driver and vaapi
|
||||
+ if (v->profile == PROFILE_ADVANCED) {
|
||||
+ pic_descriptor->width_in_mb = s->avctx->coded_width;
|
||||
+ pic_descriptor->height_in_mb = s->avctx->coded_height;
|
||||
+ } else {
|
||||
+ pic_descriptor->width_in_mb = s->mb_width;
|
||||
+ pic_descriptor->height_in_mb = s->mb_height;
|
||||
+ }
|
||||
+ pic_descriptor->picture_structure = s->picture_structure;
|
||||
+ // xvba-video set this to 1 only 4:2:0 supported
|
||||
+ // doc says: if not set, choose 1 - we try this
|
||||
+ pic_descriptor->chroma_format = 1;
|
||||
+ pic_descriptor->avc_intra_flag = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type == 1;
|
||||
+ pic_descriptor->avc_reference = (s->current_picture_ptr->f.reference & 3) ? 1 : 0;
|
||||
+
|
||||
+ // VC-1 explicit parameters see page 30 of sdk
|
||||
+ // sps_info
|
||||
+ pic_descriptor->sps_info.vc1.postprocflag = v->postprocflag;
|
||||
+
|
||||
+ // done as in vaapi
|
||||
+ pic_descriptor->sps_info.vc1.pulldown = v->broadcast;
|
||||
+ pic_descriptor->sps_info.vc1.interlace = v->interlace;
|
||||
+ pic_descriptor->sps_info.vc1.tfcntrflag = v->tfcntrflag;
|
||||
+ pic_descriptor->sps_info.vc1.finterpflag = v->finterpflag;
|
||||
+ pic_descriptor->sps_info.vc1.reserved = 1;
|
||||
+ // eventually check if this makes sense together with interlace
|
||||
+ pic_descriptor->sps_info.vc1.psf = v->psf;
|
||||
+ // what about if it is a frame (page 31)
|
||||
+ // looked at xvba-driver
|
||||
+ pic_descriptor->sps_info.vc1.second_field = !s->first_field;
|
||||
+ pic_descriptor->sps_info.vc1.xvba_vc1_sps_reserved = 0;
|
||||
+
|
||||
+ // VC-1 explicit parameters see page 30 of sdk
|
||||
+ // pps_info
|
||||
+ pic_descriptor->pps_info.vc1.panscan_flag = v->panscanflag;
|
||||
+ pic_descriptor->pps_info.vc1.refdist_flag = v->refdist_flag;
|
||||
+ pic_descriptor->pps_info.vc1.loopfilter = s->loop_filter;
|
||||
+ pic_descriptor->pps_info.vc1.fastuvmc = v->fastuvmc;
|
||||
+ pic_descriptor->pps_info.vc1.extended_mv = v->extended_mv;
|
||||
+ pic_descriptor->pps_info.vc1.dquant = v->dquant;
|
||||
+ pic_descriptor->pps_info.vc1.vstransform = v->vstransform;
|
||||
+ pic_descriptor->pps_info.vc1.overlap = v->overlap;
|
||||
+ pic_descriptor->pps_info.vc1.quantizer = v->quantizer_mode;
|
||||
+ pic_descriptor->pps_info.vc1.extended_dmv = v->extended_dmv;
|
||||
+ pic_descriptor->pps_info.vc1.maxbframes = s->avctx->max_b_frames;
|
||||
+ pic_descriptor->pps_info.vc1.rangered = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : v->rangered;
|
||||
+ pic_descriptor->pps_info.vc1.syncmarker = (pic_descriptor->profile == PROFILE_SIMPLE) ? 0 : s->resync_marker;
|
||||
+ pic_descriptor->pps_info.vc1.multires = v->multires;
|
||||
+ pic_descriptor->pps_info.vc1.reserved = 1;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapy_flag = v->range_mapy_flag;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapy = v->range_mapy;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapuv_flag = v->range_mapuv_flag;
|
||||
+ pic_descriptor->pps_info.vc1.range_mapuv = v->range_mapuv;
|
||||
+ pic_descriptor->pps_info.vc1.xvba_vc1_pps_reserved = 0;
|
||||
+
|
||||
+ pic_descriptor->past_surface = 0;
|
||||
+ pic_descriptor->future_surface = 0;
|
||||
+ switch (s->pict_type) {
|
||||
+ case AV_PICTURE_TYPE_B:
|
||||
+ next = (struct xvba_render_state *)s->next_picture.f.data[0];
|
||||
+ assert(next);
|
||||
+ if (next)
|
||||
+ pic_descriptor->past_surface = next->surface;
|
||||
+ // fall-through
|
||||
+ case AV_PICTURE_TYPE_P:
|
||||
+ last = (struct xvba_render_state *)s->last_picture.f.data[0];
|
||||
+ assert(last);
|
||||
+ if (last)
|
||||
+ pic_descriptor->future_surface = last->surface;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ff_draw_horiz_band(s->avctx, &s->dsp, s->current_picture_ptr, s->last_picture_ptr, 0, s->avctx->height, s->picture_structure, s->first_field, (s->unrestricted_mv && !s->intra_only), s->low_delay, s->v_edge_pos, s->h_edge_pos);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
|
||||
+{
|
||||
+ VC1Context* const v = avctx->priv_data;
|
||||
+ MpegEncContext* const s = &v->s;
|
||||
+ struct xvba_render_state *render;
|
||||
+
|
||||
+ render = (struct xvba_render_state *)s->current_picture_ptr->f.data[0];
|
||||
+ assert(render);
|
||||
+
|
||||
+ if (avctx->codec_id == CODEC_ID_VC1 &&
|
||||
+ size >= 4 && IS_MARKER(AV_RB32(buffer))) {
|
||||
+ buffer += 4;
|
||||
+ size -= 4;
|
||||
+ }
|
||||
+
|
||||
+ ff_xvba_add_slice_data(render, buffer, size);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#if CONFIG_WMV3_XVBA_HWACCEL
|
||||
+AVHWAccel ff_wmv3_xvba_hwaccel = {
|
||||
+ .name = "wmv3_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_WMV3,
|
||||
+ .pix_fmt = AV_PIX_FMT_XVBA_VLD,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+AVHWAccel ff_vc1_xvba_hwaccel = {
|
||||
+ .name = "vc1_xvba",
|
||||
+ .type = AVMEDIA_TYPE_VIDEO,
|
||||
+ .id = CODEC_ID_VC1,
|
||||
+ .pix_fmt = AV_PIX_FMT_XVBA_VLD,
|
||||
+ .start_frame = start_frame,
|
||||
+ .end_frame = end_frame,
|
||||
+ .decode_slice = decode_slice,
|
||||
+};
|
||||
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
|
||||
index 1016dba..53dfec1 100644
|
||||
--- a/libavutil/pixdesc.c
|
||||
+++ b/libavutil/pixdesc.c
|
||||
@@ -1141,6 +1141,12 @@ void av_write_image_line(const uint16_t *src,
|
||||
.log2_chroma_h = 1,
|
||||
.flags = PIX_FMT_HWACCEL,
|
||||
},
|
||||
+ [AV_PIX_FMT_XVBA_VLD] = {
|
||||
+ .name = "xvba_vld",
|
||||
+ .log2_chroma_w = 1,
|
||||
+ .log2_chroma_h = 1,
|
||||
+ .flags = PIX_FMT_HWACCEL,
|
||||
+ },
|
||||
[AV_PIX_FMT_YUV420P9LE] = {
|
||||
.name = "yuv420p9le",
|
||||
.nb_components = 3,
|
||||
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
|
||||
index 1c00ac4..6437e29 100644
|
||||
--- a/libavutil/pixfmt.h
|
||||
+++ b/libavutil/pixfmt.h
|
||||
@@ -124,6 +124,7 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
+ AV_PIX_FMT_XVBA_VLD, ///< HW decoding through xvba, Picture.data[3] contains a xvba_rander_state struct which contains the bitstream of the slices
|
||||
|
||||
AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
--
|
||||
1.8.1.5
|
||||
|
39
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-XVBA-revisit_draw_functions.patch
vendored
Normal file
39
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.05-XVBA-revisit_draw_functions.patch
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
From 53b61e3b71c358df2ca7605f8d8478878862ca07 Mon Sep 17 00:00:00 2001
|
||||
From: fritsch <peter.fruehberger@gmail.com>
|
||||
Date: Sat, 13 Apr 2013 11:30:39 +0200
|
||||
Subject: [PATCH] XVBA: revisit draw functions
|
||||
|
||||
---
|
||||
libavcodec/xvba_h264.c | 2 +-
|
||||
libavcodec/xvba_vc1.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c
|
||||
index ae45f3a..309d928 100644
|
||||
--- a/libavcodec/xvba_h264.c
|
||||
+++ b/libavcodec/xvba_h264.c
|
||||
@@ -160,7 +160,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
h->got_first_iframe = 1;
|
||||
}
|
||||
|
||||
- ff_draw_horiz_band(h->avctx, &h->dsp, h->cur_pic_ptr, NULL, 0, h->avctx->height, h->picture_structure, h->first_field, 0, 0, 0, 0);
|
||||
+ ff_h264_draw_horiz_band(h, 0, h->avctx->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/libavcodec/xvba_vc1.c b/libavcodec/xvba_vc1.c
|
||||
index bf3d9c2..ff35a28 100644
|
||||
--- a/libavcodec/xvba_vc1.c
|
||||
+++ b/libavcodec/xvba_vc1.c
|
||||
@@ -142,7 +142,7 @@ static int end_frame(AVCodecContext *avctx)
|
||||
break;
|
||||
}
|
||||
|
||||
- ff_draw_horiz_band(s->avctx, &s->dsp, s->current_picture_ptr, s->last_picture_ptr, 0, s->avctx->height, s->picture_structure, s->first_field, (s->unrestricted_mv && !s->intra_only), s->low_delay, s->v_edge_pos, s->h_edge_pos);
|
||||
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.8.1.5
|
||||
|
26
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch
vendored
Normal file
26
packages/multimedia/ffmpeg/patches/1.2/ffmpeg-901.06-XVBA-Make_XVBA_codec_available.patch
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
From af7027858d0b95dda461933ab6e02df4611378d9 Mon Sep 17 00:00:00 2001
|
||||
From: fritsch <peter.fruehberger@gmail.com>
|
||||
Date: Sat, 13 Apr 2013 12:06:02 +0200
|
||||
Subject: [PATCH] (ffmpeg): Make XVBA codec available
|
||||
|
||||
---
|
||||
libavcodec/vc1dec.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
|
||||
index 2130c74..4d611f9 100644
|
||||
--- a/libavcodec/vc1dec.c
|
||||
+++ b/libavcodec/vc1dec.c
|
||||
@@ -5807,6 +5807,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
#if CONFIG_VDPAU
|
||||
AV_PIX_FMT_VDPAU,
|
||||
#endif
|
||||
+#if CONFIG_XVBA
|
||||
+ AV_PIX_FMT_XVBA_VLD,
|
||||
+#endif
|
||||
AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
--
|
||||
1.8.1.5
|
||||
|
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
|
||||
#
|
||||
# This Program 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program 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.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
|
||||
for i in `ls ffmpeg-$1-*.patch`; do
|
||||
mv $i `echo $i | sed "s,$1,$2,g"`
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user