[FFmpeg-cvslog] avformat/mp3dec: prefer "fast_seek" to TOC seek for CBR files.

2015-12-02 Thread Chris Cunningham
ffmpeg | branch: master | Chris Cunningham  | Tue 
Dec  1 10:54:38 2015 -0800| [5e6ce28dabe002a6130f17b59c454bdee33088f7] | 
committer: wm4

avformat/mp3dec: prefer "fast_seek" to TOC seek for CBR files.

"Fast seek" uses linear interpolation to find the position of the
requested seek time. For CBR this is more direct than using the
mp3 TOC and bypassing the TOC avoids problems with TOC precision.
(see https://crbug.com/545914#c13)

For VBR, fast seek is not precise, so continue to prefer the TOC
when available (the lesser of two evils).

Also, some re-ordering of the logic in mp3_seek to simplify and
give usetoc=1 precedence over fastseek flag.

Signed-off-by: wm4 

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

 libavformat/mp3dec.c|   40 
 libavformat/seek-test.c |8 +---
 tests/fate/seek.mak |2 +-
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 32ca00c..526f780 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -115,7 +115,8 @@ 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 == 1 && duration > 0;
+int fast_seek = s->flags & AVFMT_FLAG_FAST_SEEK;
+int fill_index = (mp3->usetoc || fast_seek) && duration > 0;
 
 if (!filesize &&
 !(filesize = avio_size(s->pb))) {
@@ -344,9 +345,6 @@ static int mp3_read_header(AVFormatContext *s)
 int ret;
 int i;
 
-if (mp3->usetoc < 0)
-mp3->usetoc = (s->flags & AVFMT_FLAG_FAST_SEEK) ? 1 : 2;
-
 st = avformat_new_stream(s, NULL);
 if (!st)
 return AVERROR(ENOMEM);
@@ -501,35 +499,37 @@ static int mp3_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp,
 MP3DecContext *mp3 = s->priv_data;
 AVIndexEntry *ie, ie1;
 AVStream *st = s->streams[0];
-int64_t ret  = av_index_search_timestamp(st, timestamp, flags);
 int64_t best_pos;
-int fast_seek = (s->flags & AVFMT_FLAG_FAST_SEEK) ? 1 : 0;
+int fast_seek = s->flags & AVFMT_FLAG_FAST_SEEK;
 int64_t filesize = mp3->header_filesize;
 
-if (mp3->usetoc == 2)
-return -1; // generic index code
-
 if (filesize <= 0) {
 int64_t size = avio_size(s->pb);
 if (size > 0 && size > s->internal->data_offset)
 filesize = size - s->internal->data_offset;
 }
 
-if (   (mp3->is_cbr || fast_seek)
-&& (mp3->usetoc == 0 || !mp3->xing_toc)
-&& st->duration > 0
-&& filesize > 0) {
-ie = &ie1;
-timestamp = av_clip64(timestamp, 0, st->duration);
-ie->timestamp = timestamp;
-ie->pos   = av_rescale(timestamp, filesize, st->duration) + 
s->internal->data_offset;
-} else if (mp3->xing_toc) {
+if (mp3->xing_toc && (mp3->usetoc || (fast_seek && !mp3->is_cbr))) {
+int64_t ret = av_index_search_timestamp(st, timestamp, flags);
+
+// NOTE: The MP3 TOC is not a precise lookup table. Accuracy is worse
+// for bigger files.
+av_log(s, AV_LOG_WARNING, "Using MP3 TOC to seek; may be 
imprecise.\n");
+
 if (ret < 0)
 return ret;
 
 ie = &st->index_entries[ret];
+} else if (fast_seek && st->duration > 0 && filesize > 0) {
+if (!mp3->is_cbr)
+av_log(s, AV_LOG_WARNING, "Using scaling to seek VBR MP3; may be 
imprecise.\n");
+
+ie = &ie1;
+timestamp = av_clip64(timestamp, 0, st->duration);
+ie->timestamp = timestamp;
+ie->pos   = av_rescale(timestamp, filesize, st->duration) + 
s->internal->data_offset;
 } else {
-return -1;
+return -1; // generic index code
 }
 
 best_pos = mp3_sync(s, ie->pos, flags);
@@ -546,7 +546,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, 2, AV_OPT_FLAG_DECODING_PARAM},
+{ "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM},
 { NULL },
 };
 
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 1926f21..bfd06db 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -56,7 +56,7 @@ static void ts_str(char buffer[60], int64_t ts, AVRational 
base)
 int main(int argc, char **argv)
 {
 const char *filename;
-AVFormatContext *ic = NULL;
+AVFormatContext *ic = avformat_alloc_context();
 int i, ret, stream_id;
 int j;
 int64_t timestamp;
@@ -76,8 +76,10 @@ int main(int argc, char **argv)
 frame_count = atoi(argv[i+1]);
 } else if(!strcmp(argv[i], "-duration")){
 duration = atoi(argv[i+1]);
-} else if(!strcmp(argv[i],

[FFmpeg-cvslog] avformat/matroskadec: Fix sample_aspect_ratio for stereo matroska content

2015-12-02 Thread Aaron Colwell
ffmpeg | branch: master | Aaron Colwell  | Mon Nov 23 
12:06:14 2015 -0800| [ec83efd4d3c5fe1e4bc5723d0b91abf85b722f41] | committer: wm4

avformat/matroskadec: Fix sample_aspect_ratio for stereo matroska content

matroskaenc.c applies divisors to the display width/height when generating
stereo content. This patch adds the corresponding multipliers to matroskadec.c
so that the original sample aspect ratio can be recovered.

Signed-off-by: wm4 

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

 libavformat/matroskadec.c |   34 --
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 424d7bf..f05ddd6 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1648,6 +1648,30 @@ static int matroska_parse_flac(AVFormatContext *s,
 return 0;
 }
 
+static void mkv_stereo_mode_display_mul(int stereo_mode, int *h_width, int 
*h_height)
+{
+switch (stereo_mode) {
+case MATROSKA_VIDEO_STEREOMODE_TYPE_MONO:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR:
+break;
+case MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR:
+*h_width = 2;
+break;
+case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL:
+case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR:
+*h_height = 2;
+break;
+}
+}
+
 static int matroska_parse_tracks(AVFormatContext *s)
 {
 MatroskaDemuxContext *matroska = s->priv_data;
@@ -2007,6 +2031,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
 
 if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
 MatroskaTrackPlane *planes = track->operation.combine_planes.elem;
+int display_width_mul = 1;
+int display_height_mul = 1;
 
 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codec->codec_tag  = fourcc;
@@ -2014,10 +2040,14 @@ static int matroska_parse_tracks(AVFormatContext *s)
 st->codec->bits_per_coded_sample = bit_depth;
 st->codec->width  = track->video.pixel_width;
 st->codec->height = track->video.pixel_height;
+
+if (track->video.stereo_mode && track->video.stereo_mode < 
MATROSKA_VIDEO_STEREOMODE_TYPE_NB)
+mkv_stereo_mode_display_mul(track->video.stereo_mode, 
&display_width_mul, &display_height_mul);
+
 av_reduce(&st->sample_aspect_ratio.num,
   &st->sample_aspect_ratio.den,
-  st->codec->height * track->video.display_width,
-  st->codec->width  * track->video.display_height,
+  st->codec->height * track->video.display_width * 
display_width_mul,
+  st->codec->width  * track->video.display_height * 
display_height_mul,
   255);
 if (st->codec->codec_id != AV_CODEC_ID_HEVC)
 st->need_parsing = AVSTREAM_PARSE_HEADERS;

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


[FFmpeg-cvslog] AAC encoder: improve SF range utilization

2015-12-02 Thread Claudio Freire
ffmpeg | branch: master | Claudio Freire  | Tue Dec  1 
03:28:36 2015 -0300| [ca203e9985cd2dcf42a0c0853940850d3a8edf3a] | committer: 
Claudio Freire

AAC encoder: improve SF range utilization

This patch does 4 things, all of which interact and thus it
woudln't be possible to commit them separately without causing
either quality regressions or assertion failures.

Fate comparison targets don't all reflect improvements in
quality, yet listening tests show substantially improved quality
and stability.

1. Increase SF range utilization.

The spec requires SF delta values to be constrained within the
range -60..60. The previous code was applying that range to
the whole SF array and not only the deltas of consecutive values,
because doing so requires smarter code: zeroing or otherwise
skipping a band may invalidate lots of SF choices.

This patch implements that logic to allow the coders to utilize
the full dynamic range of scalefactors, increasing quality quite
considerably, and fixing delta-SF-related assertion failures,
since now the limitation is enforced rather than asserted.

2. PNS tweaks

The previous modification makes big improvements in twoloop's
efficiency, and every time that happens PNS logic needs to be
tweaked accordingly to avoid it from stepping all over twoloop's
decisions. This patch includes modifications of the sort.

3. Account for lowpass cutoff during PSY analysis

The closer PSY's allocation is to final allocation the better
the quality is, and given these modifications, twoloop is now
very efficient at avoiding holes. Thus, to compute accurate
thresholds, PSY needs to account for the lowpass applied
implicitly during twoloop (by zeroing high bands).

This patch makes twoloop set the cutoff in psymodel's context
the first time it runs, and makes PSY account for it during
threshold computation, making PE and threshold computations
closer to the final allocation and thus achieving better
subjective quality.

4. Tweaks to RC lambda tracking loop in relation to PNS

Without this tweak some corner cases cause quality regressions.
Basically, lambda needs to react faster to overall bitrate
efficiency changes since now PNS can be quite successful in
enforcing maximum bitrates, when PSY allocates too many bits
to the lower bands, suppressing the signals RC logic uses to
lower lambda in those cases and causing aggressive PNS.

This tweak makes PNS much less aggressive, though it can still
use some further tweaks.

Also update MIPS specializations and adjust fuzz

Also in lavc/mips/aacpsy_mips.h: remove trailing whitespace

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

 libavcodec/aaccoder.c   |   60 +-
 libavcodec/aaccoder_twoloop.h   |  136 +--
 libavcodec/aacenc.c |2 +-
 libavcodec/aacenc_is.c  |   11 ++-
 libavcodec/aacenc_utils.h   |   63 ++
 libavcodec/aacpsy.c |   20 +++--
 libavcodec/mips/aaccoder_mips.c |  172 ++-
 libavcodec/mips/aacpsy_mips.h   |   78 +-
 libavcodec/psymodel.c   |1 +
 libavcodec/psymodel.h   |1 +
 tests/fate/aac.mak  |   26 +++---
 11 files changed, 393 insertions(+), 177 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 2a66045..2a0cb1f 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -54,7 +54,7 @@
 
 /* Parameter of f(x) = a*(lambda/100), defines the maximum fourier spread
  * beyond which no PNS is used (since the SFBs contain tone rather than noise) 
*/
-#define NOISE_SPREAD_THRESHOLD 0.5073f
+#define NOISE_SPREAD_THRESHOLD 0.9f
 
 /* Parameter of f(x) = a*(100/lambda), defines how much PNS is allowed to
  * replace low energy non zero bands */
@@ -591,6 +591,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext 
*avctx, SingleChanne
 int bandwidth, cutoff;
 float *PNS = &s->scoefs[0*128], *PNS34 = &s->scoefs[1*128];
 float *NOR34 = &s->scoefs[3*128];
+uint8_t nextband[128];
 const float lambda = s->lambda;
 const float freq_mult = avctx->sample_rate*0.5f/wlen;
 const float thr_mult = NOISE_LAMBDA_REPLACE*(100.0f/lambda);
@@ -604,6 +605,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext 
*avctx, SingleChanne
 
 /** Keep this in sync with twoloop's cutoff selection */
 float rate_bandwidth_multiplier = 1.5f;
+int prev = -1000, prev_sf = -1;
 int frame_bit_rate = (avctx->flags & CODEC_FLAG_QSCALE)
 ? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
 : (avctx->bit_rate / avctx->channels);
@@ -619,6 +621,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext 
*avctx, SingleChanne
 cutoff = bandwidth * 2 * wlen / avctx->sample_rate;
 
 memcpy(sce->band_alt, sce->band_type, sizeof(sce->band_type));
+ff_init_nextband_map(sce, nextband);
 for (w = 0; w < sce

[FFmpeg-cvslog] avcodec/ffv1dec: Print an error if the quant table count is invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Thu Nov  5 01:25:50 2015 +0100| [183f5805944251f6856e26b6ceec10ca3072ff00] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer 
(cherry picked from commit a8b254e436dce2f5c8c6459108dab4b02cc6b79b)

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

 libavcodec/ffv1dec.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 27a92d9..c0894be 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -568,8 +568,10 @@ static int read_extra_header(FFV1Context *f)
 }
 
 f->quant_table_count = get_symbol(c, state, 0);
-if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count)
+if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
+av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
 return AVERROR_INVALIDDATA;
+}
 
 for (i = 0; i < f->quant_table_count; i++) {
 f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);

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


[FFmpeg-cvslog] avcodec/ffv1dec: Clear quant_table_count if its invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.6 | Michael Niedermayer  | 
Sat Nov 14 13:21:58 2015 +0100| [a1b8fa1d9add6014c89da4321ddea8f3694a30c1] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Clear quant_table_count if its invalid

Fixes deallocation of corrupted pointer
Fixes: 
343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi
No releases affected

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e04126072e984f8db5db9da9303c89ae01f7d6bb)

Fixes ticket #5052.

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

 libavcodec/ffv1dec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 9d25f6e..7be3027 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -569,6 +569,7 @@ static int read_extra_header(FFV1Context *f)
 f->quant_table_count = get_symbol(c, state, 0);
 if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
 av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
+f->quant_table_count = 0;
 return AVERROR_INVALIDDATA;
 }
 

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


[FFmpeg-cvslog] avcodec/ffv1dec: Clear quant_table_count if its invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Nov 14 13:21:58 2015 +0100| [ff3e717003efe3a3f06aa0371be5d40826fa0f03] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Clear quant_table_count if its invalid

Fixes deallocation of corrupted pointer
Fixes: 
343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi
No releases affected

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e04126072e984f8db5db9da9303c89ae01f7d6bb)

Fixes ticket #5052.

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

 libavcodec/ffv1dec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 1f7bfbd..9c941fa 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -571,6 +571,7 @@ static int read_extra_header(FFV1Context *f)
 f->quant_table_count = get_symbol(c, state, 0);
 if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
 av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
+f->quant_table_count = 0;
 return AVERROR_INVALIDDATA;
 }
 

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


[FFmpeg-cvslog] avcodec/ffv1dec: Print an error if the quant table count is invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.6 | Michael Niedermayer  | 
Thu Nov  5 01:25:50 2015 +0100| [df660d685435df61524e06c83b58e8e6b5f1851e] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer 
(cherry picked from commit a8b254e436dce2f5c8c6459108dab4b02cc6b79b)

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

 libavcodec/ffv1dec.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index b920be5..9d25f6e 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -567,8 +567,10 @@ static int read_extra_header(FFV1Context *f)
 }
 
 f->quant_table_count = get_symbol(c, state, 0);
