[FFmpeg-cvslog] webmdashenc: parameter'ize minimumUpdatePeriod

2015-04-22 Thread Vignesh Venkatasubramanian
ffmpeg | branch: master | Vignesh Venkatasubramanian  | 
Tue Apr 21 17:35:29 2015 -0700| [f82ce6aa882b6ccb5727c4357e4862ad11acd229] | 
committer: Michael Niedermayer

webmdashenc: parameter'ize minimumUpdatePeriod

Some players do not support setting minimumUpdatePeriod to zero.
This patch adds a new parameter that will let the users set any
value to this field. Also updates the test and the documentation.

Signed-off-by: Vignesh Venkatasubramanian 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f82ce6aa882b6ccb5727c4357e4862ad11acd229
---

 doc/muxers.texi|4 
 libavformat/webmdashenc.c  |4 +++-
 tests/fate/vpx.mak |2 +-
 tests/ref/fate/webm-dash-manifest-live |2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 335f093..ddd7c7a 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1253,6 +1253,10 @@ Smallest time (in seconds) shifting buffer for which any 
Representation is
 guaranteed to be available. This will go in the @samp{timeShiftBufferDepth}
 attribute of the @samp{MPD} element. Default: 60.
 
+@item minimum_update_period
+Minimum update period (in seconds) of the manifest. This will go in the
+@samp{minimumUpdatePeriod} attribute of the @samp{MPD} element. Default: 0.
+
 @end table
 
 @subsection Example
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index e627a15..1c63a5b 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -56,6 +56,7 @@ typedef struct WebMDashMuxContext {
 int chunk_duration;
 char *utc_timing_url;
 double time_shift_buffer_depth;
+int minimum_update_period;
 int debug_mode;
 } WebMDashMuxContext;
 
