[FFmpeg-cvslog] avfilter/f_metadata: avoid float rounding problems

2016-02-11 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Thu Feb 11 
13:35:19 2016 +0100| [8b99c5e8daf27c8198df4061eef0ac8b193e1b73] | committer: 
Paul B Mahol

avfilter/f_metadata: avoid float rounding problems

Signed-off-by: Tobias Rapp 

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

 libavfilter/f_metadata.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 40ab6bb..e0ea30b 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -23,6 +23,8 @@
  * filter for manipulating frame metadata
  */
 
+#include 
+
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/eval.h"
@@ -117,7 +119,7 @@ static int equal(MetadataContext *s, const char *value1, 
const char *value2, siz
 if (sscanf(value1, "%f", &f1) + sscanf(value2, "%f", &f2) != 2)
 return 0;
 
-return f1 == f2;
+return fabsf(f1 - f2) < FLT_EPSILON;
 }
 
 static int less(MetadataContext *s, const char *value1, const char *value2, 
size_t length)
@@ -127,7 +129,7 @@ static int less(MetadataContext *s, const char *value1, 
const char *value2, size
 if (sscanf(value1, "%f", &f1) + sscanf(value2, "%f", &f2) != 2)
 return 0;
 
-return f1 < f2;
+return (f1 - f2) < FLT_EPSILON;
 }
 
 static int greater(MetadataContext *s, const char *value1, const char *value2, 
size_t length)
@@ -137,7 +139,7 @@ static int greater(MetadataContext *s, const char *value1, 
const char *value2, s
 if (sscanf(value1, "%f", &f1) + sscanf(value2, "%f", &f2) != 2)
 return 0;
 
-return f1 > f2;
+return (f2 - f1) < FLT_EPSILON;
 }
 
 static int parse_expr(MetadataContext *s, const char *value1, const char 
*value2, size_t length)

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


[FFmpeg-cvslog] avfilter/f_metadata: add starts_with string function

2016-02-11 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Thu Feb 11 
13:35:20 2016 +0100| [6889deba68fcc3d9f1015f10392dea38b2fcd028] | committer: 
Paul B Mahol

avfilter/f_metadata: add starts_with string function

Signed-off-by: Tobias Rapp 

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

 doc/filters.texi |4 
 libavfilter/f_metadata.c |   10 ++
 2 files changed, 14 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8f4dcea..8264498 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8500,6 +8500,10 @@ Can be one of following:
 Values are interpreted as strings, returns true if @code{value} is same as 
metadata value up
 to N chars as set in @code{length} option.
 
+@item starts_with
+Values are interpreted as strings, returns true if metadata value starts with
+the @code{value} option string.
+
 @item less
 Values are interpreted as floats, returns true if metadata value is less than 
@code{value}.
 
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 9246a2a..6c9317a 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -49,6 +49,7 @@ enum MetadataMode {
 
 enum MetadataFunction {
 METADATAF_STRING,
+METADATAF_STARTS_WITH,
 METADATAF_LESS,
 METADATAF_EQUAL,
 METADATAF_GREATER,
@@ -102,6 +103,7 @@ static const AVOption filt_name##_options[] = { 
\
 { "value", "set metadata value", OFFSET(value),  AV_OPT_TYPE_STRING, 
{.str = NULL }, 0, 0, FLAGS }, \
 { "function", "function for comparing values", OFFSET(function), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
 {   "string",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING  }, 0, 
3, FLAGS, "function" }, \
+{   "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
 {   "less",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS}, 0, 
3, FLAGS, "function" }, \
 {   "equal",   NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL   }, 0, 
3, FLAGS, "function" }, \
 {   "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 
3, FLAGS, "function" }, \
@@ -117,6 +119,11 @@ static int string(MetadataContext *s, const char *value1, 
const char *value2, si
 return !strncmp(value1, value2, length);
 }
 
+static int starts_with(MetadataContext *s, const char *value1, const char 
*value2, size_t length)
+{
+return !strncmp(value1, value2, strlen(value2));
+}
+
 static int equal(MetadataContext *s, const char *value1, const char *value2, 
size_t length)
 {
 float f1, f2;
@@ -201,6 +208,9 @@ static av_cold int init(AVFilterContext *ctx)
 case METADATAF_STRING:
 s->compare = string;
 break;
+case METADATAF_STARTS_WITH:
+s->compare = starts_with;
+break;
 case METADATAF_LESS:
 s->compare = less;
 break;

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


[FFmpeg-cvslog] avfilter/f_metadata: rename "string" into "same_str"

2016-02-11 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Thu Feb 11 
15:39:57 2016 +0100| [80026a8ac35b2cfbf3667c22d733a56dcd041621] | committer: 
Paul B Mahol

avfilter/f_metadata: rename "string" into "same_str"

Rename function option value "string" into "same_str". Remove obsolete
"length" option.

Signed-off-by: Tobias Rapp 

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

 doc/filters.texi |9 ++---
 libavfilter/f_metadata.c |   32 +++-
 2 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 8264498..7898b86 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8486,19 +8486,14 @@ Set key used with all modes. Must be set for all modes 
except @code{print}.
 Set metadata value which will be used. This option is mandatory for
 @code{modify} and @code{add} mode.
 
-@item length
-Set length of how many characters of two metadata values need to match to be
-considered same. Default is all available characters.
-
 @item function
 Which function to use when comparing metadata value and @code{value}.
 
 Can be one of following:
 
 @table @samp
-@item string
-Values are interpreted as strings, returns true if @code{value} is same as 
metadata value up
-to N chars as set in @code{length} option.
+@item same_str
+Values are interpreted as strings, returns true if metadata value is same as 
@code{value}.
 
 @item starts_with
 Values are interpreted as strings, returns true if metadata value starts with
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index ae0208e..7cf286e 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -48,7 +48,7 @@ enum MetadataMode {
 };
 
 enum MetadataFunction {
-METADATAF_STRING,
+METADATAF_SAME_STR,
 METADATAF_STARTS_WITH,
 METADATAF_LESS,
 METADATAF_EQUAL,
@@ -75,7 +75,6 @@ typedef struct MetadataContext {
 int mode;
 char *key;
 char *value;
-int length;
 int function;
 
 char *expr_str;
@@ -86,7 +85,7 @@ typedef struct MetadataContext {
 char *file_str;
 
 int (*compare)(struct MetadataContext *s,
-   const char *value1, const char *value2, size_t length);
+   const char *value1, const char *value2);
 void (*print)(AVFilterContext *ctx, const char *msg, ...) 
av_printf_format(2, 3);
 } MetadataContext;
 
@@ -102,29 +101,28 @@ static const AVOption filt_name##_options[] = { \
 { "key",   "set metadata key",   OFFSET(key),AV_OPT_TYPE_STRING, 
{.str = NULL }, 0, 0, FLAGS }, \
 { "value", "set metadata value", OFFSET(value),  AV_OPT_TYPE_STRING, 
{.str = NULL }, 0, 0, FLAGS }, \
 { "function", "function for comparing values", OFFSET(function), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
-{   "string",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING  
}, 0, 3, FLAGS, "function" }, \
+{   "same_str",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_SAME_STR 
},0, 3, FLAGS, "function" }, \
 {   "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
 {   "less",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS
}, 0, 3, FLAGS, "function" }, \
 {   "equal",   NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL   
}, 0, 3, FLAGS, "function" }, \
 {   "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER 
}, 0, 3, FLAGS, "function" }, \
 {   "expr",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR
}, 0, 3, FLAGS, "function" }, \
 { "expr", "set expression for expr function", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
-{ "length", "compare up to N chars for string function", OFFSET(length), 
AV_OPT_TYPE_INT,{.i64 = INT_MAX }, 1, INT_MAX, FLAGS }, \
 { "file", "set file where to print metadata information", 
OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
 { NULL } \
 }
 
-static int string(MetadataContext *s, const char *value1, const char *value2, 
size_t length)
+static int same_str(MetadataContext *s, const char *value1, const char *value2)
 {
-return !strncmp(value1, value2, length);
+return !strcmp(value1, value2);
 }
 
-static int starts_with(MetadataContext *s, const char *value1, const char 
*value2, size_t length)
+static int starts_with(MetadataContext *s, const char *value1, const char 
*value2)
 {
 return !strncmp(value1, value2, strlen(value2));
 }
 
-static int equal(MetadataContext *s, const char *value1, const char *value2, 
size_t length)
+static int equal(MetadataContext *s, const char *value1, const char *value2)
 {
 float f1, f2;
 
@@ -134,7 +132,7 @@ static int equal(MetadataContext *s, const char *value1, 
const char *value2, siz
 return fabsf(f1 - f2) < FLT_EPSILON;
 }
 
-static int less(MetadataContext *s, const char

[FFmpeg-cvslog] avfilter/f_metadata: add support for file output

2016-02-11 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Thu Feb 11 
13:35:21 2016 +0100| [202f97872891071a24bc383ac07dd7e233ee4343] | committer: 
Paul B Mahol

avfilter/f_metadata: add support for file output

Signed-off-by: Tobias Rapp 

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

 doc/filters.texi |6 +
 libavfilter/f_metadata.c |   66 ++
 2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 6c5003f..8f4dcea 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8526,6 +8526,12 @@ Float representation of @code{value} from metadata key.
 @item VALUE2
 Float representation of @code{value} as supplied by user in @code{value} 
option.
 @end table
+
+@item file
+If specified in @code{print} mode, output is written to the named file. When
+filename equals "-" data is written to standard output.
+If @code{file} option is not set, output is written to the log with AV_LOG_INFO
+loglevel.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index e0ea30b..9246a2a 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -81,8 +81,12 @@ typedef struct MetadataContext {
 AVExpr *expr;
 double var_values[VAR_VARS_NB];
 
+FILE *file;
+char *file_str;
+
 int (*compare)(struct MetadataContext *s,
const char *value1, const char *value2, size_t length);
+void (*print)(AVFilterContext *ctx, const char *msg, ...) 
av_printf_format(2, 3);
 } MetadataContext;
 
 #define OFFSET(x) offsetof(MetadataContext, x)
@@ -104,6 +108,7 @@ static const AVOption filt_name##_options[] = { 
\
 {   "expr",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR}, 0, 
3, FLAGS, "function" }, \
 { "expr", "set expression for expr function", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
 { "length", "compare up to N chars for string function", OFFSET(length), 
AV_OPT_TYPE_INT,{.i64 = INT_MAX }, 1, INT_MAX, FLAGS }, \
+{ "file", "set file where to print metadata information", 
OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
 { NULL }\
 }
 
@@ -155,6 +160,27 @@ static int parse_expr(MetadataContext *s, const char 
*value1, const char *value2
 return av_expr_eval(s->expr, s->var_values, NULL);
 }
 
+static void print_log(AVFilterContext *ctx, const char *msg, ...)
+{
+va_list argument_list;
+
+va_start(argument_list, msg);
+if (msg)
+av_vlog(ctx, AV_LOG_INFO, msg, argument_list);
+va_end(argument_list);
+}
+
+static void print_file(AVFilterContext *ctx, const char *msg, ...)
+{
+MetadataContext *s = ctx->priv;
+va_list argument_list;
+
+va_start(argument_list, msg);
+if (msg)
+vfprintf(s->file, msg, argument_list);
+va_end(argument_list);
+}
+
 static av_cold int init(AVFilterContext *ctx)
 {
 MetadataContext *s = ctx->priv;
@@ -203,9 +229,37 @@ static av_cold int init(AVFilterContext *ctx)
 }
 }
 
+if (s->file_str) {
+if (!strcmp(s->file_str, "-")) {
+s->file = stdout;
+} else {
+s->file = fopen(s->file_str, "w");
+if (!s->file) {
+int err = AVERROR(errno);
+char buf[128];
+av_strerror(err, buf, sizeof(buf));
+av_log(ctx, AV_LOG_ERROR, "Could not open file %s: %s\n",
+   s->file_str, buf);
+return err;
+}
+}
+s->print = print_file;
+} else {
+s->print = print_log;
+}
+
 return 0;
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+MetadataContext *s = ctx->priv;
+
+if (s->file && s->file != stdout)
+fclose(s->file);
+s->file = NULL;
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -245,14 +299,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 break;
 case METADATA_PRINT:
 if (!s->key && e) {
-av_log(ctx, AV_LOG_INFO, "frame %"PRId64" pts %"PRId64"\n", 
inlink->frame_count, frame->pts);
-av_log(ctx, AV_LOG_INFO, "%s=%s\n", e->key, e->value);
+s->print(ctx, "frame %"PRId64" pts %"PRId64"\n", 
inlink->frame_count, frame->pts);
+s->print(ctx, "%s=%s\n", e->key, e->value);
 while ((e = av_dict_get(metadata, "", e, AV_DICT_IGNORE_SUFFIX)) 
!= NULL) {
-av_log(ctx, AV_LOG_INFO, "%s=%s\n", e->key, e->value);
+s->print(ctx, "%s=%s\n", e->key, e->value);
 }
 } else if (e && e->value && (!s->value || (e->value && s->compare(s, 
e->value, s->value, s->length {
-av_log(ctx, AV_LOG_INFO, "frame %"PRId64" pts %"PRId64"\n", 

[FFmpeg-cvslog] avfilter/f_metadata: whitespace clean-up

2016-02-11 Thread Tobias Rapp
ffmpeg | branch: master | Tobias Rapp  | Thu Feb 11 
13:35:22 2016 +0100| [730da5c20791d4208aa6c0ef5061cdf4380aa9ee] | committer: 
Paul B Mahol

avfilter/f_metadata: whitespace clean-up

Signed-off-by: Tobias Rapp 

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

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

diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 6c9317a..ae0208e 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -91,8 +91,8 @@ typedef struct MetadataContext {
 } MetadataContext;
 
 #define OFFSET(x) offsetof(MetadataContext, x)
-#define DEFINE_OPTIONS(filt_name, FLAGS)\
-static const AVOption filt_name##_options[] = { \
+#define DEFINE_OPTIONS(filt_name, FLAGS) \
+static const AVOption filt_name##_options[] = { \
 { "mode", "set a mode of operation", OFFSET(mode),   AV_OPT_TYPE_INT,
{.i64 = 0 }, 0, METADATA_NB-1, FLAGS, "mode" }, \
 {   "select", "select frame",0,  AV_OPT_TYPE_CONST,  
{.i64 = METADATA_SELECT }, 0, 0, FLAGS, "mode" }, \
 {   "add","add new metadata",0,  AV_OPT_TYPE_CONST,  
{.i64 = METADATA_ADD },0, 0, FLAGS, "mode" }, \
@@ -102,16 +102,16 @@ static const AVOption filt_name##_options[] = {   
  \
 { "key",   "set metadata key",   OFFSET(key),AV_OPT_TYPE_STRING, 
{.str = NULL }, 0, 0, FLAGS }, \
 { "value", "set metadata value", OFFSET(value),  AV_OPT_TYPE_STRING, 
{.str = NULL }, 0, 0, FLAGS }, \
 { "function", "function for comparing values", OFFSET(function), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
-{   "string",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING  }, 0, 
3, FLAGS, "function" }, \
+{   "string",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING  
}, 0, 3, FLAGS, "function" }, \
 {   "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
-{   "less",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS}, 0, 
3, FLAGS, "function" }, \
-{   "equal",   NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL   }, 0, 
3, FLAGS, "function" }, \
-{   "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 
3, FLAGS, "function" }, \
-{   "expr",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR}, 0, 
3, FLAGS, "function" }, \
+{   "less",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS
}, 0, 3, FLAGS, "function" }, \
+{   "equal",   NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL   
}, 0, 3, FLAGS, "function" }, \
+{   "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER 
}, 0, 3, FLAGS, "function" }, \
+{   "expr",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR
}, 0, 3, FLAGS, "function" }, \
 { "expr", "set expression for expr function", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
 { "length", "compare up to N chars for string function", OFFSET(length), 
AV_OPT_TYPE_INT,{.i64 = INT_MAX }, 1, INT_MAX, FLAGS }, \
 { "file", "set file where to print metadata information", 
OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
-{ NULL }\
+{ NULL } \
 }
 
 static int string(MetadataContext *s, const char *value1, const char *value2, 
size_t length)

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


[FFmpeg-cvslog] doc/filters: fix metadata example

2016-02-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Feb 11 16:30:04 
2016 +0100| [855d9d29ebf135b08ffdc7436e529a3ab767f977] | committer: Paul B Mahol

doc/filters: fix metadata example

Signed-off-by: Paul B Mahol 

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

 doc/filters.texi |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 7898b86..35f5050 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8541,7 +8541,7 @@ Print all metadata values for frames with key 
@code{lavfi.singnalstats.YDIF} wit
 between 0 and 1.
 @example
 @end example
-signalstats,metadata=print:key=lavfi.signalstats.YDIF:function=expr:expr='between(VALUE1,0,1)'
+signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
 @end itemize
 
 @section mpdecimate

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


[FFmpeg-cvslog] avfilter/vaf_spectrumsynth: assert that variables are initialized by switch()

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Feb 11 23:04:07 2016 +0100| [03c1129b20642df4e713b21afd5ee4844b1c409d] | 
committer: Michael Niedermayer

avfilter/vaf_spectrumsynth: assert that variables are initialized by switch()

Silences: CID1351387
Silences: CID1351388
Silences: CID1351389

Signed-off-by: Michael Niedermayer 

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

 libavfilter/vaf_spectrumsynth.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vaf_spectrumsynth.c b/libavfilter/vaf_spectrumsynth.c
index ba14d8d..8d4014e 100644
--- a/libavfilter/vaf_spectrumsynth.c
+++ b/libavfilter/vaf_spectrumsynth.c
@@ -256,6 +256,8 @@ static void read16_fft_bin(SpectrumSynthContext *s,
 case LOG:
 magnitude = ff_exp10(((m[x] / (double)UINT16_MAX) - 1.) * 6.);
 break;
+default:
+av_assert0(0);
 }
 phase = ((p[x] / (double)UINT16_MAX) * 2. - 1.) * M_PI;
 
@@ -279,6 +281,8 @@ static void read8_fft_bin(SpectrumSynthContext *s,
 case LOG:
 magnitude = ff_exp10(((m[x] / (double)UINT8_MAX) - 1.) * 6.);
 break;
+default:
+av_assert0(0);
 }
 phase = ((p[x] / (double)UINT8_MAX) * 2. - 1.) * M_PI;
 
@@ -454,6 +458,8 @@ static int try_push_frames(AVFilterContext *ctx)
 break;
 }
 break;
+default:
+av_assert0(0);
 }
 
 av_frame_free(&s->magnitude);

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