-if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count)
+if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
+av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
 return AVERROR_INVALIDDATA;
+}
 
 for (i = 0; i < f->quant_table_count; i++) {
 f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);

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


[FFmpeg-cvslog] avcodec/ffv1dec: Print an error if the quant table count is invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer  | 
Thu Nov  5 01:25:50 2015 +0100| [b622d6f6f65d778ed3011482686ce6d4df9f7450] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer 
(cherry picked from commit a8b254e436dce2f5c8c6459108dab4b02cc6b79b)

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

 libavcodec/ffv1dec.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d8f535a..abd7bf8 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -567,8 +567,10 @@ static int read_extra_header(FFV1Context *f)
 }
 
 f->quant_table_count = get_symbol(c, state, 0);
-if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count)
+if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
+av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
 return AVERROR_INVALIDDATA;
+}
 
 for (i = 0; i < f->quant_table_count; i++) {
 f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);

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


[FFmpeg-cvslog] avcodec/ffv1dec: Clear quant_table_count if its invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer  | 
Sat Nov 14 13:21:58 2015 +0100| [fa3df7ae415be860377d52e13202c8a0f7bf7316] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Clear quant_table_count if its invalid

Fixes deallocation of corrupted pointer
Fixes: 
343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi
No releases affected

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e04126072e984f8db5db9da9303c89ae01f7d6bb)

Fixes ticket #5052.

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

 libavcodec/ffv1dec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index abd7bf8..ebcb2b0 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -569,6 +569,7 @@ static int read_extra_header(FFV1Context *f)
 f->quant_table_count = get_symbol(c, state, 0);
 if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
 av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
+f->quant_table_count = 0;
 return AVERROR_INVALIDDATA;
 }
 

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


[FFmpeg-cvslog] avcodec/ffv1dec: Print an error if the quant table count is invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Thu Nov  5 01:25:50 2015 +0100| [1c6243228c343132e094cdab1cb048e20899806c] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Print an error if the quant table count is invalid

Signed-off-by: Michael Niedermayer 
(cherry picked from commit a8b254e436dce2f5c8c6459108dab4b02cc6b79b)

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

 libavcodec/ffv1dec.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 680abcf..1f7bfbd 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -569,8 +569,10 @@ static int read_extra_header(FFV1Context *f)
 }
 
 f->quant_table_count = get_symbol(c, state, 0);
-if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count)
+if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
+av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
 return AVERROR_INVALIDDATA;
+}
 
 for (i = 0; i < f->quant_table_count; i++) {
 f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);

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


[FFmpeg-cvslog] avcodec/ffv1dec: Clear quant_table_count if its invalid

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Nov 14 13:21:58 2015 +0100| [e6264f00addca8bd4efed7329aa1faf5fa13b70b] | 
committer: Carl Eugen Hoyos

avcodec/ffv1dec: Clear quant_table_count if its invalid

Fixes deallocation of corrupted pointer
Fixes: 
343dfbe142a38b521ed069dc4ea7c03b/signal_sigsegv_421427_4074_ffb11959610278cd40dbc153464aa254.avi
No releases affected

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e04126072e984f8db5db9da9303c89ae01f7d6bb)

Fixes ticket #5052.

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

 libavcodec/ffv1dec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index c0894be..ea3b8d2 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -570,6 +570,7 @@ static int read_extra_header(FFV1Context *f)
 f->quant_table_count = get_symbol(c, state, 0);
 if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || 