@@ -116,7 +117,7 @@ static void write_header(AVFormatContext *s)
 }
 avio_printf(s->pb, "  availabilityStartTime=\"%s\"\n", gmt_iso);
 avio_printf(s->pb, "  timeShiftBufferDepth=\"PT%gS\"\n", 
w->time_shift_buffer_depth);
-avio_printf(s->pb, "  minimumUpdatePeriod=\"0\"");
+avio_printf(s->pb, "  minimumUpdatePeriod=\"PT%dS\"", 
w->minimum_update_period);
 avio_printf(s->pb, ">\n");
 avio_printf(s->pb, "pb, "  schemeIdUri=\"%s\"\n",
@@ -517,6 +518,7 @@ static const AVOption options[] = {
 { "chunk_duration_ms", "duration of each chunk (in milliseconds)", 
OFFSET(chunk_duration), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "utc_timing_url", "URL of the page that will return the UTC timestamp in 
ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 }, 0, 0, 
AV_OPT_FLAG_ENCODING_PARAM },
 { "time_shift_buffer_depth", "Smallest time (in seconds) shifting buffer 
for which any Representation is guaranteed to be available.", 
OFFSET(time_shift_buffer_depth), AV_OPT_TYPE_DOUBLE, { .dbl = 60.0 }, 1.0, 
DBL_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ "minimum_update_period", "Minimum Update Period (in seconds) of the 
manifest.", OFFSET(minimum_update_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { NULL },
 };
 
diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 5eaf8fb..0e7e7eb 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -44,7 +44,7 @@ FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += 
fate-webm-dash-manifest-repr
 fate-webm-dash-manifest-representations: CMD = run ffmpeg -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
 
 FATE_VP8-$(call DEMDEC, WEBM_DASH_MANIFEST, VP8) += 
fate-webm-dash-manifest-live
-fate-webm-dash-manifest-live: CMD = run ffmpeg -f webm_dash_manifest -live 1 
-i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 
-i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f 
webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" 
-chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 
-debug_mode 1 -
+fate-webm-dash-manifest-live: CMD = run ffmpeg -f webm_dash_manifest -live 1 
-i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 
-i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f 
webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" 
-chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 
-minimum_update_period 60 -debug_mode 1 -
 
 FATE_SAMPLES_AVCONV += $(FATE_VP6-yes)
 fate-vp6: $(FATE_VP6-yes)
diff --git a/tests/ref/fate/webm-dash-manifest-live 
b/tests/ref/fate/webm-dash-manifest-live
index c682ecc..91a1c1d 100644
--- a/tests/ref/fate/webm-dash-manifest-live
+++ b/tests/ref/fate/webm-dash-manifest-live
@@ -8,7 +8,7 @@
   profiles="urn:mpeg:dash:profile:isoff-live:2011"
   availabilityStartTime=""
   timeShiftBufferDepth="

[FFmpeg-cvslog] alsdec: check sample pointer range in revert_channel_correlation

2015-04-22 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Tue Apr 21 19:25:50 2015 +0200| [afc7748d1f6abc4b3b1cc957b0fa6941837db3d0] | 
committer: Michael Niedermayer

alsdec: check sample pointer range in revert_channel_correlation

Also change the type of begin, end and smp to ptrdiff_t to make the
comparison well-defined.

Signed-off-by: Andreas Cadhalpun 
Reviewed-by: Thilo Borgmann 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=afc7748d1f6abc4b3b1cc957b0fa6941837db3d0
---

 libavcodec/alsdec.c |   34 +++---
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index c81db18..e34cf6e 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1246,6 +1246,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, 
ALSBlockData *bd,
 ALSChannelData *ch = cd[c];
 unsigned int   dep = 0;
 unsigned int channels = ctx->avctx->channels;
+unsigned int channel_size = ctx->sconf.frame_length + ctx->sconf.max_order;
 
 if (reverted[c])
 return 0;
@@ -1276,9 +1277,9 @@ static int revert_channel_correlation(ALSDecContext *ctx, 
ALSBlockData *bd,
 bd->raw_samples = ctx->raw_samples[c] + offset;
 
 for (dep = 0; !ch[dep].stop_flag; dep++) {
-unsigned int smp;
-unsigned int begin = 1;
-unsigned int end   = bd->block_length - 1;
+ptrdiff_t smp;
+ptrdiff_t begin = 1;
+ptrdiff_t end   = bd->block_length - 1;
 int64_t y;
 int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
 
@@ -1290,19 +1291,28 @@ static int revert_channel_correlation(ALSDecContext 
*ctx, ALSBlockData *bd,
 
 if (ch[dep].time_diff_sign) {
 t  = -t;
-if (t > 0 && begin < t) {
-av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
time diff index %d.\n", begin, t);
+if (begin < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "begin %td smaller than 
time diff index %d.\n", begin, t);
 return AVERROR_INVALIDDATA;
 }
 begin -= t;
 } else {
-if (t > 0 && end < t) {
-av_log(ctx->avctx, AV_LOG_ERROR, "end %u smaller than time 
diff index %d.\n", end, t);
+if (end < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "end %td smaller than 
time diff index %d.\n", end, t);
 return AVERROR_INVALIDDATA;
 }
 end   -= t;
 }
 
+if (FFMIN(begin - 1, begin - 1 + t) < ctx->raw_buffer - master ||
+FFMAX(end   + 1,   end + 1 + t) > ctx->raw_buffer + channels * 
channel_size - master) {
+av_log(ctx->avctx, AV_LOG_ERROR,
+   "sample pointer range [%p, %p] not contained in 
raw_buffer [%p, %p].\n",
+   master + FFMIN(begin - 1, begin - 1 + t), master + 
FFMAX(end + 1,   end + 1 + t),
+   ctx->raw_buffer, ctx->raw_buffer + channels * 
channel_size);
+return AVERROR_INVALIDDATA;
+}
+
 for (smp = begin; smp < end; smp++) {
 y  = (1 << 6) +
  MUL64(ch[dep].weighting[0], master[smp - 1]) +
@@ -1315,6 +1325,16 @@ static int revert_channel_correlation(ALSDecContext 
*ctx, ALSBlockData *bd,
 bd->raw_samples[smp] += y >> 7;
 }
 } else {
+
+if (begin - 1 < ctx->raw_buffer - master ||
+end   + 1 > ctx->raw_buffer + channels * channel_size - 
master) {
+av_log(ctx->avctx, AV_LOG_ERROR,
+   "sample pointer range [%p, %p] not contained in 
raw_buffer [%p, %p].\n",
+   master + begin - 1, master + end + 1,
+   ctx->raw_buffer, ctx->raw_buffer + channels * 
channel_size);
+return AVERROR_INVALIDDATA;
+}
+
 for (smp = begin; smp < end; smp++) {
 y  = (1 << 6) +
  MUL64(ch[dep].weighting[0], master[smp - 1]) +

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: add common mechanism for skipping samples at the start of file

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:36 
2015 +0200| [7dd8bf53bdb5669a7c65822417fe29036435b40f] | committer: Michael 
Niedermayer

avformat: add common mechanism for skipping samples at the start of file

This makes using the generic indexing code with mp3 easier at a later
point.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7dd8bf53bdb5669a7c65822417fe29036435b40f
---

 libavformat/avformat.h |9 +
 libavformat/utils.c|4 
 2 files changed, 13 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 514e646..c2f798d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1083,6 +1083,15 @@ typedef struct AVStream {
 int skip_samples;
 
 /**
+ * If not 0, the number of samples that should be skipped from the start of
+ * the stream (the samples are removed from packets with pts==0, which also
+ * assumes negative timestamps do not happen).
+ * Intended for use with formats such as mp3 with ad-hoc gapless audio
+ * support.
+ */
+int64_t start_skip_samples;
+
+/**
  * If not 0, the first audio sample that should be discarded from the 
stream.
  * This is broken by design (needs global sample count), but can't be
  * avoided for broken by design formats such as mp3 with ad-hoc gapless
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 950b3c6..2f6122d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1416,6 +1416,8 @@ static int read_frame_internal(AVFormatContext *s, 
AVPacket *pkt)
 sample < st->last_discard_sample)
 discard_padding = FFMIN(end_sample - st->first_discard_sample, 
duration);
 }
+if (st->start_skip_samples && (pkt->pts == 0 || pkt->pts == 
RELATIVE_TS_BASE))
+st->skip_samples = st->start_skip_samples;
 if (st->skip_samples || discard_padding) {
 uint8_t *p = av_packet_new_side_data(pkt, 
AV_PKT_DATA_SKIP_SAMPLES, 10);
 if (p) {
@@ -1645,6 +1647,8 @@ void ff_read_frame_flush(AVFormatContext *s)
 
 if (s->internal->inject_global_side_data)
 st->inject_global_side_data = 1;
+
+st->skip_samples = 0;
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mp3dec: use the common mechanism for skipping samples

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:37 
2015 +0200| [066b92e91d678f500c64c947d86cd8bf73ee6c61] | committer: Michael 
Niedermayer

avformat/mp3dec: use the common mechanism for skipping samples

The mp2 seek test results change. Whether to skip samples if the file
had no LAME gapless tags was inconsistent. When seeking to the start
of the file, 529 samples were skipped, but when playing from start,
nothing was skipped. This commit changes the behavior on seek to skip
nothing.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=066b92e91d678f500c64c947d86cd8bf73ee6c61
---

 libavformat/mp3dec.c  |7 ++-
 tests/ref/seek/acodec-mp2 |8 
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 0604e31..008cb23 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -228,13 +228,13 @@ static void mp3_parse_info_tag(AVFormatContext *s, 
AVStream *st,
 
 mp3->start_pad = v>>12;
 mp3->  end_pad = v&4095;
-st->skip_samples = mp3->start_pad + 528 + 1;
+st->start_skip_samples = mp3->start_pad + 528 + 1;
 if (mp3->frames) {
 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * 
(int64_t)spf;
 st->last_discard_sample = mp3->frames * (int64_t)spf;
 }
 if (!st->start_time)
-st->start_time = av_rescale_q(st->skip_samples,
+st->start_time = av_rescale_q(st->start_skip_samples,
 (AVRational){1, c->sample_rate},
 st->time_base);
 av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3->  end_pad);
@@ -447,8 +447,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 
 ie = &st->index_entries[ret];
 } else {
-st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
-
 return -1;
 }
 
@@ -496,7 +494,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 }
 
 ff_update_cur_dts(s, st, ie->timestamp);
-st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
 return 0;
 }
 
diff --git a/tests/ref/seek/acodec-mp2 b/tests/ref/seek/acodec-mp2
index 62abab4..8de3676 100644
--- a/tests/ref/seek/acodec-mp2
+++ b/tests/ref/seek/acodec-mp2
@@ -1,6 +1,6 @@
 ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st:-1 flags:0  ts:-1.00
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st:-1 flags:1  ts: 1.894167
 ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  30093 size:   
418
 ret: 0 st: 0 flags:0  ts: 0.788334
@@ -18,7 +18,7 @@ ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 
 34690 size:   418
 ret: 0 st:-1 flags:1  ts: 1.047503
 ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  16718 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 2.835837
 ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  45139 size:   
418
 ret: 0 st:-1 flags:0  ts: 1.730004
@@ -26,7 +26,7 @@ ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 
 28003 size:   418
 ret: 0 st:-1 flags:1  ts: 0.624171
 ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:   9613 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 2.412505
 ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  38452 size:   
418
 ret: 0 st:-1 flags:0  ts: 1.306672
@@ -34,7 +34,7 @@ ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 
 21315 size:   418
 ret: 0 st:-1 flags:1  ts: 0.200839
 ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   2925 size:   
418
 ret: 0 st: 0 flags:0  ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
440
+ret: 0 st: 0 flags:1 dts: 0.00 pts: 0.00 pos:  0 size:   
417
 ret: 0 st: 0 flags:1  ts: 1.989173
 ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  31764 size:   
418
 ret: 0 st:-1 flags:0  ts: 0.883340

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mp3dec: allow enabling generic seek mode

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:38 
2015 +0200| [c3a73666ad1eee93e49f25efae30fda5556c228e] | committer: Michael 
Niedermayer

avformat/mp3dec: allow enabling generic seek mode

"-usetoc 2" now invokes the generic seek and indexing mode. This mode
skips data until the seek target is reached, and this is exact. It also
makes gapless audio actually work if a seek past the start of the file
is involved.

Change the fate-gapless-mp3 test to use the new mode, and move the old
one to fate-gapless-mp3-toc (since the test forces use of the Xing TOC).
The new mode has a different result for the seek - this result is
actually correct.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3a73666ad1eee93e49f25efae30fda5556c228e
---

 libavformat/mp3dec.c   |   12 +---
 tests/fate/gapless.mak |5 +++--
 tests/ref/fate/gapless-mp3 |2 +-
 tests/ref/fate/gapless-mp3-toc |5 +
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 008cb23..8a4dfbd 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -110,7 +110,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t 
filesize, int64_t duration
 {
 int i;
 MP3DecContext *mp3 = s->priv_data;
-int fill_index = mp3->usetoc && duration > 0;
+int fill_index = mp3->usetoc == 1 && duration > 0;
 
 if (!filesize &&
 !(filesize = avio_size(s->pb))) {
@@ -336,6 +336,9 @@ static int mp3_read_header(AVFormatContext *s)
 int ret;
 int i;
 
+if (mp3->usetoc < 0)
+mp3->usetoc = 0;
+
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
@@ -432,8 +435,11 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 int64_t best_pos;
 int best_score;
 
+if (mp3->usetoc == 2)
+return -1; // generic index code
+
 if (   mp3->is_cbr
-&& (mp3->usetoc <= 0 || !mp3->xing_toc)
+&& (mp3->usetoc == 0 || !mp3->xing_toc)
 && st->duration > 0
 && mp3->header_filesize > s->internal->data_offset
 && mp3->frames) {
@@ -498,7 +504,7 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 }
 
 static const AVOption options[] = {
-{ "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM},
+{ "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, AV_OPT_FLAG_DECODING_PARAM},
 { NULL },
 };
 
diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index a09dac6..93a878f 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,5 +1,6 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-notoc
-fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
1"
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
+fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
2"
+fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
 fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
 FATE_GAPLESS = $(FATE_GAPLESS-yes)
diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3
index 984ae84..e6a7a33 100644
--- a/tests/ref/fate/gapless-mp3
+++ b/tests/ref/fate/gapless-mp3
@@ -2,4 +2,4 @@ d5c88cf38416329a052a9b0cb140fb4c 
*tests/data/fate/gapless-mp3.out-1
 c96c3ae7bd3300fd2f4debac222de5b7
 3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3.out-2
 c96c3ae7bd3300fd2f4debac222de5b7
-70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3.out-3
+92e37f050ad4fc817730c8af17ee6d1b *tests/data/fate/gapless-mp3.out-3
diff --git a/tests/ref/fate/gapless-mp3-toc b/tests/ref/fate/gapless-mp3-toc
new file mode 100644
index 000..5d1cc00
--- /dev/null
+++ b/tests/ref/fate/gapless-mp3-toc
@@ -0,0 +1,5 @@
+d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-toc.out-1
+c96c3ae7bd3300fd2f4debac222de5b7
+3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-toc.out-2
+c96c3ae7bd3300fd2f4debac222de5b7
+70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3-toc.out-3

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mp3dec: make generic index mode the default

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:39 
2015 +0200| [58fade2c68483d31f4bcaf1db49aafc45c2c3672] | committer: Michael 
Niedermayer

avformat/mp3dec: make generic index mode the default

It's the most useful mode, because it seeks accurately, and does not
break features like gapless audio.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58fade2c68483d31f4bcaf1db49aafc45c2c3672
---

 libavformat/mp3dec.c   |2 +-
 tests/fate/gapless.mak |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 8a4dfbd..a2d3dfe 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -337,7 +337,7 @@ static int mp3_read_header(AVFormatContext *s)
 int i;
 
 if (mp3->usetoc < 0)
-mp3->usetoc = 0;
+mp3->usetoc = 2;
 
 st = avformat_new_stream(s, NULL);
 if (!st)
diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index 93a878f..f0f5fd0 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,5 +1,5 @@
 FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
-fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-usetoc 
2"
+fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3
 fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
 fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dss_sp: use lowercase codec name without whitespace

2015-04-22 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Wed Apr 22 14:42:08 2015 +0200| [35e855d5b6950887320040da723cf5d5085263a7] | 
committer: Michael Niedermayer

dss_sp: use lowercase codec name without whitespace

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35e855d5b6950887320040da723cf5d5085263a7
---

 libavcodec/dss_sp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index 42ba1c4..909ad1f 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -776,7 +776,7 @@ static int dss_sp_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 
 AVCodec ff_dss_sp_decoder = {
-.name   = "DSS SP",
+.name   = "dss_sp",
 .long_name  = NULL_IF_CONFIG_SMALL("Digital Speech Standard - Standard 
Play mode (DSS SP)"),
 .type   = AVMEDIA_TYPE_AUDIO,
 .id = AV_CODEC_ID_DSS_SP,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mpeg4videodec: only allow a positive length

2015-04-22 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Wed Apr 22 16:32:42 2015 +0200| [b3408ae4c64cb674b1d5f0f30171759113ce722a] | 
committer: Michael Niedermayer

mpeg4videodec: only allow a positive length

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3408ae4c64cb674b1d5f0f30171759113ce722a
---

 libavcodec/mpeg4videodec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 8449392..9bf33dd 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext 
*ctx, GetBitContext *g
 int x = 0, y = 0;
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 x = get_xbits(gb, length);
 
 if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
 check_marker(gb, "before sprite_trajectory");
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 y = get_xbits(gb, length);
 
 check_marker(gb, "after sprite_trajectory");

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] api-flac-test: Coding style

2015-04-22 Thread Ludmila Glinskih
ffmpeg | branch: master | Ludmila Glinskih  | Wed Apr 22 
18:09:15 2015 +0300| [5adee9c0af747774c34b2f4dffbeba23ee593962] | committer: 
Michael Niedermayer

api-flac-test: Coding style

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5adee9c0af747774c34b2f4dffbeba23ee593962
---

 libavcodec/api-flac-test.c |   72 +++-
 1 file changed, 24 insertions(+), 48 deletions(-)

diff --git a/libavcodec/api-flac-test.c b/libavcodec/api-flac-test.c
index 5ca8e8f..402d4df 100644
--- a/libavcodec/api-flac-test.c
+++ b/libavcodec/api-flac-test.c
@@ -40,8 +40,7 @@ static int generate_raw_frame(uint16_t *frame_data, int i, 
int sample_rate,
 {
 int j, k;
 
-for (j = 0; j < frame_size; j++)
-{
+for (j = 0; j < frame_size; j++) {
 frame_data[channels * j] = 1 * ((j / 10 * i) % 2);
 for (k = 1; k < channels; k++)
 frame_data[channels * j + k] = frame_data[channels * j] * (k + 1);
@@ -60,8 +59,7 @@ static int init_encoder(AVCodec *enc, AVCodecContext 
**enc_ctx,
 av_log(NULL, AV_LOG_INFO, "channel layout: %s, sample rate: %i\n", 
name_buff, sample_rate);
 
 ctx = avcodec_alloc_context3(enc);
-if (!ctx)
-{
+if (!ctx) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate encoder context\n");
 return AVERROR(ENOMEM);
 }
@@ -71,8 +69,7 @@ static int init_encoder(AVCodec *enc, AVCodecContext 
**enc_ctx,
 ctx->channel_layout = ch_layout;
 
 result = avcodec_open2(ctx, enc, NULL);
-if (result < 0)
-{
+if (result < 0) {
 av_log(ctx, AV_LOG_ERROR, "Can't open encoder\n");
 return result;
 }
@@ -88,8 +85,7 @@ static int init_decoder(AVCodec *dec, AVCodecContext 
**dec_ctx,
 int result;
 
 ctx = avcodec_alloc_context3(dec);
-if (!ctx)
-{
+if (!ctx) {
 av_log(NULL, AV_LOG_ERROR , "Can't allocate decoder context\n");
 return AVERROR(ENOMEM);
 }
@@ -100,8 +96,7 @@ static int init_decoder(AVCodec *dec, AVCodecContext 
**dec_ctx,
 ctx->channel_layout = ch_layout;
 
 result = avcodec_open2(ctx, dec, NULL);
-if (result < 0)
-{
+if (result < 0) {
 av_log(ctx, AV_LOG_ERROR, "Can't open decoder\n");
 return result;
 }
@@ -123,8 +118,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 int i = 0;
 
 in_frame = av_frame_alloc();
-if (!in_frame)
-{
+if (!in_frame) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate input frame\n");
 return AVERROR(ENOMEM);
 }
@@ -132,35 +126,30 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 in_frame->nb_samples = enc_ctx->frame_size;
 in_frame->format = enc_ctx->sample_fmt;
 in_frame->channel_layout = enc_ctx->channel_layout;
-if (av_frame_get_buffer(in_frame, 32) != 0)
-{
+if (av_frame_get_buffer(in_frame, 32) != 0) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate a buffer for input 
frame\n");
 return AVERROR(ENOMEM);
 }
 
 out_frame = av_frame_alloc();
-if (!out_frame)
-{
+if (!out_frame) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate output frame\n");
 return AVERROR(ENOMEM);
 }
 
 raw_in = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
-if (!raw_in)
-{
+if (!raw_in) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_in\n");
 return AVERROR(ENOMEM);
 }
 
 raw_out = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
-if (!raw_out)
-{
+if (!raw_out) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_out\n");
 return AVERROR(ENOMEM);
 }
 
-for (i = 0; i < NUMBER_OF_FRAMES; i++)
-{
+for (i = 0; i < NUMBER_OF_FRAMES; i++) {
 av_init_packet(&enc_pkt);
 enc_pkt.data = NULL;
 enc_pkt.size = 0;
@@ -170,44 +159,36 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 memcpy(raw_in + in_offset, in_frame->data[0], in_frame->linesize[0]);
 in_offset += in_frame->linesize[0];
 result = avcodec_encode_audio2(enc_ctx, &enc_pkt, in_frame, 
&got_output);
-if (result < 0)
-{
+if (result < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error encoding audio frame\n");
 return result;
 }
 
 /* if we get an encoded packet, feed it straight to the decoder */
-if (got_output)
-{
+if (got_output) {
 result = avcodec_decode_audio4(dec_ctx, out_frame, &got_output, 
&enc_pkt);
-if (result < 0)
-{
+if (result < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error decoding audio packet\n");
 return result;
 }
 
-if (got_output)
-{
-if (result != enc_pkt.size)
-{
+if (got_output) {
+   

[FFmpeg-cvslog] fate: gapless: remove useless tests

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:40 
2015 +0200| [53ff9a4ec9ce1ab4ff2ab92479b885260ff5cf4c] | committer: Michael 
Niedermayer

fate: gapless: remove useless tests

These could be kept, but they are not overly useful. The only thing they
had over the remaining mp3 gapless test was seeking, which was incorrect
in the toc test, and only by chance correct in the notoc test.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=53ff9a4ec9ce1ab4ff2ab92479b885260ff5cf4c
---

 tests/fate/gapless.mak   |4 +---
 tests/ref/fate/gapless-mp3-notoc |5 -
 tests/ref/fate/gapless-mp3-toc   |5 -
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index f0f5fd0..2fb005f 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,7 +1,5 @@
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 fate-gapless-mp3-toc 
fate-gapless-mp3-notoc
+FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
 fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3
-fate-gapless-mp3-toc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 1"
-fate-gapless-mp3-notoc: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 
"-usetoc 0"
 
 FATE_GAPLESS = $(FATE_GAPLESS-yes)
 
diff --git a/tests/ref/fate/gapless-mp3-notoc b/tests/ref/fate/gapless-mp3-notoc
deleted file mode 100644
index 936d0ba..000
--- a/tests/ref/fate/gapless-mp3-notoc
+++ /dev/null
@@ -1,5 +0,0 @@
-d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-notoc.out-1
-c96c3ae7bd3300fd2f4debac222de5b7
-3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-notoc.out-2
-c96c3ae7bd3300fd2f4debac222de5b7
-92e37f050ad4fc817730c8af17ee6d1b *tests/data/fate/gapless-mp3-notoc.out-3
diff --git a/tests/ref/fate/gapless-mp3-toc b/tests/ref/fate/gapless-mp3-toc
deleted file mode 100644
index 5d1cc00..000
--- a/tests/ref/fate/gapless-mp3-toc
+++ /dev/null
@@ -1,5 +0,0 @@
-d5c88cf38416329a052a9b0cb140fb4c *tests/data/fate/gapless-mp3-toc.out-1
-c96c3ae7bd3300fd2f4debac222de5b7
-3386bc2009b31b7ef39247918cbb02a5 *tests/data/fate/gapless-mp3-toc.out-2
-c96c3ae7bd3300fd2f4debac222de5b7
-70e7cd7f2b6365e7f48ed206113f06fc *tests/data/fate/gapless-mp3-toc.out-3

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dshow: add capture device save and load

2015-04-22 Thread Mate Sebok
ffmpeg | branch: master | Mate Sebok  | Wed Apr 22 
18:38:38 2015 +0200| [4d98015dcf6562b5822a96f024ac8c94b95203a6] | committer: 
Michael Niedermayer

dshow: add capture device save and load

Signed-off-by: Mate Sebok 
Reviewed-by: Roger Pack 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d98015dcf6562b5822a96f024ac8c94b95203a6
---

 configure   |2 +-
 doc/indevs.texi |   24 +++
 libavdevice/dshow.c |   97 +--
 libavdevice/dshow_capture.h |4 ++
 4 files changed, 123 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 60d4b2f..e2bd3de 100755
--- a/configure
+++ b/configure
@@ -2543,7 +2543,7 @@ decklink_outdev_extralibs="-lstdc++"
 decklink_indev_deps="decklink pthreads"
 decklink_indev_extralibs="-lstdc++"
 dshow_indev_deps="IBaseFilter"
-dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32"
+dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
 dv1394_indev_deps="dv1394"
 dv1394_indev_select="dv_demuxer"
 fbdev_indev_deps="linux_fb_h"
diff --git a/doc/indevs.texi b/doc/indevs.texi
index 9818531..d5415bb 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -350,6 +350,30 @@ If set to @option{true}, before capture starts, popup a 
display
 dialog to the end user, allowing them to manually
 modify TV audio (like mono vs. stereo, Language A,B or C).
 
+@item audio_device_load
+Load an audio capture filter device from file instead of searching
+it by name. It may load additional parameters too, if the filter
+supports the serialization of its properties to.
+To use this an audio capture source has to be specified, but it can
+be anything even fake one.
+
+@item audio_device_save
+Save the currently used audio capture filter device and its
+parameters (if the filter supports it) to a file.
+If a file with the same name exists it will be overwritten.
+
+@item video_device_load
+Load a video capture filter device from file instead of searching
+it by name. It may load additional parameters too, if the filter
+supports the serialization of its properties to.
+To use this a video capture source has to be specified, but it can
+be anything even fake one.
+
+@item video_device_save
+Save the currently used video capture filter device and its
+parameters (if the filter supports it) to a file.
+If a file with the same name exists it will be overwritten.
+
 @end table
 
 @subsection Examples
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index d03670e..6224978 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -27,6 +27,8 @@
 #include "libavformat/riff.h"
 #include "avdevice.h"
 #include "libavcodec/raw.h"
+#include "objidl.h"
+#include "shlwapi.h"
 
 
 static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount)
@@ -728,12 +730,46 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 ICaptureGraphBuilder2 *graph_builder2 = NULL;
 int ret = AVERROR(EIO);
 int r;
+IStream *ifile_stream = NULL;
+IStream *ofile_stream = NULL;
+IPersistStream *pers_stream = NULL;
 
 const wchar_t *filter_name[2] = { L"Audio capture filter", L"Video capture 
filter" };
 
-if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, 
&device_filter)) < 0) {
-ret = r;
-goto error;
+
+if ( ((ctx->audio_filter_load_file) && 
(strlen(ctx->audio_filter_load_file)>0) && (sourcetype == AudioSourceDevice)) ||
+((ctx->video_filter_load_file) && 
(strlen(ctx->video_filter_load_file)>0) && (sourcetype == VideoSourceDevice)) ) 
{
+HRESULT hr;
+char *filename = NULL;
+
+if (sourcetype == AudioSourceDevice)
+filename = ctx->audio_filter_load_file;
+else
+filename = ctx->video_filter_load_file;
+
+hr = SHCreateStreamOnFile ((LPCSTR) filename, STGM_READ, 
&ifile_stream);
+if (S_OK != hr) {
+av_log(avctx, AV_LOG_ERROR, "Could not open capture filter 
description file.\n");
+goto error;
+}
+
+hr = OleLoadFromStream(ifile_stream, &IID_IBaseFilter, (void **) 
&device_filter);
+if (hr != S_OK) {
+av_log(avctx, AV_LOG_ERROR, "Could not load capture filter from 
file.\n");
+goto error;
+}
+
+if (sourcetype == AudioSourceDevice)
+av_log(avctx, AV_LOG_INFO, "Audio-");
+else
+av_log(avctx, AV_LOG_INFO, "Video-");
+av_log(avctx, AV_LOG_INFO, "Capture filter loaded successfully from 
file \"%s\".\n", filename);
+} else {
+
+if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, 
&device_filter)) < 0) {
+ret = r;
+goto error;
+}
 }
 
 ctx->device_filter [devtype] = device_filter;
@@ -758,6 +794,48 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum 
*devenum,
 }
 ctx->capture

[FFmpeg-cvslog] bink: check vst->index_entries before using it

2015-04-22 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Wed Apr 22 17:08:51 2015 +0200| [86d00ede4f9acb02690a0615490173648e1d933c] | 
committer: Michael Niedermayer

bink: check vst->index_entries before using it

This fixes a NULL pointer dereference if vst->duration is 0.

The problem was introduced in commit 0588acaf.

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86d00ede4f9acb02690a0615490173648e1d933c
---

 libavformat/bink.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 92ce261..332edbb 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -194,7 +194,10 @@ static int read_header(AVFormatContext *s)
 return ret;
 }
 
-avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
+if (vst->index_entries)
+avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
+else
+avio_skip(pb, 4);
 
 bink->current_track = -1;
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: remove one optimization branch in iadst16 which causes overflows.

2015-04-22 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Wed Apr 22 
14:53:01 2015 -0400| [d02d04a18f300ebe97319ca6e91fc943cb14f58b] | committer: 
Michael Niedermayer

vp9: remove one optimization branch in iadst16 which causes overflows.

See sample vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm from the vp9 test
vector set which reproduces the issue. This probably costs a few cycles,
but I don't think there's an easy way to workaround that.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d02d04a18f300ebe97319ca6e91fc943cb14f58b
---

 libavcodec/x86/vp9itxfm.asm |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/vp9itxfm.asm b/libavcodec/x86/vp9itxfm.asm
index bfe427f..a9d45a4 100644
--- a/libavcodec/x86/vp9itxfm.asm
+++ b/libavcodec/x86/vp9itxfm.asm
@@ -1699,7 +1699,9 @@ VP9_IDCT_IDCT_16x16_ADD_XMM avx
 SUMSUB_BAw,  5,  7,  4
 PSIGNW  m5, [pw_m1] ; m12=out15[w], 
m8=t3[w]
 
-%if cpuflag(ssse3)
+; unfortunately, the code below overflows in some cases, e.g.
+; 
http://downloads.webmproject.org/test_data/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm
+%if 0 ; cpuflag(ssse3)
 SUMSUB_BA   w,   7,  6,  4
 pmulhrswm7, [pw_m11585x2]   ; m8=out7[w]
 pmulhrswm6, [pw_11585x2]; m1=out8[w]

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

2015-04-22 Thread wm4
ffmpeg | branch: master | wm4  | Wed Apr 22 12:24:41 
2015 +0200| [748d4816d92c735f662c7ac299e79ff0f6fe252e] | committer: Michael 
Niedermayer

avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=748d4816d92c735f662c7ac299e79ff0f6fe252e
---

 doc/APIchanges  |4 
 doc/formats.texi|2 ++
 libavformat/avformat.h  |1 +
 libavformat/mp3dec.c|2 +-
 libavformat/options_table.h |1 +
 libavformat/version.h   |2 +-
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b422e29..b65fd62 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2014-08-09
 
 API changes, most recent first:
 
+2015-xx-xx - xxx - lavf 56.xx.xxx - avformat.h
+  Add AVFMT_FLAG_FAST_SEEK flag. Some formats (initially mp3) use it to enable
+  fast, but inaccurate seeking.
+
 2015-xx-xx - xxx - lavu 54.12.0
   Add AV_LOG_TRACE for extremely verbose debugging.
 
diff --git a/doc/formats.texi b/doc/formats.texi
index cbbdc10..aa39d4b 100644
--- a/doc/formats.texi
+++ b/doc/formats.texi
@@ -37,6 +37,8 @@ Possible values:
 @table @samp
 @item ignidx
 Ignore index.
+@item fastseek
+Enable fast, but inaccurate seeks for some formats.
 @item genpts
 Generate PTS.
 @item nofillin
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index c2f798d..339ff52 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1391,6 +1391,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_SORT_DTS0x1 ///< try to interleave outputted 
packets by dts (using this flag can slow demuxing down)
 #define AVFMT_FLAG_PRIV_OPT0x2 ///< Enable use of private options by 
delaying codec open (this could be made default once all code is converted)
 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep 
it separate.
+#define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 
 /**
  * @deprecated deprecated in favor of probesize2
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index a2d3dfe..8c17776 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -337,7 +337,7 @@ static int mp3_read_header(AVFormatContext *s)
 int i;
 
 if (mp3->usetoc < 0)
-mp3->usetoc = 2;
+mp3->usetoc = (s->flags & AVFMT_FLAG_FAST_SEEK) ? 0 : 2;
 
 st = avformat_new_stream(s, NULL);
 if (!st)
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 40f1e0a..58670b0 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -49,6 +49,7 @@ static const AVOption avformat_options[] = {
 {"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},
 {"sortdts", "try to interleave outputted packets by dts", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, 
"fflags"},
 {"keepside", "don't merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
+{"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, "fflags"},
 {"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
 {"nobuffer", "reduce the latency introduced by optional buffering", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
 {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D},
diff --git a/libavformat/version.h b/libavformat/version.h
index 55287ae..381c071 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 56
-#define LIBAVFORMAT_VERSION_MINOR  30
+#define LIBAVFORMAT_VERSION_MINOR  31
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] postproc: Replaced inline asm for prefetching with prefetch functions

2015-04-22 Thread Tucker DiNapoli
ffmpeg | branch: master | Tucker DiNapoli  | Wed Apr 22 
16:27:26 2015 -0400| [6264b6227c779af9d2520722f6acb45a2c51cdfd] | committer: 
Michael Niedermayer

postproc: Replaced inline asm for prefetching with prefetch functions

Prefetching functions are defined in postprocess_template using the
RENAME macro so that prefetching is used when available. For x86
targets inline asm is used and the functions are non-empty only for
cpus where prefetching is available. For non x86 targets the gcc bultin
prefetch is used if it is available, otherwise no prefetching is done.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6264b6227c779af9d2520722f6acb45a2c51cdfd
---

 libpostproc/postprocess.c  |   31 -
 libpostproc/postprocess_template.c |  126 
 2 files changed, 71 insertions(+), 86 deletions(-)

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 9d89782..af70bb3 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -168,37 +168,6 @@ static const char * const replaceTable[]=
 NULL //End Marker
 };
 
-
-#if ARCH_X86 && HAVE_INLINE_ASM
-static inline void prefetchnta(const void *p)
-{
-__asm__ volatile(   "prefetchnta (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht0(const void *p)
-{
-__asm__ volatile(   "prefetcht0 (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht1(const void *p)
-{
-__asm__ volatile(   "prefetcht1 (%0)\n\t"
-: : "r" (p)
-);
-}
-
-static inline void prefetcht2(const void *p)
-{
-__asm__ volatile(   "prefetcht2 (%0)\n\t"
-: : "r" (p)
-);
-}
-#endif
-
 /* The horizontal functions exist only in C because the MMX
  * code is faster with vertical filters and transposing. */
 
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index 16e441a..e153b13 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3242,6 +3242,69 @@ static inline void RENAME(duplicate)(uint8_t src[], int 
stride)
 #endif
 }
 
+#if ARCH_X86 && TEMPLATE_PP_MMXEXT
+static inline void RENAME(prefetchnta)(const void *p)
+{
+__asm__ volatile(   "prefetchnta (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht0)(const void *p)
+{
+__asm__ volatile(   "prefetcht0 (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht1)(const void *p)
+{
+__asm__ volatile(   "prefetcht1 (%0)\n\t"
+: : "r" (p)
+);
+}
+
+static inline void RENAME(prefetcht2)(const void *p)
+{
+__asm__ volatile(   "prefetcht2 (%0)\n\t"
+: : "r" (p)
+);
+}
+#elif !ARCH_X86 && AV_GCC_VERSION_AT_LEAST(3,2)
+static inline void RENAME(prefetchnta)(const void *p)
+{
+__builtin_prefetch(p,0,0);
+}
+static inline void RENAME(prefetcht0)(const void *p)
+{
+__builtin_prefetch(p,0,1);
+}
+static inline void RENAME(prefetcht1)(const void *p)
+{
+__builtin_prefetch(p,0,2);
+}
+static inline void RENAME(prefetcht2)(const void *p)
+{
+__builtin_prefetch(p,0,3);
+}
+#else
+static inline void RENAME(prefetchnta)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht0)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht1)(const void *p)
+{
+return;
+}
+static inline void RENAME(prefetcht2)(const void *p)
+{
+return;
+}
+#endif
 /**
  * Filter array of bytes (Y or U or V values)
  */
@@ -3368,34 +3431,10 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
 // finish 1 block before the next otherwise we might have a problem
 // with the L1 Cache of the P4 ... or only a few blocks at a time or 
something
 for(x=0; x>2)&6) + 5)*srcStride + 32);
-prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-__asm__(
-"mov %4, %%"REG_a"  \n\t"
-"shr $2, %%"REG_a"  \n\t"
-"and $6, %%"REG_a"  \n\t"
-"add %5, %%"REG_a"  \n\t"
-"mov %%"REG_a", %%"REG_d"   \n\t"
-"imul %1, %%"REG_a" \n\t"
-"imul %3, %%"REG_d" \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-"add %1, %%"REG_a"  \n\t"
-"add %3, %%"REG_d"  \n\t"
-"prefetchnta 32(%%"REG_a", %0)  \n\t"
-"prefetcht0 32(%%"REG_d", %2)   \n\t"
-:: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), 
"r" ((x86_reg)dstStride),
-"g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
-: "%"REG_a, "%"REG_d
-   

[FFmpeg-cvslog] postproc: Made QP, nonBQP, and pQPb arrays

2015-04-22 Thread Tucker DiNapoli
ffmpeg | branch: master | Tucker DiNapoli  | Wed Apr 22 
16:27:27 2015 -0400| [cbe27006cee0099076d1d68af646f3ef914167d8] | committer: 
Michael Niedermayer

postproc: Made QP, nonBQP, and pQPb arrays

Also pulled QP initialization out of inner loop, which removed some redundent 
code.

Added some dummy fields to PPContext to allow current code to work while
changing the rest of the postprocessing code to support the arrays.

I also increased alignment requirements for some fields in the PPContext struct 
to
support future avx2 code.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbe27006cee0099076d1d68af646f3ef914167d8
---

 libpostproc/postprocess_internal.h |   10 -
 libpostproc/postprocess_template.c |   81 +---
 2 files changed, 46 insertions(+), 45 deletions(-)

diff --git a/libpostproc/postprocess_internal.h 
b/libpostproc/postprocess_internal.h
index 1ebd974..c1a306d 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -143,8 +143,11 @@ typedef struct PPContext{
 DECLARE_ALIGNED(8, uint64_t, pQPb);
 DECLARE_ALIGNED(8, uint64_t, pQPb2);
 
-DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
-DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
+DECLARE_ALIGNED(32, uint64_t, pQPb_block)[4];
+DECLARE_ALIGNED(32, uint64_t, pQPb2_block)[4];
+
+DECLARE_ALIGNED(32, uint64_t, mmxDcOffset)[64];
+DECLARE_ALIGNED(32, uint64_t, mmxDcThreshold)[64];
 
 QP_STORE_T *stdQPTable;   ///< used to fix MPEG2 style qscale
 QP_STORE_T *nonBQPTable;
@@ -153,6 +156,9 @@ typedef struct PPContext{
 int QP;
 int nonBQP;
 
+DECLARE_ALIGNED(32, int, QP_block)[4];
+DECLARE_ALIGNED(32, int, nonBQP_block)[4];
+
 int frameNum;
 
 int cpuCaps;
diff --git a/libpostproc/postprocess_template.c 
b/libpostproc/postprocess_template.c
index e153b13..b7296c4 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -3479,7 +3479,7 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 #endif
 const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
 int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
-int QP=0;
+int QP=0, nonBQP=0;
 /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 
1 line upwards
if not than use a temporary buffer */
 if(y+15 >= height){
@@ -3512,6 +3512,29 @@ static void RENAME(postProcess)(const uint8_t src[], int 
srcStride, uint8_t dst[
 int endx = FFMIN(width, x+32);
 uint8_t *dstBlockStart = dstBlock;
 const uint8_t *srcBlockStart = srcBlock;
+int qp_index = 0;
+for(qp_index=0; qp_index < (endx-startx)/BLOCK_SIZE; qp_index++){
+QP = QPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
+nonBQP = nonBQPptr[(x+qp_index*BLOCK_SIZE)>>qpHShift];
+if(!isColor){
+QP= (QP* QPCorrecture + 256*128)>>16;
+nonBQP= (nonBQP* QPCorrecture + 256*128)>>16;
+yHistogram[(srcBlock+qp_index*8)[srcStride*12 + 4]]++;
+}
+c.QP_block[qp_index] = QP;
+c.nonBQP_block[qp_index] = nonBQP;
+#if TEMPLATE_PP_MMX
+__asm__ volatile(
+"movd %1, %%mm7 \n\t"
+"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
+"packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
+"movq %%mm7, %0 \n\t"
+: "=m" (c.pQPb_block[qp_index])
+: "r" (QP)
+);
+#endif
+}
   for(; x < endx; x+=BLOCK_SIZE){
 RENAME(prefetchnta)(srcBlock + (((x>>2)&6) + copyAhead)*srcStride 
+ 32);
 RENAME(prefetchnta)(srcBlock + (((x>>2)&6) + 
copyAhead+1)*srcStride + 32);
@@ -3543,27 +3566,15 @@ static void RENAME(postProcess)(const uint8_t src[], 
int srcStride, uint8_t dst[
   dstBlock = dstBlockStart;
   srcBlock = srcBlockStart;
 
-  for(x = startx; x < endx; x+=BLOCK_SIZE){
+  for(x = startx, qp_index = 0; x < endx; x+=BLOCK_SIZE, qp_index++){
 const int stride= dstStride;
-QP = QPptr[x>>qpHShift];
-c.nonBQP = nonBQPptr[x>>qpHShift];
-if(!isColor){
-QP= (QP* QPCorrecture + 256*128)>>16;
-c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
-yHistogram[srcBlock[srcStride*12 + 4]]++;
-}
-c.QP= QP;
-#if TEMPLATE_PP_MMX
-__asm__ volatile(
-"movd %1, %%mm7 \n\t"
-"packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
-"packuswb %%mm7, %%mm7  \n\t" // QP,...,

[FFmpeg-cvslog] fate: add cinepak encoder vsynth tests

2015-04-22 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Apr 22 17:34:28 
2015 -0300| [d7f62f033c214f3863acfd8e0672407b0bf91a3b] | committer: Michael 
Niedermayer

fate: add cinepak encoder vsynth tests

Signed-off-by: James Almer 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7f62f033c214f3863acfd8e0672407b0bf91a3b
---

 tests/fate/vcodec.mak|6 +-
 tests/ref/vsynth/vsynth1-cinepak |4 
 tests/ref/vsynth/vsynth2-cinepak |4 
 tests/ref/vsynth/vsynth_lena-cinepak |4 
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
index 0aba87b..1ad5e96 100644
--- a/tests/fate/vcodec.mak
+++ b/tests/fate/vcodec.mak
@@ -18,6 +18,10 @@ fate-vsynth%-asv1:   ENCOPTS = -qscale 10
 FATE_VCODEC-$(call ENCDEC, ASV2, AVI)   += asv2
 fate-vsynth%-asv2:   ENCOPTS = -qscale 10
 
+FATE_VCODEC-$(call ENCDEC, CINEPAK, MOV) += cinepak
+fate-vsynth%-cinepak:ENCOPTS  = -vcodec cinepak -frames 3
+fate-vsynth%-cinepak:FMT  = mov
+
 FATE_VCODEC-$(call ENCDEC, CLJR, AVI)   += cljr
 fate-vsynth%-cljr:   ENCOPTS = -strict -1
 
@@ -320,7 +324,7 @@ FATE_VSYNTH_LENA = $(FATE_VCODEC:%=fate-vsynth_lena-%)
 RESIZE_OFF   = dnxhd-720p dnxhd-720p-rd dnxhd-720p-10bit dnxhd-1080i \
dv dv-411 dv-50 avui snow snow-hpel snow-ll
 # Incorrect parameters - usually size or color format restrictions
-INC_PAR_OFF  = h261 h261-trellis h263 h263p h263-obmc msvideo1 \
+INC_PAR_OFF  = cinepak h261 h261-trellis h263 h263p h263-obmc msvideo1 \
roqvideo rv10 rv20 y41p qtrlegray
 VSYNTH3_OFF  = $(RESIZE_OFF) $(INC_PAR_OFF)
 
diff --git a/tests/ref/vsynth/vsynth1-cinepak b/tests/ref/vsynth/vsynth1-cinepak
new file mode 100644
index 000..f1dfcd8
--- /dev/null
+++ b/tests/ref/vsynth/vsynth1-cinepak
@@ -0,0 +1,4 @@
+546c7c1069f9e418aa787f469b693b94 *tests/data/fate/vsynth1-cinepak.mov
+99465 tests/data/fate/vsynth1-cinepak.mov
+bee091c200262be3427a233a2812388c *tests/data/fate/vsynth1-cinepak.out.rawvideo
+stddev:8.46 PSNR: 29.58 MAXDIFF:  105 bytes:  7603200/   456192
diff --git a/tests/ref/vsynth/vsynth2-cinepak b/tests/ref/vsynth/vsynth2-cinepak
new file mode 100644
index 000..18eb1d5
--- /dev/null
+++ b/tests/ref/vsynth/vsynth2-cinepak
@@ -0,0 +1,4 @@
+cc0879f1993cdd6231e2c3b9c2c015a0 *tests/data/fate/vsynth2-cinepak.mov
+88400 tests/data/fate/vsynth2-cinepak.mov
+12c480911ebb89762dc49af003b176c7 *tests/data/fate/vsynth2-cinepak.out.rawvideo
+stddev:5.07 PSNR: 34.02 MAXDIFF:   59 bytes:  7603200/   456192
diff --git a/tests/ref/vsynth/vsynth_lena-cinepak 
b/tests/ref/vsynth/vsynth_lena-cinepak
new file mode 100644
index 000..39b1d68
--- /dev/null
+++ b/tests/ref/vsynth/vsynth_lena-cinepak
@@ -0,0 +1,4 @@
+e3837018f84929f07019ae2eccd303e2 *tests/data/fate/vsynth_lena-cinepak.mov
+88900 tests/data/fate/vsynth_lena-cinepak.mov
+f54ffa70f335ac7b701d7ae34462e001 
*tests/data/fate/vsynth_lena-cinepak.out.rawvideo
+stddev:4.09 PSNR: 35.88 MAXDIFF:   46 bytes:  7603200/   456192

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: add support for resolution changes in inter frames.

2015-04-22 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Tue Apr 21 
20:54:51 2015 -0400| [e8b4f6d6befc5062db74916ea8a4d830e83022a8] | committer: 
Michael Niedermayer

vp9: add support for resolution changes in inter frames.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e8b4f6d6befc5062db74916ea8a4d830e83022a8
---

 libavcodec/vp9.c |  316 +-
 libavcodec/vp9_mc_template.c |  171 +++
 libavcodec/vp9_parser.c  |5 +-
 libavcodec/vp9dsp.c  |  205 +--
 libavcodec/vp9dsp.h  |9 ++
 5 files changed, 535 insertions(+), 171 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 89257fa..ee73325 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -242,7 +242,7 @@ typedef struct VP9Context {
 // whole-frame cache
 uint8_t *intra_pred_data[3];
 struct VP9Filter *lflvl;
-DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[71*80];
+DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135*144];
 
 // block reconstruction intermediates
 int block_alloc_using_2pass;
@@ -251,6 +251,8 @@ typedef struct VP9Context {
 struct { int x, y; } min_mv, max_mv;
 DECLARE_ALIGNED(32, uint8_t, tmp_y)[64*64];
 DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][32*32];
+uint16_t mvscale[3][2];
+uint8_t mvstep[3][2];
 } VP9Context;
 
 static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
@@ -577,6 +579,26 @@ static int decode_frame_header(AVCodecContext *ctx,
 s->varcompref[1] = 2;
 }
 }
+
+for (i = 0; i < 3; i++) {
+AVFrame *ref = s->refs[s->refidx[i]].f;
+int refw = ref->width, refh = ref->height;
+
+if (refw == w && refh == h) {
+s->mvscale[i][0] = s->mvscale[i][1] = 0;
+} else {
+if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 
16 * refh) {
+av_log(ctx, AV_LOG_ERROR,
+   "Invalid ref frame dimensions %dx%d for frame 
size %dx%d\n",
+   refw, refh, w, h);
+return AVERROR_INVALIDDATA;
+}
+s->mvscale[i][0] = (refw << 14) / w;
+s->mvscale[i][1] = (refh << 14) / h;
+s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
+s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
+}
+}
 }
 }
 s->refreshctx   = s->errorres ? 0 : get_bits1(&s->gb);
@@ -2524,12 +2546,118 @@ static void intra_recon(AVCodecContext *ctx, ptrdiff_t 
y_off, ptrdiff_t uv_off)
 }
 }
 
-static av_always_inline void mc_luma_dir(VP9Context *s, vp9_mc_func (*mc)[2],
- uint8_t *dst, ptrdiff_t dst_stride,
- const uint8_t *ref, ptrdiff_t 
ref_stride,
- ThreadFrame *ref_frame,
- ptrdiff_t y, ptrdiff_t x, const 
VP56mv *mv,
- int bw, int bh, int w, int h)
+static av_always_inline void mc_luma_scaled(VP9Context *s, vp9_scaled_mc_func 
smc,
+uint8_t *dst, ptrdiff_t dst_stride,
+const uint8_t *ref, ptrdiff_t 
ref_stride,
+ThreadFrame *ref_frame,
+ptrdiff_t y, ptrdiff_t x, const 
VP56mv *mv,
+int bw, int bh, int w, int h,
+const uint16_t *scale, const 
uint8_t *step)
+{
+#define scale_mv(n, dim) (((int64_t)n * scale[dim]) >> 14)
+// BUG libvpx seems to scale the two components separately. This introduces
+// rounding errors but we have to reproduce them to be exactly compatible
+// with the output from libvpx...
+int mx = scale_mv(mv->x * 2, 0) + scale_mv(x * 16, 0);
+int my = scale_mv(mv->y * 2, 1) + scale_mv(y * 16, 1);
+int refbw_m1, refbh_m1;
+int th;
+
+y = my >> 4;
+x = mx >> 4;
+ref += y * ref_stride + x;
+mx &= 15;
+my &= 15;
+refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
+refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
+// FIXME bilinear filter only needs 0/1 pixels, not 3/4
+// we use +7 because the last 7 pixels of each sbrow can be changed in
+// the longest loopfilter of the next sbrow
+th = (y + refbh_m1 + 4 + 7) >> 6;
+ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
+if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) {
+s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ ref - 3 * ref_stride - 3,
+ 144, ref_stride,
+ refbw

[FFmpeg-cvslog] vp9: add fate size for resolution changes.

2015-04-22 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Tue Apr 21 
20:54:52 2015 -0400| [df287f3e4362982807d80a62e3122e2477b85892] | committer: 
Michael Niedermayer

vp9: add fate size for resolution changes.

See sample:
http://downloads.webmproject.org/test_data/libvpx/vp90-2-05-resize.ivf

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df287f3e4362982807d80a62e3122e2477b85892
---

 tests/fate/vpx.mak   |3 +++
 tests/ref/fate/vp9-05-resize |   15 +++
 2 files changed, 18 insertions(+)

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 0e7e7eb..304d98b 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -109,6 +109,9 @@ $(eval $(call FATE_VP9_SUITE,trac4359,$(1),$(2)))
 endef
 
 $(eval $(call FATE_VP9_FULL))
+FATE_VP9-$(CONFIG_IVF_DEMUXER) += fate-vp9-05-resize
+fate-vp9-05-resize: CMD = framemd5 -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf -s 352x288 -sws_flags 
bitexact+bilinear
+fate-vp9-05-resize: REF = $(SRC_PATH)/tests/ref/fate/vp9-05-resize
 
 FATE_SAMPLES_AVCONV-$(CONFIG_VP9_DECODER) += $(FATE_VP9-yes)
 fate-vp9: $(FATE_VP9-yes)
diff --git a/tests/ref/fate/vp9-05-resize b/tests/ref/fate/vp9-05-resize
new file mode 100644
index 000..4a3cd09
--- /dev/null
+++ b/tests/ref/fate/vp9-05-resize
@@ -0,0 +1,15 @@
+#format: frame checksums
+#version: 1
+#hash: MD5
+#tb 0: 1/30
+#stream#, dts,pts, duration, size, hash
+0,  0,  0,1,   152064, 539e9964364c1db09ad18f2e01713799
+0,  1,  1,1,   152064, fb76e673ba2a5342bfed8a1523e0a425
+0,  2,  2,1,   152064, b0e6881ac6c1e0d839f80f292cb1afd4
+0,  3,  3,1,   152064, f69a4d7f784e1619e45ffd65e3f103b9
+0,  4,  4,1,   152064, a9cefc3088de0b403c7cc1ffd117479a
+0,  5,  5,1,   152064, 6a053249fe6fdc52ed00a21668fe330f
+0,  6,  6,1,   152064, 2c6f7b8c72a0103cd1fa37270f6d9962
+0,  7,  7,1,   152064, 9f837ba58bf07d1e1a8b6a30a9a588e8
+0,  8,  8,1,   152064, 81ecfd1810b25395af999e557ed4b938
+0,  9,  9,1,   152064, cee53e71d6347333fd76d421ece1740f

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog