History

lavfi: make pix_fmt_is_in() in vf_lut.c an internal function

Also generalize it, making it accept ints rather than pixel formats. Allow factorization.

Stefano Sabatini committed 15 years ago

Commit 7464a531 parent 518d8d44 files · +19 −13Browse files

Unified · Split

4 files
  1. libavfilter/avfilter.h +1 −1
  2. libavfilter/formats.c +12 −0
  3. libavfilter/internal.h +3 −0
  4. libavfilter/vf_lut.c +3 −12
libavfilter/avfilter.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 #define LIBAVFILTER_VERSION_MAJOR 2
2929 #define LIBAVFILTER_VERSION_MINOR 24
30−#define LIBAVFILTER_VERSION_MICRO 0
30+#define LIBAVFILTER_VERSION_MICRO 1
3131
3232 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
3333 LIBAVFILTER_VERSION_MINOR, \
libavfilter/formats.c+12−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include "libavutil/pixdesc.h"
2323 #include "libavutil/audioconvert.h"
2424 #include "avfilter.h"
25+#include "internal.h"
2526
2627 /**
2728 * Add all refs from a to ret and destroy a.
@@ -73,6 +74,17 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) · 45 unmodified lines
7374 return ret;
7475 }
7576
77+int ff_fmt_is_in(int fmt, const int *fmts)
78+{
79+ const int *p;
80+
81+ for (p = fmts; *p != -1; p++) {
82+ if (fmt == *p)
83+ return 1;
84+ }
85+ return 0;
86+}
87+
7688 #define MAKE_FORMAT_LIST() \
7789 AVFilterFormats *formats; \
7890 int count = 0; \
libavfilter/internal.h+3−0
@@ -58,4 +58,7 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx); · 57 unmodified lines
5858 /** default handler for freeing audio/video buffer when there are no references left */
5959 void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
6060
61+/** Tell is a format is contained in the provided list terminated by -1. */
62+int ff_fmt_is_in(int fmt, const int *fmts);
63+
6164 #endif /* AVFILTER_INTERNAL_H */
libavfilter/vf_lut.c+3−12
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include "libavutil/opt.h"
2929 #include "libavutil/pixdesc.h"
3030 #include "avfilter.h"
31+#include "internal.h"
3132
3233 static const char *var_names[] = {
3334 "E",
@@ -165,16 +166,6 @@ static int query_formats(AVFilterContext *ctx) · 131 unmodified lines
165166 return 0;
166167 }
167168
168−static int pix_fmt_is_in(enum PixelFormat pix_fmt, enum PixelFormat *pix_fmts)
169−{
170− enum PixelFormat *p;
171− for (p = pix_fmts; *p != PIX_FMT_NONE; p++) {
172− if (pix_fmt == *p)
173− return 1;
174− }
175− return 0;
176−}
177−
178169 /**
179170 * Clip value val in the minval - maxval range.
180171 */
@@ -245,8 +236,8 @@ static int config_props(AVFilterLink *inlink) · 64 unmodified lines
245236 }
246237
247238 lut->is_yuv = lut->is_rgb = 0;
248− if (pix_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
249− else if (pix_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
239+ if (ff_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
240+ else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
250241
251242 if (lut->is_rgb) {
252243 switch (inlink->format) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t