!f->quant_table_count) {
 av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", 
f->quant_table_count);
+f->quant_table_count = 0;
 return AVERROR_INVALIDDATA;
 }
 

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


[FFmpeg-cvslog] avfilter: add audio pulsator filter

2015-12-02 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Nov 28 19:50:32 
2015 +0100| [c4f7b8f0db6e867f41f9c7a0e2d53301022a2aa4] | committer: Paul B Mahol

avfilter: add audio pulsator filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |1 +
 doc/filters.texi   |   57 ++
 libavfilter/Makefile   |1 +
 libavfilter/af_apulsator.c |  254 
 libavfilter/allfilters.c   |1 +
 libavfilter/version.h  |2 +-
 6 files changed, 315 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 98927cc..69d5688 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version :
 - compensationdelay filter
 - acompressor filter
 - support encoding 16-bit RLE SGI images
+- apulsator filter
 
 
 version 2.8:
diff --git a/doc/filters.texi b/doc/filters.texi
index b3ab84a..9f72237 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1030,6 +1030,63 @@ It accepts the following values:
 @end table
 @end table
 
+@section apulsator
+
+Audio pulsator is something between an autopanner and a tremolo.
+But it can produce funny stereo effects as well. Pulsator changes the volume
+of the left and right channel based on a LFO (low frequency oscillator) with
+different waveforms and shifted phases.
+This filter have the ability to define an offset between left and right
+channel. An offset of 0 means that both LFO shapes match each other.
+The left and right channel are altered equally - a conventional tremolo.
+An offset of 50% means that the shape of the right channel is exactly shifted
+in phase (or moved backwards about half of the frequency) - pulsator acts as
+an autopanner. At 1 both curves match again. Every setting in between moves the
+phase shift gapless between all stages and produces some "bypassing" sounds 
with
+sine and triangle waveforms. The more you set the offset near 1 (starting from
+the 0.5) the faster the signal passes from the left to the right speaker.
+
+The filter accepts the following options:
+
+@table @option
+@item level_in
+Set input gain. By default it is 1. Range is [0.015625 - 64].
+
+@item level_out
+Set output gain. By default it is 1. Range is [0.015625 - 64].
+
+@item mode
+Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
+sawup or sawdown. Default is sine.
+
+@item amount
+Set modulation. Define how much of original signal is affected by the LFO.
+
+@item offset_l
+Set left channel offset. Default is 0. Allowed range is [0 - 1].
+
+@item offset_r
+Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
+
+@item width
+Set pulse width. Default is 1. Allowed range is [0 - 2].
+
+@item timing
+Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
+
+@item bpm
+Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
+is set to bpm.
+
+@item ms
+Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
+is set to ms.
+
+@item hz
+Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
+if timing is set to hz.
+@end table
+
 @anchor{aresample}
 @section aresample
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index e31bdaa..b6c0d7b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -40,6 +40,7 @@ OBJS-$(CONFIG_ANULL_FILTER)  += af_anull.o
 OBJS-$(CONFIG_APAD_FILTER)   += af_apad.o
 OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o
 OBJS-$(CONFIG_APHASER_FILTER)+= af_aphaser.o 
generate_wave_table.o
+OBJS-$(CONFIG_APULSATOR_FILTER)  += af_apulsator.o
 OBJS-$(CONFIG_AREALTIME_FILTER)  += f_realtime.o
 OBJS-$(CONFIG_ARESAMPLE_FILTER)  += af_aresample.o
 OBJS-$(CONFIG_AREVERSE_FILTER)   += f_reverse.o
diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c
new file mode 100644
index 000..6c81530
--- /dev/null
+++ b/libavfilter/af_apulsator.c
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald 
Johansen and others
+ *
+ * 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/opt.h"
+#

[FFmpeg-cvslog] avfilter/af_stereotools: remove floor usage

2015-12-02 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Dec  2 12:05:04 
2015 +0100| [6670527d33bb6b76f779440222b2ac6459fa466f] | committer: Paul B Mahol

avfilter/af_stereotools: remove floor usage

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_stereotools.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index a22efb0..3c796f5 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -139,10 +139,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 const double sc_level = s->sc_level;
 const double delay = s->delay;
 const int length = s->length;
-const int mute_l = floor(s->mute_l + 0.5);
-const int mute_r = floor(s->mute_r + 0.5);
-const int phase_l = floor(s->phase_l + 0.5);
-const int phase_r = floor(s->phase_r + 0.5);
+const int mute_l = s->mute_l;
+const int mute_r = s->mute_r;
+const int phase_l = s->phase_l;
+const int phase_r = s->phase_r;
 double *buffer = s->buffer;
 AVFrame *out;
 double *dst;

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


[FFmpeg-cvslog] lavf/rtpenc_jpeg: Less strict check for standard Huffman tables.

2015-12-02 Thread Carl Eugen Hoyos
ffmpeg | branch: release/2.8 | Carl Eugen Hoyos  | Wed Dec  2 
14:56:53 2015 +0100| [aa3101a9e825dc8b57624f3b9d07844c34c7c9a7] | committer: 
Carl Eugen Hoyos

lavf/rtpenc_jpeg: Less strict check for standard Huffman tables.

There can be one or more Huffman table segments DHT.

Reported-by: Andrey Utkin

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

 libavformat/rtpenc_jpeg.c |   83 +++--
 1 file changed, 66 insertions(+), 17 deletions(-)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index a6f2b32..60629cf 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -36,6 +36,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 int off = 0; /* fragment offset of the current JPEG frame */
 int len;
 int i;
+int default_huffman_tables = 0;
 
 s->buf_ptr   = s->buf;
 s->timestamp = s->cur_timestamp;
