[FFmpeg-cvslog] avcodec/hevc_parser: Treat extradata parsing differently, as it should not contain an AU

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Jul 19 02:50:06 2015 +0200| [54882156dd091ce3113a2ad5d977f93a1acd7907] | 
committer: Michael Niedermayer

avcodec/hevc_parser: Treat extradata parsing differently, as it should not 
contain an AU

Fixes ticket4718

Signed-off-by: Michael Niedermayer 

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

 libavcodec/hevc_parser.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 8b23244..f970de5 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -115,7 +115,13 @@ static int parse_nal_units(AVCodecParserContext *s, const 
uint8_t *buf,
 case NAL_RADL_N:
 case NAL_RADL_R:
 case NAL_RASL_N:
-case NAL_RASL_R: hevc_parse_slice_header(s, nal, avctx); break;
+case NAL_RASL_R:
+if (buf == avctx->extradata) {
+av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", 
nal->type);
+return AVERROR_INVALIDDATA;
+}
+hevc_parse_slice_header(s, nal, avctx);
+break;
 }
 }
 
@@ -187,6 +193,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, 
const uint8_t *buf,
 const uint8_t *buf_end = buf + buf_size;
 int state = -1, i;
 HEVCNAL *nal;
+int is_global = buf == avctx->extradata;
 
 if (!h->HEVClc)
 h->HEVClc = av_mallocz(sizeof(HEVCLocalContext));
@@ -266,6 +273,12 @@ static inline int parse_nal_units(AVCodecParserContext *s, 
const uint8_t *buf,
 case NAL_IDR_W_RADL:
 case NAL_IDR_N_LP:
 case NAL_CRA_NUT:
+
+if (is_global) {
+av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", 
h->nal_unit_type);
+return AVERROR_INVALIDDATA;
+}
+
 sh->first_slice_in_pic_flag = get_bits1(gb);
 s->picture_structure = h->picture_struct;
 s->field_order = h->picture_struct;
@@ -354,7 +367,8 @@ static inline int parse_nal_units(AVCodecParserContext *s, 
const uint8_t *buf,
 buf += consumed;
 }
 /* didn't find a picture! */
-av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");
+if (!is_global)
+av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");
 return -1;
 }
 #endif

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


[FFmpeg-cvslog] avutil/x86/bswap: force inline asm versions with ICC

2015-07-18 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Jul 18 18:29:44 
2015 -0300| [bd487645327b207e27aa76b4b30319e1a20d4731] | committer: James Almer

avutil/x86/bswap: force inline asm versions with ICC

Recent ICC versions that define GCC as >= 4.5 (like ICC 13) apparently can't
optimize the generic C versions of av_bswap*() on their own.

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

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

 libavutil/x86/bswap.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index 08e2a62..67f1747 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -39,7 +39,7 @@ static av_always_inline av_const unsigned av_bswap16(unsigned 
x)
 }
 #endif /* !AV_GCC_VERSION_AT_LEAST(4,1) */
 
-#if !AV_GCC_VERSION_AT_LEAST(4,5)
+#if !AV_GCC_VERSION_AT_LEAST(4,5) || defined(__INTEL_COMPILER)
 #define av_bswap32 av_bswap32
 static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
 {

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


[FFmpeg-cvslog] avutil/intmath: check for ICC before GCC

2015-07-18 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Jul 18 16:52:42 
2015 -0300| [78347549a4449ebac65add844b93a53bbbf559da] | committer: James Almer

avutil/intmath: check for ICC before GCC

Intel compiler also defines __GNUC__, so the Intel specific intrinsics were not
really being used.

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

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

 libavutil/intmath.h |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index f5ecc77..ef347f4 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -39,22 +39,22 @@
  */
 
 #if HAVE_FAST_CLZ
-#if AV_GCC_VERSION_AT_LEAST(3,4)
+#if defined( __INTEL_COMPILER )
 #ifndef ff_log2
-#   define ff_log2(x) (31 - __builtin_clz((x)|1))
+#   define ff_log2(x) (_bit_scan_reverse((x)|1))
 #   ifndef ff_log2_16bit
 #  define ff_log2_16bit av_log2
 #   endif
 #endif /* ff_log2 */
-#elif defined( __INTEL_COMPILER )
+#elif AV_GCC_VERSION_AT_LEAST(3,4)
 #ifndef ff_log2
-#   define ff_log2(x) (_bit_scan_reverse((x)|1))
+#   define ff_log2(x) (31 - __builtin_clz((x)|1))
 #   ifndef ff_log2_16bit
 #  define ff_log2_16bit av_log2
 #   endif
 #endif /* ff_log2 */
-#endif
 #endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
+#endif
 
 extern const uint8_t ff_log2_tab[256];
 
@@ -115,13 +115,13 @@ static av_always_inline av_const int 
ff_log2_16bit_c(unsigned int v)
  */
 
 #if HAVE_FAST_CLZ
-#if AV_GCC_VERSION_AT_LEAST(3,4)
+#if defined( __INTEL_COMPILER )
 #ifndef ff_ctz
-#define ff_ctz(v) __builtin_ctz(v)
+#define ff_ctz(v) _bit_scan_forward(v)
 #endif
-#elif defined( __INTEL_COMPILER )
+#elif AV_GCC_VERSION_AT_LEAST(3,4)
 #ifndef ff_ctz
-#define ff_ctz(v) _bit_scan_forward(v)
+#define ff_ctz(v) __builtin_ctz(v)
 #endif
 #endif
 #endif

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


[FFmpeg-cvslog] avfilter/vf_blend: unbreak tblend

2015-07-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jul 18 05:00:03 
2015 +| [9a829a2b6a7a5bc7f6fb492577daaaec43c9f6c8] | committer: Paul B Mahol

avfilter/vf_blend: unbreak tblend

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_blend.c |   68 +---
 1 file changed, 29 insertions(+), 39 deletions(-)

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index f359dff..a61525a 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -423,35 +423,36 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_expr_free(b->params[i].e);
 }
 
