[FFmpeg-cvslog] avfilter/vf_lut2: implement support for different input depths

2018-11-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov 15 00:07:12 
2018 +0100| [02809e7b061eabbe6e67254dac4a6d75c548b06d] | committer: Paul B Mahol

avfilter/vf_lut2: implement support for different input depths

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

 doc/filters.texi  |   4 +
 libavfilter/vf_lut2.c | 315 +-
 2 files changed, 241 insertions(+), 78 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 0d9ff43ef0..ab58e53051 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -11688,6 +11688,10 @@ set second pixel component expression
 set third pixel component expression
 @item c3
 set fourth pixel component expression, corresponds to the alpha component
+
+@item d
+set output bit depth, only available for @code{lut2} filter. By default is 0,
+which means bit depth is automatically picked from first input format.
 @end table
 
 Each of them specifies the expression to use for computing the lookup table for
diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index 66c481e570..d765dc9ad2 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -54,12 +54,17 @@ typedef struct LUT2Context {
 const AVClass *class;
 FFFrameSync fs;
 
+int odepth;
 char   *comp_expr_str[4];
 
 AVExpr *comp_expr[4];
 double var_values[VAR_VARS_NB];
 uint16_t *lut[4];  ///< lookup table for each component
 int width[4], height[4];
+int widthx[4], heightx[4];
+int widthy[4], heighty[4];
+int nb_planesx;
+int nb_planesy;
 int nb_planes;
 int depth, depthx, depthy;
 int tlut2;
@@ -77,6 +82,7 @@ static const AVOption options[] = {
 { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]),  
AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },
 { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]),  
AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },
 { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]),  
AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },
+{ "d",  "set output depth",OFFSET(odepth),
AV_OPT_TYPE_INT,{ .i64 =  0  }, 0, 16, .flags = FLAGS },
 { NULL }
 };
 
@@ -96,27 +102,93 @@ static av_cold void uninit(AVFilterContext *ctx)
 }
 }
 
+#define BIT8_FMTS \
+AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, \
+AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, \
+AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_YUV420P, \
+AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, \
+AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, \
+AV_PIX_FMT_GRAY8, AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
+
+#define BIT9_FMTS \
+AV_PIX_FMT_GBRP9, AV_PIX_FMT_GRAY9, \
+AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, \
+AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
+
+#define BIT10_FMTS \
+AV_PIX_FMT_GRAY10, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, \
+AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, \
+AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
+
+#define BIT12_FMTS \
+AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, 
AV_PIX_FMT_YUV440P12, \
+AV_PIX_FMT_GRAY12, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRP12,
+
+#define BIT14_FMTS \
+AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14, \
+AV_PIX_FMT_GRAY12, AV_PIX_FMT_GBRP14,
+
+#define BIT16_FMTS \
+AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, \
+AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
+AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
+
 static int query_formats(AVFilterContext *ctx)
 {
-static const enum AVPixelFormat pix_fmts[] = {
-AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P,
-AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
-AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_YUV420P,
-AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
-AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
-AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
-AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
-AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, 
AV_PIX_FMT_YUV440P12,
-AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
-AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
-AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
-AV_PIX_FMT_GBRP12,
-AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12,
-AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, 
AV_PIX_FMT_GRAY12,
+LUT2Context *s = ctx->priv;
+static const enum AVPixelFormat all_pix_fmts[] = {
+BIT8_FMTS
+BIT9_FMTS
+BIT10_FMTS
+BIT12_FMT

[FFmpeg-cvslog] avfilter/vf_blend: add 10bit support

2018-11-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov 15 13:41:45 
2018 +0100| [c98a32e4adec0a2289d1f82929d8f57f5c1ca38f] | committer: Paul B Mahol

avfilter/vf_blend: add 10bit support

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

 libavfilter/blend.h |   4 +-
 libavfilter/vf_blend.c  | 300 +---
 libavfilter/x86/vf_blend_init.c |   6 +-
 3 files changed, 221 insertions(+), 89 deletions(-)

diff --git a/libavfilter/blend.h b/libavfilter/blend.h
index eb20226839..00db51838d 100644
--- a/libavfilter/blend.h
+++ b/libavfilter/blend.h
@@ -74,7 +74,7 @@ typedef struct FilterParams {
   struct FilterParams *param, double *values, int starty);
 } FilterParams;
 
-void ff_blend_init(FilterParams *param, int is_16bit);
-void ff_blend_init_x86(FilterParams *param, int is_16bit);
+void ff_blend_init(FilterParams *param, int depth);
+void ff_blend_init_x86(FilterParams *param, int depth);
 
 #endif /* AVFILTER_BLEND_H */
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index e83a0db640..81fa6a1a73 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -42,6 +42,7 @@ typedef struct BlendContext {
 enum BlendMode all_mode;
 double all_opacity;
 
+int depth;
 FilterParams params[4];
 int tblend;
 AVFrame *prev_frame;/* only used with tblend */
@@ -121,19 +122,22 @@ static const AVOption blend_options[] = {
 
 FRAMESYNC_DEFINE_CLASS(blend, BlendContext, fs);
 
-#define COPY(src)\
-static void blend_copy ## src(const uint8_t *top, ptrdiff_t top_linesize,\
+#define COPY(src, depth)   
 \
+static void blend_copy ## src##_##depth(const uint8_t *top, ptrdiff_t 
top_linesize,\
 const uint8_t *bottom, ptrdiff_t bottom_linesize,\
 uint8_t *dst, ptrdiff_t dst_linesize,\
 ptrdiff_t width, ptrdiff_t height,   \
 FilterParams *param, double *values, int starty) \
 {\
 av_image_copy_plane(dst, dst_linesize, src, src ## _linesize,\
-width, height); \
+width * depth / 8, height);  \
 }
 
-COPY(top)
-COPY(bottom)
+COPY(top, 8)
+COPY(bottom, 8)
+
+COPY(top, 16)
+COPY(bottom, 16)
 
 #undef COPY
 
@@ -201,15 +205,15 @@ static void blend_## name##_8bit(const uint8_t *top, 
ptrdiff_t top_linesize,
 }  
\
 }
 
