[FFmpeg-cvslog] lavu/intmath: add faster clz support

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Dec 
16 13:28:39 2015 -0500| [0dd8a3d71e2c01d42e868d6c6b8974fadfcc529e] | committer: 
Ganesh Ajjanagadde

lavu/intmath: add faster clz support

This should be useful for the sofalizer filter.

Reviewed-by: Kieran Kunhya 
Reviewed-by: Clément Bœsch 
Signed-off-by: Ganesh Ajjanagadde 

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

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

diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 2016723..82193a6 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -96,6 +96,9 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned 
int v)
 #ifndef ff_ctzll
 #define ff_ctzll(v) __builtin_ctzll(v)
 #endif
+#ifndef ff_clz
+#define ff_clz(v) __builtin_clz(v)
+#endif
 #endif
 #endif
 
@@ -135,6 +138,21 @@ static av_always_inline av_const int ff_ctzll_c(long long 
v)
 }
 #endif
 
+#ifndef ff_clz
+#define ff_clz ff_clz_c
+static av_always_inline av_const unsigned ff_clz_c(unsigned x)
+{
+unsigned i = sizeof(x) * 8;
+
+while (x) {
+x >>= 1;
+i--;
+}
+
+return i;
+}
+#endif
+
 /**
  * @}
  */

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


[FFmpeg-cvslog] lavfi/vf_idet: replace round and cast by lrint

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Dec 
16 13:03:59 2015 -0500| [641cb77f501a7fa1410ab53da4923b1bebc2e690] | committer: 
Ganesh Ajjanagadde

lavfi/vf_idet: replace round and cast by lrint

lrint is faster and conveys the intent better here. It is safe as long int has
at least 32 bits.

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

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

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

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index e4fe6cb..60ec23a 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -409,7 +409,7 @@ static av_cold int init(AVFilterContext *ctx)
 memset(idet->history, UNDETERMINED, HIST_SIZE);
 
 if( idet->half_life > 0 )
-idet->decay_coefficient = (uint64_t) round( PRECISION * exp2(-1.0 / 
idet->half_life) );
+idet->decay_coefficient = lrint( PRECISION * exp2(-1.0 / 
idet->half_life) );
 else
 idet->decay_coefficient = PRECISION;
 

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


[FFmpeg-cvslog] lavfi/vf_cropdetect: replace round by lrint

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Dec 
16 14:52:16 2015 -0500| [425c0685f245d715f2da7066c5a89564c1ab146b] | committer: 
Ganesh Ajjanagadde

lavfi/vf_cropdetect: replace round by lrint

lrint is at least as fast, and more accurate.

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

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

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

diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
index d456377..4a89875 100644
--- a/libavfilter/vf_cropdetect.c
+++ b/libavfilter/vf_cropdetect.c
@@ -165,7 +165,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 int w, h, x, y, shrink_by;
 AVDictionary **metadata;
 int outliers, last_y;