-#if CONFIG_BLEND_FILTER
-
 static int config_output(AVFilterLink *outlink)
 {
 AVFilterContext *ctx = outlink->src;
 AVFilterLink *toplink = ctx->inputs[TOP];
-AVFilterLink *bottomlink = ctx->inputs[BOTTOM];
 BlendContext *b = ctx->priv;
 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(toplink->format);
 int ret, plane, is_16bit;
 
-if (toplink->format != bottomlink->format) {
-av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n");
-return AVERROR(EINVAL);
-}
-if (toplink->w   != bottomlink->w ||
-toplink->h   != bottomlink->h ||
-toplink->sample_aspect_ratio.num != 
bottomlink->sample_aspect_ratio.num ||
-toplink->sample_aspect_ratio.den != 
bottomlink->sample_aspect_ratio.den) {
-av_log(ctx, AV_LOG_ERROR, "First input link %s parameters "
-   "(size %dx%d, SAR %d:%d) do not match the corresponding "
-   "second input link %s parameters (%dx%d, SAR %d:%d)\n",
-   ctx->input_pads[TOP].name, toplink->w, toplink->h,
-   toplink->sample_aspect_ratio.num,
-   toplink->sample_aspect_ratio.den,
-   ctx->input_pads[BOTTOM].name, bottomlink->w, bottomlink->h,
-   bottomlink->sample_aspect_ratio.num,
-   bottomlink->sample_aspect_ratio.den);
-return AVERROR(EINVAL);
+if (!b->tblend) {
+AVFilterLink *bottomlink = ctx->inputs[BOTTOM];
+
+if (toplink->format != bottomlink->format) {
+av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n");
+return AVERROR(EINVAL);
+}
+if (toplink->w   != bottomlink->w ||
+toplink->h   != bottomlink->h ||
+toplink->sample_aspect_ratio.num != 
bottomlink->sample_aspect_ratio.num ||
+toplink->sample_aspect_ratio.den != 
bottomlink->sample_aspect_ratio.den) {
+av_log(ctx, AV_LOG_ERROR, "First input link %s parameters "
+   "(size %dx%d, SAR %d:%d) do not match the corresponding "
+   "second input link %s parameters (%dx%d, SAR %d:%d)\n",
+   ctx->input_pads[TOP].name, toplink->w, toplink->h,
+   toplink->sample_aspect_ratio.num,
+   toplink->sample_aspect_ratio.den,
+   ctx->input_pads[BOTTOM].name, bottomlink->w, bottomlink->h,
+   bottomlink->sample_aspect_ratio.num,
+   bottomlink->sample_aspect_ratio.den);
+return AVERROR(EINVAL);
+}
 }
 
 outlink->w = toplink->w;
@@ -466,8 +467,10 @@ static int config_output(AVFilterLink *outlink)
 is_16bit = pix_desc->comp[0].depth_minus1 == 15;
 b->nb_planes = av_pix_fmt_count_planes(toplink->format);
 
-if ((ret = ff_dualinput_init(ctx, &b->dinput)) < 0)
-return ret;
+if (b->tblend)
+outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
+else if ((ret = ff_dualinput_init(ctx, &b->dinput)) < 0)
+return ret;
 
 for (plane = 0; plane < FF_ARRAY_ELEMS(b->params); plane++) {
 FilterParams *param = &b->params[plane];
@@ -525,6 +528,8 @@ static int config_output(AVFilterLink *outlink)
 return 0;
 }
 
+#if CONFIG_BLEND_FILTER
+
 static int request_frame(AVFilterLink *outlink)
 {
 BlendContext *b = outlink->src->priv;
@@ -577,21 +582,6 @@ AVFilter ff_vf_blend = {
 
 #if CONFIG_TBLEND_FILTER
 
-static int tblend_config_output(AVFilterLink *outlink)
-{
-AVFilterContext *ctx = outlink->src;
-AVFilterLink *inlink = ctx->inputs[0];
-BlendContext *b = ctx->priv;
-const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
-
-b->hsub = pix_desc->log2_chroma_w;
-b->vsub = pix_desc->log2_chroma_h;
-b->nb_planes = av_pix_fmt_count_planes(inlink->format);
-outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
-
-return 0;
-}
-
 static int tblend_filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 BlendContext *b = inlink->dst->priv;
@@ -627,7 +617,7 @@ static const AVFilterPad tblend_outputs[] = {
 {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
-.config_props

[FFmpeg-cvslog] fate: add tblend filter test

2015-07-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Jul 18 02:30:59 
2015 +| [5c7f708683acc31de4c1e12a22d2c75e2e9f122b] | committer: Paul B Mahol

fate: add tblend filter test

Signed-off-by: Paul B Mahol 

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

 tests/fate/filter-video.mak  |3 +++
 tests/ref/fate/filter-tblend |   50 ++
 2 files changed, 53 insertions(+)

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 909aa29..641546e 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -238,6 +238,9 @@ fate-filter-shuffleplanes-swapuv: CMD = framecrc -c:v 
pgmyuv -i $(SRC) -vf shuff
 
 FATE_FILTER_VSYNTH-$(CONFIG_SHUFFLEPLANES_FILTER) += $(FATE_SHUFFLEPLANES)
 
+FATE_FILTER_VSYNTH-$(CONFIG_TBLEND_FILTER) += fate-filter-tblend
+fate-filter-tblend: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf 
tblend=all_mode=difference128
+
 FATE_FILTER_VSYNTH-$(CONFIG_TELECINE_FILTER) += fate-filter-telecine
 fate-filter-telecine: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf telecine
 
diff --git a/tests/ref/fate/filter-tblend b/tests/ref/fate/filter-tblend
new file mode 100644
index 000..3ff689a
--- /dev/null
+++ b/tests/ref/fate/filter-tblend
@@ -0,0 +1,50 @@
+#tb 0: 1/25
+0,  1,  1,1,   152064, 0x8e50e5e5
+0,  2,  2,1,   152064, 0x7187a95e
+0,  3,  3,1,   152064, 0xbd73863e
+0,  4,  4,1,   152064, 0xabaefc78
+0,  5,  5,1,   152064, 0xf080523f
+0,  6,  6,1,   152064, 0x2ba7c11c
+0,  7,  7,1,   152064, 0x1bfe0964
+0,  8,  8,1,   152064, 0xe081d9db
+0,  9,  9,1,   152064, 0x26eee75b
+0, 10, 10,1,   152064, 0xcc28e18c
+0, 11, 11,1,   152064, 0x3d2ed08b
+0, 12, 12,1,   152064, 0x4567acbe
+0, 13, 13,1,   152064, 0xa22f09db
+0, 14, 14,1,   152064, 0xe4438e6f
+0, 15, 15,1,   152064, 0x34d02799
+0, 16, 16,1,   152064, 0x4c9230b3
+0, 17, 17,1,   152064, 0x08e6c23c
+0, 18, 18,1,   152064, 0xa0a475a5
+0, 19, 19,1,   152064, 0x47f5d5e9
+0, 20, 20,1,   152064, 0x0713219a
+0, 21, 21,1,   152064, 0x9e4434a2
+0, 22, 22,1,   152064, 0xc06a2482
+0, 23, 23,1,   152064, 0xba321552
+0, 24, 24,1,   152064, 0x74070b31
+0, 25, 25,1,   152064, 0x92188f27
+0, 26, 26,1,   152064, 0x29cf1fae
+0, 27, 27,1,   152064, 0x04fd06ea
+0, 28, 28,1,   152064, 0xcbbded09
+0, 29, 29,1,   152064, 0x7f731df8
+0, 30, 30,1,   152064, 0x9fd5b56f
+0, 31, 31,1,   152064, 0x82217442
+0, 32, 32,1,   152064, 0x95496106
+0, 33, 33,1,   152064, 0xb9c50804
+0, 34, 34,1,   152064, 0xa7051cba
+0, 35, 35,1,   152064, 0x76bc5e88
+0, 36, 36,1,   152064, 0x8276cfb2
+0, 37, 37,1,   152064, 0x88bbf936
+0, 38, 38,1,   152064, 0x160c5d4e
+0, 39, 39,1,   152064, 0x0b61942a
+0, 40, 40,1,   152064, 0x4a4aae9b
+0, 41, 41,1,   152064, 0x049978fa
+0, 42, 42,1,   152064, 0x12584f81
+0, 43, 43,1,   152064, 0xada82b80
+0, 44, 44,1,   152064, 0x3a4876ef
+0, 45, 45,1,   152064, 0x7ccb86f2
+0, 46, 46,1,   152064, 0x11bef54d
+0, 47, 47,1,   152064, 0xb1714cd0
+0, 48, 48,1,   152064, 0x950a3388
+0, 49, 49,1,   152064, 0x1c1cc3ec

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


[FFmpeg-cvslog] avformat/mpegtsenc: Add sdt_period, similar to pat_period

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 23:25:07 2015 +0200| [b5e716ae1322eb018c95988617a0f216e6bc2b30] | 
committer: Michael Niedermayer

avformat/mpegtsenc: Add sdt_period, similar to pat_period

Signed-off-by: Michael Niedermayer 

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

 doc/muxers.texi |2 ++
 libavformat/mpegtsenc.c |   16 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index f6574eb..8e3eb4b 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -761,6 +761,8 @@ Override the default PCR retransmission time (default 
20ms), ignored
 if variable muxrate is selected.
 @item pat_period @var{number}
 Maximal time in seconds between PAT/PMT tables.
+@item sdt_period @var{number}
+Maximal time in seconds between SDT tables.
 @item -pes_payload_size @var{number}
 Set minimum PES packet payload in bytes.
 @item -mpegts_flags @var{flags}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index cec77a5..45bab1c 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -103,7 +103,9 @@ typedef struct MpegTSWrite {
 int copyts;
 int tables_version;
 float pat_period;
+float sdt_period;
 int64_t last_pat_ts;
+int64_t last_sdt_ts;
 
 int omit_video_pes_length;
 } MpegTSWrite;
@@ -787,10 +789,14 @@ static int mpegts_write_header(AVFormatContext *s)
 }
 
 ts->last_pat_ts = AV_NOPTS_VALUE;
+ts->last_sdt_ts = AV_NOPTS_VALUE;
 // The user specified a period, use only it
 if (ts->pat_period < INT_MAX/2) {
 ts->pat_packet_period = INT_MAX;
 }
+if (ts->sdt_period < INT_MAX/2) {
+ts->sdt_packet_period = INT_MAX;
+}
 
 // output a PCR as soon as possible
 service->pcr_packet_count = service->pcr_packet_period;
@@ -847,8 +853,13 @@ static void retransmit_si_info(AVFormatContext *s, int 
force_pat, int64_t dts)
 MpegTSWrite *ts = s->priv_data;
 int i;
 
-if (++ts->sdt_packet_count == ts->sdt_packet_period) {
+if (++ts->sdt_packet_count == ts->sdt_packet_period ||
+(dts != AV_NOPTS_VALUE && ts->last_sdt_ts == AV_NOPTS_VALUE) ||
+(dts != AV_NOPTS_VALUE && dts - ts->last_sdt_ts >= 
ts->sdt_period*9.0)
+) {
 ts->sdt_packet_count = 0;
+if (dts != AV_NOPTS_VALUE)
+ts->last_sdt_ts = FFMAX(dts, ts->last_sdt_ts);
 mpegts_write_sdt(s);
 }
 if (++ts->pat_packet_count == ts->pat_packet_period ||
@@ -1546,6 +1557,9 @@ static const AVOption options[] = {
 { "pat_period", "PAT/PMT retransmission time limit in seconds",
   offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_FLOAT,
   { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ "sdt_period", "SDT retransmission time limit in seconds",
+  offsetof(MpegTSWrite, sdt_period), AV_OPT_TYPE_FLOAT,
+  { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { NULL },
 };
 

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


[FFmpeg-cvslog] avformat/mpegtsenc: Support a user specified PAT/PMT period

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Jul 16 12:56:55 2015 +0200| [34da54fd1aebca62c615701fe66e4aa9c1b1b5a5] | 
committer: Michael Niedermayer

avformat/mpegtsenc: Support a user specified PAT/PMT period

Can be used to fix Ticket3714

Signed-off-by: Michael Niedermayer 

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

 doc/muxers.texi |2 ++
 libavformat/mpegtsenc.c |   22 +++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 4c2826c..f6574eb 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -759,6 +759,8 @@ Set a constant muxrate (default VBR).
 @item -pcr_period @var{numer}
 Override the default PCR retransmission time (default 20ms), ignored
 if variable muxrate is selected.
+@item pat_period @var{number}
+Maximal time in seconds between PAT/PMT tables.
 @item -pes_payload_size @var{number}
 Set minimum PES packet payload in bytes.
 @item -mpegts_flags @var{flags}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 6d589f3..cec77a5 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -102,6 +102,8 @@ typedef struct MpegTSWrite {
 int flags;
 int copyts;
 int tables_version;
+float pat_period;
+int64_t last_pat_ts;
 
 int omit_video_pes_length;
 } MpegTSWrite;
@@ -784,6 +786,12 @@ static int mpegts_write_header(AVFormatContext *s)
 service->pcr_packet_period = 1;
 }
 
+ts->last_pat_ts = AV_NOPTS_VALUE;
+// The user specified a period, use only it
+if (ts->pat_period < INT_MAX/2) {
+ts->pat_packet_period = INT_MAX;
+}
+
 // output a PCR as soon as possible
 service->pcr_packet_count = service->pcr_packet_period;
 ts->pat_packet_count  = ts->pat_packet_period - 1;
@@ -834,7 +842,7 @@ fail:
 }
 
 /* send SDT, PAT and PMT tables regulary */
-static void retransmit_si_info(AVFormatContext *s, int force_pat)
+static void retransmit_si_info(AVFormatContext *s, int force_pat, int64_t dts)
 {
 MpegTSWrite *ts = s->priv_data;
 int i;
@@ -843,8 +851,13 @@ static void retransmit_si_info(AVFormatContext *s, int 
force_pat)
 ts->sdt_packet_count = 0;
 mpegts_write_sdt(s);
 }
-if (++ts->pat_packet_count == ts->pat_packet_period || force_pat) {
+if (++ts->pat_packet_count == ts->pat_packet_period ||
+(dts != AV_NOPTS_VALUE && ts->last_pat_ts == AV_NOPTS_VALUE) ||
+(dts != AV_NOPTS_VALUE && dts - ts->last_pat_ts >= 
ts->pat_period*9.0) ||
+force_pat) {
 ts->pat_packet_count = 0;
+if (dts != AV_NOPTS_VALUE)
+ts->last_pat_ts = FFMAX(dts, ts->last_pat_ts);
 mpegts_write_pat(s);
 for (i = 0; i < ts->nb_services; i++)
 mpegts_write_pmt(s, ts->services[i]);
@@ -979,7 +992,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream 
*st,
 
 is_start = 1;
 while (payload_size > 0) {
-retransmit_si_info(s, force_pat);
+retransmit_si_info(s, force_pat, dts);
 force_pat = 0;
 
 write_pcr = 0;
@@ -1530,6 +1543,9 @@ static const AVOption options[] = {
 { "pcr_period", "PCR retransmission time",
   offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_INT,
   { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+{ "pat_period", "PAT/PMT retransmission time limit in seconds",
+  offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_FLOAT,
+  { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
 { NULL },
 };
 

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


[FFmpeg-cvslog] avformat/mpegtsenc: support storing PAT/PMT per frame

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Jul 16 01:54:56 2015 +0200| [a9c1545a33c5268fe35605da5163df722b5eedc1] | 
committer: Michael Niedermayer

avformat/mpegtsenc: support storing PAT/PMT per frame

Signed-off-by: Michael Niedermayer 

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

 doc/muxers.texi |2 ++
 libavformat/mpegtsenc.c |9 +
 2 files changed, 11 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d75d7de..4c2826c 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -810,6 +810,8 @@ Option mpegts_flags may take a set of such flags:
 Reemit PAT/PMT before writing the next packet.
 @item latm
 Use LATM packetization for AAC.
+@item pat_pmt_at_frames
+Reemit PAT and PMT at each video frame.
 @end table
 
 @subsection Example
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index c74389a..6d589f3 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -98,6 +98,7 @@ typedef struct MpegTSWrite {
 int pcr_period;
 #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
 #define MPEGTS_FLAG_AAC_LATM0x02
+#define MPEGTS_FLAG_PAT_PMT_AT_FRAMES   0x04
 int flags;
 int copyts;
 int tables_version;
@@ -971,6 +972,11 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream 
*st,
 int64_t delay = av_rescale(s->max_delay, 9, AV_TIME_BASE);
 int force_pat = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && key && 
!ts_st->prev_payload_key;
 
+av_assert0(ts_st->payload != buf || st->codec->codec_type != 
AVMEDIA_TYPE_VIDEO);
+if (ts->flags & MPEGTS_FLAG_PAT_PMT_AT_FRAMES && st->codec->codec_type == 
AVMEDIA_TYPE_VIDEO) {
+force_pat = 1;
+}
+
 is_start = 1;
 while (payload_size > 0) {
 retransmit_si_info(s, force_pat);
@@ -1505,6 +1511,9 @@ static const AVOption options[] = {
 { "latm", "Use LATM packetization for AAC",
   0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_AAC_LATM }, 0, INT_MAX,
   AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
+{ "pat_pmt_at_frames", "Reemit PAT and PMT at each video frame",
+  0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_PAT_PMT_AT_FRAMES}, 0, 
INT_MAX,
+  AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
 // backward compatibility
 { "resend_headers", "Reemit PAT/PMT before writing the next packet",
   offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT,

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


[FFmpeg-cvslog] doc/developer: add url for sample files

2015-07-18 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Sat Jul 
18 08:34:02 2015 -0400| [e3e4f1752c1c635454b0b17d91048d72606e40fa] | committer: 
Michael Niedermayer

doc/developer: add url for sample files

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

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

 doc/developer.texi |4 
 1 file changed, 4 insertions(+)

diff --git a/doc/developer.texi b/doc/developer.texi
index d9ccf7b..7e9f0b2 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -544,6 +544,10 @@ should not crash, end in a (near) infinite loop, or 
allocate ridiculous
 amounts of memory when fed damaged data.
 
 @item
+Did you test your decoder or demuxer against sample files?
+Samples may be obtained at @url{http://samples.ffmpeg.org}.
+
+@item
 Does the patch not mix functional and cosmetic changes?
 
 @item

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


[FFmpeg-cvslog] Update for FFmpeg 2.7.2

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Jul 18 20:53:40 2015 +0200| [4a6ac71742e09f425bccb623ab3e0d5455853090] | 
committer: Michael Niedermayer

Update for FFmpeg 2.7.2

Signed-off-by: Michael Niedermayer 

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

 Changelog|   52 
 RELEASE  |2 +-
 doc/Doxyfile |2 +-
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index b484505..674a9d9 100644
--- a/Changelog
+++ b/Changelog
@@ -3,6 +3,58 @@ releases are sorted from youngest to oldest.
 
 version :
 
+version 2.7.2:
+- avcodec/vp8: Check buffer size in vp8_decode_frame_header()
+- avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()
+- avcodec/diracdec: Check for hpel_base allocation failure
+- avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()
+- avfilter/af_aresample: Check ff_all_* for allocation failures
+- avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case
+- swscale/utils: Clear pix buffers
+- avutil/fifo: Fix the case where func() returns less bytes than requested in 
av_fifo_generic_write()
+- ffmpeg: Fix cleanup after failed allocation of output_files
+- avformat/mov: Fix deallocation when MOVStreamContext failed to allocate
+- ffmpeg: Fix crash with ost->last_frame allocation failure
+- ffmpeg: Fix cleanup with ost = NULL
+- avcodec/pthread_frame: check avctx on deallocation
+- avcodec/sanm: Reset sizes in destroy_buffers()
+- avcodec/alac: Clear pointers in allocate_buffers()
+- bytestream2: set the reader to the end when reading more than available
+- avcodec/utils: use a minimum 32pixel width in  avcodec_align_dimensions2() 
for H.264
+- avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()
+- oggparsedirac: check return value of init_get_bits
+- wmalosslessdec: reset frame->nb_samples on packet loss
+- wmalosslessdec: avoid reading 0 bits with get_bits
+- Put a space between string literals and macros.
+- avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()
+- avcodec/aacsbr: check that the element type matches before applying SBR
+- avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h
+- vp9/update_prob: prevent out of bounds table read
+- avfilter/vf_transpose: Fix rounding error
+- avcodec/h264_refs: discard mismatching references
+- avcodec/mjpegdec: Fix small picture upscale
+- avcodec/pngdec: Check values before updating context in decode_fctl_chunk()
+- avcodec/pngdec: Copy IHDR & plte state from last thread
+- avcodec/pngdec: Require a IHDR chunk before fctl
+- avcodec/pngdec: Only allow one IHDR chunk
+- wmavoice: limit wmavoice_decode_packet return value to packet size
+- swscale/swscale_unscaled: Fix rounding difference with RGBA output between 
little and big endian
+- ffmpeg: Do not use the data/size of a bitstream filter after failure
+- swscale/x86/rgb2rgb_template: fix signedness of v in 
shuffle_bytes_2103_{mmx,mmxext}
+- vda: unlock the pixel buffer base address.
+- swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()
+- swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix 
shuffle_bytes_2103_c on BE
+- swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian
+- swr: Remember previously set int_sample_format from user
+- swresample: soxr implementation for swr_get_out_samples()
+- avformat/swfdec: Do not error out on pixel format changes
+- ffmpeg_opt: Fix forcing fourccs
+- configure: Check for x265_api_get
+- swscale/x86/rgb2rgb_template: don't call emms on sse2/avx functions
+- swscale/x86/rgb2rgb_template: add missing xmm clobbers
+- library.mak: Workaround SDL redefining main and breaking fate tests on mingw
+- vaapi_h264: fix RefPicList[] field flags.
+
 version 2.7.1:
 - postproc: fix unaligned access
 - avformat: clarify what package needs to be compiled with SSL support
diff --git a/RELEASE b/RELEASE
index 860487c..37c2961 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-2.7.1
+2.7.2
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 0f847af..1b116d4 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME   = FFmpeg
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 2.7.1
+PROJECT_NUMBER = 2.7.2
 
 # With the PROJECT_LOGO tag one can specify a logo or icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55

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


[FFmpeg-cvslog] avfilter/vf_blend: implement 16bit support

2015-07-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jul 15 18:04:28 
2015 +| [efd4e5fe682027503883441382665812ded62c71] | committer: Paul B Mahol

avfilter/vf_blend: implement 16bit support

Signed-off-by: Paul B Mahol 

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

 libavfilter/vf_blend.c |  325 ++--
 1 file changed, 202 insertions(+), 123 deletions(-)

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 9c93baf..f359dff 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -169,24 +169,50 @@ static void blend_normal(const uint8_t *top, int 
top_linesize,
 av_image_copy_plane(dst, dst_linesize, top, top_linesize, width, end - 
start);
 }
 
-#define DEFINE_BLEND(name, expr)  \
-static void blend_## name(const uint8_t *top, int top_linesize,   \
-  const uint8_t *bottom, int bottom_linesize, \
-  uint8_t *dst, int dst_linesize, \
-  int width, int start, int end,  \
-  FilterParams *param, double *values)\
-{ \
-double opacity = param->opacity;  \
-int i, j; \
-  \
-for (i = start; i < end; i++) {   \
-for (j = 0; j < width; j++) { \
-dst[j] = top[j] + ((expr) - top[j]) * opacity;\
-} \
-dst+= dst_linesize;   \
-top+= top_linesize;   \
-bottom += bottom_linesize;\
-} \
+#define DEFINE_BLEND8(name, expr)  
\
+static void blend_## name##_8bit(const uint8_t *top, int top_linesize, 
\
+ const uint8_t *bottom, int bottom_linesize,   
\
+ uint8_t *dst, int dst_linesize,   
\
+ int width, int start, int end,
\
+ FilterParams *param, double *values)  
\
+{  
\
+double opacity = param->opacity;   
\
+int i, j;  
\
+   
\
+for (i = start; i < end; i++) {
\
+for (j = 0; j < width; j++) {  
\
+dst[j] = top[j] + ((expr) - top[j]) * opacity; 
\
+}  
\
+dst+= dst_linesize;
\
+top+= top_linesize;
\
+bottom += bottom_linesize; 
\
+}  
\
+}
+
+#define DEFINE_BLEND16(name, expr) 
\
+static void blend_## name##_16bit(const uint8_t *_top, int top_linesize,   
\
+  const uint8_t *_bottom, int bottom_linesize, 
\
+  uint8_t *_dst, int dst_linesize, 
\
+  int width, int start, int end,   
\
+  FilterParams *param, double *values) 
\
+{  
\
+const uint16_t *top = (uint16_t*)_top; 
\
+const uint16_t *bottom = (uint16_t*)_bottom;   
\
+uint16_t *dst = (uint16_t*)_dst;   
\
+double opacity = param->opacity;   
\
+int i, j;  
\
+dst_linesize /= 2; 
\
+top_linesize /= 2; 
\
+bottom_linesize /= 2;  
\
+   
\
+for (i = start; i < end; i++) {  

[FFmpeg-cvslog] avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Jul 18 19:02:26 2015 +0200| [9c655d2a57d48707317af149154b9a38893d8a15] | 
committer: Michael Niedermayer

avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()

Fixes: signal_sigsegv_d5de23_967_vp80_00_comprehensive_010.ivf with memlimit 
524288

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a84f0e8d8f293df3c535f9b893730a835bed6520)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index becbb2c..494400f 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2689,6 +2689,9 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
 VP8Context *s = avctx->priv_data;
 int i;
 
+if (!s)
+return 0;
+
 vp8_decode_flush_impl(avctx, 1);
 for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++)
 av_frame_free(&s->frames[i].tf.f);

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


[FFmpeg-cvslog] avcodec/vp8: Check buffer size in vp8_decode_frame_header()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Jul 18 19:18:24 2015 +0200| [08337cca05e6fca34a9efcb9f3ac0219291c3e56] | 
committer: Michael Niedermayer

avcodec/vp8: Check buffer size in vp8_decode_frame_header()

avoids null pointer dereference
Fixes: signal_sigsegv_d5de40_964_vp80-00-comprehensive-010.ivf with memlimit of 
1048576

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 599d746e07319dc792ed2e511b666fe482f1ff88)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp8.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 494400f..25fe70a 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -639,6 +639,11 @@ static int vp8_decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_si
 int width  = s->avctx->width;
 int height = s->avctx->height;
 
+if (buf_size < 3) {
+av_log(s->avctx, AV_LOG_ERROR, "Insufficent data (%d) for header\n", 
buf_size);
+return AVERROR_INVALIDDATA;
+}
+
 s->keyframe  = !(buf[0] & 1);
 s->profile   =  (buf[0]>>1) & 7;
 s->invisible = !(buf[0] & 0x10);

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


[FFmpeg-cvslog] avformat/mov: Fix deallocation when MOVStreamContext failed to allocate

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Tue Jul 14 14:14:16 2015 +0200| [a066b2ceddc64f8d3e8cb8eb8ee129714df302bd] | 
committer: Michael Niedermayer

avformat/mov: Fix deallocation when MOVStreamContext failed to allocate

Fixes: 
260813283176b57b3c9974fe284eebc3_signal_sigsegv_7713351a_991_xtrem_e2_m64q15_a32sxx.3gp
 with memlimit of 262144

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 15629129dde771446a005282ee33c4ea1199e696)

Signed-off-by: Michael Niedermayer 

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

 libavformat/mov.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5ea6932..b42537f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3964,6 +3964,9 @@ static int mov_read_close(AVFormatContext *s)
 AVStream *st = s->streams[i];
 MOVStreamContext *sc = st->priv_data;
 
+if (!sc)
+continue;
+
 av_freep(&sc->ctts_data);
 for (j = 0; j < sc->drefs_count; j++) {
 av_freep(&sc->drefs[j].path);

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


[FFmpeg-cvslog] avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Thu Jul 16 11:52:33 2015 +0200| [73ebc4046e774d93630b6de45bb8fbdb860187bd] | 
committer: Michael Niedermayer

avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case

Fixes: 
b4b47bc2b3fb7ca710bfffe5aa969e37_signal_sigabrt_770eccc9_744_nc_sample2.avi 
with memlimit of 4194304

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit f1a38264f20382731cf2cc75fdd98f4c9a84a626)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index c8f35a7..fbef57c 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -679,6 +679,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 
 copy->internal = av_malloc(sizeof(AVCodecInternal));
 if (!copy->internal) {
+copy->priv_data = NULL;
 err = AVERROR(ENOMEM);
 goto error;
 }

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


[FFmpeg-cvslog] avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Jul 18 11:24:45 2015 +0200| [05684cee424a6e440c6757d224a748a2ffe87dde] | 
committer: Michael Niedermayer

avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()

Avoids leaving stale pointers
Fixes: signal_sigabrt_770eccc9_819_sabtriple.rm with memlimit 536870912

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3197c0aa87a3b7190e17d49e6fbc7b554e4b3f0a)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/rv34.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index c109a9e..51e0f40 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1534,7 +1534,14 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext 
*avctx)
 
 if (avctx->internal->is_copy) {
 r->tmp_b_block_base = NULL;
+r->cbp_chroma   = NULL;
+r->cbp_luma = NULL;
+r->deblock_coefs= NULL;
+r->intra_types_hist = NULL;
+r->mb_type  = NULL;
+
 ff_mpv_idct_init(&r->s);
+
 if ((err = ff_mpv_common_init(&r->s)) < 0)
 return err;
 if ((err = rv34_decoder_alloc(r)) < 0) {

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


[FFmpeg-cvslog] avcodec/diracdec: Check for hpel_base allocation failure

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Sat Jul 18 17:55:19 2015 +0200| [f00f799833afb856ce78b9251e73e72a4a31fd70] | 
committer: Michael Niedermayer

avcodec/diracdec: Check for hpel_base allocation failure

Fixes null pointer dereference
Fixes: signal_sigsegv_b02a96_280_RL_420p_ffdirac.drc with memlimit of 67108864

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 1c5b712c0a643a039d6f34269b4102de313a050a)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/diracdec.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 0213048..49a4952 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1563,7 +1563,7 @@ static void select_dsp_funcs(DiracContext *s, int width, 
int height, int xblen,
 }
 }
 
-static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, 
int width, int height)
+static int interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, 
int width, int height)
 {
 /* chroma allocates an edge of 8 when subsampled
which for 4:2:2 means an h edge of 16 and v edge of 8
@@ -1575,11 +1575,14 @@ static void interpolate_refplane(DiracContext *s, 
DiracFrame *ref, int plane, in
 
 /* no need for hpel if we only have fpel vectors */
 if (!s->mv_precision)
-return;
+return 0;
 
 for (i = 1; i < 4; i++) {
 if (!ref->hpel_base[plane][i])
 ref->hpel_base[plane][i] = av_malloc((height+2*edge) * 
ref->avframe->linesize[plane] + 32);
+if (!ref->hpel_base[plane][i]) {
+return AVERROR(ENOMEM);
+}
 /* we need to be 16-byte aligned even for chroma */
 ref->hpel[plane][i] = ref->hpel_base[plane][i] + 
edge*ref->avframe->linesize[plane] + 16;
 }
@@ -1593,6 +1596,8 @@ static void interpolate_refplane(DiracContext *s, 
DiracFrame *ref, int plane, in
 s->mpvencdsp.draw_edges(ref->hpel[plane][3], 
ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | 
EDGE_BOTTOM);
 }
 ref->interpolated[plane] = 1;
+
+return 0;
 }
 
 /**
@@ -1646,8 +1651,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
 
 select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen);
 
-for (i = 0; i < s->num_refs; i++)
-interpolate_refplane(s, s->ref_pics[i], comp, p->width, 
p->height);
+for (i = 0; i < s->num_refs; i++) {
+int ret = interpolate_refplane(s, s->ref_pics[i], comp, 
p->width, p->height);
+if (ret < 0)
+return ret;
+}
 
 memset(s->mctmp, 0, 4*p->yoffset*p->stride);
 

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


[FFmpeg-cvslog] avfilter/af_aresample: Check ff_all_* for allocation failures

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Fri Jul 17 20:27:25 2015 +0200| [e693af81b7f497817399722a21d95cc3afc3d62b] | 
committer: Michael Niedermayer

avfilter/af_aresample: Check ff_all_* for allocation failures

Fixes: signal_sigabrt_770eccc9_498_divx502.avi with memlimit 1572864

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 2ea8a480832acad3095783bcb11d5f290bec56cf)

Signed-off-by: Michael Niedermayer 

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

 libavfilter/af_aresample.c |   21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 57ac397..6cb765d 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -87,15 +87,24 @@ static int query_formats(AVFilterContext *ctx)
 AVFilterLink *inlink  = ctx->inputs[0];
 AVFilterLink *outlink = ctx->outputs[0];
 
-AVFilterFormats*in_formats  = 
ff_all_formats(AVMEDIA_TYPE_AUDIO);
-AVFilterFormats*out_formats;
-AVFilterFormats*in_samplerates  = ff_all_samplerates();
-AVFilterFormats*out_samplerates;
-AVFilterChannelLayouts *in_layouts  = ff_all_channel_counts();
-AVFilterChannelLayouts *out_layouts;
+AVFilterFormats*in_formats, *out_formats;
+AVFilterFormats*in_samplerates, *out_samplerates;
+AVFilterChannelLayouts *in_layouts, *out_layouts;
 
+
+in_formats  = ff_all_formats(AVMEDIA_TYPE_AUDIO);
+if (!in_formats)
+return AVERROR(ENOMEM);
 ff_formats_ref  (in_formats,  &inlink->out_formats);
+
+in_samplerates  = ff_all_samplerates();
+if (!in_samplerates)
+return AVERROR(ENOMEM);
 ff_formats_ref  (in_samplerates,  &inlink->out_samplerates);
+
+in_layouts  = ff_all_channel_counts();
+if (!in_layouts)
+ return AVERROR(ENOMEM);
 ff_channel_layouts_ref(in_layouts,  &inlink->out_channel_layouts);
 
 if(out_rate > 0) {

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


[FFmpeg-cvslog] wmalosslessdec: reset frame->nb_samples on packet loss

2015-07-18 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.7 | Andreas Cadhalpun 
 | Fri Jul  3 00:02:44 2015 +0200| 
[c001472226c723615fac45cc3228874d9b9679fb] | committer: Michael Niedermayer

wmalosslessdec: reset frame->nb_samples on packet loss

Otherwise a frame with non-zero nb_samples but without any data can be
returned.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 
(cherry picked from commit 42e7a5b3c704985c2c18970cc94a837b413df9d9)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 8094db3..0c85c83 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1005,6 +1005,7 @@ static int decode_frame(WmallDecodeCtx *s)
 if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) {
 /* return an error if no frame could be decoded at all */
 s->packet_loss = 1;
+s->frame->nb_samples = 0;
 return ret;
 }
 for (i = 0; i < s->num_channels; i++) {

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


[FFmpeg-cvslog] swscale/utils: Clear pix buffers

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Wed Jul 15 19:20:19 2015 +0200| [1cbd7b08f661163ea0f41f03752e420a47904c11] | 
committer: Michael Niedermayer

swscale/utils: Clear pix buffers

Fixes use of uninitialized memory
Fixes: 
a96874b9466b6edc660a519c7ad47977_signal_sigsegv_7713351a_744_nc_sample.avi 
with memlimit 2147483648

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a5d44d5c220e12ca0cb7a4eceb0f74759cb13111)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libswscale/utils.c b/libswscale/utils.c
index f9f4ec6..63fb05c 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1487,9 +1487,9 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter 
*srcFilter,
 
 /* Allocate pixbufs (we use dynamic allocation because otherwise we would
  * need to allocate several megabytes to handle all possible cases) */
-FF_ALLOC_OR_GOTO(c, c->lumPixBuf,  c->vLumBufSize * 3 * sizeof(int16_t *), 
fail);
-FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), 
fail);
-FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), 
fail);
+FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf,  c->vLumBufSize * 3 * sizeof(int16_t 
*), fail);
+FF_ALLOCZ_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t 
*), fail);
+FF_ALLOCZ_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t 
*), fail);
 if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
 FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize * 3 * sizeof(int16_t 
*), fail);
 /* Note we need at least one pixel more at the end because of the MMX code

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


[FFmpeg-cvslog] avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()

2015-07-18 Thread Zhang Rui
ffmpeg | branch: release/2.7 | Zhang Rui  | Tue Jul 14 
14:47:26 2015 +0800| [a330aca126eb67d7374f821cbf4765eb6640d00c] | committer: 
Michael Niedermayer

avutil/fifo: Fix the case where func() returns less bytes than requested in 
av_fifo_generic_write()

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

Signed-off-by: Michael Niedermayer 

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

 libavutil/fifo.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index 4ff3194..f2fe93d 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -129,7 +129,8 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int 
size,
 do {
 int len = FFMIN(f->end - wptr, size);
 if (func) {
-if (func(src, wptr, len) <= 0)
+len = func(src, wptr, len);
+if (len <= 0)
 break;
 } else {
 memcpy(wptr, src, len);

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


[FFmpeg-cvslog] ffmpeg: Fix cleanup after failed allocation of output_files

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Tue Jul 14 15:49:41 2015 +0200| [2e7bd0f725c8124a3c040fce60e952d802925cdf] | 
committer: Michael Niedermayer

ffmpeg: Fix cleanup after failed allocation of output_files

Fixes: 
39a25908b84604acdaa490138282d091_signal_sigsegv_7713351a_331_WAWV.avi with 
memlimit of 262144

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6e80fe1ecd984a59bb6c73cbb436cc06536b7728)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 52aa967..ec67af3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -456,7 +456,10 @@ static void ffmpeg_cleanup(int ret)
 /* close files */
 for (i = 0; i < nb_output_files; i++) {
 OutputFile *of = output_files[i];
-AVFormatContext *s = of->ctx;
+AVFormatContext *s;
+if (!of)
+continue;
+s = of->ctx;
 if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
 avio_closep(&s->pb);
 avformat_free_context(s);

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


[FFmpeg-cvslog] avcodec/alac: Clear pointers in allocate_buffers()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Mon Jul 13 15:46:10 2015 +0200| [264eb0074f3b0591c9430b20927d6547c8757c48] | 
committer: Michael Niedermayer

avcodec/alac: Clear pointers in allocate_buffers()

Fixes: 
06a4edb39ad8a9883175f9bd428334a2_signal_sigsegv_7713351a_706_mov__alac__ALAC_6ch.mov

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit f7068bf277a37479aecde2832208d820682b35e6)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/alac.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index b0527f1..a5948bb 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -534,6 +534,12 @@ static int allocate_buffers(ALACContext *alac)
 int ch;
 int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
 
+for (ch = 0; ch < 2; ch++) {
+alac->predict_error_buffer[ch]  = NULL;
+alac->output_samples_buffer[ch] = NULL;
+alac->extra_bits_buffer[ch] = NULL;
+}
+
 for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
 FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
  buf_size, buf_alloc_fail);

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