-#define DEFINE_BLEND16(name, expr) 
\
-static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize, 
  \
+#define DEFINE_BLEND16(name, expr, depth)  
  \
+static void blend_## name##_##depth##bit(const uint8_t *_top, ptrdiff_t 
top_linesize,\
   const uint8_t *_bottom, ptrdiff_t 
bottom_linesize, \
   uint8_t *_dst, ptrdiff_t dst_linesize,   
  \
   ptrdiff_t width, ptrdiff_t height,   
\
   FilterParams *param, double *values, int 
starty) \
 {  
\
-const uint16_t *top = (uint16_t*)_top; 
\
-const uint16_t *bottom = (uint16_t*)_bottom;   
\
+const uint16_t *top = (const uint16_t*)_top;   
\
+const uint16_t *bottom = (const uint16_t*)_bottom; 
\
 uint16_t *dst = (uint16_t*)_dst;   
\
 double opacity = param->opacity;   
\
 int i, j;  
\
@@ -278,38 +282,81 @@ DEFINE_BLEND8(linearlight,av_clip_uint8((B < 128) ? B + 2 
* A - 255 : B + 2 * (A
 #define BURN(a, b)(((a) == 0) ? (a) : FFMAX(0, 65535 - ((65535 - (b)) 
<< 16) / (a)))
 #define DODGE(a, b)   (((a) == 65535) ? (a) : FFMIN(65535, (((b) << 16) / 
(65535 - (a)
 
-DEFINE_BLEND16(addition,   FFMIN(65535, A + B))
-DEFINE_BLEND16(grainmerge, av_clip_uint16(A + B - 32768))
-DEFINE_BLEND16(average,(A + B) / 2)
-DEFINE_BLEND16(subtract,   FFMAX(0, A - B))
-DEFINE_BLEND16(multiply,   MULTIPLY(1, A, B))
-DEFINE_BLEND16(multiply128, av_clip_uint16((A - 32768) * B / 8192. + 32768))
-DEFINE_BLEND16(negation,   65535 - FFABS(65535 - A - B))
-DEFINE_BLEND16(extremity,  FFABS(65535 - A - B))
-DEFINE_BLEND16(difference, FFABS(A - B))
-DEFINE_BLEND16(grainextract, av_c

[FFmpeg-cvslog] avfilter/vf_blend: add 12bit support

2018-11-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov 15 14:53:15 
2018 +0100| [1342ec526e320beb9d90aa2e0ca1d521fafb] | committer: Paul B Mahol

avfilter/vf_blend: add 12bit support

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

 libavfilter/vf_blend.c | 86 +-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 81fa6a1a73..c00773c924 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -358,6 +358,49 @@ DEFINE_BLEND16(xor,A ^ B, 10)
 DEFINE_BLEND16(vividlight, (A < 512) ? BURN(2 * A, B) : DODGE(2 * (A - 512), 
B), 10)
 DEFINE_BLEND16(linearlight,av_clip((B < 512) ? B + 2 * A - 1023 : B + 2 * (A - 
512), 0, 1023), 10)
 
+#undef MULTIPLY
+#undef SCREEN
+#undef BURN
+#undef DODGE
+
+#define MULTIPLY(x, a, b) ((x) * (((a) * (b)) / 4095))
+#define SCREEN(x, a, b)   (4095 - (x) * ((4095 - (a)) * (4095 - (b)) / 4095))
+#define BURN(a, b)(((a) == 0) ? (a) : FFMAX(0, 4095 - ((4095 - (b)) << 
12) / (a)))
+#define DODGE(a, b)   (((a) == 4095) ? (a) : FFMIN(4095, (((b) << 12) / 
(4095 - (a)
+
+DEFINE_BLEND16(addition,   FFMIN(4095, A + B), 12)
+DEFINE_BLEND16(grainmerge, av_clip(A + B - 2048, 0, 4095), 12)
+DEFINE_BLEND16(average,(A + B) / 2, 12)
+DEFINE_BLEND16(subtract,   FFMAX(0, A - B), 12)
+DEFINE_BLEND16(multiply,   MULTIPLY(1, A, B), 12)
+DEFINE_BLEND16(multiply128, av_clip((A - 2048) * B / 512. + 2048, 0, 4095), 12)
+DEFINE_BLEND16(negation,   4095 - FFABS(4095 - A - B), 12)
+DEFINE_BLEND16(extremity,  FFABS(4095 - A - B), 12)
+DEFINE_BLEND16(difference, FFABS(A - B), 12)
+DEFINE_BLEND16(grainextract, av_clip(2048 + A - B, 0, 4095), 12)
+DEFINE_BLEND16(screen, SCREEN(1, A, B), 12)
+DEFINE_BLEND16(overlay,(A < 2048) ? MULTIPLY(2, A, B) : SCREEN(2, A, B), 
12)
+DEFINE_BLEND16(hardlight,  (B < 2048) ? MULTIPLY(2, B, A) : SCREEN(2, B, A), 
12)
+DEFINE_BLEND16(hardmix,(A < (4095 - B)) ? 0: 4095, 12)
+DEFINE_BLEND16(heat,   (A == 0) ? 0 : 4095 - FFMIN(((4095 - B) * (4095 - 
B)) / A, 4095), 12)
+DEFINE_BLEND16(freeze, (B == 0) ? 0 : 4095 - FFMIN(((4095 - A) * (4095 - 
A)) / B, 4095), 12)
+DEFINE_BLEND16(darken, FFMIN(A, B), 12)
+DEFINE_BLEND16(lighten,FFMAX(A, B), 12)
+DEFINE_BLEND16(divide, av_clip(B == 0 ? 4095 : 4095 * A / B, 0, 4095), 12)
+DEFINE_BLEND16(dodge,  DODGE(A, B), 12)
+DEFINE_BLEND16(burn,   BURN(A, B), 12)
+DEFINE_BLEND16(softlight,  (A > 2047) ? B + (4095 - B) * (A - 2047.5) / 2047.5 
* (0.5 - fabs(B - 2047.5) / 4095): B - B * ((2047.5 - A) / 2047.5) * (0.5 - 
fabs(B - 2047.5)/4095), 12)
+DEFINE_BLEND16(exclusion,  A + B - 2 * A * B / 4095, 12)
+DEFINE_BLEND16(pinlight,   (B < 2048) ? FFMIN(A, 2 * B) : FFMAX(A, 2 * (B - 
2048)), 12)
+DEFINE_BLEND16(phoenix,FFMIN(A, B) - FFMAX(A, B) + 4095, 12)
+DEFINE_BLEND16(reflect,(B == 4095) ? B : FFMIN(4095, (A * A / (4095 - 
B))), 12)
+DEFINE_BLEND16(glow,   (A == 4095) ? A : FFMIN(4095, (B * B / (4095 - 
A))), 12)
+DEFINE_BLEND16(and,A & B, 12)
+DEFINE_BLEND16(or, A | B, 12)
+DEFINE_BLEND16(xor,A ^ B, 12)
+DEFINE_BLEND16(vividlight, (A < 2048) ? BURN(2 * A, B) : DODGE(2 * (A - 2048), 
B), 12)
+DEFINE_BLEND16(linearlight,av_clip((B < 2048) ? B + 2 * A - 4095 : B + 2 * (A 
- 2048), 0, 4095), 12)
+
 #define DEFINE_BLEND_EXPR(type, name, div) 
\
 static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize,
  \
const uint8_t *_bottom, ptrdiff_t 
bottom_linesize,\
@@ -484,9 +527,11 @@ static int query_formats(AVFilterContext *ctx)
 AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, 
AV_PIX_FMT_YUVJ422P,AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ411P,
 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV422P, 
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8,
-AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, 
AV_PIX_FMT_YUV440P10,
 AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
 AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GRAY10,
+AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, 
AV_PIX_FMT_YUV440P12,
+AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GRAY12,
 AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
 AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
@@ -592,6 +637,45 @@ void ff_blend_init(FilterParams *param, int depth)
 case BLEND_XOR:param->blend = blend_xor_10bit;   break;
 }
 break;
+case 12:
+switch (param->mode) {
+case BLEND_ADDITION:   param->blend = bl

[FFmpeg-cvslog] avfilter/vf_convolution: use sqrtf as its faster

2018-11-15 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Nov 15 19:09:20 
2018 +0100| [662120f2b27dd02dc3e512ad436c28b47b093432] | committer: Paul B Mahol

avfilter/vf_convolution: use sqrtf as its faster

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

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

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 421c169fd7..1305569c88 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -157,7 +157,7 @@ static void filter16_prewitt(uint8_t *dstp, int width,
 int sumb = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) *  1 + 
AV_RN16A(&c[3][2 * x]) * -1 +
AV_RN16A(&c[5][2 * x]) *  1 + AV_RN16A(&c[6][2 * x]) * -1 + 
AV_RN16A(&c[8][2 * x]) *  1;
 
-dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
+dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, 
peak);
 }
 }
 
@@ -173,7 +173,7 @@ static void filter16_roberts(uint8_t *dstp, int width,
 int suma = AV_RN16A(&c[0][2 * x]) *  1 + AV_RN16A(&c[1][2 * x]) * -1;
 int sumb = AV_RN16A(&c[4][2 * x]) *  1 + AV_RN16A(&c[3][2 * x]) * -1;
 
-dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
+dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, 
peak);
 }
 }
 
