1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Stefano Sabatini 2011-06-30 09:51:17 +02:00
parent 518d8d4365
commit 7464a53aaa
4 changed files with 19 additions and 13 deletions

View File

@ -27,7 +27,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 24
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \

View File

@ -22,6 +22,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "avfilter.h"
#include "internal.h"
/**
* Add all refs from a to ret and destroy a.
@ -73,6 +74,17 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
return ret;
}
int ff_fmt_is_in(int fmt, const int *fmts)
{
const int *p;
for (p = fmts; *p != -1; p++) {
if (fmt == *p)
return 1;
}
return 0;
}
#define MAKE_FORMAT_LIST() \
AVFilterFormats *formats; \
int count = 0; \

View File

@ -58,4 +58,7 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
/** default handler for freeing audio/video buffer when there are no references left */
void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
/** Tell is a format is contained in the provided list terminated by -1. */
int ff_fmt_is_in(int fmt, const int *fmts);
#endif /* AVFILTER_INTERNAL_H */

View File

@ -28,6 +28,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
static const char *var_names[] = {
"E",
@ -165,16 +166,6 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static int pix_fmt_is_in(enum PixelFormat pix_fmt, enum PixelFormat *pix_fmts)
{
enum PixelFormat *p;
for (p = pix_fmts; *p != PIX_FMT_NONE; p++) {
if (pix_fmt == *p)
return 1;
}
return 0;
}
/**
* Clip value val in the minval - maxval range.
*/
@ -245,8 +236,8 @@ static int config_props(AVFilterLink *inlink)
}
lut->is_yuv = lut->is_rgb = 0;
if (pix_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
else if (pix_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
if (ff_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
if (lut->is_rgb) {
switch (inlink->format) {