linux/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc.host.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0
   2/*
   3 * Support for Intel Camera Imaging ISP subsystem.
   4 * Copyright (c) 2015, Intel Corporation.
   5 *
   6 * This program is free software; you can redistribute it and/or modify it
   7 * under the terms and conditions of the GNU General Public License,
   8 * version 2, as published by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope it will be useful, but WITHOUT
  11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  13 * more details.
  14 */
  15
  16#include "ia_css_types.h"
  17#include "sh_css_defs.h"
  18#ifndef IA_CSS_NO_DEBUG
  19/* FIXME: See BZ 4427 */
  20#include "ia_css_debug.h"
  21#endif
  22#include "sh_css_frac.h"
  23#include "vamem.h"
  24
  25#include "ia_css_gc.host.h"
  26
  27const struct ia_css_gc_config default_gc_config = {
  28        0,
  29        0
  30};
  31
  32const struct ia_css_ce_config default_ce_config = {
  33        0,
  34        255
  35};
  36
  37void
  38ia_css_gc_encode(
  39    struct sh_css_isp_gc_params *to,
  40    const struct ia_css_gc_config *from,
  41    unsigned int size)
  42{
  43        (void)size;
  44        to->gain_k1 =
  45            uDIGIT_FITTING((int)from->gain_k1, 16,
  46                           IA_CSS_GAMMA_GAIN_K_SHIFT);
  47        to->gain_k2 =
  48            uDIGIT_FITTING((int)from->gain_k2, 16,
  49                           IA_CSS_GAMMA_GAIN_K_SHIFT);
  50}
  51
  52void
  53ia_css_ce_encode(
  54    struct sh_css_isp_ce_params *to,
  55    const struct ia_css_ce_config *from,
  56    unsigned int size)
  57{
  58        (void)size;
  59        to->uv_level_min = from->uv_level_min;
  60        to->uv_level_max = from->uv_level_max;
  61}
  62
  63void
  64ia_css_gc_vamem_encode(
  65    struct sh_css_isp_gc_vamem_params *to,
  66    const struct ia_css_gamma_table *from,
  67    unsigned int size)
  68{
  69        (void)size;
  70        memcpy(&to->gc,  &from->data, sizeof(to->gc));
  71}
  72
  73#ifndef IA_CSS_NO_DEBUG
  74void
  75ia_css_gc_dump(
  76    const struct sh_css_isp_gc_params *gc,
  77    unsigned int level)
  78{
  79        if (!gc) return;
  80        ia_css_debug_dtrace(level, "Gamma Correction:\n");
  81        ia_css_debug_dtrace(level, "\t%-32s = %d\n",
  82                            "gamma_gain_k1", gc->gain_k1);
  83        ia_css_debug_dtrace(level, "\t%-32s = %d\n",
  84                            "gamma_gain_k2", gc->gain_k2);
  85}
  86
  87void
  88ia_css_ce_dump(
  89    const struct sh_css_isp_ce_params *ce,
  90    unsigned int level)
  91{
  92        ia_css_debug_dtrace(level, "Chroma Enhancement:\n");
  93        ia_css_debug_dtrace(level, "\t%-32s = %d\n",
  94                            "ce_uv_level_min", ce->uv_level_min);
  95        ia_css_debug_dtrace(level, "\t%-32s = %d\n",
  96                            "ce_uv_level_max", ce->uv_level_max);
  97}
  98
  99void
 100ia_css_gc_debug_dtrace(
 101    const struct ia_css_gc_config *config,
 102    unsigned int level)
 103{
 104        ia_css_debug_dtrace(level,
 105                            "config.gain_k1=%d, config.gain_k2=%d\n",
 106                            config->gain_k1, config->gain_k2);
 107}
 108
 109void
 110ia_css_ce_debug_dtrace(
 111    const struct ia_css_ce_config *config,
 112    unsigned int level)
 113{
 114        ia_css_debug_dtrace(level,
 115                            "config.uv_level_min=%d, config.uv_level_max=%d\n",
 116                            config->uv_level_min, config->uv_level_max);
 117}
 118#endif
 119