Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (C) 2013 Wei Gao <weigao@multicorewareinc.com>
  3.  * Copyright (C) 2013 Lenny Wang
  4.  *
  5.  * This file is part of FFmpeg.
  6.  *
  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.
  11.  *
  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.
  16.  *
  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
  20.  */
  21.  
  22. #ifndef AVFILTER_UNSHARP_H
  23. #define AVFILTER_UNSHARP_H
  24.  
  25. #include "config.h"
  26. #include "avfilter.h"
  27. #if CONFIG_OPENCL
  28. #include "libavutil/opencl.h"
  29. #endif
  30.  
  31. #define MIN_MATRIX_SIZE 3
  32. #define MAX_MATRIX_SIZE 63
  33.  
  34. #if CONFIG_OPENCL
  35.  
  36. typedef struct {
  37.     cl_command_queue command_queue;
  38.     cl_program program;
  39.     cl_kernel kernel_default;
  40.     cl_kernel kernel_luma;
  41.     cl_kernel kernel_chroma;
  42.     cl_mem cl_luma_mask;
  43.     cl_mem cl_chroma_mask;
  44.     cl_mem cl_luma_mask_x;
  45.     cl_mem cl_chroma_mask_x;
  46.     cl_mem cl_luma_mask_y;
  47.     cl_mem cl_chroma_mask_y;
  48.     int in_plane_size[8];
  49.     int out_plane_size[8];
  50.     int plane_num;
  51.     cl_mem cl_inbuf;
  52.     size_t cl_inbuf_size;
  53.     cl_mem cl_outbuf;
  54.     size_t cl_outbuf_size;
  55.     int use_fast_kernels;
  56. } UnsharpOpenclContext;
  57.  
  58. #endif
  59.  
  60. typedef struct UnsharpFilterParam {
  61.     int msize_x;                             ///< matrix width
  62.     int msize_y;                             ///< matrix height
  63.     int amount;                              ///< effect amount
  64.     int steps_x;                             ///< horizontal step count
  65.     int steps_y;                             ///< vertical step count
  66.     int scalebits;                           ///< bits to shift pixel
  67.     int32_t halfscale;                       ///< amount to add to pixel
  68.     uint32_t *sc[MAX_MATRIX_SIZE - 1];       ///< finite state machine storage
  69. } UnsharpFilterParam;
  70.  
  71. typedef struct UnsharpContext {
  72.     const AVClass *class;
  73.     int lmsize_x, lmsize_y, cmsize_x, cmsize_y;
  74.     float lamount, camount;
  75.     UnsharpFilterParam luma;   ///< luma parameters (width, height, amount)
  76.     UnsharpFilterParam chroma; ///< chroma parameters (width, height, amount)
  77.     int hsub, vsub;
  78.     int opencl;
  79. #if CONFIG_OPENCL
  80.     UnsharpOpenclContext opencl_ctx;
  81. #endif
  82.     int (* apply_unsharp)(AVFilterContext *ctx, AVFrame *in, AVFrame *out);
  83. } UnsharpContext;
  84.  
  85. #endif /* AVFILTER_UNSHARP_H */
  86.