[FFmpeg-cvslog] ffmpeg: Fix cleanup with ost = NULL

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Mon Jul 13 23:33:18 2015 +0200| [441ef87ea8e0422fa5eee39702cabae141ebda89] | 
committer: Michael Niedermayer

ffmpeg: Fix cleanup with ost = NULL

Fixes: 
09e670595acbdafb226974b08dab66e3_signal_sigabrt_770eccc9_991_xtrem_e2_m64q15_a32sxx.3gp
 with memlimit of 1048576

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 503ec7139f887bf8ed8d57da07ce93c4e88447a6)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 1cf4487..d23e713 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -466,7 +466,12 @@ static void ffmpeg_cleanup(int ret)
 }
 for (i = 0; i < nb_output_streams; i++) {
 OutputStream *ost = output_streams[i];
-AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
+AVBitStreamFilterContext *bsfc;
+
+if (!ost)
+continue;
+
+bsfc = ost->bitstream_filters;
 while (bsfc) {
 AVBitStreamFilterContext *next = bsfc->next;
 av_bitstream_filter_close(bsfc);

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


[FFmpeg-cvslog] ffmpeg: Fix crash with ost->last_frame allocation failure

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Tue Jul 14 13:02:19 2015 +0200| [a18e8d82de87f6cd88a68ede8f5526a102d47869] | 
committer: Michael Niedermayer

ffmpeg: Fix crash with ost->last_frame allocation failure

Fixes: 1013dbde2c360d939cc2dfc33e4f275c_signal_sigsegv_a0500f_45_320vp3.nsv 
with memlimit of 536870912

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit fd4c87fa3becaf8a6c480db915daf51e297b76c5)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index d23e713..52aa967 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1182,7 +1182,7 @@ static void do_video_out(AVFormatContext *s,
 if (!ost->last_frame)
 ost->last_frame = av_frame_alloc();
 av_frame_unref(ost->last_frame);
-if (next_picture)
+if (next_picture && ost->last_frame)
 av_frame_ref(ost->last_frame, next_picture);
 else
 av_frame_free(&ost->last_frame);

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


[FFmpeg-cvslog] avcodec/pthread_frame: check avctx on deallocation

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Mon Jul 13 21:19:04 2015 +0200| [6e53134f98928d4de91341540cfbb64eb328c5f1] | 
committer: Michael Niedermayer

avcodec/pthread_frame: check avctx on deallocation

Fixes null pointer dereferences
Fixes: 
af1a5a33e67e479f439239097bd0d4fd_signal_sigsegv_7713351a_152_Dolby_Rain_Logo.pmp
 with memlimit of 8388608

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5d346feafa817c4fbc30f7ed0b93b2dad6cef15b)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/pthread_frame.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a3fd1ff..c8f35a7 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -572,7 +572,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int 
thread_count)
 pthread_join(p->thread, NULL);
 p->thread_init=0;
 
-if (codec->close)
+if (codec->close && p->avctx)
 codec->close(p->avctx);
 
 release_delayed_buffers(p);
@@ -590,12 +590,13 @@ void ff_frame_thread_free(AVCodecContext *avctx, int 
thread_count)
 av_packet_unref(&p->avpkt);
 av_freep(&p->released_buffers);
 
-if (i) {
+if (i && p->avctx) {
 av_freep(&p->avctx->priv_data);
 av_freep(&p->avctx->slice_offset);
 }
 
-av_freep(&p->avctx->internal);
+if (p->avctx)
+av_freep(&p->avctx->internal);
 av_freep(&p->avctx);
 }
 

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


[FFmpeg-cvslog] avcodec/sanm: Reset sizes in destroy_buffers()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Mon Jul 13 16:05:21 2015 +0200| [237751eb257fd528a91f35f0a835c2273957ee62] | 
committer: Michael Niedermayer

avcodec/sanm: Reset sizes in destroy_buffers()

Fixes crash in 
1288a2fe8e9ae6b00ca40e089d08ca65_signal_sigsegv_771426a7_354_accident.san 
with allocation limit 65536

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 39bbdebb1ed8eb9c9b0cd6db85afde6ba89d86e4)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 9e5ec54..2547abb 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -457,6 +457,7 @@ static void destroy_buffers(SANMVideoContext *ctx)
 ctx->frm0_size =
 ctx->frm1_size =
 ctx->frm2_size = 0;
+init_sizes(ctx, 0, 0);
 }
 
 static av_cold int init_buffers(SANMVideoContext *ctx)

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


[FFmpeg-cvslog] bytestream2: set the reader to the end when reading more than available

2015-07-18 Thread Anton Khirnov
ffmpeg | branch: release/2.7 | Anton Khirnov  | Fri Jul 10 
09:31:24 2015 +0200| [7db809a373f0fb066eea20883d1ba3b35fcbfe70] | committer: 
Michael Niedermayer

bytestream2: set the reader to the end when reading more than available

This prevents possible infinite loops with the calling code along the
lines of while (bytestream2_get_bytes_left()) { ... }, where the reader
does not advance.

CC: libav-sta...@libav.org
(cherry picked from commit 86eee85daddb682fa072c2e2657c90a514b855e3)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index c2cb601..7c05ea6 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -71,8 +71,10 @@ static av_always_inline type bytestream2_get_ ## name ## 
u(GetByteContext *g)  \
 }  
\
 static av_always_inline type bytestream2_get_ ## name(GetByteContext *g)   
\
 {  
\
-if (g->buffer_end - g->buffer < bytes) 
\
+if (g->buffer_end - g->buffer < bytes) {   
\
+g->buffer = g->buffer_end; 
\
 return 0;  
\
+}  
\
 return bytestream2_get_ ## name ## u(g);   
\
 }  
\
 static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g)  
\

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


[FFmpeg-cvslog] avcodec/utils: use a minimum 32pixel width in avcodec_align_dimensions2() for H.264

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Fri Jul 
10 02:01:17 2015 +0200| [0df814cf97310903eecd6b44c0f828c7da52905a] | committer: 
Michael Niedermayer

avcodec/utils: use a minimum 32pixel width in  avcodec_align_dimensions2() for 
H.264

Fixes Assertion failure
Found-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 7ef6656b1e5bfbc7499013d3b38b093b6b2f31ec)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 558afeb..6596aea 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -428,10 +428,12 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 
 *width  = FFALIGN(*width, w_align);
 *height = FFALIGN(*height, h_align);
-if (s->codec_id == AV_CODEC_ID_H264 || s->lowres)
+if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {
 // some of the optimized chroma MC reads one line too much
 // which is also done in mpeg decoders with lowres > 0
 *height += 2;
+*width = FFMAX(*width, 32);
+}
 
 for (i = 0; i < 4; i++)
 linesize_align[i] = STRIDE_ALIGN;

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


[FFmpeg-cvslog] avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Thu Jul 
 9 22:16:15 2015 +0200| [88fa3243ddf320ce1d6691c6098e87263bd6d0ca] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()

This ensures that no stale pointers leak through on any path

Fixes: signal_sigsegv_c3097a_991_xtrem_e2_m64q15_a32sxx.3gp

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b160fc290cf49b516c5b6ee0730fd9da7fc623b1)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpegvideo.c |   82 +---
 1 file changed, 78 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 03d6815..06188a0 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1227,6 +1227,82 @@ fail:
 return AVERROR(ENOMEM);
 }
 
+static void clear_context(MpegEncContext *s)
+{
+int i, j, k;
+
+memset(&s->next_picture, 0, sizeof(s->next_picture));
+memset(&s->last_picture, 0, sizeof(s->last_picture));
+memset(&s->current_picture, 0, sizeof(s->current_picture));
+memset(&s->new_picture, 0, sizeof(s->new_picture));
+
+memset(s->thread_context, 0, sizeof(s->thread_context));
+
+s->me.map = NULL;
+s->me.score_map = NULL;
+s->dct_error_sum = NULL;
+s->block = NULL;
+s->blocks = NULL;
+memset(s->pblocks, 0, sizeof(s->pblocks));
+s->ac_val_base = NULL;
+s->ac_val[0] =
+s->ac_val[1] =
+s->ac_val[2] =NULL;
+s->sc.edge_emu_buffer = NULL;
+s->me.scratchpad = NULL;
+s->me.temp =
+s->sc.rd_scratchpad =
+s->sc.b_scratchpad =
+s->sc.obmc_scratchpad = NULL;
+
+s->parse_context.buffer = NULL;
+s->parse_context.buffer_size = 0;
+s->bitstream_buffer = NULL;
+s->allocated_bitstream_buffer_size = 0;
+s->picture  = NULL;
+s->mb_type  = NULL;
+s->p_mv_table_base  = NULL;
+s->b_forw_mv_table_base = NULL;
+s->b_back_mv_table_base = NULL;
+s->b_bidir_forw_mv_table_base = NULL;
+s->b_bidir_back_mv_table_base = NULL;
+s->b_direct_mv_table_base = NULL;
+s->p_mv_table= NULL;
+s->b_forw_mv_table   = NULL;
+s->b_back_mv_table   = NULL;
+s->b_bidir_forw_mv_table = NULL;
+s->b_bidir_back_mv_table = NULL;
+s->b_direct_mv_table = NULL;
+for (i = 0; i < 2; i++) {
+for (j = 0; j < 2; j++) {
+for (k = 0; k < 2; k++) {
+s->b_field_mv_table_base[i][j][k] = NULL;
+s->b_field_mv_table[i][j][k] = NULL;
+}
+s->b_field_select_table[i][j] = NULL;
+s->p_field_mv_table_base[i][j] = NULL;
+s->p_field_mv_table[i][j] = NULL;
+}
+s->p_field_select_table[i] = NULL;
+}
+
+s->dc_val_base = NULL;
+s->coded_block_base = NULL;
+s->mbintra_table = NULL;
+s->cbp_table = NULL;
+s->pred_dir_table = NULL;
+
+s->mbskip_table = NULL;
+
+s->er.error_status_table = NULL;
+s->er.er_temp_buffer = NULL;
+s->mb_index2xy = NULL;
+s->lambda_table = NULL;
+
+s->cplx_tab = NULL;
+s->bits_tab = NULL;
+}
+
 /**
  * init common structure for both encoder and decoder.
  * this assumes that some variables like width/height are already set
@@ -1238,6 +1314,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
  s->avctx->active_thread_type & FF_THREAD_SLICE) ?
 s->avctx->thread_count : 1;
 
+clear_context(s);
+
 if (s->encoding && s->avctx->slices)
 nb_slices = s->avctx->slices;
 
@@ -1282,10 +1360,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
 if (!s->picture[i].f)
 goto fail;
 }
-memset(&s->next_picture, 0, sizeof(s->next_picture));
-memset(&s->last_picture, 0, sizeof(s->last_picture));
-memset(&s->current_picture, 0, sizeof(s->current_picture));
-memset(&s->new_picture, 0, sizeof(s->new_picture));
 s->next_picture.f = av_frame_alloc();
 if (!s->next_picture.f)
 goto fail;

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


[FFmpeg-cvslog] vp9/update_prob: prevent out of bounds table read

2015-07-18 Thread James Zern
ffmpeg | branch: release/2.7 | James Zern  | Mon Jun 29 
23:03:14 2015 -0700| [662714abbe40249b09c9ef28c6111e8ceb00de58] | committer: 
Michael Niedermayer

vp9/update_prob: prevent out of bounds table read

the max value of the lookup in expanded form is:
(((1 << 7) - 1) << 1) - 65 + 1 + 64 = 254

add one entry of padding to inv_map_table[] to prevent out of bounds
access with non-conforming / fuzzed bitstreams

Signed-off-by: James Zern 
Reviewed-by: "Ronald S. Bultje" 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e91f860ea74e11e9178500fe8794c47f57dbf48c)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp9.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 9d9326c..a7954c3 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -425,7 +425,7 @@ static av_always_inline int inv_recenter_nonneg(int v, int 
m)
 // differential forward probability updates
 static int update_prob(VP56RangeCoder *c, int p)
 {
-static const int inv_map_table[254] = {
+static const int inv_map_table[255] = {
   7,  20,  33,  46,  59,  72,  85,  98, 111, 124, 137, 150, 163, 176,
 189, 202, 215, 228, 241, 254,   1,   2,   3,   4,   5,   6,   8,   9,
  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  21,  22,  23,  24,
@@ -444,7 +444,7 @@ static int update_prob(VP56RangeCoder *c, int p)
 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221,
 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236,
 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
-252, 253,
+252, 253, 253,
 };
 int d;
 
@@ -474,6 +474,7 @@ static int update_prob(VP56RangeCoder *c, int p)
 if (d >= 65)
 d = (d << 1) - 65 + vp8_rac_get(c);
 d += 64;
+av_assert2(d < FF_ARRAY_ELEMS(inv_map_table));
 }
 
 return p <= 128 ? 1 + inv_recenter_nonneg(inv_map_table[d], p - 1) :

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


[FFmpeg-cvslog] avcodec/aacsbr: Assert that bs_num_env is positive

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Wed Jul 
 1 02:08:25 2015 +0200| [bbcf6f5c6200c3458dc344c4ba4abac316c322b6] | committer: 
Michael Niedermayer

avcodec/aacsbr: Assert that bs_num_env is positive

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index ca6dad7..a39b78d 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -1726,6 +1726,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication 
*sbr, int id_aac,
 sbr->c.sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1,
  (const float (*)[40][2]) sbr->X_low, 
sbr->k[0]);
 sbr_chirp(sbr, &sbr->data[ch]);
+av_assert0(sbr->data[ch].bs_num_env > 0);
 sbr_hf_gen(ac, sbr, sbr->X_high,
(const float (*)[40][2]) sbr->X_low,
(const float (*)[2]) sbr->alpha0,

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


[FFmpeg-cvslog] avfilter/vf_transpose: Fix rounding error

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
30 16:01:15 2015 +0200| [51782e86903c49a172c8b5c7e494b72e6c8a8aa4] | committer: 
Michael Niedermayer

avfilter/vf_transpose: Fix rounding error

Fixes out of array access
Fixes: asan_heap-oob_7f875d_3482_cov_1818465256_ssudec.mov

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 911329c..e4de31b 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -151,7 +151,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr,
 int hsub= plane == 1 || plane == 2 ? trans->hsub : 0;
 int vsub= plane == 1 || plane == 2 ? trans->vsub : 0;
 int pixstep = trans->pixsteps[plane];
-int inh = in->height  >> vsub;
+int inh = FF_CEIL_RSHIFT(in->height, vsub);
 int outw= FF_CEIL_RSHIFT(out->width,  hsub);
 int outh= FF_CEIL_RSHIFT(out->height, vsub);
 int start   = (outh *  jobnr   ) / nb_jobs;

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


[FFmpeg-cvslog] avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Sun Jul 
 5 20:00:15 2015 +0200| [ac91bfe086535cfdba443abf3c9cfedf4fd8cb36] | committer: 
Michael Niedermayer

avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()

the later is not optimal when the buffer size is well known at allocation time

This avoids a memcpy()
Overall 2.5% speedup with a random 1920x1080 video

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index d792393..71c1de5 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -54,7 +54,7 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
 if (ret < 0)
 return ret;
 
-if ((ret = ff_alloc_packet2(avctx, pkt, ret)) < 0)
+if ((ret = ff_alloc_packet(pkt, ret)) < 0)
 return ret;
 if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, 
avctx->width,
 avctx->height, pkt->data, pkt->size)) < 0)

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


[FFmpeg-cvslog] oggparsedirac: check return value of init_get_bits

2015-07-18 Thread Chris Watkins
ffmpeg | branch: release/2.7 | Chris Watkins  | Tue Jul  7 
10:23:44 2015 -0700| [2a6f2cd8486fb5fbe4f1d2fa97c272bd4a7b34fb] | committer: 
Michael Niedermayer

oggparsedirac: check return value of init_get_bits

If init_get_bits fails the GetBitContext is invalid and must not be
used. Check the return value in dirac_header and propogate the error.

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

Signed-off-by: Michael Niedermayer 

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

 libavformat/oggparsedirac.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
index 10fb07e..ab40f96 100644
--- a/libavformat/oggparsedirac.c
+++ b/libavformat/oggparsedirac.c
@@ -31,14 +31,19 @@ static int dirac_header(AVFormatContext *s, int idx)
 AVStream *st = s->streams[idx];
 dirac_source_params source;
 GetBitContext gb;
+int ret;
 
 // already parsed the header
 if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
 return 0;
 
-init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
-if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
-return -1;
+ret = init_get_bits8(&gb, os->buf + os->pstart + 13, (os->psize - 13));
+if (ret < 0)
+return ret;
+
+ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source);
+if (ret < 0)
+return ret;
 
 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codec->codec_id = AV_CODEC_ID_DIRAC;

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


[FFmpeg-cvslog] Put a space between string literals and macros.

2015-07-18 Thread Chris Watkins
ffmpeg | branch: release/2.7 | Chris Watkins  | Tue Jul  7 
10:40:27 2015 -0700| [151554e1eb86404fd973dbcf888c50d2d5a51ff5] | committer: 
Michael Niedermayer

Put a space between string literals and macros.

When compiling libavutil/internal.h as C++11, clang warns that a space
is required between a string literal and an identifier. Put spaces
in concatenations of string literals and EXTERN_PREFIX.

Signed-off-by: Chris Watkins 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 55e29ceec84aa498122576c1ae8a0fa1fab0b41e)

Signed-off-by: Michael Niedermayer 

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

 libavutil/internal.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 8817ec3..859b919 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -238,8 +238,8 @@ void avpriv_request_sample(void *avc,
 #if HAVE_LIBC_MSVCRT
 #include 
 #if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
-#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
-#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
+#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_strtod")
+#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_snprintf")
 #endif
 
 #define avpriv_open ff_open

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


[FFmpeg-cvslog] avcodec/h264_refs: discard mismatching references

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
30 03:23:30 2015 +0200| [0afb004d3cc42fa520735436a375fdf8c7af66cd] | committer: 
Michael Niedermayer

avcodec/h264_refs: discard mismatching references

Fixes inconsistency and out of array access
Fixes: asan_heap-oob_17301a3_2100_cov_3226131691_ff_add_pixels_clamped_mmx.m2ts

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/h264_refs.c |   16 
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 379fb26..548a3ba 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -125,6 +125,7 @@ static int add_sorted(H264Picture **sorted, H264Picture 
**src, int len, int limi
 int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl)
 {
 int i, len;
+int j;
 
 if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
 H264Picture *sorted[32];
@@ -188,6 +189,21 @@ int ff_h264_fill_default_ref_list(H264Context *h, 
H264SliceContext *sl)
 }
 }
 #endif
+
+for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
+for (i = 0; i < sl->ref_count[j]; i++) {
+if (h->default_ref_list[j][i].parent) {
+AVFrame *f = h->default_ref_list[j][i].parent->f;
+if (h->cur_pic_ptr->f->width  != f->width ||
+h->cur_pic_ptr->f->height != f->height ||
+h->cur_pic_ptr->f->format != f->format) {
+av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching 
reference\n");
+memset(&h->default_ref_list[j][i], 0, 
sizeof(h->default_ref_list[j][i]));
+}
+}
+}
+}
+
 return 0;
 }
 

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


[FFmpeg-cvslog] wmalosslessdec: avoid reading 0 bits with get_bits

2015-07-18 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.7 | Andreas Cadhalpun 
 | Fri Jul  3 00:01:56 2015 +0200| 
[1ec0541ae05b40f7dfdba76fd3fce4c84d3eac31] | committer: Michael Niedermayer

wmalosslessdec: avoid reading 0 bits with get_bits

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 
(cherry picked from commit f9020d514e9ed5043496a710b36daba1ab182e97)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 843ce90..8094db3 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -488,7 +488,7 @@ static int decode_cdlms(WmallDecodeCtx *s)
 if ((1 << cbits) < s->cdlms[c][i].scaling + 1)
 cbits++;
 
-s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2;
+s->cdlms[c][i].bitsend = (cbits ? get_bits(&s->gb, cbits) : 0) 
+ 2;
 shift_l = 32 - s->cdlms[c][i].bitsend;
 shift_r = 32 - s->cdlms[c][i].scaling - 2;
 for (j = 0; j < s->cdlms[c][i].coefsend; j++)

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


[FFmpeg-cvslog] avcodec/pngdec: Only allow one IHDR chunk

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
29 21:08:05 2015 +0200| [e84d17c7c991f380622f6d2f25994dc6955d853c] | committer: 
Michael Niedermayer

avcodec/pngdec: Only allow one IHDR chunk

Multiple IHDR chunks are forbidden in PNG
Fixes inconsistency and out of array accesses

Fixes: 
asan_heap-oob_4d5c5a_1738_cov_2638287726_c-m2-8f2b481b7fd9bd745e620b7c01a18df2.png

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/pngdec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index ceda383..f8b398f 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -542,6 +542,11 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 return AVERROR_INVALIDDATA;
 }
 
+if (s->state & PNG_IHDR) {
+av_log(avctx, AV_LOG_ERROR, "Multiple IHDR\n");
+return AVERROR_INVALIDDATA;
+}
+
 s->width  = bytestream2_get_be32(&s->gb);
 s->height = bytestream2_get_be32(&s->gb);
 if (av_image_check_size(s->width, s->height, 0, avctx)) {

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


[FFmpeg-cvslog] avcodec/aacsbr: check that the element type matches before applying SBR

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Wed Jul 
 1 02:05:43 2015 +0200| [e740506d31e793801c520e4a6283438d88279e75] | committer: 
Michael Niedermayer

avcodec/aacsbr: check that the element type matches before applying SBR

Fixes out of array access
Fixes: signal_sigsegv_3670fc0_2818_cov_2307326154_moon.mux

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/aacsbr.c |8 
 libavcodec/sbr.h|1 +
 2 files changed, 9 insertions(+)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 7e98834..ca6dad7 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -1019,6 +1019,8 @@ static unsigned int read_sbr_data(AACContext *ac, 
SpectralBandReplication *sbr,
 {
 unsigned int cnt = get_bits_count(gb);
 
+sbr->id_aac = id_aac;
+
 if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
 if (read_sbr_single_channel_element(ac, sbr, gb)) {
 sbr_turnoff(sbr);
@@ -1695,6 +1697,12 @@ void ff_sbr_apply(AACContext *ac, 
SpectralBandReplication *sbr, int id_aac,
 int nch = (id_aac == TYPE_CPE) ? 2 : 1;
 int err;
 
+if (id_aac != sbr->id_aac) {
+av_log(ac->avctx, AV_LOG_ERROR,
+"element type mismatch %d != %d\n", id_aac, sbr->id_aac);
+sbr_turnoff(sbr);
+}
+
 if (!sbr->kx_and_m_pushed) {
 sbr->kx[0] = sbr->kx[1];
 sbr->m[0] = sbr->m[1];
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
index e28fccd..ff00acb 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -137,6 +137,7 @@ typedef struct AACSBRContext {
 struct SpectralBandReplication {
 intsample_rate;
 intstart;
+intid_aac;
 intreset;
 SpectrumParameters spectrum_params;
 intbs_amp_res_header;

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


[FFmpeg-cvslog] avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
30 19:37:12 2015 +0200| [65aac419e53a7f6ed6df1e6bebfc31c6aff3321a] | committer: 
Michael Niedermayer

avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h

Fixes out of array access
Fixes: 
asan_heap-oob_4d5bb0_682_cov_3124593265_Fraunhofer__a_driving_force_in_innovation__small.mp4

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 0712f2d..968e3ec 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1558,8 +1558,8 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
   (const uint8_t **)prev->f->data,
   prev->f->linesize,
   prev->f->format,
-  h->mb_width  * 16,
-  h->mb_height * 16);
+  prev->f->width,
+  prev->f->height);
 h->short_ref[0]->poc = prev->poc + 2;
 }
 h->short_ref[0]->frame_num = h->prev_frame_num;

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


[FFmpeg-cvslog] avcodec/mjpegdec: Fix small picture upscale

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
30 01:19:30 2015 +0200| [a9c3b588af747521a88c57f528df9c740e4b1c6b] | committer: 
Michael Niedermayer

avcodec/mjpegdec: Fix small picture upscale

Fixes out of array access

Fixes: 
asan_heap-oob_1dd60fd_267_cov_2954683513_5baad44ca4702949724234e35c5bb341.jpg

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mjpegdec.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1ce3328..2c18a49 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2192,11 +2192,13 @@ the_end:
 }
 } else if (s->upscale_h[p] == 2) {
 if (is16bit) {
-((uint16_t*)line)[w - 1] =
-((uint16_t*)line)[w - 2] = ((uint16_t*)line)[(w - 1) / 
3];
+((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 
3];
+if (w > 1)
+((uint16_t*)line)[w - 2] = ((uint16_t*)line)[w - 
1];
 } else {
-line[w - 1] =
-line[w - 2] = line[(w - 1) / 3];
+line[w - 1] = line[(w - 1) / 3];
+if (w > 1)
+line[w - 2] = line[w - 1];
 }
 for (index = w - 3; index > 0; index--) {
 line[index] = (line[index / 3] + line[(index + 1) / 3] 
+ line[(index + 2) / 3] + 1) / 3;

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


[FFmpeg-cvslog] swscale/x86/rgb2rgb_template: fix signedness of v in shuffle_bytes_2103_{mmx, mmxext}

2015-07-18 Thread James Almer
ffmpeg | branch: release/2.7 | James Almer  | Tue Jun 23 
01:15:07 2015 -0300| [3f06023bd248248f59914ee4af429d438a39a035] | committer: 
Michael Niedermayer

swscale/x86/rgb2rgb_template: fix signedness of v in 
shuffle_bytes_2103_{mmx,mmxext}

Reviewed-by: Michael Niedermayer 
Signed-off-by: James Almer 
(cherry picked from commit e22edbfd413242dda720dc5191fc00a51c24d74c)

Signed-off-by: Michael Niedermayer 

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

 libswscale/x86/rgb2rgb_template.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/x86/rgb2rgb_template.c 
b/libswscale/x86/rgb2rgb_template.c
index a1f7434..e97ba4f 100644
--- a/libswscale/x86/rgb2rgb_template.c
+++ b/libswscale/x86/rgb2rgb_template.c
@@ -1090,7 +1090,7 @@ static inline void RENAME(shuffle_bytes_2103)(const 
uint8_t *src, uint8_t *dst,
 : "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one)
 : "memory");
 for (; idx<15; idx+=4) {
-register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
+register unsigned v  = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
 v &= 0xff00ff;
 *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
 }

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


[FFmpeg-cvslog] avcodec/pngdec: Require a IHDR chunk before fctl

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
29 21:57:12 2015 +0200| [be54d1f1043e9e4fc58bb7889c9cf85b52de5396] | committer: 
Michael Niedermayer

avcodec/pngdec: Require a IHDR chunk before fctl

This is required by the APNG spec

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/pngdec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f8b398f..85bc447 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -824,6 +824,11 @@ static int decode_fctl_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 if (length != 26)
 return AVERROR_INVALIDDATA;
 
+if (!(s->state & PNG_IHDR)) {
+av_log(avctx, AV_LOG_ERROR, "fctl before IHDR\n");
+return AVERROR_INVALIDDATA;
+}
+
 s->last_w = s->cur_w;
 s->last_h = s->cur_h;
 s->last_x_offset = s->x_offset;

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


[FFmpeg-cvslog] avcodec/pngdec: Copy IHDR & plte state from last thread

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
29 21:59:41 2015 +0200| [cccb06b09573a708a9ce03471db07af8dd47e712] | committer: 
Michael Niedermayer

avcodec/pngdec: Copy IHDR & plte state from last thread

Previously these chunks where parsed again for each frame with threads
but not without leading to a different path and the potential for
inconsistencies

This also removes a related special case from decode_ihdr_chunk()

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/pngdec.c |   23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 85bc447..615aad3 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -547,18 +547,13 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 return AVERROR_INVALIDDATA;
 }
 
-s->width  = bytestream2_get_be32(&s->gb);
-s->height = bytestream2_get_be32(&s->gb);
+s->width  = s->cur_w = bytestream2_get_be32(&s->gb);
+s->height = s->cur_h = bytestream2_get_be32(&s->gb);
 if (av_image_check_size(s->width, s->height, 0, avctx)) {
-s->width = s->height = 0;
+s->cur_w = s->cur_h = s->width = s->height = 0;
 av_log(avctx, AV_LOG_ERROR, "Invalid image size\n");
 return AVERROR_INVALIDDATA;
 }
-if (s->cur_w == 0 && s->cur_h == 0) {
-// Only set cur_w/h if update_thread_context() has not set it
-s->cur_w = s->width;
-s->cur_h = s->height;
-}
 s->bit_depth= bytestream2_get_byte(&s->gb);
 s->color_type   = bytestream2_get_byte(&s->gb);
 s->compression_type = bytestream2_get_byte(&s->gb);
@@ -1269,12 +1264,24 @@ static int update_thread_context(AVCodecContext *dst, 
const AVCodecContext *src)
 (ret = ff_thread_ref_frame(&pdst->picture, &psrc->picture)) < 0)
 return ret;
 if (CONFIG_APNG_DECODER && dst->codec_id == AV_CODEC_ID_APNG) {
+pdst->width = psrc->width;
+pdst->height= psrc->height;
+pdst->bit_depth = psrc->bit_depth;
+pdst->color_type= psrc->color_type;
+pdst->compression_type  = psrc->compression_type;
+pdst->interlace_type= psrc->interlace_type;
+pdst->filter_type   = psrc->filter_type;
 pdst->cur_w = psrc->cur_w;
 pdst->cur_h = psrc->cur_h;
 pdst->x_offset = psrc->x_offset;
 pdst->y_offset = psrc->y_offset;
+
 pdst->dispose_op = psrc->dispose_op;
 
+memcpy(pdst->palette, psrc->palette, sizeof(pdst->palette));
+
+pdst->state |= psrc->state & (PNG_IHDR | PNG_PLTE);
+
 ff_thread_release_buffer(dst, &pdst->last_picture);
 if (psrc->last_picture.f->data[0])
 return ff_thread_ref_frame(&pdst->last_picture, 
&psrc->last_picture);

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


[FFmpeg-cvslog] avcodec/pngdec: Check values before updating context in decode_fctl_chunk( )

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
29 22:32:02 2015 +0200| [f775a92054a4aebbc4acc33795cb9203805e816a] | committer: 
Michael Niedermayer

avcodec/pngdec: Check values before updating context in decode_fctl_chunk()

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/pngdec.c |   34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 615aad3..60c4975 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -815,6 +815,7 @@ static int decode_fctl_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
  uint32_t length)
 {
 uint32_t sequence_number;
+int cur_w, cur_h, x_offset, y_offset, dispose_op, blend_op;
 
 if (length != 26)
 return AVERROR_INVALIDDATA;
@@ -831,23 +832,23 @@ static int decode_fctl_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 s->last_dispose_op = s->dispose_op;
 
 sequence_number = bytestream2_get_be32(&s->gb);
-s->cur_w= bytestream2_get_be32(&s->gb);
-s->cur_h= bytestream2_get_be32(&s->gb);
-s->x_offset = bytestream2_get_be32(&s->gb);
-s->y_offset = bytestream2_get_be32(&s->gb);
+cur_w   = bytestream2_get_be32(&s->gb);
+cur_h   = bytestream2_get_be32(&s->gb);
+x_offset= bytestream2_get_be32(&s->gb);
+y_offset= bytestream2_get_be32(&s->gb);
 bytestream2_skip(&s->gb, 4); /* delay_num (2), delay_den (2) */