@@ -90,23 +91,66 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 return;
 }
 } else if (buf[i + 1] == DHT) {
-if (   AV_RB16(&buf[i + 2]) < 418
-|| i + 420 >= size
-|| buf[i +   4] != 0x00
-|| buf[i +  33] != 0x01
-|| buf[i +  62] != 0x10
-|| buf[i + 241] != 0x11
-|| memcmp(buf + i +   5, avpriv_mjpeg_bits_dc_luminance   + 1, 
16)
-|| memcmp(buf + i +  21, avpriv_mjpeg_val_dc, 12)
-|| memcmp(buf + i +  34, avpriv_mjpeg_bits_dc_chrominance + 1, 
16)
-|| memcmp(buf + i +  50, avpriv_mjpeg_val_dc, 12)
-|| memcmp(buf + i +  63, avpriv_mjpeg_bits_ac_luminance   + 1, 
16)
-|| memcmp(buf + i +  79, avpriv_mjpeg_val_ac_luminance, 162)
-|| memcmp(buf + i + 242, avpriv_mjpeg_bits_ac_chrominance + 1, 
16)
-|| memcmp(buf + i + 258, avpriv_mjpeg_val_ac_chrominance, 
162)) {
-av_log(s1, AV_LOG_ERROR,
-   "RFC 2435 requires standard Huffman tables for jpeg\n");
-return;
+int dht_size = AV_RB16(&buf[i + 2]);
+default_huffman_tables |= 1 << 4;
+i += 3;
+dht_size -= 2;
+if (i + dht_size >= size)
+continue;
+while (dht_size > 0)
+switch (buf[i + 1]) {
+case 0x00:
+if (   dht_size >= 29
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_dc_luminance + 1, 16)
+&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+default_huffman_tables |= 1;
+i += 29;
+dht_size -= 29;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x01:
+if (   dht_size >= 29
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_dc_chrominance + 1, 16)
+&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+default_huffman_tables |= 1 << 1;
+i += 29;
+dht_size -= 29;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x10:
+if (   dht_size >= 179
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_ac_luminance   + 1, 16)
+&& !memcmp(buf + i + 18, 
avpriv_mjpeg_val_ac_luminance, 162)) {
+default_huffman_tables |= 1 << 2;
+i += 179;
+dht_size -= 179;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x11:
+if (   dht_size >= 179
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_ac_chrominance + 1, 16)
+&& !memcmp(buf + i + 18, 
avpriv_mjpeg_val_ac_chrominance, 162)) {
+default_huffman_tables |= 1 << 3;
+i += 179;
+dht_size -= 179;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+default:
+i += dht_size;
+dht_size = 0;
+continue;
 }
 } else if (buf[i + 1] == SOS) {
 /* SOS is last marker in the header */
@@ -119,6 +163,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 b

[FFmpeg-cvslog] lavf/rtpenc_jpeg: Less strict check for standard Huffman tables.

2015-12-02 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Wed Dec  2 
14:56:53 2015 +0100| [d208acf2c82b260e90be6215c93809f3343760f0] | committer: 
Carl Eugen Hoyos

lavf/rtpenc_jpeg: Less strict check for standard Huffman tables.

There can be one or more Huffman table segments DHT.

Reported-by: Andrey Utkin

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

 libavformat/rtpenc_jpeg.c |   83 +++--
 1 file changed, 66 insertions(+), 17 deletions(-)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index a6f2b32..60629cf 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -36,6 +36,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 int off = 0; /* fragment offset of the current JPEG frame */
 int len;
 int i;
+int default_huffman_tables = 0;
 
 s->buf_ptr   = s->buf;
 s->timestamp = s->cur_timestamp;
@@ -90,23 +91,66 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 return;
 }
 } else if (buf[i + 1] == DHT) {
-if (   AV_RB16(&buf[i + 2]) < 418
-|| i + 420 >= size
-|| buf[i +   4] != 0x00
-|| buf[i +  33] != 0x01
-|| buf[i +  62] != 0x10
-|| buf[i + 241] != 0x11
-|| memcmp(buf + i +   5, avpriv_mjpeg_bits_dc_luminance   + 1, 
16)
-|| memcmp(buf + i +  21, avpriv_mjpeg_val_dc, 12)
-|| memcmp(buf + i +  34, avpriv_mjpeg_bits_dc_chrominance + 1, 
16)
-|| memcmp(buf + i +  50, avpriv_mjpeg_val_dc, 12)
-|| memcmp(buf + i +  63, avpriv_mjpeg_bits_ac_luminance   + 1, 
16)
-|| memcmp(buf + i +  79, avpriv_mjpeg_val_ac_luminance, 162)
-|| memcmp(buf + i + 242, avpriv_mjpeg_bits_ac_chrominance + 1, 
16)
-|| memcmp(buf + i + 258, avpriv_mjpeg_val_ac_chrominance, 
162)) {
-av_log(s1, AV_LOG_ERROR,
-   "RFC 2435 requires standard Huffman tables for jpeg\n");
-return;
+int dht_size = AV_RB16(&buf[i + 2]);
+default_huffman_tables |= 1 << 4;
+i += 3;
+dht_size -= 2;
+if (i + dht_size >= size)
+continue;
+while (dht_size > 0)
+switch (buf[i + 1]) {
+case 0x00:
+if (   dht_size >= 29
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_dc_luminance + 1, 16)
+&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+default_huffman_tables |= 1;
+i += 29;
+dht_size -= 29;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x01:
+if (   dht_size >= 29
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_dc_chrominance + 1, 16)
+&& !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+default_huffman_tables |= 1 << 1;
+i += 29;
+dht_size -= 29;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x10:
+if (   dht_size >= 179
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_ac_luminance   + 1, 16)
+&& !memcmp(buf + i + 18, 
avpriv_mjpeg_val_ac_luminance, 162)) {
+default_huffman_tables |= 1 << 2;
+i += 179;
+dht_size -= 179;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+case 0x11:
+if (   dht_size >= 179
+&& !memcmp(buf + i +  2, 
avpriv_mjpeg_bits_ac_chrominance + 1, 16)
+&& !memcmp(buf + i + 18, 
avpriv_mjpeg_val_ac_chrominance, 162)) {
+default_huffman_tables |= 1 << 3;
+i += 179;
+dht_size -= 179;
+} else {
+i += dht_size;
+dht_size = 0;
+}
+break;
+default:
+i += dht_size;
+dht_size = 0;
+continue;
 }
 } else if (buf[i + 1] == SOS) {
 /* SOS is last marker in the header */
@@ -119,6 +163,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 break;

[FFmpeg-cvslog] [ffmpeg-web] branch master updated. d391a05 web/download: remove architecture lists

2015-12-02 Thread ffmpeg-cvslog
The branch, master has been updated
   via  d391a05edc5b8b8ea9f3bfb53ecfb8f32c7466f3 (commit)
  from  8bae71d86e245304e7e1e2543361632bc7a7bdad (commit)


- Log -
commit d391a05edc5b8b8ea9f3bfb53ecfb8f32c7466f3
Author: Andreas Cadhalpun 
AuthorDate: Wed Nov 25 00:34:26 2015 +0100
Commit: Andreas Cadhalpun 
CommitDate: Wed Dec 2 18:30:48 2015 +0100

web/download: remove architecture lists

They are not very helpful and feel out-of-place.

Suggested-by: Timothy Gu 
Reviewed-by: Timothy Gu 
Signed-off-by: Andreas Cadhalpun 

diff --git a/src/download b/src/download
index 85bbd51..fde54ca 100644
--- a/src/download
+++ b/src/download
@@ -55,23 +55,19 @@
 
   https://tracker.debian.org/pkg/ffmpeg";>
 Debian – Official packages for 
Stable-Backports, Testing, Unstable
-(amd64, arm64, armel, armhf, i386, kfreebsd-amd64, 
kfreebsd-i386, mips, mipsel, powerpc, ppc64el, s390x)
   
   http://www.deb-multimedia.org/";>
 Debian – deb-multimedia packages for 
Oldstable, Stable, Testing, Unstable
-(amd64, armel, armhf, i386, ia64, kfreebsd-amd64, 
kfreebsd-i386, mips, mipsel, powerpc, sparc)
   
   https://launchpad.net/ubuntu/+source/ffmpeg"; 
class="list-group-item">
 Ubuntu – Official packages for Vivid, Wily, 
Xenial
-(amd64, arm64, armhf, i386, powerpc, ppc64el)
   
   https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media"; 
class="list-group-item">
 Ubuntu – Ubuntu Multimedia for Trusty PPA. 
Provides static binaries
 from most recent release branch.
-(amd64, i386)
   
   http://rpmfusion.org/";>
-Fedora and Red Hat Enterprise 
Linux packages (i386, x86_64)
+Fedora and Red Hat Enterprise 
Linux packages
   
  
 

---

Summary of changes:
 src/download | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)


hooks/post-receive
-- 

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


[FFmpeg-cvslog] Makefile: add cleanup of pkg-config files created by configure to distclean

2015-12-02 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Wed Nov 25 
11:47:14 2015 +0100| [bc517be6b0fb276997e431ae7708b2d1681d1aff] | committer: 
Andreas Cadhalpun

Makefile: add cleanup of pkg-config files created by configure to distclean

Signed-off-by: Andreas Cadhalpun 

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

 Makefile |1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 306f060..58f1a3a 100644
--- a/Makefile
+++ b/Makefile
@@ -181,6 +181,7 @@ clean::
 distclean::
$(RM) $(DISTCLEANSUFFIXES)
$(RM) config.* .config libavutil/avconfig.h .version avversion.h 
version.h libavutil/ffversion.h libavcodec/codec_names.h
+   $(RM) -rf doc/examples/pc-uninstalled
 
 config:
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)

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


[FFmpeg-cvslog] git-howto: mention how to clone ffmpeg-web

2015-12-02 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Wed Nov 25 00:52:39 2015 +0100| [fb1bf4454e6e8d70c001969c0e423399235d3224] | 
committer: Andreas Cadhalpun

git-howto: mention how to clone ffmpeg-web

Signed-off-by: Andreas Cadhalpun 

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

 doc/git-howto.texi |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/doc/git-howto.texi b/doc/git-howto.texi
index bf37bcc..e5e3c81 100644
--- a/doc/git-howto.texi
+++ b/doc/git-howto.texi
@@ -65,6 +65,21 @@ git clone git@@source.ffmpeg.org:ffmpeg 
 This will put the FFmpeg sources into the directory @var{} and let
 you push back your changes to the remote repository.
 
+@example
+git clone gil@@ffmpeg.org:ffmpeg-web 
+@end example
+
+This will put the source of the FFmpeg website into the directory
+@var{} and let you push back your changes to the remote repository.
+(Note that @var{gil} stands for GItoLite and is not a typo of @var{git}.)
+
+If you don't have write-access to the ffmpeg-web repository, you can
+create patches after making a read-only ffmpeg-web clone:
+
+@example
+git clone git://ffmpeg.org/ffmpeg-web 
+@end example
+
 Make sure that you do not have Windows line endings in your checkouts,
 otherwise you may experience spurious compilation failures. One way to
 achieve this is to run

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


[FFmpeg-cvslog] vp9: always keep s->bytesperpixel and ctx->pix_fmt in sync.

2015-12-02 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Tue Dec  1 
12:24:05 2015 -0500| [1ac89869db05c283235045477f690f1a00852691] | committer: 
Ronald S. Bultje

vp9: always keep s->bytesperpixel and ctx->pix_fmt in sync.

Fixes mozilla bug 1229128.

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

 libavcodec/vp9.c |   43 ++-
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index d4061e2..dc0 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -69,6 +69,7 @@ typedef struct VP9Context {
 uint8_t ss_h, ss_v;
 uint8_t last_bpp, bpp, bpp_index, bytesperpixel;
 uint8_t last_keyframe;
+enum AVPixelFormat pix_fmt, last_fmt;
 ThreadFrame next_refs[8];
 
 struct {
@@ -211,7 +212,7 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
*dst, VP9Frame *src)
 return 0;
 }
 
-static int update_size(AVCodecContext *ctx, int w, int h, enum AVPixelFormat 
fmt)
+static int update_size(AVCodecContext *ctx, int w, int h)
 {
 VP9Context *s = ctx->priv_data;
 uint8_t *p;
@@ -219,12 +220,12 @@ static int update_size(AVCodecContext *ctx, int w, int h, 
enum AVPixelFormat fmt
 
 av_assert0(w > 0 && h > 0);
 
-if (s->intra_pred_data[0] && w == ctx->width && h == ctx->height && 
ctx->pix_fmt == fmt)
+if (s->intra_pred_data[0] && w == ctx->width && h == ctx->height && 
s->pix_fmt == s->last_fmt)
 return 0;
 
 if ((res = ff_set_dimensions(ctx, w, h)) < 0)
 return res;
-ctx->pix_fmt = fmt;
+s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
 s->sb_cols   = (w + 63) >> 6;
 s->sb_rows   = (h + 63) >> 6;
 s->cols  = (w + 7) >> 3;
@@ -383,14 +384,13 @@ static int update_prob(VP56RangeCoder *c, int p)
 255 - inv_recenter_nonneg(inv_map_table[d], 255 - p);
 }
 
-static enum AVPixelFormat read_colorspace_details(AVCodecContext *ctx)
+static int read_colorspace_details(AVCodecContext *ctx)
 {
 static const enum AVColorSpace colorspaces[8] = {
 AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, 
AVCOL_SPC_SMPTE170M,
 AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, 
AVCOL_SPC_RGB,
 };
 VP9Context *s = ctx->priv_data;
-enum AVPixelFormat res;
 int bits = ctx->profile <= 1 ? 0 : 1 + get_bits1(&s->gb); // 0:8, 1:10, 
2:12
 
 s->bpp_index = bits;
@@ -401,10 +401,10 @@ static enum AVPixelFormat 
read_colorspace_details(AVCodecContext *ctx)
 static const enum AVPixelFormat pix_fmt_rgb[3] = {
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12
 };
+s->ss_h = s->ss_v = 0;
+ctx->color_range = AVCOL_RANGE_JPEG;
+s->pix_fmt = pix_fmt_rgb[bits];
 if (ctx->profile & 1) {
-s->ss_h = s->ss_v = 0;
-res = pix_fmt_rgb[bits];
-ctx->color_range = AVCOL_RANGE_JPEG;
 if (get_bits1(&s->gb)) {
 av_log(ctx, AV_LOG_ERROR, "Reserved bit set in RGB\n");
 return AVERROR_INVALIDDATA;
@@ -427,7 +427,8 @@ static enum AVPixelFormat 
read_colorspace_details(AVCodecContext *ctx)
 if (ctx->profile & 1) {
 s->ss_h = get_bits1(&s->gb);
 s->ss_v = get_bits1(&s->gb);
-if ((res = pix_fmt_for_ss[bits][s->ss_v][s->ss_h]) == 
AV_PIX_FMT_YUV420P) {
+s->pix_fmt = pix_fmt_for_ss[bits][s->ss_v][s->ss_h];
+if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
 av_log(ctx, AV_LOG_ERROR, "YUV 4:2:0 not supported in profile 
%d\n",
ctx->profile);
 return AVERROR_INVALIDDATA;
@@ -438,11 +439,11 @@ static enum AVPixelFormat 
read_colorspace_details(AVCodecContext *ctx)
 }
 } else {
 s->ss_h = s->ss_v = 1;
-res = pix_fmt_for_ss[bits][1][1];
+s->pix_fmt = pix_fmt_for_ss[bits][1][1];
 }
 }
 
-return res;
+return 0;
 }
 
 static int decode_frame_header(AVCodecContext *ctx,
@@ -450,7 +451,6 @@ static int decode_frame_header(AVCodecContext *ctx,
 {
 VP9Context *s = ctx->priv_data;
 int c, i, j, k, l, m, n, w, h, max, size2, res, sharp;
-enum AVPixelFormat fmt = ctx->pix_fmt;
 int last_invisible;
 const uint8_t *data2;
 
@@ -486,8 +486,8 @@ static int decode_frame_header(AVCodecContext *ctx,
 av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
 return AVERROR_INVALIDDATA;
 }
-if ((fmt = read_colorspace_details(ctx)) < 0)
-return fmt;
+if ((res = read_colorspace_details(ctx)) < 0)
+return res;
 // for profile 1, here follows the subsampling bits
 s->s.h.refreshrefmask = 0xff;
 w = get_bits(&s->gb, 16) + 1;
@@ -503,14 +503,14 @@ static int decode_frame_header(AVCodecContext *ctx,
 return AVERROR_INVALIDDATA;
 }
 if (ct

[FFmpeg-cvslog] avutil/mathematics: return INT64_MIN (=AV_NOPTS_VALUE) from av_rescale_rnd () for overflows

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Dec  1 13:32:31 2015 +0100| [f03c2ceec174877e03bb302f5971fbe9ffbe4856] | 
committer: Michael Niedermayer

avutil/mathematics: return INT64_MIN (=AV_NOPTS_VALUE) from av_rescale_rnd() 
for overflows

Fixes integer overflow
Fixes: mozilla bug 1229167

Found-by: Tyson Smith
Signed-off-by: Michael Niedermayer 

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

 libavutil/mathematics.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 689325f..c12c73e 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -72,7 +72,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum 
AVRounding rnd)
 }
 
 if (a < 0)
-return -av_rescale_rnd(-FFMAX(a, -INT64_MAX), b, c, rnd ^ ((rnd >> 1) 
& 1));
+return -(uint64_t)av_rescale_rnd(-FFMAX(a, -INT64_MAX), b, c, rnd ^ 
((rnd >> 1) & 1));
 
 if (rnd == AV_ROUND_NEAR_INF)
 r = c / 2;
@@ -82,8 +82,13 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum 
AVRounding rnd)
 if (b <= INT_MAX && c <= INT_MAX) {
 if (a <= INT_MAX)
 return (a * b + r) / c;
-else
-return a / c * b + (a % c * b + r) / c;
+else {
+int64_t ad = a / c;
+int64_t a2 = (a % c * b + r) / c;
+if (ad >= INT32_MAX && ad > (INT64_MAX - a2) / b)
+return INT64_MIN;
+return ad * b + a2;
+}
 } else {
 #if 1
 uint64_t a0  = a & 0x;
@@ -107,6 +112,8 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, 
enum AVRounding rnd)
 t1++;
 }
 }
+if (t1 > INT64_MAX)
+return INT64_MIN;
 return t1;
 }
 #else

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


[FFmpeg-cvslog] avcodec/apedec: Check length in long_filter_high_3800()

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Dec  2 21:16:27 2015 +0100| [cd7524fdd13dc8d0cf22e2cfd8300a245542b13a] | 
committer: Michael Niedermayer

avcodec/apedec: Check length in long_filter_high_3800()