-int limit = round(s->limit);
+int limit = lrint(s->limit);
 
 // ignore first 2 frames - they may be empty
 if (++s->frame_nb > 0) {

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


[FFmpeg-cvslog] lavfi/vsrc_mandelbrot: replace round by lrint

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Dec 
16 14:54:53 2015 -0500| [5484cbe9f765124f9e9c704467c6013731d71ed0] | committer: 
Ganesh Ajjanagadde

lavfi/vsrc_mandelbrot: replace round by lrint

lrint is at least as fast, and is more accurate.

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

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

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

diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 063b7d1..2f6944f 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -183,7 +183,7 @@ static void fill_from_cache(AVFilterContext *ctx, uint32_t 
*color, int *in_cidx,
 int x;
 if(p->p[1] > py)
 break;
-x= round((p->p[0] - s->start_x) / scale + s->w/2);
+x= lrint((p->p[0] - s->start_x) / scale + s->w/2);
 if(x<0 || x >= s->w)
 continue;
 if(color) color[x] = p->val;

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


[FFmpeg-cvslog] lavf/hlsenc: replace round by lrint

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Wed Dec 
16 14:40:50 2015 -0500| [18bc3dc7681c2b520af62b9dea9c3d1815fc5ad7] | committer: 
Ganesh Ajjanagadde

lavf/hlsenc: replace round by lrint

Mainly cosmetic here.

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

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

 libavformat/hlsenc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index adcf7df..f2d7a52 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -430,7 +430,7 @@ static int hls_window(AVFormatContext *s, int last)
 }
 
 if (hls->flags & HLS_ROUND_DURATIONS)
-avio_printf(out, "#EXTINF:%d,\n",  (int)round(en->duration));
+avio_printf(out, "#EXTINF:%ld,\n",  lrint(en->duration));
 else
 avio_printf(out, "#EXTINF:%f,\n", en->duration);
 if (hls->flags & HLS_SINGLE_FILE)

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


[FFmpeg-cvslog] lavc/aacsbr: sbr_dequant optimization

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Tue Dec 
15 23:27:23 2015 -0500| [def3c83e1b85cc17cade257cbf3b1fb84e61f788] | committer: 
Ganesh Ajjanagadde

lavc/aacsbr: sbr_dequant optimization

This uses ff_exp2fi to get a speedup (~ 6x).

sample benchmark (Haswell, GNU/Linux):
old:
  19102 decicycles in sbr_dequant,1023 runs,  1 skips
  19002 decicycles in sbr_dequant,2045 runs,  3 skips
  17638 decicycles in sbr_dequant,4093 runs,  3 skips
  15825 decicycles in sbr_dequant,8189 runs,  3 skips
  16404 decicycles in sbr_dequant,   16379 runs,  5 skips

new:
   3063 decicycles in sbr_dequant,1024 runs,  0 skips
   3049 decicycles in sbr_dequant,2048 runs,  0 skips
   2968 decicycles in sbr_dequant,4096 runs,  0 skips
   2818 decicycles in sbr_dequant,8191 runs,  1 skips
   2853 decicycles in sbr_dequant,   16383 runs,  1 skips

Reviewed-by: Andreas Cadhalpun 
Signed-off-by: Ganesh Ajjanagadde 

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

 libavcodec/aacsbr.c |   34 ++
 libavcodec/aacsbr.h |2 +-
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index d1e3a91..15956e3 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -33,6 +33,7 @@
 #include "aacsbrdata.h"
 #include "aacsbr_tablegen.h"
 #include "fft.h"
+#include "internal.h"
 #include "aacps.h"
 #include "sbrdsp.h"
 #include "libavutil/internal.h"
@@ -73,15 +74,22 @@ static void sbr_dequant(SpectralBandReplication *sbr, int 
id_aac)
 {
 int k, e;
 int ch;
-
+static const double exp2_tab[2] = {1, M_SQRT2};
 if (id_aac == TYPE_CPE && sbr->bs_coupling) {
-float alpha  = sbr->data[0].bs_amp_res ?  1.0f :  0.5f;
-float pan_offset = sbr->data[0].bs_amp_res ? 12.0f : 24.0f;
+int pan_offset = sbr->data[0].bs_amp_res ? 12 : 24;
 for (e = 1; e <= sbr->data[0].bs_num_env; e++) {
 for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
-float temp1 = exp2f(sbr->data[0].env_facs_q[e][k] * alpha + 
7.0f);
-float temp2 = exp2f((pan_offset - 
sbr->data[1].env_facs_q[e][k]) * alpha);
-float fac;
+float temp1, temp2, fac;
+if (sbr->data[0].bs_amp_res) {
+temp1 = ff_exp2fi(sbr->data[0].env_facs_q[e][k] + 7);
+temp2 = ff_exp2fi(pan_offset - 
sbr->data[1].env_facs_q[e][k]);
+}
+else {
+temp1 = ff_exp2fi((sbr->data[0].env_facs_q[e][k]>>1) + 7) *
+exp2_tab[sbr->data[0].env_facs_q[e][k] & 1];
+temp2 = ff_exp2fi((pan_offset - 
sbr->data[1].env_facs_q[e][k])>>1) *
+exp2_tab[(pan_offset - 
sbr->data[1].env_facs_q[e][k]) & 1];
+}
 if (temp1 > 1E20) {
 av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow 
in dequant\n");
 temp1 = 1;
@@ -93,8 +101,8 @@ static void sbr_dequant(SpectralBandReplication *sbr, int 
id_aac)
 }
 for (e = 1; e <= sbr->data[0].bs_num_noise; e++) {
 for (k = 0; k < sbr->n_q; k++) {
-float temp1 = exp2f(NOISE_FLOOR_OFFSET - 
sbr->data[0].noise_facs_q[e][k] + 1);
-float temp2 = exp2f(12 - sbr->data[1].noise_facs_q[e][k]);
+float temp1 = ff_exp2fi(NOISE_FLOOR_OFFSET - 
sbr->data[0].noise_facs_q[e][k] + 1);
+float temp2 = ff_exp2fi(12 - sbr->data[1].noise_facs_q[e][k]);
 float fac;
 av_assert0(temp1 <= 1E20);
 fac = temp1 / (1.0f + temp2);
@@ -104,11 +112,13 @@ static void sbr_dequant(SpectralBandReplication *sbr, int 
id_aac)
 }
 } else { // SCE or one non-coupled CPE
 for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
-float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f;
 for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
 for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){
-sbr->data[ch].env_facs[e][k] =
-exp2f(alpha * sbr->data[ch].env_facs_q[e][k] + 6.0f);
+if (sbr->data[ch].bs_amp_res)
+sbr->data[ch].env_facs[e][k] = 
ff_exp2fi(sbr->data[ch].env_facs_q[e][k] + 6);
+else
+sbr->data[ch].env_facs[e][k] = 
ff_exp2fi((sbr->data[ch].env_facs_q[e][k]>>1) + 6)
+   * 
exp2_tab[sbr->data[ch].env_facs_q[e][k] & 1];
 if (sbr->data[ch].env_facs[e][k] > 1E20) {
 av_log(NULL, AV_LOG_ERROR, "envelope scalefactor 
overflow in dequant\n");
 

[FFmpeg-cvslog] swscale/arm/yuv2rgb: add ff_yuv420p_to_{argb, rgba, abgr, bgra}_neon_{16, 32}

2015-12-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue 
Dec 15 14:42:22 2015 +0100| [b32a42295ad7b254f9662082d799c0aae2071c2e] | 
committer: Matthieu Bouron

swscale/arm/yuv2rgb: add ff_yuv420p_to_{argb,rgba,abgr,bgra}_neon_{16,32}

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

 libswscale/arm/swscale_unscaled.c |   52 ++---
 libswscale/arm/yuv2rgb_neon.S |   77 ++---
 2 files changed, 118 insertions(+), 11 deletions(-)

diff --git a/libswscale/arm/swscale_unscaled.c 
b/libswscale/arm/swscale_unscaled.c
index 4c12122..1b50acd 100644
--- a/libswscale/arm/swscale_unscaled.c
+++ b/libswscale/arm/swscale_unscaled.c
@@ -63,6 +63,50 @@ static int rgbx_to_nv12_neon_16_wrapper(SwsContext *context, 
const uint8_t *src[
 }
 #endif
 
+#define YUV_TO_RGB_TABLE(precision)
 \
+c->yuv2rgb_v2r_coeff / ((precision) == 16 ? 1 << 7 : 1),   
 \
+c->yuv2rgb_u2g_coeff / ((precision) == 16 ? 1 << 7 : 1),   
 \
+c->yuv2rgb_v2g_coeff / ((precision) == 16 ? 1 << 7 : 1),   
 \
+c->yuv2rgb_u2b_coeff / ((precision) == 16 ? 1 << 7 : 1),   
 \
+
+#define DECLARE_FF_YUV420P_TO_RGBX_FUNCS(ofmt, precision)  
 \
+int ff_yuv420p_to_##ofmt##_neon_##precision(int w, int h,  
 \
+ uint8_t *dst, int linesize,   
 \
+ const uint8_t *srcY, int linesizeY,   
 \
+ const uint8_t *srcU, int linesizeU,   
 \
+ const uint8_t *srcV, int linesizeV,   
 \
+ const int16_t *table, 
 \
+ int y_offset, 
 \
+ int y_coeff); 
 \
+   
 \
+static int yuv420p_to_##ofmt##_neon_wrapper_##precision(SwsContext *c, const 
uint8_t *src[],\
+   int srcStride[], int srcSliceY, int 
srcSliceH,   \
+   uint8_t *dst[], int dstStride[]) {  
 \
+const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE(precision) };   
 \
+   
 \
+ff_yuv420p_to_##ofmt##_neon_##precision(c->srcW, srcSliceH,
 \
+ dst[0] + srcSliceY * dstStride[0], 
dstStride[0],   \
+ src[0], srcStride[0], 
 \
+ src[1], srcStride[1], 
 \
+ src[2], srcStride[2], 
 \
+ yuv2rgb_table,
 \
+ c->yuv2rgb_y_offset >> 9, 
 \
+ c->yuv2rgb_y_coeff / ((precision) == 16 ? 1 
<< 7 : 1));\
+   
 \
+return 0;  
 \
+}  
 \
+
+#define DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(precision)
 \
+DECLARE_FF_YUV420P_TO_RGBX_FUNCS(argb, precision)  
 \
+DECLARE_FF_YUV420P_TO_RGBX_FUNCS(rgba, precision)  
 \
+DECLARE_FF_YUV420P_TO_RGBX_FUNCS(abgr, precision)  
 \
+DECLARE_FF_YUV420P_TO_RGBX_FUNCS(bgra, precision)  
 \
+
+#define DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS 
 \
+DECLARE_FF_YUV420P_TO_ALL_RGBX_FUNCS(16)   
 \
+
+DECLARE_FF_YUV420P_TO_ALL_RGBX_ALL_PRECISION_FUNCS
+
 #define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt, precision)
 \
 int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h, 
 \
  uint8_t *dst, int linesize,   
 \
@@ -75,12 +119,7 @@ int ff_##ifmt##_to_##ofmt##_neon_##precision(int w, int h,
 static int 

[FFmpeg-cvslog] swscale/arm/yuv2rgb: disable neon if accurate_rnd is enabled

2015-12-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Fri 
Dec 18 14:24:52 2015 +0100| [e0dc22b99e85823ea85a9da85eced1e9b2bf24e4] | 
committer: Matthieu Bouron

swscale/arm/yuv2rgb: disable neon if accurate_rnd is enabled

This disables the 32bit precision neon code path in favor of the
default C one and avoids breaking fate.

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

 libswscale/arm/swscale_unscaled.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libswscale/arm/swscale_unscaled.c 
b/libswscale/arm/swscale_unscaled.c
index e694ef4..4c12122 100644
--- a/libswscale/arm/swscale_unscaled.c
+++ b/libswscale/arm/swscale_unscaled.c
@@ -100,7 +100,6 @@ DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra, precision)
 
 #define DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nvx)
 \
 DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx, 16)  
 \
-DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx, 32)  
 \
 
 DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv12)
 DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv21)
@@ -113,9 +112,9 @@ DECLARE_FF_NVX_TO_ALL_RGBX_ALL_PRECISION_FUNCS(nv21)
 if (c->srcFormat == AV_PIX_FMT_##IFMT  
 \
 && c->dstFormat == AV_PIX_FMT_##OFMT   
 \
 && !(c->srcH & 1)  
 \
-&& !(c->srcW & 15)) {  
 \
-c->swscale = (accurate_rnd) ? ifmt##_to_##ofmt##_neon_wrapper_32 : 
 \
-  ifmt##_to_##ofmt##_neon_wrapper_16 ; 
 \
+&& !(c->srcW & 15) 
 \
+&& !accurate_rnd) {
 \
+c->swscale = ifmt##_to_##ofmt##_neon_wrapper_16;   
 \
 }  
 \
 } while (0)
 

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


[FFmpeg-cvslog] lavu/libm: add copysign hack

2015-12-19 Thread Ganesh Ajjanagadde
ffmpeg | branch: master | Ganesh Ajjanagadde  | Fri Dec 
18 11:13:11 2015 -0800| [062e3e23824ba3d25594ea966d7834bcf34db49b] | committer: 
Ganesh Ajjanagadde

lavu/libm: add copysign hack

For systems with broken libms.
Tested with NAN, -NAN, INFINITY, -INFINITY, +/-x for regular double x and
combinations of these.

Old versions of MSVC need some UINT64_C hackery.

Reviewed-by: Ronald S. Bultje 
Reviewed-by: Hendrik Leppkes 
Signed-off-by: Ganesh Ajjanagadde 

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

 configure|2 +-
 libavutil/libm.h |9 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index dc1d2eb..da74616 100755
--- a/configure
+++ b/configure
@@ -2851,7 +2851,7 @@ cropdetect_filter_deps="gpl"
 delogo_filter_deps="gpl"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
-dynaudnorm_filter_deps="copysign erf"
+dynaudnorm_filter_deps="erf"
 ebur128_filter_deps="gpl"
 eq_filter_deps="gpl"
 fftfilt_filter_deps="avcodec"
diff --git a/libavutil/libm.h b/libavutil/libm.h
index 6d8bd68..37b8e86 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -62,6 +62,15 @@ static av_always_inline float cbrtf(float x)
 }
 #endif
 
+#if !HAVE_COPYSIGN
+static av_always_inline double copysign(double x, double y)
+{
+uint64_t vx = av_double2int(x);
+uint64_t vy = av_double2int(y);
+return av_int2double((vx & UINT64_C(0x7fff)) | (vy & 
UINT64_C(0x8000)));
+}
+#endif
+
 #if !HAVE_COSF
 #undef cosf
 #define cosf(x) ((float)cos(x))

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


[FFmpeg-cvslog] avfilter/vf_stereo3d: add interleave columns input support

2015-12-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Dec 18 22:00:31 
2015 +0100| [ebe1ca01d15372b53e06b919845c480c105fdebc] | committer: Paul B Mahol

avfilter/vf_stereo3d: add interleave columns input support

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi  |6 ++
 libavfilter/vf_stereo3d.c |  217 ++---
 2 files changed, 172 insertions(+), 51 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b8047ab..ba81dc7 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10784,6 +10784,12 @@ interleaved rows (left eye has top row, right eye 
starts on next row)
 @item irr
 interleaved rows (right eye has top row, left eye starts on next row)
 
+@item icl
+interleaved columns, left eye first
+
+@item icr
+interleaved columns, right eye first
+
 Default value is @samp{sbsl}.
 @end table
 
diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c
index de884a8..85a5258 100644
--- a/libavfilter/vf_stereo3d.c
+++ b/libavfilter/vf_stereo3d.c
@@ -170,6 +170,8 @@ static const AVOption stereo3d_options[] = {
 { "sbsr",  "side by side right first",0, AV_OPT_TYPE_CONST, 
{.i64=SIDE_BY_SIDE_RL},0, 0, FLAGS, "in" },
 { "irl",   "interleave rows left first",  0, AV_OPT_TYPE_CONST, 
{.i64=INTERLEAVE_ROWS_LR}, 0, 0, FLAGS, "in" },
 { "irr",   "interleave rows right first", 0, AV_OPT_TYPE_CONST, 
{.i64=INTERLEAVE_ROWS_RL}, 0, 0, FLAGS, "in" },
+{ "icl",   "interleave columns left first",   0, AV_OPT_TYPE_CONST, 
{.i64=INTERLEAVE_COLS_LR}, 0, 0, FLAGS, "in" },
+{ "icr",   "interleave columns right first",  0, AV_OPT_TYPE_CONST, 
{.i64=INTERLEAVE_COLS_RL}, 0, 0, FLAGS, "in" },
 { "out",   "set output format", OFFSET(out.format),  AV_OPT_TYPE_INT,   
{.i64=ANAGLYPH_RC_DUBOIS}, 0, STEREO_CODE_COUNT-1, FLAGS, "out"},
 { "ab2l",  "above below half height left first",  0, AV_OPT_TYPE_CONST, 
{.i64=ABOVE_BELOW_2_LR},   0, 0, FLAGS, "out" },
 { "ab2r",  "above below half height right first", 0, AV_OPT_TYPE_CONST, 
{.i64=ABOVE_BELOW_2_RL},   0, 0, FLAGS, "out" },
@@ -312,6 +314,26 @@ static inline uint8_t ana_convert(const int *coeff, const 
uint8_t *left, const u
 return av_clip_uint8(sum >> 16);
 }
 
+static void anaglyph_ic(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
+ptrdiff_t dst_linesize, ptrdiff_t l_linesize, 
ptrdiff_t r_linesize,
+int width, int height,
+const int *ana_matrix_r, const int *ana_matrix_g, 
const int *ana_matrix_b)
+{
+int x, y, o;
+
+for (y = 0; y < height; y++) {
+for (o = 0, x = 0; x < width; x++, o+= 3) {
+dst[o] = ana_convert(ana_matrix_r, lsrc + o * 2, rsrc + o * 2);
+dst[o + 1] = ana_convert(ana_matrix_g, lsrc + o * 2, rsrc + o * 2);
+dst[o + 2] = ana_convert(ana_matrix_b, lsrc + o * 2, rsrc + o * 2);
+}
+
+dst  += dst_linesize;
+lsrc += l_linesize;
+rsrc += r_linesize;
+}
+}
+
 static void anaglyph(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
  ptrdiff_t dst_linesize, ptrdiff_t l_linesize, ptrdiff_t 
r_linesize,
  int width, int height,
@@ -344,6 +366,8 @@ static int config_output(AVFilterLink *outlink)
 int ret;
 
 switch (s->in.format) {
+case INTERLEAVE_COLS_LR:
+case INTERLEAVE_COLS_RL:
 case SIDE_BY_SIDE_2_LR:
 case SIDE_BY_SIDE_LR:
 case SIDE_BY_SIDE_2_RL:
@@ -408,6 +432,10 @@ static int config_output(AVFilterLink *outlink)
 fps.den*= 2;
 tb.num *= 2;
 break;
+case INTERLEAVE_COLS_RL:
+case INTERLEAVE_COLS_LR:
+s->width= inlink->w / 2;
+break;
 case INTERLEAVE_ROWS_LR:
 case INTERLEAVE_ROWS_RL:
 s->in.row_step  = 2;
@@ -504,8 +532,10 @@ static int config_output(AVFilterLink *outlink)
 s->out.off_lstep = 1;
 break;
 case MONO_R:
-s->in.off_left   = s->in.off_right;
-s->in.row_left   = s->in.row_right;
+if (s->in.format != INTERLEAVE_COLS_LR) {
+s->in.off_left = s->in.off_right;
+s->in.row_left = s->in.row_right;
+}
 if (s->in.format == INTERLEAVE_ROWS_LR)
 FFSWAP(int, s->in.off_lstep, s->in.off_rstep);
 break;
@@ -531,6 +561,17 @@ static int config_output(AVFilterLink *outlink)
 return AVERROR(EINVAL);
 }
 
+if (s->in.format == INTERLEAVE_COLS_LR || s->in.format == 
INTERLEAVE_COLS_RL) {
+if ((s->in.format & 1) != (s->out.format & 1)) {
+FFSWAP(int, s->in.row_left,   s->in.row_right);
+FFSWAP(int, s->in.off_lstep,  s->in.off_rstep);
+FFSWAP(int, s->in.off_left,   s->in.off_right);
+FFSWAP(int, s->out.row_left,  s->out.row_right);

[FFmpeg-cvslog] avcodec/h264_refs: Fix long_idx check

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Dec 19 21:59:42 2015 +0100| [b92b4775a0d07cacfdd2b4be6511f3cb362c977b] | 
committer: Michael Niedermayer

avcodec/h264_refs: Fix long_idx check

Fixes out of array read
Fixes mozilla bug 1233606

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

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

 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 b47c995..fbdcbd6 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -301,7 +301,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, 
H264SliceContext *sl)
 
 long_idx = pic_num_extract(h, pic_id, _structure);
 
-if (long_idx > 31) {
+if (long_idx > 31U) {
 av_log(h->avctx, AV_LOG_ERROR,
"long_term_pic_idx overflow\n");
 return AVERROR_INVALIDDATA;

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


[FFmpeg-cvslog] avcodec/Makefile: add missing dep for g723_1 encoder

2015-12-19 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Dec 19 18:50:47 
2015 -0300| [0f520e489a659d9ea0fa7467aca3bf85cc006ef7] | committer: James Almer

avcodec/Makefile: add missing dep for g723_1 encoder

Signed-off-by: James Almer 

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

 libavcodec/Makefile |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 44b199e..5bcd35b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -281,7 +281,7 @@ OBJS-$(CONFIG_G2M_DECODER) += g2meet.o elsdec.o
 OBJS-$(CONFIG_G723_1_DECODER)  += g723_1dec.o g723_1.o \
   acelp_vectors.o celp_filters.o 
celp_math.o
 OBJS-$(CONFIG_G723_1_ENCODER)  += g723_1enc.o g723_1.o \
-  acelp_vectors.o celp_filters.o
+  acelp_vectors.o celp_filters.o 
celp_math.o
 OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o 
acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
 OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
 OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o

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


[FFmpeg-cvslog] avfilter/af_dynaudnorm: use av_malloc_array()

2015-12-19 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sat Dec 19 22:46:10 
2015 +0100| [7caf381a95d41d1c2f5a7dd753ac6949f21724b7] | committer: Paul B Mahol

avfilter/af_dynaudnorm: use av_malloc_array()

Signed-off-by: Paul B Mahol 

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

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

diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c
index 5f412f5..1085189 100644
--- a/libavfilter/af_dynaudnorm.c
+++ b/libavfilter/af_dynaudnorm.c
@@ -162,7 +162,7 @@ static cqueue *cqueue_create(int size)
 q->nb_elements = 0;
 q->first = 0;
 
-q->elements = av_malloc(sizeof(double) * size);
+q->elements = av_malloc_array(size, sizeof(double));
 if (!q->elements) {
 av_free(q);
 return NULL;
@@ -266,16 +266,16 @@ static int config_input(AVFilterLink *inlink)
 inlink->partial_buf_size = frame_size(inlink->sample_rate, 
s->frame_len_msec);
 av_log(ctx, AV_LOG_DEBUG, "frame len %d\n", s->frame_len);
 
-s->fade_factors[0] = av_malloc(s->frame_len * sizeof(*s->fade_factors[0]));
-s->fade_factors[1] = av_malloc(s->frame_len * sizeof(*s->fade_factors[1]));
+s->fade_factors[0] = av_malloc_array(s->frame_len, 
sizeof(*s->fade_factors[0]));
+s->fade_factors[1] = av_malloc_array(s->frame_len, 
sizeof(*s->fade_factors[1]));
 
-s->prev_amplification_factor = av_malloc(inlink->channels * 
sizeof(*s->prev_amplification_factor));
+s->prev_amplification_factor = av_malloc_array(inlink->channels, 
sizeof(*s->prev_amplification_factor));
 s->dc_correction_value = av_calloc(inlink->channels, 
sizeof(*s->dc_correction_value));
 s->compress_threshold = av_calloc(inlink->channels, 
sizeof(*s->compress_threshold));
 s->gain_history_original = av_calloc(inlink->channels, 
sizeof(*s->gain_history_original));
 s->gain_history_minimum = av_calloc(inlink->channels, 
sizeof(*s->gain_history_minimum));
 s->gain_history_smoothed = av_calloc(inlink->channels, 
sizeof(*s->gain_history_smoothed));
-s->weights = av_malloc(s->filter_size * sizeof(*s->weights));
+s->weights = av_malloc_array(s->filter_size, sizeof(*s->weights));
 if (!s->prev_amplification_factor || !s->dc_correction_value ||
 !s->compress_threshold || !s->fade_factors[0] || !s->fade_factors[1] ||
 !s->gain_history_original || !s->gain_history_minimum ||

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


[FFmpeg-cvslog] nutdec: reject negative value_len in read_sm_data

2015-12-19 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Sat Dec 19 12:02:56 2015 +0100| [ce10f572c12b0d172c72d31d8c979afce602bf0c] | 
committer: Andreas Cadhalpun

nutdec: reject negative value_len in read_sm_data

If it is negative, it can cause the byte position to move backwards in
avio_skip, which in turn makes sm_size negative and thus size larger
than the size of the packet buffer, causing invalid writes in avio_read.

Also fix potential overflow of avio_tell(bc) + value_len.

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

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

 libavformat/nutdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ef08ad9..4df6a57 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -934,7 +934,7 @@ static int read_sm_data(AVFormatContext *s, AVIOContext 
*bc, AVPacket *pkt, int
 return ret;
 }
 value_len = ffio_read_varlen(bc);
-if (avio_tell(bc) + value_len >= maxpos)
+if (value_len < 0 || value_len >= maxpos - avio_tell(bc))
 return AVERROR_INVALIDDATA;
 if (!strcmp(name, "Palette")) {
 dst = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, 
value_len);

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


[FFmpeg-cvslog] Tag n2.8.4 : FFmpeg 2.8.4 release

2015-12-19 Thread git
[ffmpeg] [branch: refs/tags/n2.8.4]
Tag:c62ac58527d5112a9102e3e05bb80ee2497f3c6e
> http://git.videolan.org/gitweb.cgi/ffmpeg.git?a=tag;h=c62ac58527d5112a9102e3e05bb80ee2497f3c6e

Tagger: Michael Niedermayer 
Date:   Sun Dec 20 03:07:07 2015 +0100

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


[FFmpeg-cvslog] avcodec/mpeg4videodec: also for empty partitioned slices

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Dec 19 23:21:33 2015 +0100| [70f13abb4f9a376ddc0d2c566739bc3c6a0c47e7] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: also for empty partitioned slices

Fixes assertion failure
Fixes: id_acf3e47f864e1ee4c7b86c0653e0ff31e5bde56e.m4v

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

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 5cc8fab..2c3b598 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -883,7 +883,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
 const int part_a_end   = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END   
| ER_MV_END)   : ER_MV_END;
 
 mb_num = mpeg4_decode_partition_a(ctx);
-if (mb_num < 0) {
+if (mb_num <= 0) {
 ff_er_add_slice(>er, s->resync_mb_x, s->resync_mb_y,
 s->mb_x, s->mb_y, part_a_error);
 return -1;

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


[FFmpeg-cvslog] avcodec/h264_refs: Fix long_idx check

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Dec 19 21:59:42 2015 +0100| [3a3be0220834b1bb1de2e68da47cc944cbf5f746] | 
committer: Michael Niedermayer

avcodec/h264_refs: Fix long_idx check

Fixes out of array read
Fixes mozilla bug 1233606

Found-by: Tyson Smith
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b92b4775a0d07cacfdd2b4be6511f3cb362c977b)

Signed-off-by: Michael Niedermayer 

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

 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 a81ee76..a3de6b2 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -303,7 +303,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, 
H264SliceContext *sl)
 
 long_idx = pic_num_extract(h, pic_id, _structure);
 
-if (long_idx > 31) {
+if (long_idx > 31U) {
 av_log(h->avctx, AV_LOG_ERROR,
"long_term_pic_idx overflow\n");
 return AVERROR_INVALIDDATA;

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


[FFmpeg-cvslog] avcodec/mpeg4videodec: also for empty partitioned slices

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sat Dec 19 23:21:33 2015 +0100| [bdc6ba460429d78a805c39fecaf7d101df36d11f] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: also for empty partitioned slices

Fixes assertion failure
Fixes: id_acf3e47f864e1ee4c7b86c0653e0ff31e5bde56e.m4v

Found-by: Andreas Cadhalpun 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 70f13abb4f9a376ddc0d2c566739bc3c6a0c47e7)

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 7d664cc..2c34d21 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -883,7 +883,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
 const int part_a_end   = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END   
| ER_MV_END)   : ER_MV_END;
 
 mb_num = mpeg4_decode_partition_a(ctx);
-if (mb_num < 0) {
+if (mb_num <= 0) {
 ff_er_add_slice(>er, s->resync_mb_x, s->resync_mb_y,
 s->mb_x, s->mb_y, part_a_error);
 return -1;

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


[FFmpeg-cvslog] [ffmpeg-web] branch master updated. 040628a web/download: add FFmpeg 2.8.4

2015-12-19 Thread ffmpeg-cvslog
The branch, master has been updated
   via  040628ac21606ed472e0beb2f07bc08d3f954d7d (commit)
  from  33764ae5c94f5d5a019acaeaee25b1498a4e0eb3 (commit)


- Log -
commit 040628ac21606ed472e0beb2f07bc08d3f954d7d
Author: Michael Niedermayer 
AuthorDate: Sun Dec 20 03:19:59 2015 +0100
Commit: Michael Niedermayer 
CommitDate: Sun Dec 20 03:19:59 2015 +0100

web/download: add FFmpeg 2.8.4

diff --git a/src/download b/src/download
index 43cf05f..cbc4bdf 100644
--- a/src/download
+++ b/src/download
@@ -1,10 +1,10 @@
 
 
   
-http://ffmpeg.org/releases/ffmpeg-2.8.3.tar.bz2; class="btn 
btn-success">
+http://ffmpeg.org/releases/ffmpeg-2.8.4.tar.bz2; class="btn 
btn-success">
   
   Download
-  ffmpeg-2.8.3.tar.bz2
+  ffmpeg-2.8.4.tar.bz2
 
 
 More releases
@@ -270,10 +270,10 @@
   
 
 
-  FFmpeg 2.8.3 "Feynman"
+  FFmpeg 2.8.4 "Feynman"
 
   
-2.8.3 was released on 2015-11-27. It is the latest stable FFmpeg release
+2.8.4 was released on 2015-12-20. It is the latest stable FFmpeg release
 from the 2.8 release branch, which was cut from master on 2015-09-05.
 Amongst lots of other changes, it includes all changes from
 ffmpeg-mt, libav master of 2015-08-28, libav 11 as of 2015-08-28.
@@ -293,19 +293,19 @@ libpostproc53.  3.100
 
   
 
-  Download 
xz tarball
-  PGP 
signature
+  Download 
xz tarball
+  PGP 
signature
  
 
-  Download 
bzip2 tarball
-  PGP 
signature
+  Download 
bzip2 tarball
+  PGP 
signature
  
 
-  Download 
gzip tarball
-  PGP 
signature
+  Download 
gzip tarball
+  PGP 
signature
  
 
-  http://git.videolan.org/?p=ffmpeg.git;a=shortlog;h=n2.8.3;>Changelog
+  http://git.videolan.org/?p=ffmpeg.git;a=shortlog;h=n2.8.4;>Changelog
   http://git.videolan.org/?p=ffmpeg.git;a=blob;f=RELEASE_NOTES;hb=release/2.8;>Release
 Notes
  


---

Summary of changes:
 src/download | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)


hooks/post-receive
-- 

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


[FFmpeg-cvslog] mlvdec: check that index_entries exist

2015-12-19 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.8 | Andreas Cadhalpun 
 | Sat Dec 19 23:47:54 2015 +0100| 
[63ecbb82fc1d6db23cda10b313c0435866d16384] | committer: Michael Niedermayer

mlvdec: check that index_entries exist

This fixes NULL pointer dereferencing.

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

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

 libavformat/mlvdec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 48a429e..4b3bdc1 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -365,6 +365,11 @@ static int read_header(AVFormatContext *avctx)
 if (ast)
 ast->duration = ast->nb_index_entries;
 
+if ((vst && !vst->nb_index_entries) || (ast && !ast->nb_index_entries)) {
+av_log(avctx, AV_LOG_ERROR, "no index entries found\n");
+return AVERROR_INVALIDDATA;
+}
+
 if (vst && ast)
 avio_seek(pb, FFMIN(vst->index_entries[0].pos, 
ast->index_entries[0].pos), SEEK_SET);
 else if (vst)

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


[FFmpeg-cvslog] rawdec: only exempt BIT0 with need_copy from buffer sanity check

2015-12-19 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.8 | Andreas Cadhalpun 
 | Sat Dec 19 23:49:14 2015 +0100| 
[9be3441c311c8b09fe3af38169a3ad4c5cb5cac8] | committer: Michael Niedermayer

rawdec: only exempt BIT0 with need_copy from buffer sanity check

Otherwise the too samll buffer is directly used in the frame, causing
segmentation faults, when trying to use the frame.

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

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

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

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index d8d77fc..af764ab 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -258,7 +258,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 buf += buf_size - context->frame_size;
 
 len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? 
AVPALETTE_SIZE : 0);
-if (buf_size < len && (avctx->codec_tag & 0xFF) != MKTAG('B','I','T', 
0)) {
+if (buf_size < len && ((avctx->codec_tag & 0xFF) != MKTAG('B','I','T', 
0) || !need_copy)) {
 av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < 
expected frame_size %d\n", buf_size, len);
 av_buffer_unref(>buf[0]);
 return AVERROR(EINVAL);

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


[FFmpeg-cvslog] Update Changelog

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.8 | Michael Niedermayer  | 
Sun Dec 20 02:58:41 2015 +0100| [644179e0d4155ae8f5ddd5c3f6bd003e2e13cf94] | 
committer: Michael Niedermayer

Update Changelog

Signed-off-by: Michael Niedermayer 

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

 Changelog |   25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 7646dac..b7f32b1 100644
--- a/Changelog
+++ b/Changelog
@@ -2,7 +2,30 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version 2.8.4
-- avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H
+- rawdec: only exempt BIT0 with need_copy from buffer sanity check
+- mlvdec: check that index_entries exist
+- avcodec/mpeg4videodec: also for empty partitioned slices
+- avcodec/h264_refs: Fix long_idx check
+- avcodec/h264_mc_template: prefetch list1 only if it is used in the MB
+- avcodec/h264_slice: Simplify ref2frm indexing
+- avfilter/vf_mpdecimate: Add missing emms_c()
+- sonic: make sure num_taps * channels is not larger than frame_size
+- opus_silk: fix typo causing overflow in silk_stabilize_lsf
+- ffm: reject invalid codec_id and codec_type
+- golomb: always check for invalid UE golomb codes in get_ue_golomb
+- sbr_qmf_analysis: sanitize input for 32-bit imdct
+- sbrdsp_fixed: assert that input values are in the valid range
+- aacsbr: ensure strictly monotone time borders
+- aacenc: update max_sfb when num_swb changes
+- aaccoder: prevent crash of anmr coder
+- ffmdec: reject zero-sized chunks
+- swscale/x86/rgb2rgb_template: Fallback to mmx in interleaveBytes() if the 
alignment is insufficient for SSE*
+- swscale/x86/rgb2rgb_template: Do not crash on misaligend stride
+- avformat/mxfenc: Do not crash if there is no packet in the first stream
+- lavf/tee: fix side data double free.
+- avformat/hlsenc: Check the return code of avformat_write_header()
+- avformat/mov: Enable parser for mp3s by old HandBrake
+- avformat/mxfenc: Fix integer overflow in length computation
 - avformat/utils: estimate_timings_from_pts - increase retry counter, fixes 
invalid duration for ts files with hevc codec
 - avformat/matroskaenc: Check codecdelay before use
 - avutil/mathematics: Fix division by 0

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


[FFmpeg-cvslog] avcodec/h264_slice: Simplify ref2frm indexing

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Thu Dec 17 22:51:00 2015 +0100| [a628b7083100f96e376d97e5afb12efb74f01e8a] | 
committer: Michael Niedermayer

avcodec/h264_slice: Simplify ref2frm indexing

This also suppresses a ubsan warning
Fixes Mozilla bug 1230247

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 2f32948..f80c469 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1940,12 +1940,12 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 if (USES_LIST(top_type, list)) {
 const int b_xy  = h->mb2b_xy[top_xy] + 3 * b_stride;
 const int b8_xy = 4 * top_xy + 2;
-int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & 
(MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
+int *ref2frm = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 
1)][list] + (MB_MBAFF(sl) ? 20 : 2);
 AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
 ref_cache[0 - 1 * 8] =
-ref_cache[1 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
+ref_cache[1 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 
0]];
 ref_cache[2 - 1 * 8] =
-ref_cache[3 - 1 * 8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];
+ref_cache[3 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 
1]];
 } else {
 AV_ZERO128(mv_dst - 1 * 8);
 AV_WN32A(_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 
0x01010101u);
@@ -1955,15 +1955,15 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 if (USES_LIST(left_type[LTOP], list)) {
 const int b_xy  = h->mb2b_xy[left_xy[LTOP]] + 3;
 const int b8_xy = 4 * left_xy[LTOP] + 1;
-int (*ref2frm)[64] =(void*)( 
sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + 
(MB_MBAFF(sl) ? 20 : 2));
+int *ref2frm = sl->ref2frm[h->slice_table[left_xy[LTOP]] & 
(MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2);
 AV_COPY32(mv_dst - 1 +  0, h->cur_pic.motion_val[list][b_xy + 
b_stride * 0]);
 AV_COPY32(mv_dst - 1 +  8, h->cur_pic.motion_val[list][b_xy + 
b_stride * 1]);
 AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + 
b_stride * 2]);
 AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + 
b_stride * 3]);
 ref_cache[-1 +  0] =
-ref_cache[-1 +  8] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]];
+ref_cache[-1 +  8] = ref2frm[h->cur_pic.ref_index[list][b8_xy 
+ 2 * 0]];
 ref_cache[-1 + 16] =
-ref_cache[-1 + 24] = 
ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]];
+ref_cache[-1 + 24] = ref2frm[h->cur_pic.ref_index[list][b8_xy 
+ 2 * 1]];
 } else {
 AV_ZERO32(mv_dst - 1 +  0);
 AV_ZERO32(mv_dst - 1 +  8);
@@ -1988,9 +1988,9 @@ static av_always_inline void 
fill_filter_caches_inter(const H264Context *h,
 
 {
 int8_t *ref = >cur_pic.ref_index[list][4 * mb_xy];
-int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 
1)][0] + (MB_MBAFF(sl) ? 20 : 2));
-uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], 
ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
-uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], 
ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
+int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][list] + 
(MB_MBAFF(sl) ? 20 : 2);
+uint32_t ref01 = (pack16to32(ref2frm[ref[0]], ref2frm[ref[1]]) & 
0x00FF00FF) * 0x0101;
+uint32_t ref23 = (pack16to32(ref2frm[ref[2]], ref2frm[ref[3]]) & 
0x00FF00FF) * 0x0101;
 AV_WN32A(_cache[0 * 8], ref01);
 AV_WN32A(_cache[1 * 8], ref01);
 AV_WN32A(_cache[2 * 8], ref23);

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


[FFmpeg-cvslog] avcodec/h264_mc_template: prefetch list1 only if it is used in the MB

2015-12-19 Thread Michael Niedermayer
ffmpeg | branch: release/2.7 | Michael Niedermayer  | 
Fri Dec 18 00:20:51 2015 +0100| [50ce06cc7c5aa37ddab9147c13b22aaff959a43a] | 
committer: Michael Niedermayer

avcodec/h264_mc_template: prefetch list1 only if it is used in the MB

Fixes ubsan warning
Fixes Mozilla bug 1230276

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

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c
index eaead35..e4333a7 100644
--- a/libavcodec/h264_mc_template.c
+++ b/libavcodec/h264_mc_template.c
@@ -158,6 +158,7 @@ static void MCFUNC(hl_motion)(const H264Context *h, 
H264SliceContext *sl,
 }
 }
 
-prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);
+if (USES_LIST(mb_type, 1))
+prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);
 }
 

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


[FFmpeg-cvslog] swscale/arm/yuv2rgb: simplify process_16px_* macro call

2015-12-19 Thread Matthieu Bouron
ffmpeg | branch: master | Matthieu Bouron  | Tue 
Dec 15 17:04:09 2015 +0100| [c2ad24832139699815b9666b91ae8876fe3b47c1] | 
committer: Matthieu Bouron