-s->dispose_op   = bytestream2_get_byte(&s->gb);
-s->blend_op = bytestream2_get_byte(&s->gb);
+dispose_op  = bytestream2_get_byte(&s->gb);
+blend_op= bytestream2_get_byte(&s->gb);
 bytestream2_skip(&s->gb, 4); /* crc */
 
 if (sequence_number == 0 &&
-(s->cur_w != s->width ||
- s->cur_h != s->height ||
- s->x_offset != 0 ||
- s->y_offset != 0) ||
-s->cur_w <= 0 || s->cur_h <= 0 ||
-s->x_offset < 0 || s->y_offset < 0 ||
-s->cur_w > s->width - s->x_offset|| s->cur_h > s->height - s->y_offset)
+(cur_w != s->width ||
+ cur_h != s->height ||
+ x_offset != 0 ||
+ y_offset != 0) ||
+cur_w <= 0 || cur_h <= 0 ||
+x_offset < 0 || y_offset < 0 ||
+cur_w > s->width - x_offset|| cur_h > s->height - y_offset)
 return AVERROR_INVALIDDATA;
 
 if (sequence_number == 0 && s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
@@ -868,6 +869,13 @@ static int decode_fctl_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 s->dispose_op = APNG_BLEND_OP_SOURCE;
 }
 
+s->cur_w  = cur_w;
+s->cur_h  = cur_h;
+s->x_offset   = x_offset;
+s->y_offset   = y_offset;
+s->dispose_op = dispose_op;
+s->blend_op   = blend_op;
+
 return 0;
 }
 

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


[FFmpeg-cvslog] swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
23 05:09:11 2015 +0200| [f5c880cecb191026aada81feab5afe2332ec1725] | committer: 
Michael Niedermayer

swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()

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

Signed-off-by: Michael Niedermayer 

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

 libswscale/rgb2rgb_template.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index 5b446de..1cc28cd 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -322,7 +322,7 @@ static inline void shuffle_bytes_2103_c(const uint8_t *src, 
uint8_t *dst,
 uint8_t *d   = dst - idx;
 
 for (; idx < 15; idx += 4) {
-register int v= *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
+register unsigned v   = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
 v&= 0xff00ff;
 *(uint32_t *)&d[idx]  = (v >> 16) + g + (v << 16);
 }

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


[FFmpeg-cvslog] swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Tue Jun 
23 04:36:02 2015 +0200| [2af2c7ecff2c5c5f2bc696149f9584c814d23f73] | committer: 
Michael Niedermayer

swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix 
shuffle_bytes_2103_c on BE

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

Signed-off-by: Michael Niedermayer 

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

 libswscale/rgb2rgb.c  |2 +-
 libswscale/rgb2rgb.h  |2 +-
 libswscale/rgb2rgb_template.c |   20 +++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index 5b1fcf7..340174f 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -51,6 +51,7 @@ void (*rgb16to15)(const uint8_t *src, uint8_t *dst, int 
src_size);
 void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size);
 void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size);
 
+void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size);
 void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
 
 void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
@@ -333,7 +334,6 @@ void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, 
\
 }   \
 }
 
-DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
 DEFINE_SHUFFLE_BYTES(1, 2, 3, 0)
 DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
 DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
index 5df5dea..8faebe6 100644
--- a/libswscale/rgb2rgb.h
+++ b/libswscale/rgb2rgb.h
@@ -50,6 +50,7 @@ extern void(*rgb24to15)(const uint8_t *src, uint8_t *dst, 
int src_size);
 extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
 extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
 
+extern void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int 
src_size);
 extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int 
src_size);
 
 void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
@@ -71,7 +72,6 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int 
src_size);
 void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
 voidrgb12to15(const uint8_t *src, uint8_t *dst, int src_size);
 
-void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
 void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size);
 void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size);
 void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size);
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index 70294ae..5b446de 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -328,6 +328,20 @@ static inline void shuffle_bytes_2103_c(const uint8_t 
*src, uint8_t *dst,
 }
 }
 
+static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst,
+int src_size)
+{
+int idx  = 15  - src_size;
+const uint8_t *s = src - idx;
+uint8_t *d   = dst - idx;
+
+for (; idx < 15; idx += 4) {
+register unsigned v   = *(const uint32_t *)&s[idx], g = v & 0x00ff00ff;
+v&= 0xff00ff00;
+*(uint32_t *)&d[idx]  = (v >> 16) + g + (v << 16);
+}
+}
+
 static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int 
src_size)
 {
 unsigned i;
@@ -929,7 +943,11 @@ static av_cold void rgb2rgb_init_c(void)
 rgb24to15  = rgb24to15_c;
 rgb24to16  = rgb24to16_c;
 rgb24tobgr24   = rgb24tobgr24_c;
-#if !HAVE_BIGENDIAN
+#if HAVE_BIGENDIAN
+shuffle_bytes_0321 = shuffle_bytes_2103_c;
+shuffle_bytes_2103 = shuffle_bytes_0321_c;
+#else
+shuffle_bytes_0321 = shuffle_bytes_0321_c;
 shuffle_bytes_2103 = shuffle_bytes_2103_c;
 #endif
 rgb32tobgr16   = rgb32tobgr16_c;

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


[FFmpeg-cvslog] ffmpeg: Do not use the data/size of a bitstream filter after failure

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Wed Jun 
24 13:27:39 2015 +0200| [483a02e25f7babffb1658f6e13f1553d5f8d5370] | committer: 
Michael Niedermayer

ffmpeg: Do not use the data/size of a bitstream filter after failure

Found-by: Rodger Combs
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 8f0f678f090d9939b0014ba85641e2cb83d39cb8)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index f502998..1cf4487 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -650,6 +650,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
 if (!new_pkt.buf)
 exit_program(1);
 } else if (a < 0) {
+new_pkt = *pkt;
 av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for 
stream %d with codec %s",
bsfc->filter->name, pkt->stream_index,
avctx->codec ? avctx->codec->name : "copy");

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


[FFmpeg-cvslog] wmavoice: limit wmavoice_decode_packet return value to packet size

2015-07-18 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.7 | Andreas Cadhalpun 
 | Sun Jun 28 12:40:12 2015 +0200| 
[254fabe758a476587cefe96c49dbd8c8c3d575ac] | committer: Michael Niedermayer

wmavoice: limit wmavoice_decode_packet return value to packet size

Claiming to have decoded more bytes than the packet size is wrong.

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 
(cherry picked from commit 2a4700a4f03280fa8ba4fc0f8a9987bb550f0d1e)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/wmavoice.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index ae88d4e..fff1aa8 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -1982,7 +1982,14 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, 
void *data,
 *got_frame_ptr) {
 cnt += s->spillover_nbits;
 s->skip_bits_next = cnt & 7;
-return cnt >> 3;
+res = cnt >> 3;
+if (res > avpkt->size) {
+av_log(ctx, AV_LOG_ERROR,
+   "Trying to skip %d bytes in packet of size 
%d\n",
+   res, avpkt->size);
+return AVERROR_INVALIDDATA;
+}
+return res;
 } else
 skip_bits_long (gb, s->spillover_nbits - cnt +
 get_bits_count(gb)); // resync
@@ -2001,7 +2008,14 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, 
void *data,
 } else if (*got_frame_ptr) {
 int cnt = get_bits_count(gb);
 s->skip_bits_next = cnt & 7;
-return cnt >> 3;
+res = cnt >> 3;
+if (res > avpkt->size) {
+av_log(ctx, AV_LOG_ERROR,
+   "Trying to skip %d bytes in packet of size %d\n",
+   res, avpkt->size);
+return AVERROR_INVALIDDATA;
+}
+return res;
 } else if ((s->sframe_cache_size = pos) > 0) {
 /* rewind bit reader to start of last (incomplete) superframe... */
 init_get_bits(gb, avpkt->data, size << 3);

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


[FFmpeg-cvslog] swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
22 22:23:22 2015 +0200| [12aa4220dd1fa75590a64520b82f2db2ea080c3e] | committer: 
Michael Niedermayer

swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian

The function is specific to little endian

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

Signed-off-by: Michael Niedermayer 

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

 libswscale/rgb2rgb_template.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index f9a98a8..70294ae 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -929,7 +929,9 @@ static av_cold void rgb2rgb_init_c(void)
 rgb24to15  = rgb24to15_c;
 rgb24to16  = rgb24to16_c;
 rgb24tobgr24   = rgb24tobgr24_c;
+#if !HAVE_BIGENDIAN
 shuffle_bytes_2103 = shuffle_bytes_2103_c;
+#endif
 rgb32tobgr16   = rgb32tobgr16_c;
 rgb32tobgr15   = rgb32tobgr15_c;
 yv12toyuy2 = yv12toyuy2_c;

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


[FFmpeg-cvslog] swscale/swscale_unscaled: Fix rounding difference with RGBA output between little and big endian

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
29 13:51:43 2015 +0200| [d1f8eaf3d2b0b845b7b50e3a82267e2acd7ada02] | committer: 
Michael Niedermayer

swscale/swscale_unscaled: Fix rounding difference with RGBA output between 
little and big endian

Fixes fate/dds-rgb16 on big endian

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

Conflicts:

tests/ref/fate/dds-rgb16

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

 libswscale/swscale_unscaled.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index b426fa1..1dc42c8 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1243,6 +1243,11 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
 if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) 
&& !isRGBA32(srcFormat) && ALT32_CORR<0)
 return NULL;
 
+// Maintain symmetry between endianness
+if (c->flags & SWS_BITEXACT)
+if ((dstFormat == AV_PIX_FMT_RGB32   || dstFormat == AV_PIX_FMT_BGR32  
) && !isRGBA32(srcFormat) && ALT32_CORR>0)
+return NULL;
+
 return conv;
 }
 

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


[FFmpeg-cvslog] vda: unlock the pixel buffer base address.

2015-07-18 Thread Sebastien Zwickert
ffmpeg | branch: release/2.7 | Sebastien Zwickert  | Sat 
Jun 20 13:19:29 2015 +0200| [ce3a8c983f6e31ab685db1ab245d8a00a0d63b68] | 
committer: Michael Niedermayer

vda: unlock the pixel buffer base address.

The pixel buffer base address is never unlocked this causes
a bug with some pixel format types that are produced natively
by the hardware decoder: the first buffer was always used.
Unlock the pixel buffer base address fixes the issue.
(cherry picked from commit c06fdacc3dc706e70d953917fea845532d3703ca)

Signed-off-by: Michael Niedermayer 

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

 ffmpeg_vda.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/ffmpeg_vda.c b/ffmpeg_vda.c
index d15648d..6fe4ed4 100644
--- a/ffmpeg_vda.c
+++ b/ffmpeg_vda.c
@@ -77,6 +77,8 @@ static int vda_retrieve_data(AVCodecContext *s, AVFrame 
*frame)
   frame->width, frame->height);
 
 ret = av_frame_copy_props(vda->tmp_frame, frame);
+CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
+
 if (ret < 0)
 return ret;
 

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


[FFmpeg-cvslog] swr: Remember previously set int_sample_format from user

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | Mon Jun 
22 18:27:27 2015 +0200| [e40688ed807f2a5d4346f95c014921815a8be750] | committer: 
Michael Niedermayer

swr: Remember previously set int_sample_format from user

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

Signed-off-by: Michael Niedermayer 

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

 libswresample/options.c |4 ++--
 libswresample/swresample.c  |2 ++
 libswresample/swresample_internal.h |1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libswresample/options.c b/libswresample/options.c
index de84672..1bc1a70 100644
--- a/libswresample/options.c
+++ b/libswresample/options.c
@@ -49,8 +49,8 @@ static const AVOption options[]={
 {"in_sample_fmt", "set input sample format" , OFFSET( 
in_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , 
INT_MAX, PARAM},
 {"osf"  , "set output sample format", 
OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 
  , INT_MAX, PARAM},
 {"out_sample_fmt"   , "set output sample format", 
OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 
  , INT_MAX, PARAM},
-{"tsf"  , "set internal sample format"  , 
OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 
  , INT_MAX, PARAM},
-{"internal_sample_fmt"  , "set internal sample format"  , 
OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 
  , INT_MAX, PARAM},
+{"tsf"  , "set internal sample format"  , 
OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , 
{.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
+{"internal_sample_fmt"  , "set internal sample format"  , 
OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , 
{.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
 {"icl"  , "set input channel layout", 
OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0   }, 0  
  , INT64_MAX , PARAM, "channel_layout"},
 {"in_channel_layout", "set input channel layout", 
OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0   }, 0  
  , INT64_MAX , PARAM, "channel_layout"},
 {"ocl"  , "set output channel layout"   , 
OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0   }, 0  
  , INT64_MAX , PARAM, "channel_layout"},
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index ab02bac..693a403 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -173,6 +173,8 @@ av_cold int swr_init(struct SwrContext *s){
 s-> in_ch_layout = s-> user_in_ch_layout;
 s->out_ch_layout = s->user_out_ch_layout;
 
+s->int_sample_fmt= s->user_int_sample_fmt;
+
 if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) {
 av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid 
or unsupported.\n", s-> in_ch_layout);
 s->in_ch_layout = 0;
diff --git a/libswresample/swresample_internal.h 
b/libswresample/swresample_internal.h
index 6669cbf..e36faf1 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -119,6 +119,7 @@ struct SwrContext {
 int user_used_ch_count; ///< User set used channel 
count
 int64_t user_in_ch_layout;  ///< User set input 
channel layout
 int64_t user_out_ch_layout; ///< User set output 
channel layout
+enum AVSampleFormat user_int_sample_fmt;///< User set internal 
sample format
 
 struct DitherContext dither;
 

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


[FFmpeg-cvslog] swresample: soxr implementation for swr_get_out_samples()

2015-07-18 Thread Rob Sykes
ffmpeg | branch: release/2.7 | Rob Sykes  | Sun Jun 21 
19:45:50 2015 +| [d403242a289aee3a346d536864485230052b7c57] | committer: 
Michael Niedermayer

swresample: soxr implementation for swr_get_out_samples()

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

Signed-off-by: Michael Niedermayer 

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

 libswresample/soxr_resample.c   |   34 ++
 libswresample/swresample_internal.h |1 +
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/libswresample/soxr_resample.c b/libswresample/soxr_resample.c
index 0f75bc5..535e9ce 100644
--- a/libswresample/soxr_resample.c
+++ b/libswresample/soxr_resample.c
@@ -67,7 +67,17 @@ static void destroy(struct ResampleContext * *c){
 }
 
 static int flush(struct SwrContext *s){
+s->delayed_samples_fixup = soxr_delay((soxr_t)s->resample);
+
 soxr_process((soxr_t)s->resample, NULL, 0, NULL, NULL, 0, NULL);
+
+{
+float f;
+size_t idone, odone;
+soxr_process((soxr_t)s->resample, &f, 0, &idone, &f, 0, &odone);
+s->delayed_samples_fixup -= soxr_delay((soxr_t)s->resample);
+}
+
 return 0;
 }
 
@@ -87,18 +97,34 @@ static int process(
 }
 
 static int64_t get_delay(struct SwrContext *s, int64_t base){
-double delay_s = soxr_delay((soxr_t)s->resample) / s->out_sample_rate;
+double delayed_samples = soxr_delay((soxr_t)s->resample);
+double delay_s;
+
+if (s->flushed)
+delayed_samples += s->delayed_samples_fixup;
+
+delay_s = delayed_samples / s->out_sample_rate;
+
 return (int64_t)(delay_s * base + .5);
 }
 
 static int invert_initial_buffer(struct ResampleContext *c, AudioData *dst, 
const AudioData *src,
- int in_count, int *out_idx, int *out_sz)
-{
+ int in_count, int *out_idx, int *out_sz){
 return 0;
 }
 
+static int64_t get_out_samples(struct SwrContext *s, int in_samples){
+double out_samples = (double)s->out_sample_rate / s->in_sample_rate * 
in_samples;
+double delayed_samples = soxr_delay((soxr_t)s->resample);
+
+if (s->flushed)
+delayed_samples += s->delayed_samples_fixup;
+
+return (int64_t)(out_samples + delayed_samples + 1 + .5);
+}
+
 struct Resampler const swri_soxr_resampler={
 create, destroy, process, flush, NULL /* set_compensation */, get_delay,
-invert_initial_buffer,
+invert_initial_buffer, get_out_samples
 };
 
diff --git a/libswresample/swresample_internal.h 
b/libswresample/swresample_internal.h
index 7595588..6669cbf 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -157,6 +157,7 @@ struct SwrContext {
 int64_t outpts; ///< output PTS
 int64_t firstpts;   ///< first PTS
 int drop_output;///< number of output 
samples to drop
+double delayed_samples_fixup;   ///< soxr 0.1.1: needed to 
fixup delayed_samples after flush has been called.
 
 struct AudioConvert *in_convert;///< input conversion 
context
 struct AudioConvert *out_convert;   ///< output conversion 
context

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


[FFmpeg-cvslog] fate: add test for mergeplanes filter

2015-07-18 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Jul 17 12:52:22 
2015 +| [e03cb1e115b41f8087c91d62e39c3965fc3b9a11] | committer: Paul B Mahol

fate: add test for mergeplanes filter

Signed-off-by: Paul B Mahol 

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

 tests/fate/filter-video.mak   |4 +++
 tests/filtergraphs/mergeplanes|2 ++
 tests/ref/fate/filter-mergeplanes |   51 +
 3 files changed, 57 insertions(+)

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index e8e9d78..909aa29 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -114,6 +114,10 @@ fate-filter-histogram-levels: CMD = framecrc -c:v pgmyuv 
-i $(SRC) -vf histogram
 FATE_FILTER_VSYNTH-$(CONFIG_HISTOGRAM_FILTER) += fate-filter-histogram-waveform
 fate-filter-histogram-waveform: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf 
format=yuv444p,histogram=mode=waveform -flags +bitexact -sws_flags 
+accurate_rnd+bitexact
 
+FATE_FILTER_VSYNTH-$(CONFIG_MERGEPLANES_FILTER) += fate-filter-mergeplanes
+fate-filter-mergeplanes: tests/data/filtergraphs/mergeplanes
+fate-filter-mergeplanes: CMD = framecrc -c:v pgmyuv -i $(SRC) -c:v pgmyuv -i 
$(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/mergeplanes
+
 FATE_FILTER_VSYNTH-$(CONFIG_OVERLAY_FILTER) += fate-filter-overlay
 fate-filter-overlay: tests/data/filtergraphs/overlay
 fate-filter-overlay: CMD = framecrc -c:v pgmyuv -i $(SRC) -c:v pgmyuv -i 
$(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay
diff --git a/tests/filtergraphs/mergeplanes b/tests/filtergraphs/mergeplanes
new file mode 100644
index 000..0058a20
--- /dev/null
+++ b/tests/filtergraphs/mergeplanes
@@ -0,0 +1,2 @@
+sws_flags=+accurate_rnd+bitexact;
+format=yuv420p,mergeplanes=0:yuv444p
diff --git a/tests/ref/fate/filter-mergeplanes 
b/tests/ref/fate/filter-mergeplanes
new file mode 100644
index 000..841d14f
--- /dev/null
+++ b/tests/ref/fate/filter-mergeplanes
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0,  0,  0,1,   304128, 0x90660272
+0,  1,  1,1,   304128, 0x6b09c8a6
+0,  2,  2,1,   304128, 0x343858f3
+0,  3,  3,1,   304128, 0x2f8ba46c
+0,  4,  4,1,   304128, 0xe31fc163
+0,  5,  5,1,   304128, 0xc1f3a301
+0,  6,  6,1,   304128, 0x76b132d2
+0,  7,  7,1,   304128, 0xf47b97f1
+0,  8,  8,1,   304128, 0x12089641
+0,  9,  9,1,   304128, 0x04156f0f
+0, 10, 10,1,   304128, 0xc8bf96e8
+0, 11, 11,1,   304128, 0xbecdae62
+0, 12, 12,1,   304128, 0x74053994
+0, 13, 13,1,   304128, 0xc1f3eec7
+0, 14, 14,1,   304128, 0xf4e496b3
+0, 15, 15,1,   304128, 0xa5a3d663
+0, 16, 16,1,   304128, 0x1d3738ea
+0, 17, 17,1,   304128, 0xfdfa09f5
+0, 18, 18,1,   304128, 0x8844bbc5
+0, 19, 19,1,   304128, 0x7eb20cea
+0, 20, 20,1,   304128, 0x5b5e7351
+0, 21, 21,1,   304128, 0x2b5e5fc1
+0, 22, 22,1,   304128, 0xd6a2e9a7
+0, 23, 23,1,   304128, 0xf56ed1be
+0, 24, 24,1,   304128, 0xd60530a5
+0, 25, 25,1,   304128, 0x363aa5bf
+0, 26, 26,1,   304128, 0x37f56bb0
+0, 27, 27,1,   304128, 0xe8428c1f
+0, 28, 28,1,   304128, 0x78ef39cf
+0, 29, 29,1,   304128, 0x76b2ab97
+0, 30, 30,1,   304128, 0x3f09f5ef
+0, 31, 31,1,   304128, 0x6f2c0371
+0, 32, 32,1,   304128, 0x8baaf4a3
+0, 33, 33,1,   304128, 0xda157bc0
+0, 34, 34,1,   304128, 0xae46ebb0
+0, 35, 35,1,   304128, 0xbe3458a2
+0, 36, 36,1,   304128, 0x9784f913
+0, 37, 37,1,   304128, 0xa67d93cd
+0, 38, 38,1,   304128, 0x8b0e84ba
+0, 39, 39,1,   304128, 0x583250f1
+0, 40, 40,1,   304128, 0x7d1ee0a8
+0, 41, 41,1,   304128, 0x6d83f980
+0, 42, 42,1,   304128, 0x027ce4c5
+0, 43, 43,1,   304128, 0xcf1a0c75
+0, 44, 44,1,   304128, 0xbd1c2e5c
+0, 45, 45,1,   304128, 0x36d4fe48
+0, 46, 46,1,   304128, 0x9cc1650e
+0, 47, 47,1,   304128, 0xf1af6288
+0, 48, 48,1,   304128, 0x5eb8d36e
+0, 4

[FFmpeg-cvslog] avcodec/vp8: Check buffer size in vp8_decode_frame_header()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 19:18:24 2015 +0200| [599d746e07319dc792ed2e511b666fe482f1ff88] | 
committer: Michael Niedermayer

avcodec/vp8: Check buffer size in vp8_decode_frame_header()

avoids null pointer dereference
Fixes: signal_sigsegv_d5de40_964_vp80-00-comprehensive-010.ivf with memlimit of 
1048576

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/vp8.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 494400f..25fe70a 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -639,6 +639,11 @@ static int vp8_decode_frame_header(VP8Context *s, const 
uint8_t *buf, int buf_si
 int width  = s->avctx->width;
 int height = s->avctx->height;
 
+if (buf_size < 3) {
+av_log(s->avctx, AV_LOG_ERROR, "Insufficent data (%d) for header\n", 
buf_size);
+return AVERROR_INVALIDDATA;
+}
+
 s->keyframe  = !(buf[0] & 1);
 s->profile   =  (buf[0]>>1) & 7;
 s->invisible = !(buf[0] & 0x10);

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


[FFmpeg-cvslog] avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 19:02:26 2015 +0200| [a84f0e8d8f293df3c535f9b893730a835bed6520] | 
committer: Michael Niedermayer

avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()

Fixes: signal_sigsegv_d5de23_967_vp80_00_comprehensive_010.ivf with memlimit 
524288

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index becbb2c..494400f 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2689,6 +2689,9 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
 VP8Context *s = avctx->priv_data;
 int i;
 
+if (!s)
+return 0;
+
 vp8_decode_flush_impl(avctx, 1);
 for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++)
 av_frame_free(&s->frames[i].tf.f);

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


[FFmpeg-cvslog] avcodec/diracdec: Check for hpel_base allocation failure

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 17:55:19 2015 +0200| [1c5b712c0a643a039d6f34269b4102de313a050a] | 
committer: Michael Niedermayer

avcodec/diracdec: Check for hpel_base allocation failure

Fixes null pointer dereference
Fixes: signal_sigsegv_b02a96_280_RL_420p_ffdirac.drc with memlimit of 67108864

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/diracdec.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 0213048..49a4952 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1563,7 +1563,7 @@ static void select_dsp_funcs(DiracContext *s, int width, 
int height, int xblen,
 }
 }
 
-static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, 
int width, int height)
+static int interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, 
int width, int height)
 {
 /* chroma allocates an edge of 8 when subsampled
which for 4:2:2 means an h edge of 16 and v edge of 8
@@ -1575,11 +1575,14 @@ static void interpolate_refplane(DiracContext *s, 
DiracFrame *ref, int plane, in
 
 /* no need for hpel if we only have fpel vectors */
 if (!s->mv_precision)
-return;
+return 0;
 
 for (i = 1; i < 4; i++) {
 if (!ref->hpel_base[plane][i])
 ref->hpel_base[plane][i] = av_malloc((height+2*edge) * 
ref->avframe->linesize[plane] + 32);
+if (!ref->hpel_base[plane][i]) {
+return AVERROR(ENOMEM);
+}
 /* we need to be 16-byte aligned even for chroma */
 ref->hpel[plane][i] = ref->hpel_base[plane][i] + 
edge*ref->avframe->linesize[plane] + 16;
 }
@@ -1593,6 +1596,8 @@ static void interpolate_refplane(DiracContext *s, 
DiracFrame *ref, int plane, in
 s->mpvencdsp.draw_edges(ref->hpel[plane][3], 
ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | 
EDGE_BOTTOM);
 }
 ref->interpolated[plane] = 1;
+
+return 0;
 }
 
 /**
@@ -1646,8 +1651,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
 
 select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen);
 
-for (i = 0; i < s->num_refs; i++)
-interpolate_refplane(s, s->ref_pics[i], comp, p->width, 
p->height);
+for (i = 0; i < s->num_refs; i++) {
+int ret = interpolate_refplane(s, s->ref_pics[i], comp, 
p->width, p->height);
+if (ret < 0)
+return ret;
+}
 
 memset(s->mctmp, 0, 4*p->yoffset*p->stride);
 

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


[FFmpeg-cvslog] avformat/movenc: Drop redundant bit exact field from context

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 13:17:21 2015 +0200| [a194298954e98d915790ef4f7f277f50762be1ad] | 
committer: Michael Niedermayer

avformat/movenc: Drop redundant bit exact field from context

Signed-off-by: Michael Niedermayer 

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

 libavformat/movenc.c |8 ++--
 libavformat/movenc.h |1 -
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 77905eb..8b7e582 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3116,7 +3116,6 @@ static void mov_write_psp_udta_tag(AVIOContext *pb,
 
 static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
 {
-MOVMuxContext *mov = s->priv_data;
 AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
 int64_t pos, pos2;
 
@@ -3141,7 +3140,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, 
AVFormatContext *s)
 avio_wb16(pb, 0x0);  /* ? */
 avio_wb16(pb, 0x021C);   /* data */
 
-if (!mov->exact)
+if (!(s->flags & AVFMT_FLAG_BITEXACT))
 mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT,  "eng", 0x04);
 mov_write_psp_udta_tag(pb, title->value,  "eng", 0x01);
 mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03);
@@ -3276,7 +3275,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov)
 avio_printf(pb, "\n");
 avio_printf(pb, "http://www.w3.org/2001/SMIL20/Language\";>\n");
 avio_printf(pb, "\n");
-if (!mov->exact)
+if (!(mov->fc->flags & AVFMT_FLAG_BITEXACT))
 avio_printf(pb, "\n",
 LIBAVFORMAT_IDENT);
 avio_printf(pb, "\n");
@@ -4961,9 +4960,6 @@ static int mov_write_header(AVFormatContext *s)
 else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V;
 }
 
-if (s->flags & AVFMT_FLAG_BITEXACT)
-mov->exact = 1;
-
 if (mov->flags & FF_MOV_FLAG_DELAY_MOOV)
 mov->flags |= FF_MOV_FLAG_EMPTY_MOOV;
 
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 744d14e..75d7782 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -164,7 +164,6 @@ typedef struct MOVMuxContext {
 
 int flags;
 int rtp_flags;
-int exact;
 
 int iods_skip;
 int iods_video_profile;

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


[FFmpeg-cvslog] avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 11:24:45 2015 +0200| [3197c0aa87a3b7190e17d49e6fbc7b554e4b3f0a] | 
committer: Michael Niedermayer

avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()

Avoids leaving stale pointers
Fixes: signal_sigabrt_770eccc9_819_sabtriple.rm with memlimit 536870912

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 

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

 libavcodec/rv34.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index c109a9e..51e0f40 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1534,7 +1534,14 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext 
*avctx)
 
 if (avctx->internal->is_copy) {
 r->tmp_b_block_base = NULL;
+r->cbp_chroma   = NULL;
+r->cbp_luma = NULL;
+r->deblock_coefs= NULL;
+r->intra_types_hist = NULL;
+r->mb_type  = NULL;
+
 ff_mpv_idct_init(&r->s);
+
 if ((err = ff_mpv_common_init(&r->s)) < 0)
 return err;
 if ((err = rv34_decoder_alloc(r)) < 0) {

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


[FFmpeg-cvslog] avutil/frame: Update AVFrame docs library references

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 10:45:57 2015 +0200| [129785b5e8abfd5d5e05515b6255062479c7f977] | 
committer: Michael Niedermayer

avutil/frame: Update AVFrame docs library references

These where apparently forgotten when AVFrames where moved into libavutil

Signed-off-by: Michael Niedermayer 

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

 libavutil/frame.h |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index e910b51..196b578 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -507,7 +507,7 @@ typedef struct AVFrame {
 
 /**
  * frame timestamp estimated using various heuristics, in stream time base
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_best_effort_timestamp(frame)
  * - encoding: unused
  * - decoding: set by libavcodec, read by user.
@@ -516,7 +516,7 @@ typedef struct AVFrame {
 
 /**
  * reordered pos from the last AVPacket that has been input into the 
decoder
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_pkt_pos(frame)
  * - encoding: unused
  * - decoding: Read by user.
@@ -526,7 +526,7 @@ typedef struct AVFrame {
 /**
  * duration of the corresponding packet, expressed in
  * AVStream->time_base units, 0 if unknown.
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_pkt_duration(frame)
  * - encoding: unused
  * - decoding: Read by user.
@@ -535,7 +535,7 @@ typedef struct AVFrame {
 
 /**
  * metadata.
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_metadata(frame)
  * - encoding: Set by user.
  * - decoding: Set by libavcodec.
@@ -546,7 +546,7 @@ typedef struct AVFrame {
  * decode error flags of the frame, set to a combination of
  * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
  * were errors during the decoding.
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_decode_error_flags(frame)
  * - encoding: unused
  * - decoding: set by libavcodec, read by user.
@@ -557,7 +557,7 @@ typedef struct AVFrame {
 
 /**
  * number of audio channels, only used for audio.
- * Code outside libavcodec should access this field using:
+ * Code outside libavutil should access this field using:
  * av_frame_get_channels(frame)
  * - encoding: unused
  * - decoding: Read by user.
@@ -583,7 +583,7 @@ typedef struct AVFrame {
 /**
  * Accessors for some AVFrame fields.
  * The position of these field in the structure is not part of the ABI,
- * they should not be accessed directly outside libavcodec.
+ * they should not be accessed directly outside libavutil.
  */
 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
 voidav_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);

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


[FFmpeg-cvslog] avfilter/af_dynaudnorm: Use av_frame_get_channels()

2015-07-18 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 18 10:45:12 2015 +0200| [2927b61c559fefd2da1c693c0787fcdbd7706b09] | 
committer: Michael Niedermayer

avfilter/af_dynaudnorm: Use av_frame_get_channels()

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c
index ba3a008..60d6c87 100644
--- a/libavfilter/af_dynaudnorm.c
+++ b/libavfilter/af_dynaudnorm.c
@@ -334,7 +334,7 @@ static double find_peak_magnitude(AVFrame *frame, int 
channel)
 int c, i;
 
 if (channel == -1) {
-for (c = 0; c < frame->channels; c++) {
+for (c = 0; c < av_frame_get_channels(frame); c++) {
 double *data_ptr = (double *)frame->extended_data[c];
 
 for (i = 0; i < frame->nb_samples; i++)
@@ -356,7 +356,7 @@ static double compute_frame_rms(AVFrame *frame, int channel)
 int c, i;
 
 if (channel == -1) {
-for (c = 0; c < frame->channels; c++) {
+for (c = 0; c < av_frame_get_channels(frame); c++) {
 const double *data_ptr = (double *)frame->extended_data[c];
 
 for (i = 0; i < frame->nb_samples; i++) {
@@ -364,7 +364,7 @@ static double compute_frame_rms(AVFrame *frame, int channel)
 }
 }
 
-rms_value /= frame->nb_samples * frame->channels;
+rms_value /= frame->nb_samples * av_frame_get_channels(frame);
 } else {
 const double *data_ptr = (double *)frame->extended_data[channel];
 for (i = 0; i < frame->nb_samples; i++) {

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