[FFmpeg-cvslog] avfilter/avf_avectorscope: assert that variables are initialized by switch ()

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Feb 11 23:08:48 2016 +0100| [62eb935bf93299c94239036978a674ad09449e39] | 
committer: Michael Niedermayer

avfilter/avf_avectorscope: assert that variables are initialized by switch()

Silences: CID1351390
Silences: CID1351391

Signed-off-by: Michael Niedermayer 

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

 libavfilter/avf_avectorscope.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c
index 7f415fc..29d0287 100644
--- a/libavfilter/avf_avectorscope.c
+++ b/libavfilter/avf_avectorscope.c
@@ -300,6 +300,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 prev_y = y;
 }
 break;
+default:
+av_assert0(0);
 }
 
 s->prev_x = x, s->prev_y = y;

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


[FFmpeg-cvslog] avfilter/vf_zoompan: Remove dead store

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 00:07:29 2016 +0100| [9313fb6a3e90e4c21258b69514e2129d9dae1f5f] | 
committer: Michael Niedermayer

avfilter/vf_zoompan: Remove dead store

Signed-off-by: Michael Niedermayer 

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

 libavfilter/vf_zoompan.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 5acbe42..8d640e7 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -283,7 +283,6 @@ static int request_frame(AVFilterLink *outlink)
 s->nb_frames = 0;
 s->current_frame = 0;
 av_frame_free(&s->in);
