ffmpeg: Update to 3.0.1 (Kodi 17)

This commit is contained in:
MilhouseVH 2016-04-01 11:39:57 +01:00
parent 93c033029e
commit 6b10486821
13 changed files with 8053 additions and 7143 deletions

View File

@ -17,13 +17,14 @@
################################################################################
PKG_NAME="ffmpeg"
PKG_VERSION="2.8.6"
PKG_VERSION="3.0-xbmc"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="LGPLv2.1+"
PKG_SITE="https://ffmpeg.org"
PKG_URL="https://ffmpeg.org/releases/${PKG_NAME}-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libvorbis libressl dcadec speex"
PKG_URL="https://github.com/xbmc/FFmpeg/archive/release/${PKG_VERSION}.tar.gz"
PKG_SOURCE_DIR="FFmpeg-release-${PKG_VERSION}"
PKG_DEPENDS_TARGET="toolchain yasm:host zlib bzip2 libvorbis libressl speex"
PKG_PRIORITY="optional"
PKG_SECTION="multimedia"
PKG_SHORTDESC="FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video."
@ -194,7 +195,6 @@ configure_target() {
--disable-libopencore-amrwb \
--disable-libopencv \
--disable-libdc1394 \
--enable-libdcadec \
--disable-libfaac \
--disable-libfreetype \
--disable-libgsm \
@ -205,7 +205,6 @@ configure_target() {
--disable-libschroedinger \
--enable-libspeex \
--disable-libtheora \
--disable-libvo-aacenc \
--disable-libvo-amrwbenc \
--enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis \
--disable-libvpx \

View File

@ -1,585 +0,0 @@
From 007ee4796d1621ef6070fdef9aa10ff227ee20b4 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sun, 11 Sep 2011 19:04:51 +0200
Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's
This is how the palette is stored on dvd's. Currently
only xbmc passes the palette information to libavcodec
this way.
---
libavcodec/dvdsubdec.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index f009824..bbee694 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -64,6 +64,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_crop_tab + 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;
@@ -708,6 +726,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
parse_ifo_palette(ctx, ctx->ifo_str);
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:");
From 3b001c5375fdcb0fca89c813bf808da35f904323 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 28 Jun 2010 01:55:31 -0400
Subject: [PATCH 02/13] if av_read_packet returns AVERROR_IO, we are done.
ffmpeg's codecs might or might not handle returning any completed demuxed
packets correctly
---
libavformat/utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 30567fa..8a947d6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1329,6 +1329,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];
From 75902cb6825c581853636147020f1be99aba198c Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 28 Jun 2010 02:10:50 -0400
Subject: [PATCH 03/13] added: Ticket #7187, TV Teletext support for DVB EBU
Teletext streams
---
libavcodec/avcodec.h | 4 ++++
libavformat/mpegts.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9d38b59..bc1b1b9 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -532,6 +532,10 @@ enum AVCodecID {
AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska
AV_CODEC_ID_HDMV_TEXT_SUBTITLE = MKBETAG('B','D','T','X'),
+ /* 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 65824dd..338861e 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -756,6 +756,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 },
};
From fabf7216626da8caecf9cb34b188739e530cc8d4 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sun, 18 Sep 2011 19:16:34 +0200
Subject: [PATCH 04/13] 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 338861e..d4168c8 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -585,6 +585,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;
@@ -667,6 +668,7 @@ static int parse_section_header(SectionHeader *h,
val = get8(pp, p_end);
if (val < 0)
return val;
+ h->current = val & 0x1;
h->version = (val >> 1) & 0x1f;
val = get8(pp, p_end);
if (val < 0)
@@ -2020,6 +2022,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return;
if (ts->skip_changes)
return;
+ if (!h->current)
+ return;
if (skip_identical(h, tssf))
return;
From 4f1d8668a50ebf7cddc03d191c72c36fca2146dc Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sun, 18 Sep 2011 19:17:23 +0200
Subject: [PATCH 05/13] 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 d4168c8..9c6f6dc 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -91,6 +91,7 @@ struct MpegTSFilter {
int es_id;
int last_cc; /* last cc code (-1 if first packet) */
int64_t last_pcr;
+ int last_version; /* last version of data on this pid */
enum MpegTSFilterType type;
union {
MpegTSPESFilter pes_filter;
@@ -459,6 +460,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid,
filter->es_id = -1;
filter->last_cc = -1;
filter->last_pcr= -1;
+ filter->last_version = -1;
return filter;
}
@@ -2024,6 +2026,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);
if (skip_identical(h, tssf))
return;
From 72cf6cb34af9de7e81bffc6a53f7d1f450e5b624 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Fri, 9 Jul 2010 16:43:31 -0400
Subject: [PATCH 06/13] Read PID timestamps as well as PCR timestamps to find
location in mpegts stream
---
libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9c6f6dc..a4db558 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2519,6 +2519,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) {
av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n");
}
+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;
@@ -2724,6 +2762,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
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;
int pos47 = ts->pos47_full % ts->raw_packet_size;
pos =
((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) *
@@ -2745,6 +2784,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(&timestamp, buf) == 0) {
+ *ppos = pos;
+ return timestamp;
+ }
pos += ts->raw_packet_size;
}
@@ -2844,7 +2888,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,
.priv_class = &mpegts_class,
};
@@ -2856,7 +2900,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,
};
From ee8a688e4e6f59785180c1e92981ff867f6f5c23 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sat, 22 Oct 2011 19:01:38 +0200
Subject: [PATCH 07/13] 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 8a947d6..88786f1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2455,6 +2455,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_READ_SIZE 250000LL
#define DURATION_MAX_RETRY 6
+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)
{
@@ -2605,6 +2640,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 {
/* less precise: use bitrate info */
estimate_timings_from_bit_rate(ic);
From a45171f7370c263344805d19181e08a12a65dcdd Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Wed, 8 Dec 2010 14:03:43 +0000
Subject: [PATCH 08/13] 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 4ce4e2d..2c364ac 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4624,8 +4624,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;
From c3e8fbd02c2eaba2a5d14d2b6c07fe08746f5947 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Fri, 26 Nov 2010 20:56:48 +0000
Subject: [PATCH 09/13] 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 a4db558..492d9c7 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -868,6 +868,10 @@ static void reset_pes_packet_state(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->buf = pes->buffer;
@@ -2715,6 +2719,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->size = -1;
ts->pkt = pkt;
+ ts->pkt->data = NULL;
+
ret = handle_packets(ts, 0);
if (ret < 0) {
av_free_packet(ts->pkt);
From eba5c839b7e24f8e6800d3f923d5334c2c9e6b2d Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Mon, 28 Jun 2010 21:26:54 +0000
Subject: [PATCH 10/13] Speed up mpegts av_find_stream_info
---
libavformat/mpegts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 492d9c7..29d58eb 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1030,7 +1030,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
goto skip;
/* stream not present in PMT */
- if (!pes->st) {
+ if (ts->auto_guess && !pes->st) {
if (ts->skip_changes)
goto skip;
From 2372b27243eb7d0932d9885558708ba115596d0b Mon Sep 17 00:00:00 2001
From: marc <mhocking@ubuntu-desktop.(none)>
Date: Mon, 18 Feb 2013 17:18:18 +0000
Subject: [PATCH 11/13] dxva-h264 Fix dxva playback of streams that don't start
with an I-Frame (adjusted to 2.7)
---
libavcodec/dxva2_h264.c | 8 ++++++++
libavcodec/h264.c | 1 +
libavcodec/h264.h | 2 ++
libavcodec/h264_slice.c | 1 +
4 files changed, 12 insertions(+)
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 99b80ba..eb5ecd1 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -497,6 +497,14 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
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->f,
&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 907943e..718b746 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1087,6 +1087,7 @@ void ff_h264_flush_change(H264Context *h)
h->next_outputed_poc = INT_MIN;
h->prev_interlaced_frame = 1;
+ h->got_first_iframe = 0;
idr(h);
h->prev_frame_num = -1;
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7356288..907ee5e 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -813,6 +813,8 @@ typedef struct H264Context {
* slices) anymore */
int setup_finished;
+ 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
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 8be803b7..939d02b 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1043,6 +1043,7 @@ static int h264_slice_header_init(H264Context *h)
h->first_field = 0;
h->prev_interlaced_frame = 1;
+ h->got_first_iframe = 0;
init_scan_tables(h);
ret = ff_h264_alloc_tables(h);
From 959b88473b6f76fb2245f329ef604d2066b2cb89 Mon Sep 17 00:00:00 2001
From: wsnipex <wsnipex@a1.net>
Date: Mon, 16 Feb 2015 09:58:28 +0100
Subject: [PATCH 12/13] only check for a git rev if the src tree is in a git
repo
fixes the version string when building from the kodi depends src tree
---
version.sh | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/version.sh b/version.sh
index f9754eb..cc23f80 100755
--- a/version.sh
+++ b/version.sh
@@ -2,30 +2,32 @@
# Usage: version.sh <ffmpeg-root-dir> <output-version.h> <extra-version>
+if [ -d $1/.git ]; then # only check for a git rev, if the src tree is in a git repo
# check for git short hash
-if ! test "$revision"; then
+ if ! test "$revision"; then
if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then
revision=$(cd "$1" && git describe --tags --match N 2> /dev/null)
else
revision=$(cd "$1" && git describe --tags --always 2> /dev/null)
fi
-fi
+ fi
+
+ # Shallow Git clones (--depth) do not have the N tag:
+ # use 'git-YYYY-MM-DD-hhhhhhh'.
+ test "$revision" || revision=$(cd "$1" &&
+ git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null)
-# Shallow Git clones (--depth) do not have the N tag:
-# use 'git-YYYY-MM-DD-hhhhhhh'.
-test "$revision" || revision=$(cd "$1" &&
- git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null)
-
-# Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or
-# ffmpeg-HEAD-hhhhhhh.
-if [ -z "$revision" ]; then
- srcdir=$(cd "$1" && pwd)
- case "$srcdir" in
- */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])
- git_hash="${srcdir##*-}";;
- */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])
- git_hash="${srcdir##*-}";;
- esac
+ # Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or
+ # ffmpeg-HEAD-hhhhhhh.
+ if [ -z "$revision" ]; then
+ srcdir=$(cd "$1" && pwd)
+ case "$srcdir" in
+ */ffmpeg-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])
+ git_hash="${srcdir##*-}";;
+ */ffmpeg-HEAD-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])
+ git_hash="${srcdir##*-}";;
+ esac
+ fi
fi
# no revision number found