Fixes out of array read
Fixes: 
0a7ff0c1d93da9cef28a315ec91b692a/asan_heap-oob_4a52e5_3604_9c56dbb20e308f4faeef7b35f688521a.ape

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/apedec.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index fcccfbe..a528e60 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -892,6 +892,9 @@ static void long_filter_high_3800(int32_t *buffer, int 
order, int shift, int len
 int32_t dotprod, sign;
 int32_t coeffs[256], delay[256];
 
+if (order >= length)
+return;
+
 memset(coeffs, 0, order * sizeof(*coeffs));
 for (i = 0; i < order; i++)
 delay[i] = buffer[i];

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


[FFmpeg-cvslog] avutil/rational: Test av_rescale_rnd() with combinations of "special" values

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Dec  1 13:34:19 2015 +0100| [97b8db334a63e89a0571b625595024872e40307c] | 
committer: Michael Niedermayer

avutil/rational: Test av_rescale_rnd() with combinations of "special" values

Signed-off-by: Michael Niedermayer 

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

 libavutil/Makefile   |1 +
 libavutil/rational.c |   44 
 2 files changed, 45 insertions(+)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 1bac2b9..b43cede 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -106,6 +106,7 @@ OBJS = adler32.o
\
hash.o   \
hmac.o   \
imgutils.o   \
+   integer.o\
intmath.o\
lfg.o\
lls.o\
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 81a9402..6b3f50a 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -183,9 +183,18 @@ uint32_t av_q2intfloat(AVRational q) {
 }
 
 #ifdef TEST
+
+#include "integer.h"
+
 int main(void)
 {
 AVRational a,b,r;
+int i,j,k;
+static const int64_t numlist[] = {
+INT64_MIN, INT64_MIN+1, INT64_MAX, INT32_MIN, INT32_MAX, 1,0,-1,
+123456789, INT32_MAX-1, INT32_MAX+1LL, UINT32_MAX-1, UINT32_MAX, 
UINT32_MAX+1LL
+};
+
 for (a.num = -2; a.num <= 2; a.num++) {
 for (a.den = -2; a.den <= 2; a.den++) {
 for (b.num = -2; b.num <= 2; b.num++) {
@@ -207,6 +216,41 @@ int main(void)
 }
 }
 
+for (i = 0; i < FF_ARRAY_ELEMS(numlist); i++) {
+int64_t a = numlist[i];
+
+for (j = 0; j < FF_ARRAY_ELEMS(numlist); j++) {
+int64_t b = numlist[j];
+if (b<=0)
+continue;
+for (k = 0; k < FF_ARRAY_ELEMS(numlist); k++) {
+int64_t c = numlist[k];
+int64_t res;
+AVInteger ai;
+
+if (c<=0)
+continue;
+res = av_rescale_rnd(a,b,c, AV_ROUND_ZERO);
+
+ai = av_mul_i(av_int2i(a), av_int2i(b));
+ai = av_div_i(ai, av_int2i(c));
+
+if (av_cmp_i(ai, av_int2i(INT64_MAX)) > 0 && res == INT64_MIN)
+continue;
+if (av_cmp_i(ai, av_int2i(INT64_MIN)) < 0 && res == INT64_MIN)
+continue;
+if (av_cmp_i(ai, av_int2i(res)) == 0)
+continue;
+
+// Special exception for INT64_MIN, remove this in case 
INT64_MIN is handled without off by 1 error
+if (av_cmp_i(ai, av_int2i(res-1)) == 0 && a == INT64_MIN)
+continue;
+
+av_log(NULL, AV_LOG_ERROR, "%"PRId64" * %"PRId64" / %"PRId64" 
= %"PRId64" or %"PRId64"\n", a,b,c, res, av_i2int(ai));
+}
+}
+}
+
 for (a.num = 1; a.num <= 10; a.num++) {
 for (a.den = 1; a.den <= 10; a.den++) {
 if (av_gcd(a.num, a.den) > 1)

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


[FFmpeg-cvslog] avformat/mpjpeg: allow processing of MIME parts without Content-Length header

2015-12-02 Thread Alex Agranovsky
ffmpeg | branch: master | Alex Agranovsky  | Sun Nov 29 
18:36:20 2015 -0500| [79103f21990307bb8855a03d68154e1c5d197a7c] | committer: wm4

avformat/mpjpeg: allow processing of MIME parts without Content-Length header

Fixes ticket 5023

Signed-off-by: Alex Agranovsky 

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

 libavformat/mpjpegdec.c |  168 +++
 1 file changed, 125 insertions(+), 43 deletions(-)

diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index 2749a48..9d5700a 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -23,13 +23,30 @@
 
 #include "avformat.h"
 #include "internal.h"
+#include "avio_internal.h"
 
-static int get_line(AVIOContext *pb, char *line, int line_size)
+
+
+typedef struct MPJPEGDemuxContext {
+char   *boundary;
+char   *searchstr;
+int searchstr_len;
+} MPJPEGDemuxContext;
+
+
+static void trim_right(char *p)
 {
-int i = ff_get_line(pb, line, line_size);
+if (!p || !*p)
+return;
+
+char *end = p + strlen(p);
+while (end > p && av_isspace(*(end-1)))
+*(--end) = '\0';
+}
 
-if (i > 1 && line[i - 2] == '\r')
-line[i - 2] = '\0';
+static int get_line(AVIOContext *pb, char *line, int line_size)
+{
+ff_get_line(pb, line, line_size);
 
 if (pb->error)
 return pb->error;
@@ -37,21 +54,11 @@ static int get_line(AVIOContext *pb, char *line, int 
line_size)
 if (pb->eof_reached)
 return AVERROR_EOF;
 
+trim_right(line);
 return 0;
 }
 
 
-static void trim_right(char* p)
-{
-char *end;
-if (!p || !*p)
-return;
-end = p + strlen(p) - 1;
-while (end != p && av_isspace(*end)) {
-*end = '\0';
-end--;
-}
-}
 
 static int split_tag_value(char **tag, char **value, char *line)
 {
@@ -86,12 +93,24 @@ static int split_tag_value(char **tag, char **value, char 
*line)
 return 0;
 }
 
-static int parse_multipart_header(AVIOContext *pb, void *log_ctx);
+static int parse_multipart_header(AVIOContext *pb,
+int* size,
+const char* expected_boundary,
+void *log_ctx);
+
+static int mpjpeg_read_close(AVFormatContext *s)
+{
+MPJPEGDemuxContext *mpjpeg = s->priv_data;
+av_freep(&mpjpeg->boundary);
+av_freep(&mpjpeg->searchstr);
+return 0;
+}
 
 static int mpjpeg_read_probe(AVProbeData *p)
 {
 AVIOContext *pb;
 int ret = 0;
+int size = 0;
 
 if (p->buf_size < 2 || p->buf[0] != '-' || p->buf[1] != '-')
 return 0;
@@ -100,7 +119,7 @@ static int mpjpeg_read_probe(AVProbeData *p)
 if (!pb)
 return 0;
 
-ret = (parse_multipart_header(pb, NULL)>0)?AVPROBE_SCORE_MAX:0;
+ret = (parse_multipart_header(pb, &size, "--", NULL) > 0) ? 
AVPROBE_SCORE_MAX : 0;
 
 av_free(pb);
 
@@ -110,14 +129,15 @@ static int mpjpeg_read_probe(AVProbeData *p)
 static int mpjpeg_read_header(AVFormatContext *s)
 {
 AVStream *st;
-char boundary[70 + 2 + 1];
+char boundary[70 + 2 + 1] = {0};
 int64_t pos = avio_tell(s->pb);
 int ret;
 
-
-ret = get_line(s->pb, boundary, sizeof(boundary));
-if (ret < 0)
-return ret;
+do {
+ret = get_line(s->pb, boundary, sizeof(boundary));
+if (ret < 0)
+return ret;
+} while (!boundary[0]);
 
 if (strncmp(boundary, "--", 2))
 return AVERROR_INVALIDDATA;
@@ -147,11 +167,16 @@ static int parse_content_length(const char *value)
 return val;
 }
 
-static int parse_multipart_header(AVIOContext *pb, void *log_ctx)
+static int parse_multipart_header(AVIOContext *pb,
+int* size,
+const char* expected_boundary,
+void *log_ctx)
 {
 char line[128];
 int found_content_type = 0;
-int ret, size = -1;
+int ret;
+
+*size = -1;
 
 // get the CRLF as empty string
 ret = get_line(pb, line, sizeof(line));
@@ -161,14 +186,21 @@ static int parse_multipart_header(AVIOContext *pb, void 
*log_ctx)
 /* some implementation do not provide the required
  * initial CRLF (see rfc1341 7.2.1)
  */
-if (!line[0]) {
+while (!line[0]) {
 ret = get_line(pb, line, sizeof(line));
 if (ret < 0)
 return ret;
 }
 
-if (strncmp(line, "--", 2))
+if (!av_strstart(line, expected_boundary, NULL)) {
+av_log(log_ctx,
+AV_LOG_ERROR,
+"Expected boundary '%s' not found, instead found a line of %zu 
bytes\n",
+expected_boundary,
+strlen(line));
+
 return AVERROR_INVALIDDATA;
+}
 
 while (!pb->eof_reached) {
 char *tag, *value;
@@ -191,42 +223,90 @@ static int parse_multipart_header(AVIOContext *pb, void 
*log_ctx)
 
 if (!av_strcasecmp(tag, "Content-type")) {
   

[FFmpeg-cvslog] avformat/mpjpeg: utilize MIME boundary value to detect start of new frame

2015-12-02 Thread Alex Agranovsky
ffmpeg | branch: master | Alex Agranovsky  | Sun Nov 29 
18:54:14 2015 -0500| [259c71c199e9b4ea89bf4cb90ed0e207ddc9dff7] | committer: wm4

avformat/mpjpeg: utilize MIME boundary value to detect start of new frame

This code is disabled by default so not to regress endpoints sending invalid 
MIME, but can be enabled via AVOption 'strict_mime_boundary'

Signed-off-by: Alex Agranovsky 

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

 doc/demuxers.texi   |   15 ++
 libavformat/mpjpegdec.c |   72 +--
 2 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 349b531..fb1e4fb 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -450,6 +450,21 @@ to 1 (-1 means automatic setting, 1 means enabled, 0 means
 disabled). Default value is -1.
 @end table
 
+@section mpjpeg
+
+MJPEG encapsulated in multi-part MIME demuxer.
+
+This demuxer allows reading of MJPEG, where each frame is represented as a 
part of
+multipart/x-mixed-replace stream.
+@table @option
+
+@item strict_mime_boundary
+Default implementation applies a relaxed standard to multi-part MIME boundary 
detection,
+to prevent regression with numerous existing endpoints not generating a proper 
MIME
+MJPEG stream. Turning this option on by setting it to 1 will result in a 
stricter check
+of the boundary value.
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index 9d5700a..b644ee4 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/avstring.h"
+#include "libavutil/opt.h"
 
 #include "avformat.h"
 #include "internal.h"
@@ -28,9 +29,11 @@
 
 
 typedef struct MPJPEGDemuxContext {
+const AVClass *class;
 char   *boundary;
 char   *searchstr;
 int searchstr_len;
+int strict_mime_boundary;
 } MPJPEGDemuxContext;
 
 
@@ -242,6 +245,41 @@ static int parse_multipart_header(AVIOContext *pb,
 }
 
 
+static char* mpjpeg_get_boundary(AVIOContext* pb)
+{
+uint8_t *mime_type = NULL;
+uint8_t *start;
+uint8_t *end;
+uint8_t *res = NULL;
+int len;
+
+/* get MIME type, and skip to the first parameter */
+av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type);
+start = mime_type;
+while (start != NULL && *start != '\0') {
+start = strchr(start, ';');
+if (start)
+start = start+1;
+
+while (av_isspace(*start))
+start++;
+
+if (!av_stristart(start, "boundary=", &start)) {
+end = strchr(start, ';');
+if (end)
+len = end - start - 1;
+else
+len = strlen(start);
+res = av_strndup(start, len);
+break;
+}
+}
+
+av_freep(&mime_type);
+return res;
+}
+
+
 static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 int size;
@@ -249,8 +287,17 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 MPJPEGDemuxContext *mpjpeg = s->priv_data;
 if (mpjpeg->boundary == NULL) {
-mpjpeg->boundary = av_strdup("--");
-mpjpeg->searchstr = av_strdup("\r\n--");
+uint8_t* boundary = NULL;
+if (mpjpeg->strict_mime_boundary) {
+boundary = mpjpeg_get_boundary(s->pb);
+}
+if (boundary != NULL) {
+mpjpeg->boundary = boundary;
+mpjpeg->searchstr = av_asprintf( "\r\n%s\r\n", boundary );
+} else {
+mpjpeg->boundary = av_strdup("--");
+mpjpeg->searchstr = av_strdup("\r\n--");
+}
 if (!mpjpeg->boundary || !mpjpeg->searchstr) {
 av_freep(&mpjpeg->boundary);
 av_freep(&mpjpeg->searchstr);
@@ -309,6 +356,22 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return ret;
 }
 
+#define OFFSET(x) offsetof(MPJPEGDemuxContext, x)
+
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+const AVOption mpjpeg_options[] = {
+{ "strict_mime_boundary",  "require MIME boundaries match", 
OFFSET(strict_mime_boundary), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC },
+{ NULL }
+};
+
+
+static const AVClass mpjpeg_demuxer_class = {
+.class_name = "MPJPEG demuxer",
+.item_name  = av_default_item_name,
+.option = mpjpeg_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 AVInputFormat ff_mpjpeg_demuxer = {
 .name  = "mpjpeg",
 .long_name = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"),
@@ -318,5 +381,8 @@ AVInputFormat ff_mpjpeg_demuxer = {
 .read_probe= mpjpeg_read_probe,
 .read_header   = mpjpeg_read_header,
 .read_packet   = mpjpeg_read_packet,
-.read_close= mpjpeg_read_close
+.read_close= mpjpeg_read_close,
+.priv_class= &mpjpeg_demuxer_class
 };
+

[FFmpeg-cvslog] avfilter/af_compand: do not clip; allow >0dB curve points

2015-12-02 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Dec  1 20:09:08 
2015 +0100| [b2517b02d99054b18398427ba890fee582a8c7bf] | committer: Paul B Mahol

avfilter/af_compand: do not clip; allow >0dB curve points

Do not clip output samples, so that clipping can be handled by other filters.
Alow setting curve points above 0dB. This is useful when operating with floats.

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_compand.c |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index a64778e..68b1fae 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -205,7 +205,7 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame 
*frame)
 for (i = 0; i < nb_samples; i++) {
 update_volume(cp, fabs(src[i]));
 
-dst[i] = av_clipd(src[i] * get_volume(s, cp->volume), -1, 1);
+dst[i] = src[i] * get_volume(s, cp->volume);
 }
 }
 
@@ -266,8 +266,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame 
*frame)
 }
 
 dst = (double *)out_frame->extended_data[chan];
-dst[oindex++] = av_clipd(dbuf[dindex] *
-get_volume(s, cp->volume), -1, 1);
+dst[oindex++] = dbuf[dindex] * get_volume(s, cp->volume);
 } else {
 count++;
 }
@@ -315,8 +314,7 @@ static int compand_drain(AVFilterLink *outlink)
 
 dindex = s->delay_index;
 for (i = 0; i < frame->nb_samples; i++) {
-dst[i] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume),
--1, 1);
+dst[i] = dbuf[dindex] * get_volume(s, cp->volume);
 dindex = MOD(dindex + 1, s->delay_samples);
 }
 }
@@ -450,14 +448,14 @@ static int config_output(AVFilterLink *outlink)
 S(j) = S(j + 1);
 }
 
-for (i = 0; !i || s->segments[i - 2].x; i += 2) {
+for (i = 0; i < s->nb_segments; i += 2) {
 s->segments[i].y += s->gain_dB;
 s->segments[i].x *= M_LN10 / 20;
 s->segments[i].y *= M_LN10 / 20;
 }
 
 #define L(x) s->segments[i - (x)]
-for (i = 4; s->segments[i - 2].x; i += 2) {
+for (i = 4; i < s->nb_segments; i += 2) {
 double x, y, cx, cy, in1, in2, out1, out2, theta, len, r;
 
 L(4).a = 0;

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


[FFmpeg-cvslog] avformat/utils: Move end_time1 AV_NOPTS_VALUE Check after rescale

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Dec  2 22:59:56 2015 +0100| [ec7a3be11ed33002c8609e5d30e908a7c8827a43] | 
committer: Michael Niedermayer

avformat/utils: Move end_time1 AV_NOPTS_VALUE Check after rescale

Fixes integer overflow
Fixes: 
266ee543812e934f7b4a72923a2701d4/signal_sigabrt_76ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavformat/utils.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4475df9..973256f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2342,11 +2342,11 @@ static void update_stream_timings(AVFormatContext *ic)
 start_time_text = start_time1;
 } else
 start_time = FFMIN(start_time, start_time1);
-end_time1   = AV_NOPTS_VALUE;
-if (st->duration != AV_NOPTS_VALUE) {
-end_time1 = start_time1 +
-av_rescale_q(st->duration, st->time_base,
- AV_TIME_BASE_Q);
+end_time1 = av_rescale_q_rnd(st->duration, st->time_base,
+ AV_TIME_BASE_Q,
+ 
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
+if (end_time1 != AV_NOPTS_VALUE) {
+end_time1 += start_time1;
 end_time = FFMAX(end_time, end_time1);
 }
 for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) {

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


[FFmpeg-cvslog] avformat/utils: Check AVFormatContext->duration in compute_chapters_end() before use

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Dec  2 22:59:56 2015 +0100| [d872643cfe07e39fee42c846d5a3f57d5cad6ab6] | 
committer: Michael Niedermayer

avformat/utils: Check AVFormatContext->duration in compute_chapters_end() 
before use

Fixes integer overflow
Fixes: 
266ee543812e934f7b4a72923a2701d4/signal_sigabrt_76ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8cb7d38..4475df9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2889,7 +2889,10 @@ enum AVCodecID av_codec_get_id(const AVCodecTag *const 
*tags, unsigned int tag)
 static void compute_chapters_end(AVFormatContext *s)
 {
 unsigned int i, j;
-int64_t max_time = s->duration +
+int64_t max_time = 0;
+
+if (s->duration > 0)
+max_time = s->duration +
((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);
 
 for (i = 0; i < s->nb_chapters; i++)

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


[FFmpeg-cvslog] avcodec/vp3: ensure header is parsed successfully before tables

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Wed 
Dec  2 22:59:56 2015 +0100| [26379d4fddc17cac853ef297ff327b58c44edbad] | 
committer: Michael Niedermayer

avcodec/vp3: ensure header is parsed successfully before tables

Fixes assertion failure
Fixes: 
266ee543812e934f7b4a72923a2701d4/signal_sigabrt_76ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp3.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 46c83aa..a478a1b 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -131,7 +131,7 @@ static const uint8_t hilbert_offset[16][2] = {
 
 typedef struct Vp3DecodeContext {
 AVCodecContext *avctx;
-int theora, theora_tables;
+int theora, theora_tables, theora_header;
 int version;
 int width, height;
 int chroma_x_shift, chroma_y_shift;
@@ -2258,6 +2258,7 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 int ret;
 AVRational fps, aspect;
 
+s->theora_header = 0;
 s->theora = get_bits_long(gb, 24);
 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
 
@@ -2363,6 +2364,7 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 avctx->color_trc  = AVCOL_TRC_BT709;
 }
 
+s->theora_header = 1;
 return 0;
 }
 
@@ -2371,6 +2373,9 @@ static int theora_decode_tables(AVCodecContext *avctx, 
GetBitContext *gb)
 Vp3DecodeContext *s = avctx->priv_data;
 int i, n, matrices, inter, plane;
 
+if (!s->theora_header)
+return AVERROR_INVALIDDATA;
+
 if (s->theora >= 0x030200) {
 n = get_bits(gb, 3);
 /* loop filter limit values table */

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


[FFmpeg-cvslog] avfilter/vf_perspective: use lrint instead of floor hack

2015-12-02 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Nov 
25 17:32:15 2015 -0500| [c6bea81acfa49d7e73f625332fc304d8a0fd09bd] | committer: 
Ganesh Ajjanagadde

avfilter/vf_perspective: use lrint instead of floor hack

Reviewed-by: Michael Niedermayer 
Signed-off-by: Ganesh Ajjanagadde 

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

 libavfilter/vf_perspective.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
index 970870c..13053f1 100644
--- a/libavfilter/vf_perspective.c
+++ b/libavfilter/vf_perspective.c
@@ -213,10 +213,10 @@ static int config_input(AVFilterLink *inlink)
 for (x = 0; x < w; x++){
 int u, v;
 
-u = (int)floor(SUB_PIXELS * (x0 * x + x1 * y + x2) /
-(x6 * x + x7 * y + x8) + 0.5);
-v = (int)floor(SUB_PIXELS * (x3 * x + x4 * y + x5) /
-(x6 * x + x7 * y + x8) + 0.5);
+u =  lrint(SUB_PIXELS * (x0 * x + x1 * y + x2) /
+(x6 * x + x7 * y + x8));
+v =  lrint(SUB_PIXELS * (x3 * x + x4 * y + x5) /
+(x6 * x + x7 * y + x8));
 
 s->pv[x + y * w][0] = u;
 s->pv[x + y * w][1] = v;
@@ -235,7 +235,7 @@ static int config_input(AVFilterLink *inlink)
 sum += temp[j];
 
 for (j = 0; j < 4; j++)
-s->coeff[i][j] = (int)floor((1 << COEFF_BITS) * temp[j] / sum + 
0.5);
+s->coeff[i][j] = lrint((1 << COEFF_BITS) * temp[j] / sum);
 }
 
 return 0;

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


[FFmpeg-cvslog] avfilter/af_flanger: use rint instead of floor hack

2015-12-02 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Nov 
25 17:49:22 2015 -0500| [d64b6c38198ea35a08ceda396ebc4745138ad6ec] | committer: 
Ganesh Ajjanagadde

avfilter/af_flanger: use rint instead of floor hack

Reviewed-by: Paul B Mahol 
Signed-off-by: Ganesh Ajjanagadde 

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

 libavfilter/af_flanger.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_flanger.c b/libavfilter/af_flanger.c
index f8ec830..a92367c 100644
--- a/libavfilter/af_flanger.c
+++ b/libavfilter/af_flanger.c
@@ -130,7 +130,7 @@ static int config_input(AVFilterLink *inlink)
 return AVERROR(ENOMEM);
 
 ff_generate_wave_table(s->wave_shape, AV_SAMPLE_FMT_FLT, s->lfo, 
s->lfo_length,
-   floor(s->delay_min * inlink->sample_rate + 0.5),
+   rint(s->delay_min * inlink->sample_rate),
s->max_samples - 2., 3 * M_PI_2);
 
 return av_samples_alloc_array_and_samples(&s->delay_buffer, NULL,

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


[FFmpeg-cvslog] avfilter/vsrc_mptestsrc: use lrint instead of floor hack

2015-12-02 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Nov 
25 17:27:27 2015 -0500| [fa5d299496c15e992240914ae05b92d9b74eb3c4] | committer: 
Ganesh Ajjanagadde

avfilter/vsrc_mptestsrc: use lrint instead of floor hack

lrint is faster, and is more consistent across the codebase.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Ganesh Ajjanagadde 

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

 libavfilter/vsrc_mptestsrc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 668a001..1cdd3a4 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -121,7 +121,7 @@ static void idct(uint8_t *dst, int dst_linesize, int 
src[64])
 for (k = 0; k < 8; k++)
 sum += c[k*8+i]*tmp[8*k+j];
 
-dst[dst_linesize*i + j] = av_clip_uint8((int)floor(sum+0.5));
+dst[dst_linesize*i + j] = av_clip_uint8(lrint(sum));
 }
 }
 }

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


[FFmpeg-cvslog] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-02 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Sun Nov 
29 21:36:52 2015 -0500| [1bb7db217d9000a8e5fe53d9df691884fe8014bf] | committer: 
Ganesh Ajjanagadde

avutil/crc: avoid needless space wastage of hardcoded crc table

There was no reason AFAIK for making AV_CRC_24_IEEE 12. This simply
resulted in wasted space under --enable-hardcoded-tables:
dynamic: 1318672 libavutil/libavutil.so.55
old: 1330680 libavutil/libavutil.so.55
new: 1326488 libavutil/libavutil.so.55

Minor version number is bumped, with ifdefry due to API breakage.

Reviewed-by: James Almer 
Signed-off-by: Ganesh Ajjanagadde 

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

 libavutil/crc.h |5 +
 libavutil/version.h |3 +++
 2 files changed, 8 insertions(+)

diff --git a/libavutil/crc.h b/libavutil/crc.h
index e86bf1d..ef8a713 100644
--- a/libavutil/crc.h
+++ b/libavutil/crc.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include "attributes.h"
+#include "version.h"
 
 /**
  * @defgroup lavu_crc32 CRC32
@@ -40,7 +41,11 @@ typedef enum {
 AV_CRC_32_IEEE,
 AV_CRC_32_IEEE_LE,  /*< reversed bitorder version of AV_CRC_32_IEEE */
 AV_CRC_16_ANSI_LE,  /*< reversed bitorder version of AV_CRC_16_ANSI */
+#if FF_API_CRC_BIG_TABLE
 AV_CRC_24_IEEE = 12,
+#else
+AV_CRC_24_IEEE,
+#endif /* FF_API_CRC_BIG_TABLE */
 AV_CRC_MAX, /*< Not part of public API! Do not use outside 
libavutil. */
 }AVCRCId;
 
diff --git a/libavutil/version.h b/libavutil/version.h
index e0ddfd2..bf0a929 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -108,6 +108,9 @@
 #ifndef FF_API_ERROR_FRAME
 #define FF_API_ERROR_FRAME  (LIBAVUTIL_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_CRC_BIG_TABLE
+#define FF_API_CRC_BIG_TABLE(LIBAVUTIL_VERSION_MAJOR < 56)
+#endif
 
 
 /**

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


[FFmpeg-cvslog] avcodec/jpeg2000: fix type of arguments of tag_tree_size

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Dec  3 01:08:53 2015 +0100| [0afdfbe11678d813ce7865378276a0ba476a8cef] | 
committer: Michael Niedermayer

avcodec/jpeg2000: fix type of arguments of tag_tree_size

Fixes: out of array read
Fixes: 
36b8096fefab16c4c9326a508053e95c/signal_sigsegv_1d9ce18_3233_1a55196b018106dfabeace071a432d9e.r3d

Signed-off-by: Michael Niedermayer 

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

 libavcodec/jpeg2000.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index cbca18e..c988409 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -38,11 +38,11 @@
 /* tag tree routines */
 
 /* allocate the memory for tag tree */
-static int32_t tag_tree_size(uint16_t w, uint16_t h)
+static int32_t tag_tree_size(int w, int h)
 {
-uint32_t res = 0;
+int64_t res = 0;
 while (w > 1 || h > 1) {
-res += w * h;
+res += w * (int64_t)h;
 av_assert0(res + 1 < INT32_MAX);
 w = (w + 1) >> 1;
 h = (h + 1) >> 1;

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


Re: [FFmpeg-cvslog] avcodec/jpeg2000: fix type of arguments of tag_tree_size

2015-12-02 Thread Michael Niedermayer
On Thu, Dec 03, 2015 at 02:44:10AM +0100, Michael Niedermayer wrote:
> ffmpeg | branch: master | Michael Niedermayer  | Thu 
> Dec  3 01:08:53 2015 +0100| [0afdfbe11678d813ce7865378276a0ba476a8cef] | 
> committer: Michael Niedermayer
> 
> avcodec/jpeg2000: fix type of arguments of tag_tree_size
> 
> Fixes: out of array read
> Fixes: 
> 36b8096fefab16c4c9326a508053e95c/signal_sigsegv_1d9ce18_3233_1a55196b018106dfabeace071a432d9e.r3d
> 

+ Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

> Signed-off-by: Michael Niedermayer 

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


signature.asc
Description: Digital signature
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/timecode: Fix fps check

2015-12-02 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Dec  3 03:14:11 2015 +0100| [b46dcd5209a77254345ae098b83a872634c5591b] | 
committer: Michael Niedermayer

avutil/timecode: Fix fps check

The fps variable is explicitly set to -1 in case of some errors, the check must
thus be signed or the code setting it needs to use 0 as error code
the type of the field could be changed as well but its in an installed header

Fixes: integer overflow
Fixes: 
9982cc157b1ea90429435640a989122f/asan_generic_3ad004a_3799_22cf198d9cd09928e2d9ad250474fa58.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavutil/timecode.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index 6432a3c..fa92df1 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -153,7 +153,7 @@ static int check_fps(int fps)
 
 static int check_timecode(void *log_ctx, AVTimecode *tc)
 {
-if (tc->fps <= 0) {
+if ((int)tc->fps <= 0) {
 av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be 
specified\n");
 return AVERROR(EINVAL);
 }

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


[FFmpeg-cvslog] avformat/mpjpegdec: fix mixed declarations and code

2015-12-02 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Dec  3 01:39:47 
2015 -0300| [9ac5beaa86b55a6121c30ffb3b75a9d923343c35] | committer: James Almer

avformat/mpjpegdec: fix mixed declarations and code

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

 libavformat/mpjpegdec.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index b644ee4..49fe6f6 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -39,10 +39,12 @@ typedef struct MPJPEGDemuxContext {
 
 static void trim_right(char *p)
 {
+char *end;
+
 if (!p || !*p)
 return;
 
-char *end = p + strlen(p);
+end = p + strlen(p);
 while (end > p && av_isspace(*(end-1)))
 *(--end) = '\0';
 }
@@ -330,8 +332,10 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 while ((ret = av_append_packet(s->pb, pkt, read_chunk - remaining)) >= 
0) {
 /* scan the new data */
+char *start;
+
 len = ret + remaining;
-char *start = pkt->data + pkt->size - len;
+start = pkt->data + pkt->size - len;
 do {
 if (!memcmp(start, mpjpeg->searchstr, mpjpeg->searchstr_len)) {
 // got the boundary! rewind the stream

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