-ret = 0;
 s->finished = 1;
 ret = ff_request_frame(ctx->inputs[0]);
 }

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


[FFmpeg-cvslog] avfilter/avf_ahistogram: assert that variables are initialized by switch()

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 00:37:11 2016 +0100| [156013111a3389a3f0c1af33dfaa008824e30727] | 
committer: Michael Niedermayer

avfilter/avf_ahistogram: assert that variables are initialized by switch()

Silences: CID1351397

Signed-off-by: Michael Niedermayer 

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

 libavfilter/avf_ahistogram.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c
index 55f7462..a716a96 100644
--- a/libavfilter/avf_ahistogram.c
+++ b/libavfilter/avf_ahistogram.c
@@ -297,6 +297,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 if (aa == 1.)
 aa = 0;
 break;
+default:
+av_assert0(0);
 }
 
 h = aa * (H - 1);

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


[FFmpeg-cvslog] avfilter/avf_showfreqs: assert that variables are initialized by switch()

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 00:37:11 2016 +0100| [43bf15d1a425b99182820332ffdf5329773b319a] | 
committer: Michael Niedermayer

avfilter/avf_showfreqs: assert that variables are initialized by switch()

Silences: CID1351396

Signed-off-by: Michael Niedermayer 

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

 libavfilter/avf_showfreqs.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
