Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-11-15 23:18:18 +0300
committerClément Bœsch <u@pkh.me>2014-11-15 23:18:18 +0300
commitbe96201e5bf103a42a91e06464a9b71b4112f7c6 (patch)
tree7e674ea230e3ae8985f920c71f96d5059f461e42 /libavfilter/vf_xbr.c
parentc4fb79a3db1abaee16406667745a64d5b6c8ab94 (diff)
avfilter/xbr: use function pointers for xbr[234]x
Diffstat (limited to 'libavfilter/vf_xbr.c')
-rw-r--r--libavfilter/vf_xbr.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c
index 4f4a8f357b..d143c622d3 100644
--- a/libavfilter/vf_xbr.c
+++ b/libavfilter/vf_xbr.c
@@ -40,9 +40,12 @@
#define RED_BLUE_MASK 0x00FF00FF
#define GREEN_MASK 0x0000FF00
+typedef void (*xbrfunc_t)(AVFrame *input, AVFrame *output, const uint32_t *r2y);
+
typedef struct {
const AVClass *class;
int n;
+ xbrfunc_t func;
uint32_t rgbtoyuv[1<<24];
} XBRContext;
@@ -392,12 +395,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
av_frame_copy_props(out, in);
- if (xbr->n == 4)
- xbr4x(in, out, r2y);
- else if (xbr->n == 3)
- xbr3x(in, out, r2y);
- else
- xbr2x(in, out, r2y);
+ xbr->func(in, out, r2y);
out->width = outlink->w;
out->height = outlink->h;
@@ -409,6 +407,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int init(AVFilterContext *ctx)
{
XBRContext *xbr = ctx->priv;
+ static const xbrfunc_t xbrfuncs[] = {xbr2x, xbr3x, xbr4x};
+
uint32_t c;
int bg, rg, g;
@@ -427,6 +427,7 @@ static int init(AVFilterContext *ctx)
}
}
+ xbr->func = xbrfuncs[xbr->n - 2];
return 0;
}