View File

@ -1,47 +0,0 @@
commit 0e7427498cb1131671f6fe9d054245ae7e5a36f5
Author: popcornmix <popcornmix@gmail.com>
Date: Tue Mar 25 19:43:07 2014 +0000
[ffmpeg] Speed up wtv index creation
The index creation is O(N^2) with number of entries (typically thousands).
On a Pi this can take more than 60 seconds to execute for a recording of a few hours.
By replacing with an O(N) loop, this takes virtually zero time
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index e423370..70898bd 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -980,21 +980,23 @@ static int read_header(AVFormatContext *s)
pb = wtvfile_open(s, root, root_size, ff_timeline_table_0_entries_Events_le16);
if (pb) {
int i;
+ AVIndexEntry *e = wtv->index_entries;
+ AVIndexEntry *e_end = wtv->index_entries + wtv->nb_index_entries - 1;
+ uint64_t last_position = 0;
while (1) {
uint64_t frame_nb = avio_rl64(pb);
uint64_t position = avio_rl64(pb);
+ while (frame_nb > e->size && e <= e_end) {
+ e->pos = last_position;
+ e++;
+ }
if (avio_feof(pb))
break;
- for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
- AVIndexEntry *e = wtv->index_entries + i;
- if (frame_nb > e->size)
- break;
- if (position > e->pos)
- e->pos = position;
- }
+ last_position = position;
}
+ e_end->pos = last_position;
wtvfile_close(pb);
- st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp;
+ st->duration = e_end->timestamp;
}
}
}

