isp_pre_filt.c 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <stdint.h>
  12. #include <unistd.h>
  13. #include <string.h>
  14. #include "ra_common.h"
  15. #define REG_BASE 0x00004000
  16. static const reg_field_s reg_desc[] = {
  17. /* structure field order
  18. reg_name, offset,reset_value,msb,lsb, field_name, field_desc */
  19. {"ISP_PRE_FILT_CTRL", "Pre-filter Mode control register",
  20. 0x00004000, 0x00C08802, 23, 23, "part_two_enable", "pre part enable"},
  21. {NULL, NULL, 0x00004000, 0x00C08802, 22, 22, "part_one_enable", "post part enable"},
  22. {NULL, NULL, 0x00004000, 0x00C08802, 21, 21, "soft_rst_pre_filt", "Soft reset. 0: release; 1: reset"},
  23. {NULL, NULL, 0x00004000, 0x00C08802, 20, 13, "demosaic_threshold", "Threshold for Bayer demosaicing texture detection. " LINE_PADDING_6TAB
  24. "This value shifted left 4 bits is compared with the " LINE_PADDING_6TAB
  25. "difference of the vertical and horizontal 12 bit wide " LINE_PADDING_6TAB
  26. "texture indicators, to determine if the vertical or " LINE_PADDING_6TAB
  27. "horizontal texture flag must be set." LINE_PADDING_6TAB
  28. "0x00: maximum edge sensitivity" LINE_PADDING_6TAB
  29. "0xFF: no texture detection"},
  30. {NULL, NULL, 0x00004000, 0x00C08802, 12, 9, "stage1_select", "Green filter stage 1 select (range 0x0...0x8)" LINE_PADDING_6TAB
  31. "0x0: maximum blurring; 0x4: Default; " LINE_PADDING_6TAB
  32. "0x7: minimum blurring; 0x8: filter stage1 bypass" LINE_PADDING_6TAB
  33. "For a detailed description refer to chapter " LINE_PADDING_6TAB
  34. "'Filter (Sharpen/Blur) Programming' " LINE_PADDING_6TAB
  35. "in the Programming Guide, Part 2."},
  36. {NULL, NULL, 0x00004000, 0x00C08802, 8, 7, "out_rgb_bayer_pattern","0: RGGB; 1: GRBG; 2: GBRG; 3: BGGR"},
  37. {NULL, NULL, 0x00004000, 0x00C08802, 6, 3, "rgbir_bayer_pattern", "0: BGGIR/BAYER PATTERN (Default); 1: GRIRG; 2: RGGIR; 3: GBIRG;" LINE_PADDING_6TAB
  38. "4: GIRRG; 5: IRGGB; 6: GIRBG; 7: IRGGR; 8: RGIRB; 9: GRBI;" LINE_PADDING_6TAB
  39. "10: IRBRG; 11: BIRGR; 12: BGIRR; 13: GBRIR; 14: IRRBG; 15: RIRGB"},
  40. {NULL, NULL, 0x00004000, 0x00C08802, 2, 2, "green_filt_enable", "Enable/disable green channel filter" LINE_PADDING_6TAB
  41. "0: disable green filter (Default)" LINE_PADDING_6TAB
  42. "1: enable green filter"},
  43. {NULL, NULL, 0x00004000, 0x00C08802, 1, 1, "green_filt_mode", "0: green filter static mode (active filter factor = FILT_FAC_MID)" LINE_PADDING_6TAB
  44. "1: dynamic noise reduction/sharpen (Default)"},
  45. {NULL, NULL, 0x00004000, 0x00C08802, 0, 0, "isp_pre_filt_enable", "0: bypass pre_filt (Default); 1: enable pre_filt"},
  46. };
  47. int light_isp_pre_filt_reg_dump(reg_analyzer_info_s *ra_info)
  48. {
  49. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  50. return ra_dump_reg_fields(ra_info, reg_desc, count);
  51. }
  52. int light_isp_pre_filt_reg_define(reg_analyzer_info_s *ra_info)
  53. {
  54. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  55. return ra_dump_reg_define(ra_info, reg_desc, count);
  56. }
  57. int light_isp_pre_filt_reg_find(reg_analyzer_info_s *ra_info)
  58. {
  59. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  60. return ra_dump_reg_find(ra_info, reg_desc, count);
  61. }