[FFmpeg-cvslog] avcodec/snowenc: Mark as FF_CODEC_CAP_INIT_THREADSAFE and FF_CODEC_CAP_INIT_CLEANUP

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat Apr 25 
12:44:04 2015 +0200| [d49210788b0836d56dd872d517fe73f83b080101] | committer: 
Michael Niedermayer

avcodec/snowenc: Mark as FF_CODEC_CAP_INIT_THREADSAFE and 
FF_CODEC_CAP_INIT_CLEANUP

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index d192d1c..ea5e544 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -60,7 +60,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
 }
 
 if ((ret = ff_snow_common_init(avctx)) < 0) {
-ff_snow_common_end(avctx->priv_data);
 return ret;
 }
 ff_mpegvideoencdsp_init(&s->mpvencdsp, avctx);
@@ -1903,6 +1902,8 @@ AVCodec ff_snow_encoder = {
 AV_PIX_FMT_NONE
 },
 .priv_class = &snowenc_class,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
+  FF_CODEC_CAP_INIT_CLEANUP,
 };
 
 

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


[FFmpeg-cvslog] avcodec/mips: disable assembly not supported for Loongson-3

2015-04-25 Thread ZhouXiaoyong
ffmpeg | branch: master | ZhouXiaoyong  | Wed Apr 15 
20:18:15 2015 +0800| [6c5ef7f65732e87866218b601eba6bd28acb5cb5] | committer: 
Michael Niedermayer

avcodec/mips: disable assembly not supported for Loongson-3

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mips/aacsbr_mips.h |4 ++--
 libavcodec/mips/iirfilter_mips.c  |4 
 libavcodec/mips/mpegaudiodsp_mips_float.c |6 ++
 libavcodec/mips/sbrdsp_mips.c |4 
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mips/aacsbr_mips.h b/libavcodec/mips/aacsbr_mips.h
index da8389f..e525197 100644
--- a/libavcodec/mips/aacsbr_mips.h
+++ b/libavcodec/mips/aacsbr_mips.h
@@ -149,7 +149,7 @@ static void sbr_qmf_analysis_mips(AVFloatDSPContext *fdsp, 
FFTContext *mdct,
 }
 }
 
-#if HAVE_MIPSFPU
+#if (HAVE_MIPSFPU && !HAVE_LOONGSON3)
 static void sbr_qmf_synthesis_mips(FFTContext *mdct,
   SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp,
   float *out, float X[2][38][64],
@@ -488,7 +488,7 @@ static void sbr_qmf_synthesis_mips(FFTContext *mdct,
 #define sbr_qmf_analysis sbr_qmf_analysis_mips
 #define sbr_qmf_synthesis sbr_qmf_synthesis_mips
 
-#endif /* HAVE_MIPSFPU */
+#endif /* (HAVE_MIPSFPU && !HAVE_LOONGSON3) */
 #endif /* HAVE_INLINE_ASM */
 
 #endif /* AVCODEC_MIPS_AACSBR_FLOAT_H */
diff --git a/libavcodec/mips/iirfilter_mips.c b/libavcodec/mips/iirfilter_mips.c
index a5646cd..5a145cf 100644
--- a/libavcodec/mips/iirfilter_mips.c
+++ b/libavcodec/mips/iirfilter_mips.c
@@ -55,6 +55,7 @@
 #include "libavcodec/iirfilter.h"
 
 #if HAVE_INLINE_ASM
+#if !HAVE_LOONGSON3
 typedef struct FFIIRFilterCoeffs {
 int   order;
 float gain;
@@ -195,10 +196,13 @@ static void ff_iir_filter_flt_mips(const struct 
FFIIRFilterCoeffs *c,
 }
 }
 }
+#endif /* !HAVE_LOONGSON3 */
 #endif /* HAVE_INLINE_ASM */
 
 void ff_iir_filter_init_mips(FFIIRFilterContext *f) {
 #if HAVE_INLINE_ASM
+#if !HAVE_LOONGSON3
 f->filter_flt = ff_iir_filter_flt_mips;
+#endif /* !HAVE_LOONGSON3 */
 #endif /* HAVE_INLINE_ASM */
 }
diff --git a/libavcodec/mips/mpegaudiodsp_mips_float.c 
b/libavcodec/mips/mpegaudiodsp_mips_float.c
index bd36894..beebace 100644
--- a/libavcodec/mips/mpegaudiodsp_mips_float.c
+++ b/libavcodec/mips/mpegaudiodsp_mips_float.c
@@ -278,6 +278,7 @@ static void ff_mpadsp_apply_window_mips_float(float 
*synth_buf, float *window,
 );
 }
 
+#if !HAVE_LOONGSON3
 static void ff_dct32_mips_float(float *out, const float *tab)
 {
 float val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7,
@@ -786,6 +787,7 @@ static void ff_dct32_mips_float(float *out, const float 
*tab)
 out[15] = val30 + val17;
 out[31] = val31;
 }
+#endif /* !HAVE_LOONGSON3 */
 
 static void imdct36_mips_float(float *out, float *buf, float *in, float *win)
 {
@@ -1224,6 +1226,7 @@ static void imdct36_mips_float(float *out, float *buf, 
float *in, float *win)
 );
 }
 
+#if !HAVE_LOONGSON3
 static void ff_imdct36_blocks_mips_float(float *out, float *buf, float *in,
int count, int switch_point, int block_type)
 {
@@ -1242,10 +1245,13 @@ static void ff_imdct36_blocks_mips_float(float *out, 
float *buf, float *in,
 out++;
 }
 }
+#endif /* !HAVE_LOONGSON3 */
 
 void ff_mpadsp_init_mipsfpu(MPADSPContext *s)
 {
 s->apply_window_float   = ff_mpadsp_apply_window_mips_float;
+#if !HAVE_LOONGSON3
 s->imdct36_blocks_float = ff_imdct36_blocks_mips_float;
 s->dct32_float  = ff_dct32_mips_float;
+#endif /* !HAVE_LOONGSON3 */
 }
diff --git a/libavcodec/mips/sbrdsp_mips.c b/libavcodec/mips/sbrdsp_mips.c
index c203095..63361e4 100644
--- a/libavcodec/mips/sbrdsp_mips.c
+++ b/libavcodec/mips/sbrdsp_mips.c
@@ -438,6 +438,7 @@ static void sbr_qmf_deint_bfly_mips(float *v, const float 
*src0, const float *sr
 }
 }
 
+#if !HAVE_LOONGSON3
 static void sbr_autocorrelate_mips(const float x[40][2], float phi[3][2][2])
 {
 int i;
@@ -606,6 +607,7 @@ static void sbr_autocorrelate_mips(const float x[40][2], 
float phi[3][2][2])
 : "memory"
 );
 }
+#endif /* !HAVE_LOONGSON3 */
 
 static void sbr_hf_gen_mips(float (*X_high)[2], const float (*X_low)[2],
  const float alpha0[2], const float alpha1[2],
@@ -894,7 +896,9 @@ void ff_sbrdsp_init_mips(SBRDSPContext *s)
 s->sum64x5 = sbr_sum64x5_mips;
 s->sum_square = sbr_sum_square_mips;
 s->qmf_deint_bfly = sbr_qmf_deint_bfly_mips;
+#if !HAVE_LOONGSON3
 s->autocorrelate = sbr_autocorrelate_mips;
+#endif /* !HAVE_LOONGSON3 */
 s->hf_gen = sbr_hf_gen_mips;
 s->hf_g_filt = sbr_hf_g_filt_mips;
 

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


[FFmpeg-cvslog] configure: add Loongson-3 support

2015-04-25 Thread ZhouXiaoyong
ffmpeg | branch: master | ZhouXiaoyong  | Wed Apr 15 
19:50:01 2015 +0800| [663321ed50ce314b0a44b7265da95505b1eebbb1] | committer: 
Michael Niedermayer

configure: add Loongson-3 support

Signed-off-by: Michael Niedermayer 

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

 configure |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/configure b/configure
index e2bd3de..88e0d97 100755
--- a/configure
+++ b/configure
@@ -366,6 +366,7 @@ Optimization options (experts only):
   --disable-mipsdspr2  disable MIPS DSP ASE R2 optimizations
   --disable-msadisable MSA optimizations
   --disable-mipsfpudisable floating point MIPS optimizations
+  --disable-loongson3  disable Loongson-3 SIMD optimizations
   --disable-fast-unaligned consider unaligned accesses slow
 
 Developer options (useful when working on FFmpeg itself):
@@ -1576,6 +1577,7 @@ ARCH_EXT_LIST_MIPS="
 mipsdspr1
 mipsdspr2
 msa
+loongson3
 "
 
 ARCH_EXT_LIST_X86_SIMD="
@@ -2024,6 +2026,7 @@ mips32r2_deps="mips"
 mips32r5_deps="mips"
 mips64r6_deps="mips"
 msa_deps="mips"
+loongson3_deps="mips"
 
 altivec_deps="ppc"
 dcbzl_deps="ppc"
@@ -3916,6 +3919,23 @@ elif enabled mips; then
 check_cflags "-mtune=i6400 -mabi=64"
 check_ldflags "-mabi=64"
 ;;
+loongson3*)
+enable mipsfpu
+disable mips32r2
+disable mips32r5
+disable mips64r6
+disable mipsdspr1
+disable mipsdspr2
+disable msa
+enable local_aligned_8 local_aligned_16
+enable simd_align_16
+enable fast_64bit
+enable fast_clz
+enable fast_cmov
+enable fast_unaligned
+disable aligned_stack
+cpuflags="-march=$cpu"
+;;
 generic)
 disable mips32r5
 disable mips64r6
@@ -4696,6 +4716,8 @@ elif enabled mips; then
  check_inline_asm mipsfpu   '"madd.d $f0, $f2, $f4, $f6"'
 enabled msa   && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
  check_inline_asm msa   '"addvi.b $w0, $w1, 1"'
+enabled loongson3 && add_cflags "-mhard-float" && add_asflags 
"-mhard-float" &&
+check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
 
 enabled mips32r5 && add_asflags "-mips32r5 -mfp64"
 enabled mips64r6 && add_asflags "-mips64r6 -mfp64"
@@ -5665,6 +5687,7 @@ if enabled mips; then
 echo "MIPS DSP R1 enabled   ${mipsdspr1-no}"
 echo "MIPS DSP R2 enabled   ${mipsdspr2-no}"
 echo "MIPS MSA enabled  ${msa-no}"
+echo "LOONGSON3 enabled ${loongson3-no}"
 fi
 if enabled ppc; then
 echo "AltiVec enabled   ${altivec-no}"

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


[FFmpeg-cvslog] avutil/softfloat: document av_int2sf()

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat Apr 25 
14:51:02 2015 +0200| [a3110beebd781c422ab98792227f51c46ac5918e] | committer: 
Michael Niedermayer

avutil/softfloat: document av_int2sf()

Signed-off-by: Michael Niedermayer 

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

 libavutil/softfloat.h |4 
 1 file changed, 4 insertions(+)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 654a31f..2e85765 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -116,6 +116,10 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, 
SoftFloat b){
 
 //FIXME sqrt, log, exp, pow, sin, cos
 
+/**
+ * Converts a mantisse and exponent to a SoftFloat
+ * @returns a SoftFloat with value v * 2^frac_bits
+ */
 static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
 return av_normalize_sf((SoftFloat){v, ONE_BITS-frac_bits});
 }

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


[FFmpeg-cvslog] avcodec/h264: Do not fail with randomly truncated VUIs

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Fri Apr 
10 18:35:07 2015 +0200| [fd90005b4619b5f2731a5ec83af8c60a6bb1a5eb] | committer: 
Michael Niedermayer

avcodec/h264: Do not fail with randomly truncated VUIs

Fixes Ticket4445

Tested-by: Vittorio Giovara 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit bc48c88918f767e0dffcd138ae8e5c3052e8a92f)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/h264.c|9 +++--
 libavcodec/h264.h|2 +-
 libavcodec/h264_parser.c |2 +-
 libavcodec/h264_ps.c |7 ---
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4fde344..4757015 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1686,7 +1686,9 @@ again:
 break;
 case NAL_SPS:
 init_get_bits(&h->gb, ptr, bit_length);
-if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? 
nalsize : 1)) {
+if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+break;
+if (h->is_avc ? nalsize : 1) {
 av_log(h->avctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the 
complete NAL\n");
 if (h->is_avc)
@@ -1695,8 +1697,11 @@ again:
 break;
 init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
   8*(next_avc - buf_index + consumed - 1));
-ff_h264_decode_seq_parameter_set(h);
+if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
+break;
 }
+init_get_bits(&h->gb, ptr, bit_length);
+ff_h264_decode_seq_parameter_set(h, 1);
 
 break;
 case NAL_PPS:
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index ec0b023..2c97593 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -779,7 +779,7 @@ int ff_h264_decode_sei(H264Context *h);
 /**
  * Decode SPS
  */
-int ff_h264_decode_seq_parameter_set(H264Context *h);
+int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation);
 
 /**
  * compute profile from sps
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 14d709c..d57bf5f 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -271,7 +271,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 init_get_bits(&h->gb, ptr, 8 * dst_length);
 switch (h->nal_unit_type) {
 case NAL_SPS:
-ff_h264_decode_seq_parameter_set(h);
+ff_h264_decode_seq_parameter_set(h, 0);
 break;
 case NAL_PPS:
 ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index d969aa1..0e8be36 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -317,7 +317,7 @@ static void decode_scaling_matrices(H264Context *h, SPS 
*sps,
 }
 }
 
-int ff_h264_decode_seq_parameter_set(H264Context *h)
+int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
 {
 int profile_idc, level_idc, constraint_set_flags = 0;
 unsigned int sps_id;
@@ -538,9 +538,10 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
 }
 
 if (get_bits_left(&h->gb) < 0) {
-av_log(h->avctx, AV_LOG_ERROR,
+av_log(h->avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR,
"Overread %s by %d bits\n", sps->vui_parameters_present_flag ? 
"VUI" : "SPS", -get_bits_left(&h->gb));
-goto fail;
+if (!ignore_truncation)
+goto fail;
 }
 
 if (!sps->sar.den)

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


[FFmpeg-cvslog] avformat/img2dec: do not rewind custom io buffers

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Mon Apr 
20 23:59:53 2015 +0200| [8c832e3cc05c4590054cf49630b2f026eec4c734] | committer: 
Michael Niedermayer

avformat/img2dec: do not rewind custom io buffers

Fixes double free with some applications

Fixes vlc ticket14121
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e6e8cc8ce9c2a398fbb51254a5067f4bd3c4fa8a)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 6f10369..1509f19 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -339,7 +339,10 @@ int ff_img_read_header(AVFormatContext *s1)
 break;
 }
 }
-ffio_rewind_with_probe_data(s1->pb, &probe_buffer, 
probe_buffer_size);
+if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
+avio_seek(s1->pb, 0, SEEK_SET);
+} else
+ffio_rewind_with_probe_data(s1->pb, &probe_buffer, 
probe_buffer_size);
 }
 if (st->codec->codec_id == AV_CODEC_ID_NONE)
 st->codec->codec_id = ff_guess_image2_codec(s->path);

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


[FFmpeg-cvslog] avcodec/h264_slice: Dont reset mb_aff_frame per slice

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Wed Apr 
 8 12:29:47 2015 +0200| [e617d6f98844082404a031859b4faf05c3a91bab] | committer: 
Michael Niedermayer

avcodec/h264_slice: Dont reset mb_aff_frame per slice

Fixes null pointer dereference
Fixes Ticket4440

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

Conflicts:

libavcodec/h264_slice.c
(cherry picked from commit ce6d38e9ed0842870f3cd5414937bb6d1f2417d9)

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b7103f1..38273e3 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1310,6 +1310,7 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
 int field_pic_flag, bottom_field_flag;
 int first_slice = h == h0 && !h0->current_slice;
 int frame_num, picture_structure, droppable;
+int mb_aff_frame, last_mb_aff_frame;
 PPS *pps;
 
 h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
@@ -1533,7 +1534,8 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
 }
 
 h->mb_mbaff= 0;
-h->mb_aff_frame= 0;
+mb_aff_frame   = 0;
+last_mb_aff_frame  = h0->mb_aff_frame;
 last_pic_structure = h0->picture_structure;
 last_pic_droppable = h0->droppable;
 droppable  = h->nal_ref_idc == 0;
@@ -1551,12 +1553,13 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
 picture_structure = PICT_TOP_FIELD + bottom_field_flag;
 } else {
 picture_structure = PICT_FRAME;
-h->mb_aff_frame  = h->sps.mb_aff;
+mb_aff_frame  = h->sps.mb_aff;
 }
 }
 if (h0->current_slice) {
 if (last_pic_structure != picture_structure ||
-last_pic_droppable != droppable) {
+last_pic_droppable != droppable ||
+last_mb_aff_frame  != mb_aff_frame) {
 av_log(h->avctx, AV_LOG_ERROR,
"Changing field mode (%d -> %d) between slices is not 
allowed\n",
last_pic_structure, h->picture_structure);
@@ -1572,6 +1575,7 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
 h->picture_structure = picture_structure;
 h->droppable = droppable;
 h->frame_num = frame_num;
+h->mb_aff_frame  = mb_aff_frame;
 h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
 
 if (h0->current_slice == 0) {

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


[FFmpeg-cvslog] avcodec/h264: Be more tolerant to changing pps id between slices

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Thu Apr 
 9 13:50:07 2015 +0200| [9c4b09c4bdfa6dde530b9cae13bc9d76698228d1] | committer: 
Michael Niedermayer

avcodec/h264: Be more tolerant to changing pps id between slices

Fixes Ticket4446

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

Conflicts:

libavcodec/h264.c
(cherry picked from commit 0cd0fa9d0baabd2dc0442ed8b53ba65282733b61)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 2821747..4fde344 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1516,9 +1516,6 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size,
 continue;
 
 again:
-if (   (!(avctx->active_thread_type & FF_THREAD_FRAME) || 
nals_needed >= nal_index)
-&& !h->current_slice)
-h->au_pps_id = -1;
 /* Ignore per frame NAL unit type during extradata
  * parsing. Decoding slices is not possible in codec init
  * with frame-mt */
@@ -1564,6 +1561,10 @@ again:
 hx->inter_gb_ptr  = &hx->gb;
 hx->data_partitioning = 0;
 
+if (   nals_needed >= nal_index
+|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && 
!context_count))
+h->au_pps_id = -1;
+
 if ((err = ff_h264_decode_slice_header(hx, h)))
 break;
 

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


[FFmpeg-cvslog] avcodec/h264: reset the counts in the correct context

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Wed Apr 
 8 13:38:55 2015 +0200| [4191e01e9906a88f4686ee2e20928538da3d4b96] | committer: 
Michael Niedermayer

avcodec/h264: reset the counts in the correct context

Fixes null pointer dereference

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

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

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

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 704c089..2821747 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1728,7 +1728,7 @@ again:
 if (err < 0 || err == SLICE_SKIPED) {
 if (err < 0)
 av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header 
error\n");
-h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
+hx->ref_count[0] = hx->ref_count[1] = hx->list_count = 0;
 } else if (err == SLICE_SINGLETHREAD) {
 if (context_count > 1) {
 ret = ff_h264_execute_decode_slices(h, context_count - 1);

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


[FFmpeg-cvslog] avformat/utils: avoid discarded streams in av_find_default_stream_index()

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Mon Apr 
 6 04:20:51 2015 +0200| [d7071efae4a285dd3bd40d21aee00f13d044b339] | committer: 
Michael Niedermayer

avformat/utils: avoid discarded streams in av_find_default_stream_index()

Fixes Ticket2010

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index ac68a13..0b20b09 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1544,6 +1544,9 @@ int av_find_default_stream_index(AVFormatContext *s)
 score += 50;
 }
 
+if (st->discard != AVDISCARD_ALL)
+score += 200;
+
 if (score > best_score) {
 best_score = score;
 best_stream = i;

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


[FFmpeg-cvslog] avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Mon Apr 
20 22:22:31 2015 +0200| [81e4b6f11a01afe459b616511f7d18a8c1464b29] | committer: 
Michael Niedermayer

avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index f1610d6..ac68a13 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -399,6 +399,9 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
 if (options)
 av_dict_copy(&tmp, *options, 0);
 
+if (s->pb) // must be before any goto fail
+s->flags |= AVFMT_FLAG_CUSTOM_IO;
+
 if ((ret = av_opt_set_dict(s, &tmp)) < 0)
 goto fail;
 

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


[FFmpeg-cvslog] tests: Fix test name for pixfmts tests( cherry picked from commit e1ee0521a698809ed216e9e5c11bd2bbb466ed04)

2015-04-25 Thread Timothy Gu
ffmpeg | branch: release/2.4 | Timothy Gu  | Sun Nov  9 
21:37:18 2014 -0800| [155e0e9fd964683969f2a905626ba975c5cddf1a] | committer: 
Michael Niedermayer

tests: Fix test name for pixfmts tests(cherry picked from commit 
e1ee0521a698809ed216e9e5c11bd2bbb466ed04)

Signed-off-by: Michael Niedermayer 

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

 tests/fate-run.sh |2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index b994aba..c466e06 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -197,12 +197,14 @@ pixfmts(){
 $showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print 
fmt }' | sort >$in_fmts
 pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
 
+outertest=$test
 for pix_fmt in $pix_fmts; do
 test=$pix_fmt
 video_filter "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" 
-pix_fmt $pix_fmt
 done
 
 rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
+test=$outertest
 }
 
 mkdir -p "$outdir"

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


[FFmpeg-cvslog] avcodec/h264: finish previous slices before switching to single thread mode

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Tue Apr 
 7 02:47:36 2015 +0200| [7493c54ad075920721c2b80a9b0d86cf02f41f4a] | committer: 
Michael Niedermayer

avcodec/h264: finish previous slices before switching to single thread mode

Fixes null pointer dereference
Fixes Ticket4438

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

Conflicts:

libavcodec/h264.c
(cherry picked from commit 09cc7aee3f4d1bd1d7107d38520f782c62c14036)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7b5c506..704c089 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1730,6 +1730,12 @@ again:
 av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header 
error\n");
 h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
 } else if (err == SLICE_SINGLETHREAD) {
+if (context_count > 1) {
+ret = ff_h264_execute_decode_slices(h, context_count - 1);
+if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
+goto end;
+context_count = 0;
+}
 /* Slice could not be decoded in parallel mode, copy down
  * NAL unit stuff to context 0 and restart. Note that
  * rbsp_buffer is not transferred, but since we no longer

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


[FFmpeg-cvslog] avcodec/h264_ps: Move truncation check from VUI to SPS

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Wed Apr 
 8 22:18:35 2015 +0200| [cf80856cbc790c8dc1b743bd5bdd1093a08467ca] | committer: 
Michael Niedermayer

avcodec/h264_ps: Move truncation check from VUI to SPS

This more completely checks for truncation

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 641e72d..d969aa1 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -261,12 +261,6 @@ static inline int decode_vui_parameters(H264Context *h, 
SPS *sps)
 }
 }
 
-if (get_bits_left(&h->gb) < 0) {
-av_log(h->avctx, AV_LOG_ERROR,
-   "Overread VUI by %d bits\n", -get_bits_left(&h->gb));
-return AVERROR_INVALIDDATA;
-}
-
 return 0;
 }
 
@@ -543,6 +537,12 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
 goto fail;
 }
 
+if (get_bits_left(&h->gb) < 0) {
+av_log(h->avctx, AV_LOG_ERROR,
+   "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? 
"VUI" : "SPS", -get_bits_left(&h->gb));
+goto fail;
+}
+
 if (!sps->sar.den)
 sps->sar.den = 1;
 

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


[FFmpeg-cvslog] avcodec/aacdec: Fix storing state before PCE decode

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Thu Apr 
 9 00:04:44 2015 +0200| [2adcdf50844a541ccec0da0474adf28cddc51ff3] | committer: 
Michael Niedermayer

avcodec/aacdec: Fix storing state before PCE decode

Fixes Ticket4460

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 10c509b..7d802e8 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -425,7 +425,7 @@ static uint64_t sniff_channel_order(uint8_t 
(*layout_map)[3], int tags)
  * Save current output configuration if and only if it has been locked.
  */
 static void push_output_configuration(AACContext *ac) {
-if (ac->oc[1].status == OC_LOCKED) {
+if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
 ac->oc[0] = ac->oc[1];
 }
 ac->oc[1].status = OC_NONE;

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


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

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Wed Apr 22 16:32:42 2015 +0200| 
[f7a6a6d5917475a2df43751a9e147e09dfcc43a6] | committer: Michael Niedermayer

mpeg4videodec: only allow a positive length

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index bc9264f..227ba27 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext 
*ctx, GetBitContext *g
 int x = 0, y = 0;
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 x = get_xbits(gb, length);
 
 if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
 skip_bits1(gb); /* marker bit */
 
 length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
3);
-if (length)
+if (length > 0)
 y = get_xbits(gb, length);
 
 skip_bits1(gb); /* marker bit */

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


[FFmpeg-cvslog] alsdec: only adapt order for positive max_order

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Wed Apr 22 16:03:41 2015 +0200| 
[b16a6c67099852f5c1485b70611a7803acd9a782] | committer: Michael Niedermayer

alsdec: only adapt order for positive max_order

For max_order = 0 the clipping range is invalid. (amin = 2, amax = 1)

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 58d605ee9b3277289278dc40e022311f8e083833)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 9ee33bf..a55354b 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -682,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, 
ALSBlockData *bd)
 
 
 if (!sconf->rlslms) {
-if (sconf->adapt_order) {
+if (sconf->adapt_order && sconf->max_order) {
 int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 
3) - 1,
 2, sconf->max_order + 1));
 *bd->opt_order   = get_bits(gb, opt_order_length);

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


[FFmpeg-cvslog] avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sat Apr 
 4 19:28:33 2015 +0200| [7572cf7fdcc998b8fd1fdadc1ba3ff90349b6978] | committer: 
Michael Niedermayer

avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading 
mode

Fixes Ticket4408

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4757015..5f29267 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1551,8 +1551,14 @@ again:
 ret = -1;
 goto end;
 }
-if(!idr_cleared)
+if(!idr_cleared) {
+if (h->current_slice && (avctx->active_thread_type & 
FF_THREAD_SLICE)) {
+av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR 
frames cannot be decoded in slice multithreading mode\n");
+ret = AVERROR_INVALIDDATA;
+goto end;
+}
 idr(h); // FIXME ensure we don't lose some frames if there 
is reordering
+}
 idr_cleared = 1;
 h->has_recovery_point = 1;
 case NAL_SLICE:

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


[FFmpeg-cvslog] tests/fate-run: do not attempt to parse tiny_psnrs output if it failed

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Thu Apr 
23 04:27:56 2015 +0200| [f6dd6b4fd28fbd3250d61956ab2c3de6cfaa13a7] | committer: 
Michael Niedermayer

tests/fate-run: do not attempt to parse tiny_psnrs output if it failed

This avoids confusing syntax errors with awk later

Likely fixes awk errors at:
http://buildd.debian-ports.org/status/fetch.php?pkg=ffmpeg&arch=sparc64&ver=7%3A2.6.2-1&stamp=1428928967

Reviewed-by: Timothy Gu 
Thanks-to: Andreas Cadhalpun  for the link
Signed-off-by: Michael Niedermayer 
(cherry picked from commit c0d847e457c1ef72843a63853f1135d52b74131e)

Signed-off-by: Michael Niedermayer 

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

 tests/fate-run.sh |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index c466e06..6e3373a 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -42,7 +42,7 @@ compare(){
 }
 
 do_tiny_psnr(){
-psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
+psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')

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


[FFmpeg-cvslog] swresample: Allow reinitialization without ever setting channel counts

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sun Apr 
12 19:43:08 2015 +0200| [72ddcb2459faac7fe41d7c563356f860ef2d0396] | committer: 
Michael Niedermayer

swresample: Allow reinitialization without ever setting channel counts

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

Signed-off-by: Michael Niedermayer 

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

 libswresample/options.c |   12 ++--
 libswresample/swresample.c  |4 
 libswresample/swresample_internal.h |4 
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libswresample/options.c b/libswresample/options.c
index 01cdb1e..e970d3b 100644
--- a/libswresample/options.c
+++ b/libswresample/options.c
@@ -35,12 +35,12 @@
 #define PARAM AV_OPT_FLAG_AUDIO_PARAM
 
 static const AVOption options[]={
-{"ich"  , "set input channel count" , OFFSET( in.ch_count  
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
-{"in_channel_count" , "set input channel count" , OFFSET( in.ch_count  
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
-{"och"  , "set output channel count", OFFSET(out.ch_count  
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
-{"out_channel_count", "set output channel count", OFFSET(out.ch_count  
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
-{"uch"  , "set used channel count"  , OFFSET(used_ch_count 
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
-{"used_channel_count"   , "set used channel count"  , OFFSET(used_ch_count 
 ), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , SWR_CH_MAX, 
PARAM},
+{"ich"  , "set input channel count" , 
OFFSET(user_in_ch_count  ), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
+{"in_channel_count" , "set input channel count" , 
OFFSET(user_in_ch_count  ), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
+{"och"  , "set output channel count", 
OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
+{"out_channel_count", "set output channel count", 
OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
+{"uch"  , "set used channel count"  , 
OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
+{"used_channel_count"   , "set used channel count"  , 
OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0}, 0
  , SWR_CH_MAX, PARAM},
 {"isr"  , "set input sample rate"   , OFFSET( 
in_sample_rate), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , 
INT_MAX   , PARAM},
 {"in_sample_rate"   , "set input sample rate"   , OFFSET( 
in_sample_rate), AV_OPT_TYPE_INT  , {.i64=0 }, 0  , 
INT_MAX   , PARAM},
 {"osr"  , "set output sample rate"  , 
OFFSET(out_sample_rate), AV_OPT_TYPE_INT  , {.i64=0 }, 0
  , INT_MAX   , PARAM},
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 991aa13..e552626 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -164,6 +164,10 @@ av_cold int swr_init(struct SwrContext *s){
 return AVERROR(EINVAL);
 }
 
+s->out.ch_count  = s-> user_out_ch_count;
+s-> in.ch_count  = s->  user_in_ch_count;
+s->used_ch_count = s->user_used_ch_count;
+
 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 3761843..b892fea 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -90,6 +90,10 @@ struct SwrContext {
 int used_ch_count;  ///< number of used input 
channels (mapped channel count if channel_map, otherwise in.ch_count)
 enum SwrEngine engine;
 
+int user_in_ch_count;   ///< User set input 
channel count
+int user_out_ch_count;  ///< User set output 
channel count
+int user_used_ch_count; ///< User set used channel 
count
+
 struct DitherContext dither;
 
 int filter_size;/**< length of each FIR 
filter in the resampling filterbank relative to the cutoff frequency */

___
ffmpeg-cvslog maili

[FFmpeg-cvslog] swresample: Check channel layouts and channels against each other and print human readable error messages

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sun Apr 
12 21:08:09 2015 +0200| [115961acc15c5d11b4b4b58a906580dd176da2f0] | committer: 
Michael Niedermayer

swresample: Check channel layouts and channels against each other and print 
human readable error messages

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

Signed-off-by: Michael Niedermayer 

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

 libswresample/swresample.c |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 17082f1..4685a89 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -152,6 +152,7 @@ av_cold void swr_close(SwrContext *s){
 
 av_cold int swr_init(struct SwrContext *s){
 int ret;
+char l1[1024], l2[1024];
 
 clear_context(s);
 
@@ -278,10 +279,18 @@ av_cold int swr_init(struct SwrContext *s){
 return -1;
 }
 
+av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> 
in_ch_layout);
+av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, 
s->out_ch_layout);
+if (s->out_ch_layout && s->out.ch_count != 
av_get_channel_layout_nb_channels(s->out_ch_layout)) {
+av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified 
channel count %d\n", l2, s->out.ch_count);
+return AVERROR(EINVAL);
+}
+if (s->in_ch_layout && s->used_ch_count != 
av_get_channel_layout_nb_channels(s->in_ch_layout)) {
+av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified 
channel count %d\n", l1, s->used_ch_count);
+return AVERROR(EINVAL);
+}
+
 if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != 
s->out.ch_count && !s->rematrix_custom) {
-char l1[1024], l2[1024];
-av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> 
in_ch_layout);
-av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, 
s->out_ch_layout);
 av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s "
"but there is not enough information to do it\n", l1, l2);
 return -1;

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


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

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Wed Apr 22 17:08:51 2015 +0200| 
[9a9379ff7fc32e8e259d8c090cd8ccf08b27b09d] | committer: Michael Niedermayer

bink: check vst->index_entries before using it

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

The problem was introduced in commit 0588acaf.

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 86d00ede4f9acb02690a0615490173648e1d933c)

Signed-off-by: Michael Niedermayer 

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

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

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

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


[FFmpeg-cvslog] avcodec/h264_refs: Do not set reference to things which dont exist

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sat Apr 
 4 18:08:23 2015 +0200| [1deebf3b225d4f0ae5e15ec4414b343355e68157] | committer: 
Michael Niedermayer

avcodec/h264_refs: Do not set reference to things which dont exist

Fixes deadlock
Fixes Ticket4428
Fixes Ticket4429

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 12da921..045f184 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -707,7 +707,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO 
*mmco, int mmco_count)
  */
 if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
 /* Just mark the second field valid */
-h->cur_pic_ptr->reference = PICT_FRAME;
+h->cur_pic_ptr->reference |= h->picture_structure;
 } else if (h->cur_pic_ptr->long_ref) {
 av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
"assignment for second field "

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


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

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Tue Apr 21 19:25:50 2015 +0200| 
[8b9cfdc9270a4ef708e4729716020edd2fb42ae9] | committer: Michael Niedermayer

alsdec: check sample pointer range in revert_channel_correlation

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

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

Signed-off-by: Michael Niedermayer 

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

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

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

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


[FFmpeg-cvslog] avcodec/h264: Fix race between slices where one overwrites data from the next

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Tue Apr 
 7 00:40:21 2015 +0200| [27993da8e789707f1f35bab1adac5f988dd31033] | committer: 
Michael Niedermayer

avcodec/h264: Fix race between slices where one overwrites data from the next

Fixes non deterministic crash in ticket4408/fuzz2.264
Likely fixes other samples as well

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

Conflicts:

libavcodec/h264.h
libavcodec/h264_slice.c
(cherry picked from commit dbbc42858e87cdd04e6c3b7694f8b394d4bfcdc6)

Signed-off-by: Michael Niedermayer 

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

 libavcodec/h264.h   |1 +
 libavcodec/h264_slice.c |   43 ++-
 2 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index cb7e6f9..ec0b023 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -539,6 +539,7 @@ typedef struct H264Context {
 int mb_x, mb_y;
 int resync_mb_x;
 int resync_mb_y;
+int mb_index_end;
 int mb_skip_run;
 int mb_height, mb_width;
 int mb_stride;
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d3d5a92..b7103f1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -2447,8 +2447,17 @@ static int decode_slice(struct AVCodecContext *avctx, 
void *arg)
 
 for (;;) {
 // START_TIMER
-int ret = ff_h264_decode_mb_cabac(h);
-int eos;
+int ret, eos;
+
+if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
+av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
+   h->mb_index_end);
+er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
+ h->mb_y, ER_MB_ERROR);
+return AVERROR_INVALIDDATA;
+}
+
+ret = ff_h264_decode_mb_cabac(h);
 // STOP_TIMER("decode_mb_cabac")
 
 if (ret >= 0)
@@ -2510,7 +2519,17 @@ static int decode_slice(struct AVCodecContext *avctx, 
void *arg)
 }
 } else {
 for (;;) {
-int ret = ff_h264_decode_mb_cavlc(h);
+int ret;
+
+if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
+av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
+   h->mb_index_end);
+er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
+ h->mb_y, ER_MB_ERROR);
+return AVERROR_INVALIDDATA;
+}
+
+ret = ff_h264_decode_mb_cavlc(h);
 
 if (ret >= 0)
 ff_h264_hl_decode_mb(h);
@@ -2598,19 +2617,33 @@ int ff_h264_execute_decode_slices(H264Context *h, 
unsigned context_count)
 
 av_assert0(h->mb_y < h->mb_height);
 
+h->mb_index_end = INT_MAX;
+
 if (h->avctx->hwaccel ||
 h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
 return 0;
 if (context_count == 1) {
 return decode_slice(avctx, &h);
 } else {
+int j, mb_index;
 av_assert0(context_count > 0);
-for (i = 1; i < context_count; i++) {
+for (i = 0; i < context_count; i++) {
+int mb_index_end = h->mb_width * h->mb_height;
 hx = h->thread_context[i];
-if (CONFIG_ERROR_RESILIENCE) {
+mb_index = hx->resync_mb_x + hx->resync_mb_y * h->mb_width;
+if (CONFIG_ERROR_RESILIENCE && i) {
 hx->er.error_count = 0;
 }
 hx->x264_build = h->x264_build;
+for (j = 0; j < context_count; j++) {
+H264Context *sl2 = h->thread_context[j];
+int mb_index2 = sl2->resync_mb_x + sl2->resync_mb_y * 
h->mb_width;
+
+if (i==j || mb_index > mb_index2)
+continue;
+mb_index_end = FFMIN(mb_index_end, mb_index2);
+}
+hx->mb_index_end = mb_index_end;
 }
 
 avctx->execute(avctx, decode_slice, h->thread_context,

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


[FFmpeg-cvslog] swresample/swresample-test: Randomly wipe out channel counts

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sun Apr 
12 22:08:52 2015 +0200| [164ababc623884c862d01e98824c19f91919f0be] | committer: 
Michael Niedermayer

swresample/swresample-test: Randomly wipe out channel counts

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

Signed-off-by: Michael Niedermayer 

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

 libswresample/swresample-test.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libswresample/swresample-test.c b/libswresample/swresample-test.c
index c0162cd..6948806 100644
--- a/libswresample/swresample-test.c
+++ b/libswresample/swresample-test.c
@@ -314,6 +314,11 @@ int main(int argc, char **argv){
 fprintf(stderr, "Failed to init backw_ctx\n");
 return 1;
 }
+if (uint_rand(rand_seed) % 3 == 0)
+av_opt_set_int(forw_ctx, "ich", 0, 0);
+if (uint_rand(rand_seed) % 3 == 0)
+av_opt_set_int(forw_ctx, "och", 0, 0);
+
 if(swr_init( forw_ctx) < 0)
 fprintf(stderr, "swr_init(->) failed\n");
 if(swr_init(backw_ctx) < 0)

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


[FFmpeg-cvslog] alac: reject rice_limit 0 if compression is used

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Fri Apr 24 00:01:43 2015 +0200| 
[dfe37f2be202a0db5b1b06552ea2aaf33eb70628] | committer: Michael Niedermayer

alac: reject rice_limit 0 if compression is used

If rice_limit is 0, k can be 0 in decode_scalar, which calls show_bits(gb, k).

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4b657a1b1eedcf38bcf36e89a2f4be6f76b5ce09)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index aec7bb4..f5a5b86 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -316,6 +316,11 @@ static int decode_element(AVCodecContext *avctx, AVFrame 
*frame, int ch_index,
 int lpc_quant[2];
 int rice_history_mult[2];
 
+if (!alac->rice_limit) {
+avpriv_request_sample(alac->avctx, "Compression with rice limit 
0");
+return AVERROR(ENOSYS);
+}
+
 decorr_shift   = get_bits(&alac->gb, 8);
 decorr_left_weight = get_bits(&alac->gb, 8);
 

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


[FFmpeg-cvslog] lavf: Reset global flag on deinit

2015-04-25 Thread Vittorio Giovara
ffmpeg | branch: release/2.4 | Vittorio Giovara  | 
Wed Apr 22 14:59:56 2015 +0100| [ee3d4e2b098121baa7a5795b9f977cb0e7f3facd] | 
committer: Michael Niedermayer

lavf: Reset global flag on deinit

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

Signed-off-by: Michael Niedermayer 

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

 libavformat/utils.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0b20b09..d93f434 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4066,6 +4066,7 @@ int avformat_network_deinit(void)
 #if CONFIG_NETWORK
 ff_network_close();
 ff_tls_deinit();
+ff_network_inited_globally = 0;
 #endif
 return 0;
 }

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


[FFmpeg-cvslog] swresample: Allow reinitialization without ever setting channel layouts

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sun Apr 
12 20:50:53 2015 +0200| [6a87a152e8340778a1320603e88566ea5be54ee3] | committer: 
Michael Niedermayer

swresample: Allow reinitialization without ever setting channel layouts
(cherry picked from commit 80a28c7509a4e1aea5b208d56c6646d69c07)

Signed-off-by: Michael Niedermayer 

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

 libswresample/options.c |8 
 libswresample/rematrix.c|4 ++--
 libswresample/swresample.c  |7 +--
 libswresample/swresample_internal.h |2 ++
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libswresample/options.c b/libswresample/options.c
index e970d3b..de84672 100644
--- a/libswresample/options.c
+++ b/libswresample/options.c
@@ -51,10 +51,10 @@ static const AVOption options[]={
 {"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},
-{"icl"  , "set input channel layout", OFFSET( in_ch_layout 
 ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0  , 
INT64_MAX , PARAM, "channel_layout"},
-{"in_channel_layout", "set input channel layout", OFFSET( in_ch_layout 
 ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0  , 
INT64_MAX , PARAM, "channel_layout"},
-{"ocl"  , "set output channel layout"   , OFFSET(out_ch_layout 
 ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0  , 
INT64_MAX , PARAM, "channel_layout"},
-{"out_channel_layout"   , "set output channel layout"   , OFFSET(out_ch_layout 
 ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0  , 
INT64_MAX , PARAM, "channel_layout"},
+{"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"},
+{"out_channel_layout"   , "set output channel layout"   , 
OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0   }, 0  
  , INT64_MAX , PARAM, "channel_layout"},
 {"clev" , "set center mix level", OFFSET(clev  
 ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB}, -32, 32, 
PARAM},
 {"center_mix_level" , "set center mix level", OFFSET(clev  
 ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB}, -32, 32, 
PARAM},
 {"slev" , "set surround mix level"  , OFFSET(slev  
 ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB}, -32, 32, 
PARAM},
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 6552a2f..2238f0a 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -65,8 +65,8 @@ int swr_set_matrix(struct SwrContext *s, const double 
*matrix, int stride)
 if (!s || s->in_convert) // s needs to be allocated but not initialized
 return AVERROR(EINVAL);
 memset(s->matrix, 0, sizeof(s->matrix));
-nb_in  = av_get_channel_layout_nb_channels(s->in_ch_layout);
-nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout);
+nb_in  = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
+nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
 for (out = 0; out < nb_out; out++) {
 for (in = 0; in < nb_in; in++)
 s->matrix[out][in] = matrix[in];
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index e552626..17082f1 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -86,10 +86,10 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
 if (av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE,   0) < 0)
 goto fail;
 
-if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> 
in_ch_layout), 0) < 0)
+if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> 
user_in_ch_layout), 0) < 0)
 goto fail;
 
-if (av_opt_set_int(s, "och", 
av_get_channel_layout_nb_channels(s->out_ch_layout), 0) < 0)
+if (av_opt_set_int(s, "och", 
av_get_channel_layout_nb_channels(s->user_out_ch_layout), 0) < 0)
 goto fail;
 
 av_opt_set_int(s, "uch"

[FFmpeg-cvslog] avutil/pca: Check for av_malloc* failures

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Mon Mar 
30 04:37:42 2015 +0200| [3fd66f7f4589dbc31d144454546506a0bb939647] | committer: 
Michael Niedermayer

avutil/pca: Check for av_malloc* failures

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

Signed-off-by: Michael Niedermayer 

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

 libavutil/pca.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavutil/pca.c b/libavutil/pca.c
index 26d5bbb..86cb37e 100644
--- a/libavutil/pca.c
+++ b/libavutil/pca.c
@@ -41,12 +41,20 @@ PCA *ff_pca_init(int n){
 return NULL;
 
 pca= av_mallocz(sizeof(*pca));
+if (!pca)
+return NULL;
+
 pca->n= n;
 pca->z = av_malloc_array(n, sizeof(*pca->z));
 pca->count=0;
 pca->covariance= av_calloc(n*n, sizeof(double));
 pca->mean= av_calloc(n, sizeof(double));
 
+if (!pca->z || !pca->covariance || !pca->mean) {
+ff_pca_free(pca);
+return NULL;
+}
+
 return pca;
 }
 

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


[FFmpeg-cvslog] h264: avoid unnecessary calls to get_format

2015-04-25 Thread Rainer Hochecker
ffmpeg | branch: release/2.4 | Rainer Hochecker  | Tue 
Mar 31 08:27:01 2015 +0200| [07a7f384217df47442178280ac7172c4fcbf0ccb] | 
committer: Michael Niedermayer

h264: avoid unnecessary calls to get_format

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 38273e3..3a7ea4d 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1438,7 +1438,8 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
  || h->mb_width  != h->sps.mb_width
  || h->mb_height != h->sps.mb_height * (2 - 
h->sps.frame_mbs_only_flag)
 ));
-if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 
0)))
+if (h0->avctx->pix_fmt == AV_PIX_FMT_NONE
+|| (non_j_pixfmt(h0->avctx->pix_fmt) != 
non_j_pixfmt(get_pixel_format(h0, 0
 must_reinit = 1;
 
 if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))

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


[FFmpeg-cvslog] avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays never contain random data

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sat Apr 
18 20:50:23 2015 +0200| [4c20249c86e1c0cc9aea2261758f477820b1456b] | committer: 
Michael Niedermayer

avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays never 
contain random data

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

Conflicts:

libavcodec/alsdec.c

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

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index e539795..8a8bff1 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1731,9 +1731,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 // allocate and assign channel data buffer for mcc mode
 if (sconf->mc_coding) {
-ctx->chan_data_buffer  = av_malloc(sizeof(*ctx->chan_data_buffer) *
+ctx->chan_data_buffer  = av_mallocz(sizeof(*ctx->chan_data_buffer) *
num_buffers * num_buffers);
-ctx->chan_data = av_malloc(sizeof(*ctx->chan_data) *
+ctx->chan_data = av_mallocz(sizeof(*ctx->chan_data) *
num_buffers);
 ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
num_buffers);

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


[FFmpeg-cvslog] ac3: validate end in ff_ac3_bit_alloc_calc_mask

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Thu Apr 16 21:25:26 2015 +0200| 
[6b1c8797f4640ac3ce7b10118d8eab74612171a2] | committer: Michael Niedermayer

ac3: validate end in ff_ac3_bit_alloc_calc_mask

This fixes an invalid read if end is 0:
 band_end   = ff_ac3_bin_to_band_tab[end-1] + 1;

Depending on what is before the array, this can cause stack smashing,
when band_end becomes too large.

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index 29e132f..8d39bbe 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, 
int16_t *band_psd,
 int band_start, band_end, begin, end1;
 int lowcomp, fastleak, slowleak;
 
+if (end <= 0)
+return AVERROR_INVALIDDATA;
+
 /* excitation function */
 band_start = ff_ac3_bin_to_band_tab[start];
 band_end   = ff_ac3_bin_to_band_tab[end-1] + 1;

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


[FFmpeg-cvslog] aasc: return correct buffer size from aasc_decode_frame

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Thu Apr 16 19:12:02 2015 +0200| 
[cfbfe6cd4d5aa52a8fbdb750f9fe1cfa637ccc12] | committer: Michael Niedermayer

aasc: return correct buffer size from aasc_decode_frame

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0be54ad280cf114c02306b7063147e8379f8ed1e)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
index 65ef782..469fc5e 100644
--- a/libavcodec/aasc.c
+++ b/libavcodec/aasc.c
@@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
 return ret;
 
 /* report that the buffer was completely consumed */
-return buf_size;
+return avpkt->size;
 }
 
 static av_cold int aasc_decode_end(AVCodecContext *avctx)

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


[FFmpeg-cvslog] msrledec: use signed pixel_ptr in msrle_decode_pal4

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Thu Apr 16 14:49:08 2015 +0200| 
[65b257b21c7f4398458fe17af3c99e8a0d717a0c] | committer: Michael Niedermayer

msrledec: use signed pixel_ptr in msrle_decode_pal4

This fixes segmentation faults, when pic->linesize[0] is negative.
In that case 'line * pic->linesize[0] + pixel_ptr' is treated as
unsigned and wraps around.

This reverts commit 7d78a964.
The problem was introduced in commit f7e1367f, which should obsolete
that commit.

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index deb6f86..200221a 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -36,7 +36,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture 
*pic,
 unsigned char rle_code;
 unsigned char extra_byte, odd_pixel;
 unsigned char stream_byte;
-unsigned int pixel_ptr = 0;
+int pixel_ptr = 0;
 int line = avctx->height - 1;
 int i;
 

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


[FFmpeg-cvslog] alsdec: validate time diff index

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Sat Apr 18 20:09:28 2015 +0200| 
[3bd7aa46601ada27c8051b7dd0cef168ff4a2206] | committer: Michael Niedermayer

alsdec: validate time diff index

If begin is smaller than t, the subtraction 'begin -= t' wraps around,
because begin is unsigned. The same applies for end < t.

This causes segmentation faults.

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

Signed-off-by: Michael Niedermayer 

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

 libavcodec/alsdec.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 8a8bff1..0a6be7b 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext 
*ctx, ALSBlockData *bd,
 
 if (ch[dep].time_diff_sign) {
 t  = -t;
+if (t > 0 && begin < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than 
time diff index %d.\n", begin, t);
+return AVERROR_INVALIDDATA;
+}
 begin -= t;
 } else {
+if (t > 0 && end < t) {
+av_log(ctx->avctx, AV_LOG_ERROR, "end %u smaller than time 
diff index %d.\n", end, t);
+return AVERROR_INVALIDDATA;
+}
 end   -= t;
 }
 

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


[FFmpeg-cvslog] aacdec: consistently use avctx for logging in decode_eld_specific_config

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Thu Apr 16 16:58:32 2015 +0200| 
[d2ff2c9dd32426b59ffbc4b6ebe2d8fb22979ef7] | committer: Michael Niedermayer

aacdec: consistently use avctx for logging in decode_eld_specific_config

ac may be NULL and then accessing ac->avctx results in a segmentation fault.

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5b75689b987e4c4dd4f34d5c8be389547e9cc701)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 7d802e8..e92f1a1 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -881,7 +881,7 @@ static int decode_eld_specific_config(AACContext *ac, 
AVCodecContext *avctx,
 if (len == 15 + 255)
 len += get_bits(gb, 16);
 if (get_bits_left(gb) < len * 8 + 4) {
-av_log(ac->avctx, AV_LOG_ERROR, overread_err);
+av_log(avctx, AV_LOG_ERROR, overread_err);
 return AVERROR_INVALIDDATA;
 }
 skip_bits_long(gb, 8 * len);

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


[FFmpeg-cvslog] avcodec/atrac3plusdsp: fix on stack alignment

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Fri Apr 
17 11:58:41 2015 +0200| [b28fab2ebe39f04b26167474ff887559fddd3a9c] | committer: 
Michael Niedermayer

avcodec/atrac3plusdsp: fix on stack alignment

Fixes fate failure on ARM
(cherry picked from commit 38f67260684aec8a02d87ab4056b1a1fbf964c03)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/atrac3plusdsp.c b/libavcodec/atrac3plusdsp.c
index 3522af1..3c68f74 100644
--- a/libavcodec/atrac3plusdsp.c
+++ b/libavcodec/atrac3plusdsp.c
@@ -599,8 +599,8 @@ void ff_atrac3p_ipqf(FFTContext *dct_ctx, 
Atrac3pIPQFChannelCtx *hist,
  const float *in, float *out)
 {
 int i, s, sb, t, pos_now, pos_next;
-DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS];
-DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS];
+LOCAL_ALIGNED(32, float, idct_in, [ATRAC3P_SUBBANDS]);
+LOCAL_ALIGNED(32, float, idct_out, [ATRAC3P_SUBBANDS]);
 
 memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));
 

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


[FFmpeg-cvslog] aacpsy: avoid psy_band->threshold becoming NaN

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Thu Apr 16 20:04:54 2015 +0200| 
[6458ee5af8f994f2f8e42a3a4a2f407b978103f4] | committer: Michael Niedermayer

aacpsy: avoid psy_band->threshold becoming NaN

If band->thr is 0.0f, the division is undefined, making norm_fac not a
number or infinity, which causes psy_band->threshold to become NaN.

This is passed on to other variables until it finally reaches
sce->sf_idx and is converted to an integer (-2147483648).

This causes a segmentation fault when it is used as array index.

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 9eeb836..cee4bf2 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, 
int channel,
 if (active_lines > 0.0f)
 band->thr = calc_reduced_thr_3gpp(band, 
coeffs[g].min_snr, reduction);
 pe += calc_pe_3gpp(band);
-band->norm_fac = band->active_lines / band->thr;
+if (band->thr > 0.0f)
+band->norm_fac = band->active_lines / band->thr;
+else
+band->norm_fac = 0.0f;
 norm_fac += band->norm_fac;
 }
 }

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


[FFmpeg-cvslog] alsdec: ensure channel reordering is reversible

2015-04-25 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.4 | Andreas Cadhalpun 
 | Sat Apr 18 18:31:36 2015 +0200| 
[1a8b4158c574e95c6a2311c5f2955e76aedba1f9] | committer: Michael Niedermayer

alsdec: ensure channel reordering is reversible

If the same idx is used for more than one i, at least one entry in
sconf->chan_pos remains uninitialized.

This can cause segmentation faults.

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index cfece44..e539795 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -358,10 +358,14 @@ static av_cold int read_specific_config(ALSDecContext 
*ctx)
 ctx->cs_switch = 1;
 
 for (i = 0; i < avctx->channels; i++) {
+sconf->chan_pos[i] = -1;
+}
+
+for (i = 0; i < avctx->channels; i++) {
 int idx;
 
 idx = get_bits(&gb, chan_pos_bits);
-if (idx >= avctx->channels) {
+if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
 av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
 ctx->cs_switch = 0;
 break;

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


[FFmpeg-cvslog] Update for FFmpeg 2.4.9 release

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: release/2.4 | Michael Niedermayer  | Sat Apr 
25 17:10:18 2015 +0200| [73af011c7929c892bd7a3e5613c488751b13948e] | committer: 
Michael Niedermayer

Update for FFmpeg 2.4.9 release

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/Changelog b/Changelog
index 43639ae..e82ae69 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,43 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
-version :
+version 2.4.9:
+- alac: reject rice_limit 0 if compression is used
+- lavf: Reset global flag on deinit
+- bink: check vst->index_entries before using it
+- mpeg4videodec: only allow a positive length
+- alsdec: check sample pointer range in revert_channel_correlation
+- avcodec/h264_refs: Do not set reference to things which dont exist
+- avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading 
mode
+- h264: avoid unnecessary calls to get_format
+- avutil/pca: Check for av_malloc* failures
+- alsdec: validate time diff index
+- avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays 
never contain random data
+- alsdec: ensure channel reordering is reversible
+- avcodec/atrac3plusdsp: fix on stack alignment
+- ac3: validate end in ff_ac3_bit_alloc_calc_mask
+- aacpsy: avoid psy_band->threshold becoming NaN
+- aasc: return correct buffer size from aasc_decode_frame
+- aacdec: consistently use avctx for logging in decode_eld_specific_config
+- msrledec: use signed pixel_ptr in msrle_decode_pal4
+- swresample/swresample-test: Randomly wipe out channel counts
+- swresample: Check channel layouts and channels against each other and print 
human readable error messages
+- swresample: Allow reinitialization without ever setting channel layouts
+- swresample: Allow reinitialization without ever setting channel counts
+- avcodec/h264: Do not fail with randomly truncated VUIs
+- avcodec/h264_ps: Move truncation check from VUI to SPS
+- avcodec/h264: Be more tolerant to changing pps id between slices
+- avcodec/aacdec: Fix storing state before PCE decode
+- avcodec/h264: reset the counts in the correct context
+- avcodec/h264_slice: Dont reset mb_aff_frame per slice
+- tests: Fix test name for pixfmts tests
+- avcodec/h264: finish previous slices before switching to single thread mode
+- avcodec/h264: Fix race between slices where one overwrites data from the next
+- avformat/utils: avoid discarded streams in av_find_default_stream_index()
+- avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use
+- avformat/img2dec: do not rewind custom io buffers
+- fate: Include branch information in the payload header
+
 
 version 2.4.8:
 - avutil/cpu: add missing check for mmxext to av_force_cpu_flags
diff --git a/RELEASE b/RELEASE
index f041bc6..3f5987a 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-2.4.8
+2.4.9
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 3f942b5..af2b79f 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.4.8
+PROJECT_NUMBER = 2.4.9
 
 # 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] avcodec/mpeg12dec: Change mb decode tracing stuff to use ff_tlog()

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat Apr 25 
19:42:49 2015 +0200| [f4c311fef4d25c6ec3775efe0dcefb1dd4dbfc66] | committer: 
Michael Niedermayer

avcodec/mpeg12dec: Change mb decode tracing stuff to use ff_tlog()

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpeg12dec.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 0edb39d..12504e7 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -156,7 +156,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext 
*s,
 dc += diff;
 s->last_dc[component] = dc;
 block[0] = dc * quant_matrix[0];
-ff_dlog(s->avctx, "dc=%d diff=%d\n", dc, diff);
+ff_tlog(s->avctx, "dc=%d diff=%d\n", dc, diff);
 i = 0;
 {
 OPEN_READER(re, &s->gb);
@@ -568,7 +568,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext 
*s,
 dc += diff;
 s->last_dc[component] = dc;
 block[0] = dc << (3 - s->intra_dc_precision);
-ff_dlog(s->avctx, "dc=%d\n", block[0]);
+ff_tlog(s->avctx, "dc=%d\n", block[0]);
 mismatch = block[0] ^ 1;
 i = 0;
 if (s->intra_vlc_format)
@@ -735,7 +735,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 const int mb_block_count = 4 + (1 << s->chroma_format);
 int ret;
 
-ff_dlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
+ff_tlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
 
 av_assert2(s->mb_skipped == 0);
 
@@ -800,7 +800,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 mb_type = btype2mb_type[mb_type];
 break;
 }
-ff_dlog(s->avctx, "mb_type=%x\n", mb_type);
+ff_tlog(s->avctx, "mb_type=%x\n", mb_type);
 //motion_type = 0; /* avoid warning */
 if (IS_INTRA(mb_type)) {
 s->bdsp.clear_blocks(s->block[0]);
@@ -897,7 +897,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 
 /* motion vectors */
 s->mv_dir = (mb_type >> 13) & 3;
-ff_dlog(s->avctx, "motion_type=%d\n", motion_type);
+ff_tlog(s->avctx, "motion_type=%d\n", motion_type);
 switch (motion_type) {
 case MT_FRAME: /* or MT_16X8 */
 if (s->picture_structure == PICT_FRAME) {
@@ -954,12 +954,12 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
  s->last_mv[i][j][0]);
 s->last_mv[i][j][0] = val;
 s->mv[i][j][0]  = val;
-ff_dlog(s->avctx, "fmx=%d\n", val);
+ff_tlog(s->avctx, "fmx=%d\n", val);
 val = mpeg_decode_motion(s, 
s->mpeg_f_code[i][1],
  s->last_mv[i][j][1] 
>> 1);
 s->last_mv[i][j][1] = 2 * val;
 s->mv[i][j][1]  = val;
-ff_dlog(s->avctx, "fmy=%d\n", val);
+ff_tlog(s->avctx, "fmy=%d\n", val);
 }
 }
 }

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


[FFmpeg-cvslog] avcodec/mpeg12dec: Make ff_dlog() messages more clear

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat Apr 25 
20:23:28 2015 +0200| [9d3357391cec804530ad9d3ff6f60139205b2104] | committer: 
Michael Niedermayer

avcodec/mpeg12dec: Make ff_dlog() messages more clear

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 12504e7..efbd53e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1303,10 +1303,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 // res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
 // widescreen-issue562.mpg 4/3 16/9 -> 16/9
 //s->avctx->sample_aspect_ratio = 
av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height});
-ff_dlog(avctx, "A %d/%d\n",
+ff_dlog(avctx, "aspect A %d/%d\n",
 ff_mpeg2_aspect[s->aspect_ratio_info].num,
 ff_mpeg2_aspect[s->aspect_ratio_info].den);
-ff_dlog(avctx, "B %d/%d\n", s->avctx->sample_aspect_ratio.num,
+ff_dlog(avctx, "aspect B %d/%d\n", 
s->avctx->sample_aspect_ratio.num,
 s->avctx->sample_aspect_ratio.den);
 }
 } else {
@@ -1997,7 +1997,7 @@ eos: // end of slice
 return AVERROR_INVALIDDATA;
 }
 *buf += (get_bits_count(&s->gb) - 1) / 8;
-ff_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, 
s->mb_y);
+ff_dlog(s, "Slice start:%d %d  end:%d %d\n", s->resync_mb_x, 
s->resync_mb_y, s->mb_x, s->mb_y);
 return 0;
 }
 

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


[FFmpeg-cvslog] avcodec/ituh263dec: Use ff_tlog() for block level information

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun Apr 26 
01:00:05 2015 +0200| [7b94a2f4b183ff0a02a40e4ce41273d5aede54eb] | committer: 
Michael Niedermayer

avcodec/ituh263dec: Use ff_tlog() for block level information

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 580c522..8398dd9 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -303,7 +303,7 @@ static int h263p_decode_umotion(MpegEncContext * s, int 
pred)
code >>= 1;
 
code = (sign) ? (pred - code) : (pred + code);
-   ff_dlog(s->avctx,"H.263+ UMV Motion = %d\n", code);
+   ff_tlog(s->avctx,"H.263+ UMV Motion = %d\n", code);
return code;
 
 }

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


[FFmpeg-cvslog] avcodec/h264_cabac: Use ff_tlog() for block level information

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun Apr 26 
00:58:51 2015 +0200| [d52a8bf15817e2a83f6b6e32e9391c36d28d8051] | committer: 
Michael Niedermayer

avcodec/h264_cabac: Use ff_tlog() for block level information

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 401566e..c1c8b80 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -2073,7 +2073,7 @@ decode_intra_mb:
 int pred = pred_intra_mode(h, sl, i);
 sl->intra4x4_pred_mode_cache[scan8[i]] = 
decode_cabac_mb_intra4x4_pred_mode(sl, pred);
 
-ff_dlog(h->avctx, "i4x4 pred=%d mode=%d\n", pred,
+ff_tlog(h->avctx, "i4x4 pred=%d mode=%d\n", pred,
 sl->intra4x4_pred_mode_cache[scan8[i]]);
 }
 }

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


[FFmpeg-cvslog] vaapi: Fix -Wimplicit-function-declaration for ff_dlog() usage

2015-04-25 Thread Rico Tzschichholz
ffmpeg | branch: master | Rico Tzschichholz  | Thu Apr 23 
14:30:01 2015 +0100| [5aed1d4240d411533c102eec6944aa925b7f4964] | committer: 
Luca Barbato

vaapi: Fix -Wimplicit-function-declaration for ff_dlog() usage

Signed-off-by: Luca Barbato 

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

 libavcodec/vaapi_mpeg2.c |1 +
 libavcodec/vaapi_mpeg4.c |1 +
 libavcodec/vaapi_vc1.c   |1 +
 3 files changed, 3 insertions(+)

diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 541b6a9..d41a14a 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -22,6 +22,7 @@
 
 #include "mpegutils.h"
 #include "vaapi_internal.h"
+#include "internal.h"
 
 /** Reconstruct bitstream f_code */
 static inline int mpeg2_get_f_code(MpegEncContext *s)
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 2ab7fab..1cf1ea7 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -21,6 +21,7 @@
  */
 
 #include "vaapi_internal.h"
+#include "internal.h"
 #include "h263.h"
 #include "mpeg4video.h"
 
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index d6ed101..fe01c52 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -21,6 +21,7 @@
  */
 
 #include "vaapi_internal.h"
+#include "internal.h"
 #include "vc1.h"
 #include "vc1data.h"
 

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


[FFmpeg-cvslog] Merge commit '5aed1d4240d411533c102eec6944aa925b7f4964'

2015-04-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun Apr 26 
01:20:08 2015 +0200| [fa2d3b6dbe0ed507ae3d19038f9a46e8e9a72b70] | committer: 
Michael Niedermayer

Merge commit '5aed1d4240d411533c102eec6944aa925b7f4964'

* commit '5aed1d4240d411533c102eec6944aa925b7f4964':
  vaapi: Fix -Wimplicit-function-declaration for ff_dlog() usage

See: 8f7b022c8c2f40bf8ddfd90778a4c91424d3a8e5
Merged-by: Michael Niedermayer 

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



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