swscale/arm/yuv2rgb: simplify process_16px_* macro call

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

 libswscale/arm/yuv2rgb_neon.S |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libswscale/arm/yuv2rgb_neon.S b/libswscale/arm/yuv2rgb_neon.S
index 01d8536..9f9dd2a 100644
--- a/libswscale/arm/yuv2rgb_neon.S
+++ b/libswscale/arm/yuv2rgb_neon.S
@@ -226,13 +226,7 @@ function ff_\ifmt\()_to_\ofmt\()_neon_\precision\(), 
export=1
 vsubl.u8q15, d2, d10   @ q15 = 
V - 128
 .endif
 
-.ifc \precision,16
-process_16px_16 \ofmt
-.endif
-
-.ifc \precision,32
-process_16px_32 \ofmt
-.endif
+process_16px_\precision \ofmt
 
 subsr8, r8, #16@ width 
-= 16
 bgt 2b

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


[FFmpeg-cvslog] ffserver: unify exit path from build_feed_streams()

2015-12-19 Thread Reynaldo H. Verdejo Pinochet
ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet 
 | Tue Dec 15 14:51:18 2015 -0800| 
[532a2833830538925e7830c22a885e73e557d6d7] | committer: Reynaldo H. Verdejo 
Pinochet

ffserver: unify exit path from build_feed_streams()

Exit from main on build_feed_streams() failures & use
standard EXIT_ codes on error out/normal exit.

Signed-off-by: Reynaldo H. Verdejo Pinochet 

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

 ffserver.c |   46 +-
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 129f9fd..8799076 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3622,7 +3622,7 @@ static void build_file_streams(void)
 }
 
 /* compute the needed AVStream for each feed */
-static void build_feed_streams(void)
+static int build_feed_streams(void)
 {
 FFServerStream *stream, *feed;
 int i;
@@ -3658,7 +3658,7 @@ static void build_feed_streams(void)
 int ret = ffio_set_buf_size(s->pb, FFM_PACKET_SIZE);
 if (ret < 0) {
 http_log("Failed to set buffer size\n");
-exit(1);
+goto bail;
 }
 
 /* Now see if it matches */
@@ -3723,7 +3723,7 @@ static void build_feed_streams(void)
 if (feed->readonly) {
 http_log("Unable to delete feed file '%s' as it is marked 
readonly\n",
 feed->feed_filename);
-exit(1);
+goto bail;
 }
 unlink(feed->feed_filename);
 }
@@ -3733,27 +3733,27 @@ static void build_feed_streams(void)
 
 if (!s) {
 http_log("Failed to allocate context\n");
-exit(1);
+goto bail;
 }
 
 if (feed->readonly) {
 http_log("Unable to create feed file '%s' as it is marked 
readonly\n",
 feed->feed_filename);
-exit(1);
+goto bail;
 }
 
 /* only write the header of the ffm file */
 if (avio_open(>pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) {
 http_log("Could not open output feed file '%s'\n",
  feed->feed_filename);
-exit(1);
+goto bail;
 }
 s->oformat = feed->fmt;
 s->nb_streams = feed->nb_streams;
 s->streams = feed->streams;
 if (avformat_write_header(s, NULL) < 0) {
 http_log("Container doesn't support the required 
parameters\n");
-exit(1);
+goto bail;
 }
 /* XXX: need better API */
 av_freep(>priv_data);
@@ -3767,7 +3767,7 @@ static void build_feed_streams(void)
 if (fd < 0) {
 http_log("Could not open output feed file '%s'\n",
 feed->feed_filename);
-exit(1);
+goto bail;
 }
 
 feed->feed_write_index = FFMAX(ffm_read_write_index(fd), 
FFM_PACKET_SIZE);
@@ -3778,6 +3778,10 @@ static void build_feed_streams(void)
 
 close(fd);
 }
+return 0;
+
+bail:
+return -1;
 }
 
 /* compute the bandwidth used by each stream */
@@ -3858,7 +3862,9 @@ static const OptionDef options[] = {
 int main(int argc, char **argv)
 {
 struct sigaction sigact = { { 0 } };
-int ret = 0;
+int cfg_parsed;
+int ret = EXIT_FAILURE;
+
 
 config.filename = av_strdup("/etc/ffserver.conf");
 
@@ -3880,13 +3886,11 @@ int main(int argc, char **argv)
 sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
 sigaction(SIGCHLD, , 0);
 
-if ((ret = ffserver_parse_ffconfig(config.filename, )) < 0) {
+if ((cfg_parsed = ffserver_parse_ffconfig(config.filename, )) < 0) {
 fprintf(stderr, "Error reading configuration file '%s': %s\n",
-config.filename, av_err2str(ret));
-av_freep();
-exit(1);
+config.filename, av_err2str(cfg_parsed));
+goto bail;
 }
-av_freep();
 
 /* open log file if needed */
 if (config.logfilename[0] != '\0') {
@@ -3899,7 +3903,10 @@ int main(int argc, char **argv)
 
 build_file_streams();
 
-build_feed_streams();
+if (build_feed_streams() < 0) {
+http_log("Could not setup feed streams\n");
+goto bail;
+}
 
 compute_bandwidth();
 
@@ -3908,8 +3915,13 @@ int main(int argc, char **argv)
 
 if (http_server() < 0) {
 http_log("Could not start server\n");
-exit(1);
+goto bail;
 }
 
-return 0;
+ret=EXIT_SUCCESS;
+
+bail:
+av_freep ();
+avformat_network_deinit();
+return ret;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org

[FFmpeg-cvslog] ffserver: refactor build_feed_streams()

2015-12-19 Thread Reynaldo H. Verdejo Pinochet
ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet 
 | Wed Dec 16 18:14:25 2015 -0800| 
[ae2ed20b5912b00866631e78049f165deb9f2fb2] | committer: Reynaldo H. Verdejo 
Pinochet

ffserver: refactor build_feed_streams()

* Avoid excesive nesting that made it really hard to follow
* Drop unneeded vars
* Factor out codec compatibility check routine
* Ensure inputs are closed and contexts are freed as needed
  before returning

Signed-off-by: Reynaldo H. Verdejo Pinochet 

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

 ffserver.c |  172 ++--
 1 file changed, 98 insertions(+), 74 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 65044e6..c7dbb16 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -242,6 +242,9 @@ static HTTPContext *rtp_new_connection(struct sockaddr_in 
*from_addr,
 static int rtp_new_av_stream(HTTPContext *c,
  int stream_index, struct sockaddr_in *dest_addr,
  HTTPContext *rtsp_c);
+/* utils */
+static inline int check_codec_match(AVCodecContext *ccf, AVCodecContext *ccs,
+int stream);
 
 static const char *my_program_name;
 
@@ -3624,11 +3627,46 @@ static void build_file_streams(void)
 }
 }
 
+static inline
+int check_codec_match(AVCodecContext *ccf, AVCodecContext *ccs, int stream)
+{
+int matches = 1;
+
+#define CHECK_CODEC(x)  (ccf->x != ccs->x)
+if (CHECK_CODEC(codec_id) || CHECK_CODEC(codec_type)) {
+http_log("Codecs do not match for stream %d\n", stream);
+matches = 0;
+} else if (CHECK_CODEC(bit_rate) || CHECK_CODEC(flags)) {
+http_log("Codec bitrates do not match for stream %d\n", stream);
+matches = 0;
+} else if (ccf->codec_type == AVMEDIA_TYPE_VIDEO) {
+if (CHECK_CODEC(time_base.den) ||
+CHECK_CODEC(time_base.num) ||
+CHECK_CODEC(width) ||
+CHECK_CODEC(height)) {
+http_log("Codec width, height or framerate do not match for stream 
%d\n", stream);
+matches = 0;
+}
+} else if (ccf->codec_type == AVMEDIA_TYPE_AUDIO) {
+if (CHECK_CODEC(sample_rate) ||
+CHECK_CODEC(channels) ||
+CHECK_CODEC(frame_size)) {
+http_log("Codec sample_rate, channels, frame_size do not match for 
stream %d\n", stream);
+matches = 0;
+}
+} else {
+http_log("Unknown codec type for stream %d\n", stream);
+matches = 0;
+}
+
+return matches;
+}
+
 /* compute the needed AVStream for each feed */
 static int build_feed_streams(void)
 {
 FFServerStream *stream, *feed;
-int i;
+int i, fd;
 
 /* gather all streams */
 for(stream = config.first_stream; stream; stream = stream->next) {
@@ -3639,98 +3677,77 @@ static int build_feed_streams(void)
 if (stream->is_feed) {
 for(i=0;inb_streams;i++)
 stream->feed_streams[i] = i;
-} else {
-/* we handle a stream coming from a feed */
-for(i=0;inb_streams;i++)
-stream->feed_streams[i] = add_av_stream(feed,
-stream->streams[i]);
+continue;
 }
+/* we handle a stream coming from a feed */
+for(i=0;inb_streams;i++)
+stream->feed_streams[i] = add_av_stream(feed, stream->streams[i]);
 }
 
 /* create feed files if needed */
 for(feed = config.first_feed; feed; feed = feed->next_feed) {
-int fd;
 
 if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
-/* See if it matches */
 AVFormatContext *s = NULL;
 int matches = 0;
 
-if (avformat_open_input(, feed->feed_filename, NULL, NULL) >= 0) 
{
-/* set buffer size */
-int ret = ffio_set_buf_size(s->pb, FFM_PACKET_SIZE);
-if (ret < 0) {
-http_log("Failed to set buffer size\n");
-goto bail;
-}
+/* See if it matches */
 
-/* Now see if it matches */
-if (s->nb_streams == feed->nb_streams) {
-matches = 1;
-for(i=0;inb_streams;i++) {
-AVStream *sf, *ss;
-sf = feed->streams[i];
-ss = s->streams[i];
-
-if (sf->index != ss->index ||
-sf->id != ss->id) {
-http_log("Index & Id do not match for stream %d 
(%s)\n",
-   i, feed->feed_filename);
-matches = 0;
-} else {
-AVCodecContext *ccf, *ccs;
-
-ccf = sf->codec;
-

[FFmpeg-cvslog] ffserver: refactor build_file_streams()

2015-12-19 Thread Reynaldo H. Verdejo Pinochet
ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet 
 | Tue Dec 15 22:08:52 2015 -0800| 
[4ba148a6ea2c3f2491f1dc60246dd62c665ce1cf] | committer: Reynaldo H. Verdejo 
Pinochet

ffserver: refactor build_file_streams()

Avoid unneeded nesting, drop redundant var

Signed-off-by: Reynaldo H. Verdejo Pinochet 

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

 ffserver.c |   85 +++-
 1 file changed, 44 insertions(+), 41 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 8799076..65044e6 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3567,56 +3567,59 @@ static void extract_mpeg4_header(AVFormatContext 
*infile)
 /* compute the needed AVStream for each file */
 static void build_file_streams(void)
 {
-FFServerStream *stream, *stream_next;
+FFServerStream *stream;
+AVFormatContext *infile;
 int i, ret;
 
 /* gather all streams */
-for(stream = config.first_stream; stream; stream = stream_next) {
-AVFormatContext *infile = NULL;
-stream_next = stream->next;
-if (stream->stream_type == STREAM_TYPE_LIVE &&
-!stream->feed) {
-/* the stream comes from a file */
-/* try to open the file */
-/* open stream */
-if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
-/* specific case : if transport stream output to RTP,
- * we use a raw transport stream reader */
-av_dict_set(>in_opts, "mpeg2ts_compute_pcr", "1", 0);
-}
+for(stream = config.first_stream; stream; stream = stream->next) {
+infile = NULL;
 
-if (!stream->feed_filename[0]) {
-http_log("Unspecified feed file for stream '%s'\n",
- stream->filename);
-goto fail;
-}
+if (stream->stream_type != STREAM_TYPE_LIVE || stream->feed)
+continue;
+
+/* the stream comes from a file */
+/* try to open the file */
+/* open stream */
 
-http_log("Opening feed file '%s' for stream '%s'\n",
- stream->feed_filename, stream->filename);
-ret = avformat_open_input(, stream->feed_filename,
-  stream->ifmt, >in_opts);
-if (ret < 0) {
-http_log("Could not open '%s': %s\n", stream->feed_filename,
- av_err2str(ret));
-/* remove stream (no need to spend more time on it) */
-fail:
-remove_stream(stream);
-} else {
-/* find all the AVStreams inside and reference them in
- * 'stream' */
-if (avformat_find_stream_info(infile, NULL) < 0) {
-http_log("Could not find codec parameters from '%s'\n",
- stream->feed_filename);
-avformat_close_input();
-goto fail;
-}
-extract_mpeg4_header(infile);
 
-for(i=0;inb_streams;i++)
-add_av_stream1(stream, infile->streams[i]->codec, 1);
+/* specific case: if transport stream output to RTP,
+ * we use a raw transport stream reader */
+if (stream->fmt && !strcmp(stream->fmt->name, "rtp"))
+av_dict_set(>in_opts, "mpeg2ts_compute_pcr", "1", 0);
 
+if (!stream->feed_filename[0]) {
+http_log("Unspecified feed file for stream '%s'\n",
+ stream->filename);
+goto fail;
+}
+
+http_log("Opening feed file '%s' for stream '%s'\n",
+ stream->feed_filename, stream->filename);
+
+ret = avformat_open_input(, stream->feed_filename,
+  stream->ifmt, >in_opts);
+if (ret < 0) {
+http_log("Could not open '%s': %s\n", stream->feed_filename,
+ av_err2str(ret));
+/* remove stream (no need to spend more time on it) */
+fail:
+remove_stream(stream);
+} else {
+/* find all the AVStreams inside and reference them in
+ * 'stream' */
+if (avformat_find_stream_info(infile, NULL) < 0) {
+http_log("Could not find codec parameters from '%s'\n",
+ stream->feed_filename);
 avformat_close_input();
+goto fail;
 }
+extract_mpeg4_header(infile);
+
+for(i=0;inb_streams;i++)
+add_av_stream1(stream, infile->streams[i]->codec, 1);
+
+avformat_close_input();
 }
 }
 }

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


[FFmpeg-cvslog] nutdec: only copy the header if it exists

2015-12-19 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Fri Dec 18 15:18:47 2015 +0100| [9f82506c79874edd7b09707ab63d9e72078de8f9] | 
committer: Andreas Cadhalpun

nutdec: only copy the header if it exists

Fixes ubsan runtime error: null pointer passed as argument 2, which is
declared to never be null

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

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

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

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 286d1ee..ef08ad9 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1133,7 +1133,8 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, 
int frame_code)
 ret = av_new_packet(pkt, size + nut->header_len[header_idx]);
 if (ret < 0)
 return ret;
-memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
+if (nut->header[header_idx])
+memcpy(pkt->data, nut->header[header_idx], 
nut->header_len[header_idx]);
 pkt->pos = avio_tell(bc); // FIXME
 if (stc->last_flags & FLAG_SM_DATA) {
 int sm_size;

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


[FFmpeg-cvslog] ffplay: remove existing AVPicture usage

2015-12-19 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Tue Dec  8 22:33:31 
2015 +0100| [c413d9e6356e843aa492be9bb0ddf66ae6c97501] | committer: Marton 
Balint

ffplay: remove existing AVPicture usage

It is deprecated.

Reviewed-by: Paul B Mahol 
Signed-off-by: Marton Balint 

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

 ffplay.c |   51 +++
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 36da8a5..3baefcc 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -858,7 +858,7 @@ static void fill_border(int xleft, int ytop, int width, int 
height, int x, int y
 
 #define BPP 1
 
-static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int 
imgw, int imgh)
+static void blend_subrect(uint8_t **data, int *linesize, const AVSubtitleRect 
*rect, int imgw, int imgh)
 {
 int x, y, Y, U, V, A;
 uint8_t *lum, *cb, *cr;
@@ -869,9 +869,9 @@ static void blend_subrect(AVPicture *dst, const 
AVSubtitleRect *rect, int imgw,
 dsth = av_clip(rect->h, 0, imgh);
 dstx = av_clip(rect->x, 0, imgw - dstw);
 dsty = av_clip(rect->y, 0, imgh - dsth);
-lum = dst->data[0] + dstx + dsty * dst->linesize[0];
-cb  = dst->data[1] + dstx/2 + (dsty >> 1) * dst->linesize[1];
-cr  = dst->data[2] + dstx/2 + (dsty >> 1) * dst->linesize[2];
+lum = data[0] + dstx + dsty * linesize[0];
+cb  = data[1] + dstx/2 + (dsty >> 1) * linesize[1];
+cr  = data[2] + dstx/2 + (dsty >> 1) * linesize[2];
 
 for (y = 0; ylinesize[0] - dstw;
+lum += linesize[0] - dstw;
 }
 
 for (y = 0; ylinesize[1] - dstw/2;
-cr += dst->linesize[2] - dstw/2;
+cb += linesize[1] - dstw/2;
+cr += linesize[2] - dstw/2;
 }
 }
 
@@ -944,7 +944,6 @@ static void video_image_display(VideoState *is)
 {
 Frame *vp;
 Frame *sp;
-AVPicture pict;
 SDL_Rect rect;
 int i;
 
@@ -955,18 +954,21 @@ static void video_image_display(VideoState *is)
 sp = frame_queue_peek(>subpq);
 
 if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 
1000)) {
+uint8_t *data[4];
+int linesize[4];
+
 SDL_LockYUVOverlay (vp->bmp);
 
-pict.data[0] = vp->bmp->pixels[0];
-pict.data[1] = vp->bmp->pixels[2];
-pict.data[2] = vp->bmp->pixels[1];
+data[0] = vp->bmp->pixels[0];
+data[1] = vp->bmp->pixels[2];
+data[2] = vp->bmp->pixels[1];
 
-pict.linesize[0] = vp->bmp->pitches[0];
-pict.linesize[1] = vp->bmp->pitches[2];
-pict.linesize[2] = vp->bmp->pitches[1];
+linesize[0] = vp->bmp->pitches[0];
+linesize[1] = vp->bmp->pitches[2];
+linesize[2] = vp->bmp->pitches[1];
 
 for (i = 0; i < sp->sub.num_rects; i++)
-blend_subrect(, sp->subrects[i],
+blend_subrect(data, linesize, sp->subrects[i],
   vp->bmp->w, vp->bmp->h);
 
 SDL_UnlockYUVOverlay (vp->bmp);
@@ -1760,22 +1762,23 @@ static int queue_picture(VideoState *is, AVFrame 
*src_frame, double pts, double
 
 /* if the frame is not skipped, then display it */
 if (vp->bmp) {
-AVPicture pict = { { 0 } };
+uint8_t *data[4];
+int linesize[4];
 
 /* get a pointer on the bitmap */
 SDL_LockYUVOverlay (vp->bmp);
 
-pict.data[0] = vp->bmp->pixels[0];
-pict.data[1] = vp->bmp->pixels[2];
-pict.data[2] = vp->bmp->pixels[1];
+data[0] = vp->bmp->pixels[0];
+data[1] = vp->bmp->pixels[2];
+data[2] = vp->bmp->pixels[1];
 
-pict.linesize[0] = vp->bmp->pitches[0];
-pict.linesize[1] = vp->bmp->pitches[2];
-pict.linesize[2] = vp->bmp->pitches[1];
+linesize[0] = vp->bmp->pitches[0];
+linesize[1] = vp->bmp->pitches[2];
+linesize[2] = vp->bmp->pitches[1];
 
 #if CONFIG_AVFILTER
 // FIXME use direct rendering
-av_picture_copy(, (AVPicture *)src_frame,
+av_image_copy(data, linesize, (const uint8_t **)src_frame->data, 
src_frame->linesize,
 src_frame->format, vp->width, vp->height);
 #else
 {
@@ -1798,7 +1801,7 @@ static int queue_picture(VideoState *is, AVFrame 
*src_frame, double pts, double
 exit(1);
 }
 sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize,
- 

[FFmpeg-cvslog] xwddec: prevent overflow of lsize * avctx->height

2015-12-19 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Fri Dec 18 19:28:51 2015 +0100| [9d38f06d05efbb9d6196c27668eb943e934943ae] | 
committer: Andreas Cadhalpun

xwddec: prevent overflow of lsize * avctx->height

This is used to check if the input buffer is large enough, so if this
overflows it can cause a false negative leading to a segmentation fault
in bytestream2_get_bufferu.

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

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

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

diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 2febedc..64cd841 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -141,7 +141,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void 
*data,
 return AVERROR_INVALIDDATA;
 }
 
-if (bytestream2_get_bytes_left() < ncolors * XWD_CMAP_SIZE + 
avctx->height * lsize) {
+if (bytestream2_get_bytes_left() < ncolors * XWD_CMAP_SIZE + 
(uint64_t)avctx->height * lsize) {
 av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
 return AVERROR_INVALIDDATA;
 }

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