////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2023 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////

#ifndef __FOVC_H__
#define __FOVC_H__

#if defined(__cplusplus)
extern "C"
{
#endif

#define NUM_OF_REF 4
#define LEN_OF_LDC_TABLE 1024

//------------------------------------------------------------------------------
/// @brief
///     Pack reference data into struct FOVC_config_t
/// @param FOVC_config
///     Pointer to pointer to struct for storing the FOVC references
/// @param focus_position
///     1d array of 4 references of focus positions
/// @param focal_length
///     1d array of 4 references of focal lengthes
/// @param ldc_table
///     2d array of 4 references of LDC tables each with length 1024
/// @param ldc_lut_size
///     1d array of 4 references of ldc look-up table size to be interpolated
/// @param ldc_table
///     2d array of 4 references of partial LDC tables each with length 1024
/// @param ldc_lut_size
///     1d array of 4 references of partial ldc look-up table size to be interpolated
/// @return
///     Sucess: return 0, fail: return -1
//------------------------------------------------------------------------------
int FOVC_init(void** FOVC_config, const float* focus_position, const float* focal_length, const float* ldc_table, const float* ldc_lut_size, const float* partial_ldc_table, const float* partial_ldc_lut_size);

//------------------------------------------------------------------------------
/// @brief
///     Convert focus position to focal length and LDC table by interpolation
/// @param FOVC_config
///     Pointer to struct for storing the FOVC references
/// @param focus_position
///     Focus position generated by AF algo
/// @param focal_length
///     Pointer to focal length to be interpolated
/// @param ldc_table
///     Pointer to LDC 1D array to be interpolated
/// @param ldc_lut_size
///     Pointer to ldc look-up table size to be interpolated
/// @param partial_ldc_table
///     Pointer to partial LDC 1D array to be interpolated
/// @param partial_ldc_lut_size
///     Pointer to partial ldc look-up table size to be interpolated
/// @return
///     Sucess: return 0, fail: return -1
//------------------------------------------------------------------------------
int FOVC_interpolation(const void* FOVC_config, const float focus_position, float* focal_length, float* ldc_table, float* ldc_lut_size, float* partial_ldc_table, float* partial_ldc_lut_size);

#if defined(__cplusplus)
}
#endif

#endif