@@ -191,7 +191,7 @@ static void filter16_sobel(uint8_t *dstp, int width,
 int sumb = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) *  1 + 
AV_RN16A(&c[3][2 * x]) * -2 +
AV_RN16A(&c[5][2 * x]) *  2 + AV_RN16A(&c[6][2 * x]) * -1 + 
AV_RN16A(&c[8][2 * x]) *  1;
 
-dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
+dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, 
peak);
 }
 }
 
@@ -211,7 +211,7 @@ static void filter_prewitt(uint8_t *dst, int width,
 int sumb = c0[x] * -1 + c2[x] *  1 + c3[x] * -1 +
c5[x] *  1 + c6[x] * -1 + c8[x] *  1;
 
-dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
+dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
 }
 }
 
@@ -226,7 +226,7 @@ static void filter_roberts(uint8_t *dst, int width,
 int suma = c[0][x] *  1 + c[1][x] * -1;
 int sumb = c[4][x] *  1 + c[3][x] * -1;
 
-dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
+dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
 }
 }
 
@@ -246,7 +246,7 @@ static void filter_sobel(uint8_t *dst, int width,
 int sumb = c0[x] * -1 + c2[x] *  1 + c3[x] * -2 +
c5[x] *  2 + c6[x] * -1 + c8[x] *  1;
 
-dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
+dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
 }
 }
 

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


[FFmpeg-cvslog] avfilter/af_afade: fix duration maximum

2018-11-15 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Mon Nov 12 22:00:49 
2018 +0100| [aecd63b926812148014c4f01270473722ae5e945] | committer: Marton 
Balint

avfilter/af_afade: fix duration maximum

