2 * Copyright (C) 2013 Wei Gao <weigao@multicorewareinc.com>
3 * Copyright (C) 2013 Lenny Wang
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef AVFILTER_UNSHARP_H
23 #define AVFILTER_UNSHARP_H
28 #include "libavutil/opencl.h"
31 #define MIN_MATRIX_SIZE 3
32 #define MAX_MATRIX_SIZE 63
37 cl_command_queue command_queue
;
39 cl_kernel kernel_default
;
40 cl_kernel kernel_luma
;
41 cl_kernel kernel_chroma
;
43 cl_mem cl_chroma_mask
;
45 int out_plane_size
[8];
50 size_t cl_outbuf_size
;
52 } UnsharpOpenclContext
;
56 typedef struct UnsharpFilterParam
{
57 int msize_x
; ///< matrix width
58 int msize_y
; ///< matrix height
59 int amount
; ///< effect amount
60 int steps_x
; ///< horizontal step count
61 int steps_y
; ///< vertical step count
62 int scalebits
; ///< bits to shift pixel
63 int32_t halfscale
; ///< amount to add to pixel
64 uint32_t *sc
[MAX_MATRIX_SIZE
- 1]; ///< finite state machine storage
67 typedef struct UnsharpContext
{
69 int lmsize_x
, lmsize_y
, cmsize_x
, cmsize_y
;
70 float lamount
, camount
;
71 UnsharpFilterParam luma
; ///< luma parameters (width, height, amount)
72 UnsharpFilterParam chroma
; ///< chroma parameters (width, height, amount)
76 UnsharpOpenclContext opencl_ctx
;
78 int (* apply_unsharp
)(AVFilterContext
*ctx
, AVFrame
*in
, AVFrame
*out
);
81 #endif /* AVFILTER_UNSHARP_H */