View File

@ -1,23 +0,0 @@
From 101dcdc12659e7fc2ddc1393992e2b431e2c4da1 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Fri, 22 Jan 2016 13:50:42 +0100
Subject: [PATCH] dxva2_h264: fix reference field marking in long slice struct
Fixes artifacts in interlaced decoding on old Intel GPUs.
---
libavcodec/dxva2_h264.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index eb5ecd1..242a79e 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -248,7 +248,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
else
index = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, r->f));
fill_picture_entry(&slice->RefPicList[list][i], index,
- r->reference == PICT_BOTTOM_FIELD);
+ sl->ref_list[list][i].reference == PICT_BOTTOM_FIELD);
for (plane = 0; plane < 3; plane++) {
int w, o;
if (plane == 0 && sl->luma_weight_flag[list]) {

View File

@ -0,0 +1,410 @@
From 29c3327a0d72a7e872ff170363cfe5ed13bca5d0 Mon Sep 17 00:00:00 2001
From: Seppo Tomperi <seppo.tomperi@vtt.fi>
Date: Tue, 22 Dec 2015 18:10:24 +0000
Subject: [PATCH] hevcdsp: ARM NEON optimized epel functions
---
libavcodec/arm/Makefile | 1 +
libavcodec/arm/hevcdsp_epel_neon.S | 334 +++++++++++++++++++++++++++++++++++++
libavcodec/arm/hevcdsp_init_neon.c | 23 +++
3 files changed, 358 insertions(+)
create mode 100644 libavcodec/arm/hevcdsp_epel_neon.S
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index cdd35b0..6051ec8 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -131,6 +131,7 @@ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \
arm/synth_filter_neon.o
NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \
arm/hevcdsp_deblock_neon.o \
+ arm/hevcdsp_epel_neon.o \
arm/hevcdsp_idct_neon.o \
arm/hevcdsp_qpel_neon.o
NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o
diff --git a/libavcodec/arm/hevcdsp_epel_neon.S b/libavcodec/arm/hevcdsp_epel_neon.S
new file mode 100644
index 0000000..516ae5b
--- /dev/null
+++ b/libavcodec/arm/hevcdsp_epel_neon.S
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2014 - 2015 Seppo Tomperi <seppo.tomperi@vtt.fi>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/arm/asm.S"
+#include "neon.S"
+
+#define MAX_PB_SIZE #64
+
+.macro vextin_d4
+ vld1.8 {q10}, [r1], r2
+ vmov d16, d20
+ vext.8 d17, d20, d21, #1
+ vext.8 d18, d20, d21, #2
+ vext.8 d19, d20, d21, #3
+.endm
+
+.macro vextin_d4_8
+ vld1.8 d16, [r1], r2
+ vext.8 d17, d16, d16, #1
+ vext.8 d18, d16, d16, #2
+ vext.8 d19, d16, d16, #3
+.endm
+
+.macro load_coeffs_16b coeffs
+ ldr \coeffs, [\coeffs]
+ vdup.i8 d0, \coeffs
+ lsr \coeffs, #8
+ vdup.i8 d1, \coeffs
+ lsr \coeffs, #8
+ vdup.i8 d2, \coeffs
+ lsr \coeffs, #8
+ vdup.i8 d3, \coeffs
+.endm
+
+.macro epel_filter_16b out=q12
+ vmull.u8 q3, d16, d0
+ vmull.u8 q11, d19, d3
+ vmull.u8 \out, d17, d1
+ vmull.u8 q10, d18, d2
+ vadd.s16 q3, q11
+ vadd.s16 \out, q10
+ vsub.s16 \out, q3
+.endm
+
+.macro load_coeffs_32b coeffs
+ ldr \coeffs, [\coeffs]
+ vmov.i64 d4, #0
+ vmov.8 d4[0], \coeffs
+ lsr \coeffs, #8
+ vmov.8 d4[2], \coeffs
+ lsr \coeffs, #8
+ vmov.8 d4[4], \coeffs
+ lsr \coeffs, #8
+ vmov.8 d4[6], \coeffs
+.endm
+
+.macro epel_filter_32b
+ vmull.s16 q3, d24, d4[0] //q12
+ vmull.s16 q4, d25, d4[0]
+ vmull.s16 q5, d30, d4[3] //q15
+ vmull.s16 q6, d31, d4[3]
+
+ vmull.s16 q7, d26, d4[1] // q13
+ vmull.s16 q8, d27, d4[1]
+ vmull.s16 q9, d28, d4[2] // q14
+ vmull.s16 q10, d29, d4[2]
+ vadd.s32 q3, q5
+ vadd.s32 q4, q6
+ vadd.s32 q7, q9
+ vadd.s32 q8, q10
+ vsub.s32 q7, q3
+ vsub.s32 q8, q4
+ vqshrn.s32 d6, q7, #6
+ vqshrn.s32 d7, q8, #6
+.endm
+
+.macro epel_filter_32b_4
+ vmull.s16 q3, d24, d4[0] //q12
+ vmull.s16 q5, d30, d4[3] //q15
+ vmull.s16 q7, d26, d4[1] // q13
+ vmull.s16 q9, d28, d4[2] // q14
+ vadd.s32 q3, q5
+ vadd.s32 q7, q9
+ vsub.s32 q7, q3
+ vqshrn.s32 d6, q7, #6
+.endm
+
+function ff_hevc_put_epel_h_neon_8, export=1
+ push {r4-r7}
+ mov r4, MAX_PB_SIZE
+ ldr r7, [sp, #16] // mx
+ ldr r5, [sp, #24] // width
+ sub r7, #1
+ lsl r7, #2
+ vpush {d8-d15}
+ adrl r12, epel_coeffs
+ add r7, r12
+ sub r1, #1
+ lsl r4, #1
+ load_coeffs_16b r7
+ mov r12, r3
+ mov r6, r0
+ mov r7, r1
+ cmp r5, #6
+ bgt 8f
+ cmp r5, #4
+ blt 2f
+ b 4f
+8: subs r3, #1
+ pld [r1]
+ vextin_d4
+ epel_filter_16b
+ vst1.16 {q12}, [r0], r4
+ bne 8b
+ subs r5, #8
+ beq 99f
+ mov r3, r12
+ add r6, #16
+ mov r0, r6
+ add r7, #8
+ mov r1, r7
+ cmp r5, #4
+ bgt 8b
+4: subs r3, #1
+ pld [r1]
+ vextin_d4_8
+ epel_filter_16b
+ vst1.16 d24, [r0], r4
+ bne 4b
+ subs r5, #4
+ beq 99f
+ mov r3, r12
+ add r6, #8
+ mov r0, r6
+ add r7, #4
+ mov r1, r7
+2: subs r3, #1
+ pld [r1]
+ vextin_d4_8
+ epel_filter_16b
+ vst1.32 d24[0], [r0], r4
+ bne 2b
+99: vpop {d8-d15}
+ pop {r4-r7}
+ bx lr
+endfunc
+
+function ff_hevc_put_epel_v_neon_8, export=1
+ push {r4-r7}
+ mov r4, MAX_PB_SIZE
+ ldr r7, [sp, #20] // my
+ ldr r5, [sp, #24] // width
+ sub r7, #1
+ lsl r7, #2
+ vpush {d8-d15}
+ adrl r12, epel_coeffs
+ add r7, r12
+ load_coeffs_16b r7
+ sub r1, r2
+ lsl r4, #1
+ mov r12, r3
+ mov r6, r0
+ mov r7, r1
+0: pld [r1]
+ vld1.8 {d16}, [r1], r2
+ pld [r1]
+ vld1.8 {d17}, [r1], r2
+ pld [r1]
+ vld1.8 {d18}, [r1], r2
+ cmp r5, #6
+ bgt 8f
+ cmp r5, #4
+ blt 2f
+ b 4f
+8: pld [r1]
+ vld1.8 {d19}, [r1], r2
+ subs r3, #1
+ epel_filter_16b
+ vst1.16 {q12}, [r0], r4
+ vmov d16, d17
+ vmov d17, d18
+ vmov d18, d19
+ bne 8b
+ subs r5, #8
+ beq 99f
+ mov r3, r12
+ add r6, #16
+ mov r0, r6
+ add r7, #8
+ mov r1, r7
+ b 0b
+4: pld [r1]
+ vld1.8 {d19}, [r1], r2
+ subs r3, #1
+ epel_filter_16b
+ vst1.16 d24, [r0], r4
+ vmov d16, d17
+ vmov d17, d18
+ vmov d18, d19
+ bne 4b
+ subs r5, #4
+ beq 99f
+ mov r3, r12
+ add r6, #8
+ mov r0, r6
+ add r7, #4
+ mov r1, r7
+ b 0b
+2: pld [r1]
+ vld1.8 {d19}, [r1], r2
+ subs r3, #1
+ epel_filter_16b
+ vst1.32 d24[0], [r0], r4
+ vmov d16, d17
+ vmov d17, d18
+ vmov d18, d19
+ bne 2b
+99: vpop {d8-d15}
+ pop {r4-r7}
+ bx lr
+endfunc
+
+function ff_hevc_put_epel_hv_neon_8, export=1
+ push {r4-r7}
+ mov r4, MAX_PB_SIZE
+ ldr r6, [sp, #16] // mx
+ ldr r7, [sp, #20] // my
+ ldr r5, [sp, #24] // width
+ sub r7, #1
+ lsl r7, #2
+ vpush {d8-d15}
+ adrl r12, epel_coeffs
+ sub r6, #1
+ lsl r6, #2
+ add r6, r12 // mx epel coeff offset
+ add r7, r12
+ sub r1, #1
+ sub r1, r2
+ lsl r4, #1
+ load_coeffs_16b r6
+ load_coeffs_32b r7
+ mov r12, r3
+ mov r6, r0
+ mov r7, r1
+0: pld [r1]
+ vextin_d4
+ epel_filter_16b q12
+ pld [r1]
+ vextin_d4
+ epel_filter_16b q13
+ pld [r1]
+ vextin_d4
+ epel_filter_16b q14
+ cmp r5, #6
+ bgt 8f
+ cmp r5, #4
+ blt 2f
+ b 4f
+8: pld [r1]
+ vextin_d4
+ epel_filter_16b q15
+ subs r3, #1
+ epel_filter_32b
+ vst1.16 {q3}, [r0], r4
+ vmov q12, q13
+ vmov q13, q14
+ vmov q14, q15
+ bne 8b
+ subs r5, #8
+ beq 99f
+ mov r3, r12
+ add r6, #16
+ mov r0, r6
+ add r7, #8
+ mov r1, r7
+ b 0b
+4: pld [r1]
+ vextin_d4_8
+ epel_filter_16b q15
+ subs r3, #1
+ epel_filter_32b_4
+ vst1.16 d6, [r0], r4
+ vmov q12, q13
+ vmov q13, q14
+ vmov q14, q15
+ bne 4b
+ subs r5, #4
+ beq 99f
+ mov r3, r12
+ add r6, #8
+ mov r0, r6
+ add r7, #4
+ mov r1, r7
+ b 0b
+2: pld [r1]
+ vextin_d4_8
+ epel_filter_16b q15
+ subs r3, #1
+ epel_filter_32b_4
+ vst1.32 d6[0], [r0], r4
+ vmov q12, q13
+ vmov q13, q14
+ vmov q14, q15
+ bne 2b
+99: vpop {d8-d15}
+ pop {r4-r7}
+ bx lr
+endfunc
+
+epel_coeffs:
+ .byte 2, 58, 10, 2
+ .byte 4, 54, 16, 2
+ .byte 6, 46, 28, 4
+ .byte 4, 36, 36, 4
+ .byte 4, 28, 46, 6
+ .byte 2, 16, 54, 4
+ .byte 2, 10, 58, 2
diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
index 5591807..733ff08 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -58,6 +58,15 @@ PUT_PIXELS(ff_hevc_put_pixels_w32_neon_8);
PUT_PIXELS(ff_hevc_put_pixels_w48_neon_8);
PUT_PIXELS(ff_hevc_put_pixels_w64_neon_8);
#undef PUT_PIXELS
+void ff_hevc_put_epel_h_neon_8(int16_t *dst, uint8_t *src,
+ ptrdiff_t srcstride, int height,
+ intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_epel_v_neon_8(int16_t *dst, uint8_t *src,
+ ptrdiff_t srcstride, int height,
+ intptr_t mx, intptr_t my, int width);
+void ff_hevc_put_epel_hv_neon_8(int16_t *dst, uint8_t *src,
+ ptrdiff_t srcstride, int height,
+ intptr_t mx, intptr_t my, int width);
static void (*put_hevc_qpel_neon[4][4])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
int height, int width);
@@ -201,7 +210,21 @@ av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
c->put_hevc_qpel_bi[x][1][0] = ff_hevc_put_qpel_bi_neon_wrapper;
c->put_hevc_qpel_bi[x][0][1] = ff_hevc_put_qpel_bi_neon_wrapper;
c->put_hevc_qpel_bi[x][1][1] = ff_hevc_put_qpel_bi_neon_wrapper;
+ c->put_hevc_epel[x][1][0] = ff_hevc_put_epel_v_neon_8;
+ c->put_hevc_epel[x][0][1] = ff_hevc_put_epel_h_neon_8;
+ c->put_hevc_epel[x][1][1] = ff_hevc_put_epel_hv_neon_8;
}
+ c->put_hevc_epel[0][0][0] = ff_hevc_put_pixels_w2_neon_8;
+ c->put_hevc_epel[1][0][0] = ff_hevc_put_pixels_w4_neon_8;
+ c->put_hevc_epel[2][0][0] = ff_hevc_put_pixels_w6_neon_8;
+ c->put_hevc_epel[3][0][0] = ff_hevc_put_pixels_w8_neon_8;
+ c->put_hevc_epel[4][0][0] = ff_hevc_put_pixels_w12_neon_8;
+ c->put_hevc_epel[5][0][0] = ff_hevc_put_pixels_w16_neon_8;
+ c->put_hevc_epel[6][0][0] = ff_hevc_put_pixels_w24_neon_8;
+ c->put_hevc_epel[7][0][0] = ff_hevc_put_pixels_w32_neon_8;
+ c->put_hevc_epel[8][0][0] = ff_hevc_put_pixels_w48_neon_8;
+ c->put_hevc_epel[9][0][0] = ff_hevc_put_pixels_w64_neon_8;
+
c->put_hevc_qpel[0][0][0] = ff_hevc_put_pixels_w2_neon_8;
c->put_hevc_qpel[1][0][0] = ff_hevc_put_pixels_w4_neon_8;
c->put_hevc_qpel[2][0][0] = ff_hevc_put_pixels_w6_neon_8;
--
2.5.0

View File

@ -0,0 +1,68 @@
From f2e011c656b3579b6ede184bb5c56a7b97fad0f3 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Sat, 9 Jan 2016 15:34:09 +0100
Subject: [PATCH] avcodec: add h264_mvc codec id and profiles
avcodec: add h264_mvc codec id and profiles
---
libavcodec/avcodec.h | 5 +++++
libavcodec/codec_desc.c | 7 +++++++
libavcodec/profiles.c | 3 +++
libavformat/mpegts.c | 2 +-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f365775..8498921 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -316,6 +316,8 @@ enum AVCodecID {
AV_CODEC_ID_APNG,
AV_CODEC_ID_DAALA,
+ AV_CODEC_ID_H264_MVC,
+
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
AV_CODEC_ID_PCM_S16LE = 0x10000,
@@ -3086,6 +3088,9 @@ typedef struct AVCodecContext {
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_CAVLC_444 44
+#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
+#define FF_PROFILE_H264_STEREO_HIGH 128
+#define FF_PROFILE_H264_MULTIVIEW_HIGH_DEPTH 138
#define FF_PROFILE_VC1_SIMPLE 0
#define FF_PROFILE_VC1_MAIN 1
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 5fbe624..9431bd8 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1521,6 +1521,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
.mime_types= MT("image/png"),
},
+ {
+ .id = AV_CODEC_ID_H264_MVC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h264_mvc",
+ .long_name = NULL_IF_CONFIG_SMALL("H264 MVC"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
/* various PCM "codecs" */
{
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 22874e6..34b6987 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -698,7 +698,7 @@ static const StreamType ISO_types[] = {
{ 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM }, /* LATM syntax */
#endif
{ 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
+ { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264_MVC },
{ 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000 },
{ 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
{ 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS },

View File

@ -0,0 +1,114 @@
From 0b857974bc3f2f48800526efbe02b9e72fdeb266 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Sat, 9 Jan 2016 16:34:40 +0100
Subject: [PATCH] h264_parser: add support for parsing h264 mvc NALUs
---
libavcodec/allcodecs.c | 1 +
libavcodec/h264.h | 2 ++
libavcodec/h264_parser.c | 34 ++++++++++++++++++++++++++++++----
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2097db0..66eb571 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -633,6 +633,7 @@ void avcodec_register_all(void)
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
+ REGISTER_PARSER(H264_MVC, h264_mvc);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 78f4eed..9e1d377 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -123,7 +123,9 @@ enum {
NAL_END_STREAM = 11,
NAL_FILLER_DATA = 12,
NAL_SPS_EXT = 13,
+ NAL_SPS_SUBSET = 15,
NAL_AUXILIARY_SLICE = 19,
+ NAL_SLICE_EXT = 20,
NAL_FF_IGNORE = 0xff0f001,
};
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 12d6397..4337c8c 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -38,6 +38,7 @@ typedef struct H264ParseContext {
H264Context h;
ParseContext pc;
int got_first;
+ int is_mvc;
} H264ParseContext;
@@ -86,14 +87,18 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
} else if (state <= 5) {
int nalu_type = buf[i] & 0x1F;
if (nalu_type == NAL_SEI || nalu_type == NAL_SPS ||
- nalu_type == NAL_PPS || nalu_type == NAL_AUD) {
+ nalu_type == NAL_PPS || nalu_type == NAL_AUD ||
+ nalu_type == NAL_SPS_SUBSET) {
if (pc->frame_start_found) {
i++;
goto found;
}
} else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA ||
- nalu_type == NAL_IDR_SLICE) {
+ nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) {
state += 8;
+
+ if (nalu_type == NAL_SLICE_EXT)
+ i += 3; // skip mvc extension
continue;
}
state = 7;
@@ -532,7 +537,8 @@ static int h264_parse(AVCodecParserContext *s,
}
}
- parse_nal_units(s, avctx, buf, buf_size);
+ if (!p->is_mvc)
+ parse_nal_units(s, avctx, buf, buf_size);
if (avctx->framerate.num)
avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
@@ -569,7 +575,7 @@ static int h264_split(AVCodecContext *avctx,
if ((state & 0xFFFFFF00) != 0x100)
break;
nalu_type = state & 0x1F;
- if (nalu_type == NAL_SPS) {
+ if (nalu_type == NAL_SPS || nalu_type == NAL_SPS_SUBSET) {
has_sps = 1;
} else if (nalu_type == NAL_PPS)
has_pps = 1;
@@ -625,3 +631,23 @@ AVCodecParser ff_h264_parser = {
.parser_close = h264_close,
.split = h264_split,
};
+
+static av_cold int init_mvc(AVCodecParserContext *s)
+{
+ H264ParseContext *p = s->priv_data;
+ int ret = init(s);
+ if (ret < 0)
+ return ret;
+
+ p->is_mvc = 1;
+ return 0;
+}
+
+AVCodecParser ff_h264_mvc_parser = {
+ .codec_ids = { AV_CODEC_ID_H264_MVC },
+ .priv_data_size = sizeof(H264ParseContext),
+ .parser_init = init_mvc,
+ .parser_parse = h264_parse,
+ .parser_close = h264_close,
+ .split = h264_split,
+};

View File

@ -0,0 +1,67 @@
From fd627f6435db524f3e1fd8df6f64a17dcda5c8b9 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Fri, 26 Feb 2016 00:23:53 +0100
Subject: [PATCH] h264_parser: fix parsing of mvc slices in some corner cases
---
libavcodec/h264.h | 2 +-
libavcodec/h264_parser.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 9e1d377..846e4dc 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -828,7 +828,7 @@ typedef struct H264Context {
int cur_bit_depth_luma;
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
- uint8_t parse_history[6];
+ uint8_t parse_history[9];
int parse_history_count;
int parse_last_mb;
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 4337c8c..2fd3f2b 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -39,6 +39,7 @@ typedef struct H264ParseContext {
ParseContext pc;
int got_first;
int is_mvc;
+ int slice_ext;
} H264ParseContext;
@@ -97,18 +98,17 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
nalu_type == NAL_IDR_SLICE || (p->is_mvc && nalu_type == NAL_SLICE_EXT)) {
state += 8;
- if (nalu_type == NAL_SLICE_EXT)
- i += 3; // skip mvc extension
+ p->slice_ext = (nalu_type == NAL_SLICE_EXT);
continue;
}
state = 7;
} else {
h->parse_history[h->parse_history_count++]= buf[i];
- if (h->parse_history_count>5) {
+ if (h->parse_history_count>8) {
unsigned int mb, last_mb= h->parse_last_mb;
GetBitContext gb;
- init_get_bits(&gb, h->parse_history, 8*h->parse_history_count);
+ init_get_bits8(&gb, h->parse_history + 3*p->slice_ext, h->parse_history_count - 3*p->slice_ext);
h->parse_history_count=0;
mb= get_ue_golomb_long(&gb);
h->parse_last_mb= mb;
@@ -131,7 +131,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
pc->frame_start_found = 0;
if (h->is_avc)
return next_avc;
- return i - (state & 5) - 5 * (state > 7);
+ return i - (state & 5) - 8 * (state > 7);
}
static int scan_mmco_reset(AVCodecParserContext *s)

View File

@ -0,0 +1,25 @@
From 73fde6f9f3d01f7fc0f3ae4b66f6c725f9fb1105 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Mon, 1 Sep 2014 11:39:09 +0200
Subject: [PATCH] h264_parser: force grabing a new timestamp until a frame
start was found
---
libavcodec/h264_parser.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 2fd3f2b..7165652 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -525,6 +525,9 @@ static int h264_parse(AVCodecParserContext *s,
} else {
next = h264_find_frame_end(p, buf, buf_size);
+ if (next == END_NOT_FOUND && pc->frame_start_found == 0)
+ s->fetch_timestamp = 1;
+
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL;
*poutbuf_size = 0;