Signed-off-by: Marton Balint 

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

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

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 8c7678107a..751db7da4d 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -239,8 +239,8 @@ static const AVOption afade_options[] = {
 { "ns",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT64,  {.i64 = 44100}, 1, INT64_MAX, FLAGS },
 { "start_time",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "st",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
-{ "duration", "set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
-{ "d","set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+{ "duration", "set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
+{ "d","set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "curve","set fade curve type", 
OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI  }, 0, NB_CURVES - 1, 
FLAGS, "curve" },
 { "c","set fade curve type", 
OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI  }, 0, NB_CURVES - 1, 
FLAGS, "curve" },
 { "tri",  "linear slope",0,
AV_OPT_TYPE_CONST,  {.i64 = TRI  }, 0, 0, FLAGS, "curve" },

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


[FFmpeg-cvslog] avfilter/vf_fade: fix start/duration max value

2018-11-15 Thread Mark Harris
ffmpeg | branch: release/4.1 | Mark Harris  | Sun Nov 11 
22:54:04 2018 -0800| [fed94c2f22fc165e1b012e3b621802b4d03e9214] | committer: 
Marton Balint

avfilter/vf_fade: fix start/duration max value

A fade out (usually at the end of a video) can easily start beyond
INT32_MAX (about 36 minutes).  Regression since d40dc64173.

(cherry picked from commit ae4323548ae821db81b73bc66cf5a2f9885296cb)

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

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

diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index c30c41db0d..17eca109b6 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -386,13 +386,13 @@ static const AVOption fade_options[] = {
 OFFSET(nb_frames),   
AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
 { "alpha",   "fade alpha if it is available on the input", 
OFFSET(alpha),   AV_OPT_TYPE_BOOL, {.i64 = 0}, 0,   1, FLAGS },
 { "start_time",  "Number of seconds of the beginning of the effect.",
-OFFSET(start_time),  
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+OFFSET(start_time),  
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "st",  "Number of seconds of the beginning of the effect.",
-OFFSET(start_time),  
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+OFFSET(start_time),  
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "duration","Duration of the effect in seconds.",
-OFFSET(duration),
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+OFFSET(duration),
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "d",   "Duration of the effect in seconds.",
-OFFSET(duration),
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+OFFSET(duration),
AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "color",   "set color",   OFFSET(color_rgba),  
AV_OPT_TYPE_COLOR,{.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
 { "c",   "set color",   OFFSET(color_rgba),  
AV_OPT_TYPE_COLOR,{.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
 { NULL }

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


[FFmpeg-cvslog] avfilter/af_afade: fix duration maximum

2018-11-15 Thread Marton Balint
ffmpeg | branch: release/4.1 | Marton Balint  | Mon Nov 12 
22:00:49 2018 +0100| [bb01cd3cc01c9982e4b57f8ce5cfd6ec4724f848] | committer: 
Marton Balint

avfilter/af_afade: fix duration maximum

Signed-off-by: Marton Balint 
(cherry picked from commit aecd63b926812148014c4f01270473722ae5e945)

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

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

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 9aab644039..8d9ba916bf 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -245,8 +245,8 @@ static const AVOption afade_options[] = {
 { "ns",   "set number of samples for fade duration", 
OFFSET(nb_samples),   AV_OPT_TYPE_INT64,  {.i64 = 44100}, 1, INT64_MAX, FLAGS },
 { "start_time",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "st",   "set time to start fading",
OFFSET(start_time),   AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
-{ "duration", "set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
-{ "d","set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS },
+{ "duration", "set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
+{ "d","set fade duration",   
OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },
 { "curve","set fade curve type", 
OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI  }, 0, NB_CURVES - 1, 
FLAGS, "curve" },
 { "c","set fade curve type", 
OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI  }, 0, NB_CURVES - 1, 
FLAGS, "curve" },
 { "tri",  "linear slope",0,
AV_OPT_TYPE_CONST,  {.i64 = TRI  }, 0, 0, FLAGS, "curve" },

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


[FFmpeg-cvslog] avcodec/libvpxenc: Add a maximum constraint of 16 encoder threads.

2018-11-15 Thread Chirag Lathia
ffmpeg | branch: master | Chirag Lathia  | Thu Nov 15 
10:51:32 2018 -0800| [d6b1248fc6aa17dd03cb41403c70c85183078fd2] | committer: 
James Almer

avcodec/libvpxenc: Add a maximum constraint of 16 encoder threads.

Signed-off-by: Chirag Lathia 
Signed-off-by: James Almer 

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

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

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index ad440a9c21..da9b9c6d46 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -497,7 +497,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 enccfg.g_h= avctx->height;
 enccfg.g_timebase.num = avctx->time_base.num;
 enccfg.g_timebase.den = avctx->time_base.den;
-enccfg.g_threads  = avctx->thread_count ? avctx->thread_count : 
av_cpu_count();
+enccfg.g_threads  =
+FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 16);
 enccfg.g_lag_in_frames= ctx->lag_in_frames;
 
 if (avctx->flags & AV_CODEC_FLAG_PASS1)

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