index af6e4c2..b33587b 100644
--- a/libavfilter/avf_showfreqs.c
+++ b/libavfilter/avf_showfreqs.c
@@ -310,6 +310,8 @@ static inline void plot_freq(ShowFreqsContext *s, int ch,
 end = (outlink->h / s->nb_channels) * (ch + 1);
 y = (outlink->h / s->nb_channels) * ch + a * (outlink->h / 
s->nb_channels) - 1;
 break;
+default:
+av_assert0(0);
 }
 if (y < 0)
 return;

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


[FFmpeg-cvslog] avcodec/cfhd: Check the number of tag/value pairs

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Feb 11 22:12:36 2016 +0100| [bbc4d069d0ef70102a2e7e7b1c0d3a00f488e666] | 
committer: Michael Niedermayer

avcodec/cfhd: Check the number of tag/value pairs

Fixes potentially long loop
Fixes: CID1351382/11

Reviewed-by: Kieran Kunhya 
Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 2436aae..5ecfcef 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -344,6 +344,11 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 break;
 } else if (tag == 2) {
 av_log(avctx, AV_LOG_DEBUG, "tag=2 header - skipping %i tag/value 
pairs\n", data);
+if (data > bytestream2_get_bytes_left(&gb) / 4) {
+av_log(avctx, AV_LOG_ERROR, "too many tag/value pairs (%d)\n", 
data);
+ret = AVERROR_INVALIDDATA;
+break;
+}
 for (i = 0; i < data; i++) {
 uint16_t tag2 = bytestream2_get_be16(&gb);
 uint16_t val2 = bytestream2_get_be16(&gb);

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


[FFmpeg-cvslog] avcodec/cfhd: Fix errors with valid files.

2016-02-11 Thread Kieran Kunhya
ffmpeg | branch: master | Kieran Kunhya  | Fri Feb 12 
00:26:33 2016 +| [1e2fd57fc0967249917e5ec330f22746a75eca64] | committer: 
Kieran Kunhya

avcodec/cfhd: Fix errors with valid files.

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

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

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 5ecfcef..5c15d9b 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -312,7 +312,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 s->plane[s->channel_num].band[0][0].width  = data;
 s->plane[s->channel_num].band[0][0].stride = data;
 av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n", data);
-if (data < 2 || (data & 1) || data > 
s->plane[s->channel_num].band[0][0].a_width) {
+if (data < 2 || data > 
s->plane[s->channel_num].band[0][0].a_width) {
 av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n");
 ret = AVERROR(EINVAL);
 break;
@@ -358,7 +358,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 s->plane[s->channel_num].band[s->level][s->subband_num].width  = 
data;
 s->plane[s->channel_num].band[s->level][s->subband_num].stride = 
FFALIGN(data, 8);
 av_log(avctx, AV_LOG_DEBUG, "Highpass width %i channel %i level %i 
subband %i\n", data, s->channel_num, s->level, s->subband_num);
-if (data < 2 || (data & 1)) {
+if (data < 2) {
 av_log(avctx, AV_LOG_ERROR, "Invalid highpass width\n");
 ret = AVERROR(EINVAL);
 break;
@@ -375,7 +375,7 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 s->plane[s->channel_num].band[s->level][s->subband_num].width  = 
data;
 s->plane[s->channel_num].band[s->level][s->subband_num].stride = 
FFALIGN(data, 8);
 av_log(avctx, AV_LOG_DEBUG, "Highpass width2 %i\n", data);
-if (data < 2 || (data & 1)) {
+if (data < 2) {
 av_log(avctx, AV_LOG_ERROR, "Invalid highpass width2\n");
 ret = AVERROR(EINVAL);
 break;

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


[FFmpeg-cvslog] avcodec/h264_slice: Fix dequant table init with field pictures

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 03:43:17 2016 +0100| [69738466189a0f68b0a635b4804ef9cf7bee3672] | 
committer: Michael Niedermayer

avcodec/h264_slice: Fix dequant table init with field pictures

Fixes regression of Ticket4389

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 8a33553..2131338 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1422,7 +1422,7 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
 }
 }
 
-if (first_slice && h->dequant_coeff_pps != pps_id) {
+if (!h->current_slice && h->dequant_coeff_pps != pps_id) {
 h->dequant_coeff_pps = pps_id;
 ff_h264_init_dequant_tables(h);
 }

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


[FFmpeg-cvslog] avcodec/h264_slice: assert relation between current_slice ans slice_ctx

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 03:40:19 2016 +0100| [873158fd76f387142f5a5e6835052f4fd0ec6911] | 
committer: Michael Niedermayer

avcodec/h264_slice: assert relation between current_slice ans slice_ctx

Signed-off-by: Michael Niedermayer 

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

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

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6a80d89..8a33553 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1212,6 +1212,9 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
 }
 }
 
+if (!h->current_slice)
+av_assert0(sl == h->slice_ctx);
+
 slice_type = get_ue_golomb_31(&sl->gb);
 if (slice_type > 9) {
 av_log(h->avctx, AV_LOG_ERROR,

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


[FFmpeg-cvslog] avcodec/h264_slice: remove duplicate unconditional picture_structure setting code

2016-02-11 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Feb 12 02:18:24 2016 +0100| [6c6f2e49e40a8728c6b0102c58b17d37dac901af] | 
committer: Michael Niedermayer

avcodec/h264_slice: remove duplicate unconditional picture_structure setting 
code

Signed-off-by: Michael Niedermayer 

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

 libavcodec/h264_slice.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6395cee..6a80d89 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1477,7 +1477,6 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264SliceContext *sl)
 }
 }
 
-h->picture_structure = picture_structure;
 if (!h->setup_finished) {
 h->droppable = droppable;
 h->picture_structure = picture_structure;

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


[FFmpeg-cvslog] avcodec/vc2enc_dwt: add missing header

2016-02-11 Thread James Almer
ffmpeg | branch: master | James Almer  | Fri Feb 12 02:06:05 
2016 -0300| [0abdf7030eebe8b8fa1a7f8ddc5e5ea64feb1302] | committer: James Almer

avcodec/vc2enc_dwt: add missing header

Fixes make checkheaders

Signed-off-by: James Almer 

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

 libavcodec/vc2enc_dwt.h |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vc2enc_dwt.h b/libavcodec/vc2enc_dwt.h
index ce141d7..8e1b614 100644
--- a/libavcodec/vc2enc_dwt.h
+++ b/libavcodec/vc2enc_dwt.h
@@ -22,6 +22,7 @@
 #ifndef AVCODEC_VC2ENC_DWT_H
 #define AVCODEC_VC2ENC_DWT_H
 
+#include 
 #include 
 
 typedef int16_t dwtcoef;

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