]> git.sesse.net Git - ffmpeg/blob - libavfilter/unsharp.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavfilter / unsharp.h
1 /*
2  * Copyright (C) 2013 Wei Gao <weigao@multicorewareinc.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVFILTER_UNSHARP_H
22 #define AVFILTER_UNSHARP_H
23
24 #include "config.h"
25 #include "avfilter.h"
26 #if CONFIG_OPENCL
27 #include "libavutil/opencl.h"
28 #endif
29
30 #define MIN_MATRIX_SIZE 3
31 #define MAX_MATRIX_SIZE 63
32
33 #if CONFIG_OPENCL
34
35 typedef struct {
36     cl_mem cl_luma_mask;
37     cl_mem cl_chroma_mask;
38     int in_plane_size[8];
39     int out_plane_size[8];
40     int plane_num;
41     cl_mem cl_inbuf;
42     size_t cl_inbuf_size;
43     cl_mem cl_outbuf;
44     size_t cl_outbuf_size;
45     AVOpenCLKernelEnv kernel_env;
46 } UnsharpOpenclContext;
47
48 #endif
49
50 typedef struct UnsharpFilterParam {
51     int msize_x;                             ///< matrix width
52     int msize_y;                             ///< matrix height
53     int amount;                              ///< effect amount
54     int steps_x;                             ///< horizontal step count
55     int steps_y;                             ///< vertical step count
56     int scalebits;                           ///< bits to shift pixel
57     int32_t halfscale;                       ///< amount to add to pixel
58     uint32_t *sc[MAX_MATRIX_SIZE - 1];       ///< finite state machine storage
59 } UnsharpFilterParam;
60
61 typedef struct {
62     const AVClass *class;
63     int lmsize_x, lmsize_y, cmsize_x, cmsize_y;
64     float lamount, camount;
65     UnsharpFilterParam luma;   ///< luma parameters (width, height, amount)
66     UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount)
67     int hsub, vsub;
68     int opencl;
69 #if CONFIG_OPENCL
70     UnsharpOpenclContext opencl_ctx;
71 #endif
72     int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out);
73 } UnsharpContext;
74
75 #endif /* AVFILTER_UNSHARP_H */